View Javadoc

1   /*
2      Licensed under the Apache License, Version 2.0 (the "License");
3      you may not use this file except in compliance with the License.
4      You may obtain a copy of the License at
5   
6        http://www.apache.org/licenses/LICENSE-2.0
7   
8      Unless required by applicable law or agreed to in writing, software
9      distributed under the License is distributed on an "AS IS" BASIS,
10     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11     See the License for the specific language governing permissions and
12     limitations under the License.
13  */
14  package uk.nhs.interoperability.infrastructure;
15  
16  
17  /**
18   * Interface representing the pertinent information
19   * contained within an ITK Infrastructure Ack. Typically this information
20   * is used to convey the Ack (or Nack) information back to the originator
21   * of the message to which this Ack/Nack pertains.<br/><br/>
22   * 
23   * It is an application responsibility to correlate the Ack/Nack back with
24   * the original message based on the tracking reference {@link #getTrackingRef()}
25   * and {@link #getIntendedRecipient()}*.<br/><br/>
26   * 
27   * * <b>Note</b> In the 0.1 version of the API {@link #getIntendedRecipient()} is not strictly
28   * required to correlating responses, however if the API scope is expanded to support
29   * mutli-destination messaging the intended recipient would also need to be used in the
30   * correlation
31   * 
32   * @author Michael Odling-Smee
33   * @author Nicholas Jones
34   * @since version 0.1
35   *
36   */
37  public interface ITKAckDetails {
38  	
39  	/**
40  	 * The tracking id reference from the message being acknowledged
41  	 * @return A String representation of the id
42  	 * (note this should be a UUID)
43  	 * 
44  	 * TODO - should the method actually return a {@link java.util.UUID}?
45  	 */
46  	public String getTrackingRef();
47  	
48  	/**
49  	 * The service identifier from the message being acknowledged
50  	 * @return A string representation of the service - 
51  	 * e.g. <code>urn:nhs-itk:services:201005:SendCDADocument-v2-0</code>
52  	 */
53  	public String getServiceRef();
54  	
55  	/**
56  	 * Get the identity of the node that originated the InfrastructureAck
57  	 * This may be different to the {@link #getIntendedRecipient()} if a
58  	 * nack was generated by an intermediary node
59  	 * 
60  	 * @return A string representation of the reporting identity
61  	 */
62  	public String getReportingIdentity();
63  	
64  	/**
65  	 * Provides the ITKAddress for the intended recipient of the message
66  	 * being acknowledged
67  	 * @return an ITKAddress representing the logical addressee information
68  	 * of the intended recipient of the message being acknowledged
69  	 */
70  	public ITKAddress getIntendedRecipient();
71  	
72  	/**
73  	 * Obtains details about the error for which the Nack is being generated.
74  	 * If the the ITKAckDetails is an Ack (rather than Nack) then there is no
75  	 * associated error information and <code>null</code> is returned.
76  	 * @return An {@link ITKMessagingException} encapsulating the error details
77  	 */
78  	public ITKMessagingException getNackError(); 
79  	
80  	/**
81  	 * Convenient method to simply establish whether the {@link ITKAckDetails}
82  	 * represents an Ack or Nack
83  	 * @return <code>true</code> if it is a Nack (i.e. {@link #getNackError()}
84  	 * is not <code>null</code>), <code>false</code> otherwise
85  	 */
86  	public boolean isNack();
87  
88  }