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.payload;
15  
16  import uk.nhs.interoperability.infrastructure.ITKMessageProperties;
17  import uk.nhs.interoperability.transport.ITKTransportRoute;
18  import uk.nhs.interoperability.util.Logger;
19  
20  /**
21   * The Class ITKSimpleMessageResponse.
22   *
23   * @author Michael Odling-Smee
24   * @author Nicholas Jones
25   * @since 0.1
26   */
27  public class ITKSimpleMessageResponse extends ITKMessageImpl {
28  	
29  	/**
30  	 * Instantiates a new iTK simple message response.
31  	 *
32  	 * @param itkMessageProperties the itk message properties
33  	 * @param reflectMessageProperties the reflect message properties
34  	 */
35  	public ITKSimpleMessageResponse(ITKMessageProperties itkMessageProperties, boolean reflectMessageProperties) {
36  		super(itkMessageProperties, null, null, reflectMessageProperties);
37  		/*
38  		 * Simple message responses do not have Distribution Envelope Wrappers
39  		 * applied when being transmitted. If there is a pre-resolved route
40  		 * (e.g. for the simple Async pattern) then make sure that no wrapper
41  		 * is specified
42  		 */
43  		if (super.getPreresolvedRoute() != null) {
44  			Logger.trace("Override DE wrapper - setting NO_WRAPPER");
45  			super.getPreresolvedRoute().setWrapperType(ITKTransportRoute.NO_WRAPPER);
46  		}
47  	}
48  
49  
50  	/**
51  	 * Instantiates a new iTK simple message response.
52  	 */
53  	public ITKSimpleMessageResponse() {
54  		super();
55  	}
56  	
57  	/* (non-Javadoc)
58  	 * @see uk.nhs.interoperability.payload.ITKMessage#getFullPayload()
59  	 */
60  	@Override
61  	public String getFullPayload() {
62  		return "<itk:SimpleMessageResponse xmlns:itk=\"urn:nhs-itk:ns:201005\">OK</itk:SimpleMessageResponse>";
63  	}
64  
65  }