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.client.samples.smsp;
15
16 import uk.nhs.interoperability.infrastructure.ITKMessagingException;
17 import uk.nhs.interoperability.payload.ITKMessage;
18
19
20 /**
21 * The Class GetPatientDetailsByNHSNumberResponse.
22 *
23 * @author Michael Odling-Smee
24 * @author Nicholas Jones
25 * @since 0.1
26 */
27 public class GetPatientDetailsByNHSNumberResponse {
28
29 /**
30 * Gets the nhs number.
31 *
32 * @return the nhs number
33 */
34 public String getNhsNumber() {
35 return nhsNumber;
36 }
37
38 /**
39 * Sets the nhs number.
40 *
41 * @param nhsNumber the new nhs number
42 */
43 public void setNhsNumber(String nhsNumber) {
44 this.nhsNumber = nhsNumber;
45 }
46
47 /**
48 * Gets the verified indicator.
49 *
50 * @return the verified indicator
51 */
52 public boolean getVerifiedIndicator() {
53 return verifiedIndicator;
54 }
55
56 /**
57 * Sets the verified indicator.
58 *
59 * @param verifiedIndicator the new verified indicator
60 */
61 public void setVerifiedIndicator(boolean verifiedIndicator) {
62 this.verifiedIndicator = verifiedIndicator;
63 }
64
65 /**
66 * Gets the response code.
67 *
68 * @return the response code
69 */
70 public String getResponseCode() {
71 return responseCode;
72 }
73
74 /**
75 * Sets the response code.
76 *
77 * @param responseCode the new response code
78 */
79 public void setResponseCode(String responseCode) {
80 this.responseCode = responseCode;
81 }
82
83 /**
84 * Gets the response message.
85 *
86 * @return the response message
87 */
88 public String getPayload() {
89 return responseMessage;
90 }
91
92 /**
93 * Sets the response message.
94 *
95 * @param responseMessage the new response message
96 */
97 public void setResponseMessage(String responseMessage) {
98 this.responseMessage = responseMessage;
99 }
100
101 // TODO: Change to appropriate response message
102 /** The nhs number. */
103 String nhsNumber;
104
105 /** The verified indicator. */
106 boolean verifiedIndicator;
107
108 /** The response code. */
109 String responseCode;
110
111 /** The response message. */
112 String responseMessage;
113
114 /**
115 * Instantiates a new gets the patient details by nhs number response.
116 *
117 * @param response the response
118 * @throws ITKMessagingException the iTK messaging exception
119 */
120 public GetPatientDetailsByNHSNumberResponse(ITKMessage response) throws ITKMessagingException {
121
122 if (response==null || response.getBusinessPayload() == null){
123 throw new ITKMessagingException("No payload returned from service");
124 }
125
126 // TODO : Build the response message from the response document
127 // For now just make one up.
128
129 this.verifiedIndicator = true;
130 this.nhsNumber = "1234567890";
131 this.responseCode = "0000";
132 this.responseMessage = response.getBusinessPayload();
133
134
135 }
136
137 }