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.client.samples.smsp;
15  
16  import java.util.UUID;
17  
18  import uk.nhs.interoperability.transform.TransformManager;
19  
20  /**
21   * The Class GetNHSNumberRequest.
22   *
23   * @author Michael Odling-Smee
24   * @author Nicholas Jones
25   * @since 0.1
26   */
27  public class GetNHSNumberRequest {
28  
29  	/** The message id. */
30  	String messageId;
31  	
32  	/**
33  	 * Gets the message id.
34  	 *
35  	 * @return the message id
36  	 */
37  	public String getMessageId() {
38  		return messageId;
39  	}
40  	
41  	/**
42  	 * Gets the nHS number.
43  	 *
44  	 * @return the nHS number
45  	 */
46  	public String getNHSNumber() {
47  		return nhsNumber;
48  	}
49  	
50  	/**
51  	 * Sets the nHS number.
52  	 *
53  	 * @param nhsNumber the new nHS number
54  	 */
55  	public void setNHSNumber(String nhsNumber) {
56  		this.nhsNumber = nhsNumber;
57  	}
58  	
59  	/**
60  	 * Gets the given name.
61  	 *
62  	 * @return the given name
63  	 */
64  	public String getGivenName() {
65  		return givenName;
66  	}
67  	
68  	/**
69  	 * Sets the given name.
70  	 *
71  	 * @param givenName the new given name
72  	 */
73  	public void setGivenName(String givenName) {
74  		this.givenName = givenName;
75  	}
76  	
77  	/**
78  	 * Gets the surname.
79  	 *
80  	 * @return the surname
81  	 */
82  	public String getSurname() {
83  		return surname;
84  	}
85  	
86  	/**
87  	 * Sets the surname.
88  	 *
89  	 * @param surname the new surname
90  	 */
91  	public void setSurname(String surname) {
92  		this.surname = surname;
93  	}
94  	
95  	/**
96  	 * Gets the date of birth.
97  	 *
98  	 * @return the date of birth
99  	 */
100 	public String getDateOfBirth() {
101 		return dateOfBirth;
102 	}
103 	
104 	/**
105 	 * Sets the date of birth.
106 	 *
107 	 * @param dateOfBirth the new date of birth
108 	 */
109 	public void setDateOfBirth(String dateOfBirth) {
110 		this.dateOfBirth = dateOfBirth;
111 	}
112 	
113 	/**
114 	 * Gets the postcode.
115 	 *
116 	 * @return the postcode
117 	 */
118 	public String getPostcode() {
119 		return postcode;
120 	}
121 	
122 	/**
123 	 * Sets the postcode.
124 	 *
125 	 * @param postcode the new postcode
126 	 */
127 	public void setPostcode(String postcode) {
128 		this.postcode = postcode;
129 	}
130 	
131 	/** The nhs number. */
132 	String nhsNumber;
133 	
134 	/** The given name. */
135 	String givenName;
136 	
137 	/** The surname. */
138 	String surname;
139 	
140 	/** The date of birth. */
141 	String dateOfBirth;
142 	
143 	/** The postcode. */
144 	String postcode;
145 	
146 	public String getGender() {
147 		return gender;
148 	}
149 
150 	public void setGender(String gender) {
151 		this.gender = gender;
152 	}
153 
154 	public String getLocalIdentifier() {
155 		return localIdentifier;
156 	}
157 
158 	public void setLocalIdentifier(String localIdentifier) {
159 		this.localIdentifier = localIdentifier;
160 	}
161 
162 	/** The gender. */
163 	String gender;
164 	
165 	/** The local identifier. */
166 	String localIdentifier;
167 
168 	/**
169 	 * Serialise.
170 	 *
171 	 * @return the string
172 	 */
173 	public String serialise(){
174 		String XML = "<Message>";
175 		XML += "<MessageId>"+messageId+"</MessageId>";
176 		XML += "<GivenName>"+givenName+"</GivenName>";
177 		XML += "<Surname>"+surname+"</Surname>";
178 		XML += "<DateOfBirth>"+dateOfBirth+"</DateOfBirth>";
179 		XML += "<Postcode>"+postcode+"</Postcode>";
180 		XML += "<Gender>"+gender+"</Gender>";
181 		XML += "<LocalIdentifier>"+localIdentifier+"</LocalIdentifier>";
182 		XML += "</Message>";
183 		String serialisedMessage ="";
184 		try {
185 			serialisedMessage = TransformManager.doTransform("ToGetNHSNumberRequest.xslt", XML);
186 		} catch (Exception e) {
187 			// TODO Auto-generated catch block
188 			e.printStackTrace();
189 		}
190 		return serialisedMessage;
191 	}
192 	
193 	/**
194 	 * Instantiates a new verify nhs number request.
195 	 */
196 	public GetNHSNumberRequest(){
197 		UUID messageId = UUID.randomUUID();
198 		this.messageId = messageId.toString().toUpperCase();
199 	}
200 
201 }