1
2
3
4
5
6
7
8
9
10
11
12
13
14 package uk.nhs.interoperability.client.samples.notification;
15
16 import java.util.UUID;
17
18 import uk.nhs.interoperability.transform.TransformManager;
19
20
21
22
23
24
25
26 public class Notification {
27
28
29 String messageId;
30
31
32 String nhsNumber;
33
34
35 String dateOfBirth;
36
37
38 String senderOrg;
39
40
41 String recipientOrg;
42
43
44 String recipientAddress;
45
46
47 String patientName;
48
49
50 String patientAddress;
51
52
53 String eventTypeCode;
54
55
56 String eventTypeDesc;
57
58
59 String contactName;
60
61
62 String effectiveTime;
63
64
65 String contactAddress;
66
67
68 String contactOrg;
69
70
71
72
73
74
75 public String getSenderOrg() {
76 return senderOrg;
77 }
78
79
80
81
82
83
84 public void setSenderOrg(String senderOrg) {
85 this.senderOrg = senderOrg;
86 }
87
88
89
90
91
92
93 public String getRecipientOrg() {
94 return recipientOrg;
95 }
96
97
98
99
100
101
102 public void setRecipientOrg(String recipientOrg) {
103 this.recipientOrg = recipientOrg;
104 }
105
106
107
108
109
110
111 public String getRecipientAddress() {
112 return recipientAddress;
113 }
114
115
116
117
118
119
120 public void setRecipientAddress(String recipientAddress) {
121 this.recipientAddress = recipientAddress;
122 }
123
124
125
126
127
128
129 public String getPatientName() {
130 return patientName;
131 }
132
133
134
135
136
137
138 public void setPatientName(String patientName) {
139 this.patientName = patientName;
140 }
141
142
143
144
145
146
147 public String getPatientAddress() {
148 return patientAddress;
149 }
150
151
152
153
154
155
156 public void setPatientAddress(String patientAddress) {
157 this.patientAddress = patientAddress;
158 }
159
160
161
162
163
164
165 public String getEventTypeCode() {
166 return eventTypeCode;
167 }
168
169
170
171
172
173
174 public void setEventTypeCode(String eventTypeCode) {
175 this.eventTypeCode = eventTypeCode;
176 }
177
178
179
180
181
182
183 public String getEventTypeDesc() {
184 return eventTypeDesc;
185 }
186
187
188
189
190
191
192 public void setEventTypeDesc(String eventTypeDesc) {
193 this.eventTypeDesc = eventTypeDesc;
194 }
195
196
197
198
199
200
201 public String getContactName() {
202 return contactName;
203 }
204
205
206
207
208
209
210 public void setContactName(String contactName) {
211 this.contactName = contactName;
212 }
213
214
215
216
217
218
219 public String getEffectiveTime() {
220 return effectiveTime;
221 }
222
223
224
225
226
227
228 public void setEffectiveTime(String effectiveTime) {
229 this.effectiveTime = effectiveTime;
230 }
231
232
233
234
235
236
237 public String getContactAddress() {
238 return contactAddress;
239 }
240
241
242
243
244
245
246 public void setContactAddress(String contactAddress) {
247 this.contactAddress = contactAddress;
248 }
249
250
251
252
253
254
255 public String getContactOrg() {
256 return contactOrg;
257 }
258
259
260
261
262
263
264 public void setContactOrg(String contactOrg) {
265 this.contactOrg = contactOrg;
266 }
267
268
269
270
271
272
273 public void setMessageId(String messageId) {
274 this.messageId = messageId;
275 }
276
277
278
279
280
281
282 public String getMessageId() {
283 return messageId;
284 }
285
286
287
288
289
290
291 public String getNHSNumber() {
292 return nhsNumber;
293 }
294
295
296
297
298
299
300 public void setNHSNumber(String nhsNumber) {
301 this.nhsNumber = nhsNumber;
302 }
303
304
305
306
307
308
309 public String getDateOfBirth() {
310 return dateOfBirth;
311 }
312
313
314
315
316
317
318 public void setDateOfBirth(String dateOfBirth) {
319 this.dateOfBirth = dateOfBirth;
320 }
321
322
323
324
325
326
327 public String serialise(){
328 String XML = "<Message>";
329 XML += "<MessageId>"+messageId+"</MessageId>";
330
331 XML += "<EffectiveTime>"+effectiveTime+"</EffectiveTime>";
332 XML += "<DateOfBirth>"+dateOfBirth+"</DateOfBirth>";
333 XML += "<SenderOrg>"+senderOrg+"</SenderOrg>";
334 XML += "<RecipientOrg>"+recipientOrg+"</RecipientOrg>";
335 XML += "<RecipientAddress>"+recipientAddress+"</RecipientAddress>";
336 XML += "<PatientName>"+patientName+"</PatientName>";
337 XML += "<PatientAddress>"+patientAddress+"</PatientAddress>";
338 XML += "<NHSNumber>"+nhsNumber+"</NHSNumber>";
339 XML += "<EventTypeCode>"+eventTypeCode+"</EventTypeCode>";
340 XML += "<EventTypeDesc>"+eventTypeDesc+"</EventTypeDesc>";
341 XML += "<ContactName>"+contactName+"</ContactName>";
342 XML += "<ContactAddress>"+contactAddress+"</ContactAddress>";
343 XML += "<ContactOrg>"+contactOrg+"</ContactOrg>";
344 XML += "</Message>";
345 String serialisedMessage ="";
346 try {
347 serialisedMessage = TransformManager.doTransform("ToNotification.xsl", XML);
348 } catch (Exception e) {
349
350 e.printStackTrace();
351 }
352 return serialisedMessage;
353 }
354
355
356
357
358 public Notification(){
359 UUID messageId = UUID.randomUUID();
360 this.messageId = messageId.toString().toUpperCase();
361 }
362
363 }