View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v22.segment;
35  
36  // import ca.uhn.hl7v2.model.v22.group.*;
37  import ca.uhn.hl7v2.model.v22.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 NK1 message segment (NEXT OF KIN). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>NK1-1: Set ID - Next of Kin (SI) <b> </b>
53       * <li>NK1-2: NK Name (PN) <b>optional </b>
54       * <li>NK1-3: Relationship (CE) <b>optional </b>
55       * <li>NK1-4: Address (AD) <b>optional </b>
56       * <li>NK1-5: Phone Number (TN) <b>optional repeating</b>
57       * <li>NK1-6: Business Phone Number (TN) <b>optional </b>
58       * <li>NK1-7: Contact Role (CE) <b>optional </b>
59       * <li>NK1-8: Start Date (DT) <b>optional </b>
60       * <li>NK1-9: End Date (DT) <b>optional </b>
61       * <li>NK1-10: Next of Kin (ST) <b>optional </b>
62       * <li>NK1-11: Next of kin job code / class (CM_JOB_CODE) <b>optional </b>
63       * <li>NK1-12: Next of Kin Employee Number (ST) <b>optional </b>
64       * <li>NK1-13: Organization Name (ST) <b>optional </b>
65   * </ul>
66   */
67  @SuppressWarnings("unused")
68  public class NK1 extends AbstractSegment {
69  
70      /** 
71       * Creates a new NK1 segment
72       */
73      public NK1(Group parent, ModelClassFactory factory) {
74         super(parent, factory);
75         init(factory);
76      }
77  
78      private void init(ModelClassFactory factory) {
79         try {
80                                    this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - Next of Kin");
81                                    this.add(PN.class, false, 1, 48, new Object[]{ getMessage() }, "NK Name");
82                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Relationship");
83                                    this.add(AD.class, false, 1, 106, new Object[]{ getMessage() }, "Address");
84                                    this.add(TN.class, false, 3, 40, new Object[]{ getMessage() }, "Phone Number");
85                                    this.add(TN.class, false, 1, 40, new Object[]{ getMessage() }, "Business Phone Number");
86                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Contact Role");
87                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Start Date");
88                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "End Date");
89                                    this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Next of Kin");
90                                    this.add(CM_JOB_CODE.class, false, 1, 60, new Object[]{ getMessage() }, "Next of kin job code / class");
91                                    this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Next of Kin Employee Number");
92                                    this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Organization Name");
93         } catch(HL7Exception e) {
94            log.error("Unexpected error creating NK1 - this is probably a bug in the source code generator.", e);
95         }
96      }
97  
98  
99  
100     /**
101      * Returns
102      * NK1-1: "Set ID - Next of Kin" - creates it if necessary
103      */
104     public SI getSetIDNextOfKin() { 
105 		SI retVal = this.getTypedField(1, 0);
106 		return retVal;
107     }
108     
109     /**
110      * Returns
111      * NK1-1: "Set ID - Next of Kin" - creates it if necessary
112      */
113     public SI getNk11_SetIDNextOfKin() { 
114 		SI retVal = this.getTypedField(1, 0);
115 		return retVal;
116     }
117 
118 
119 
120     /**
121      * Returns
122      * NK1-2: "NK Name" - creates it if necessary
123      */
124     public PN getNKName() { 
125 		PN retVal = this.getTypedField(2, 0);
126 		return retVal;
127     }
128     
129     /**
130      * Returns
131      * NK1-2: "NK Name" - creates it if necessary
132      */
133     public PN getNk12_NKName() { 
134 		PN retVal = this.getTypedField(2, 0);
135 		return retVal;
136     }
137 
138 
139 
140     /**
141      * Returns
142      * NK1-3: "Relationship" - creates it if necessary
143      */
144     public CE getRelationship() { 
145 		CE retVal = this.getTypedField(3, 0);
146 		return retVal;
147     }
148     
149     /**
150      * Returns
151      * NK1-3: "Relationship" - creates it if necessary
152      */
153     public CE getNk13_Relationship() { 
154 		CE retVal = this.getTypedField(3, 0);
155 		return retVal;
156     }
157 
158 
159 
160     /**
161      * Returns
162      * NK1-4: "Address" - creates it if necessary
163      */
164     public AD getAddress() { 
165 		AD retVal = this.getTypedField(4, 0);
166 		return retVal;
167     }
168     
169     /**
170      * Returns
171      * NK1-4: "Address" - creates it if necessary
172      */
173     public AD getNk14_Address() { 
174 		AD retVal = this.getTypedField(4, 0);
175 		return retVal;
176     }
177 
178 
179     /**
180      * Returns all repetitions of Phone Number (NK1-5).
181      */
182     public TN[] getPhoneNumber() {
183     	TN[] retVal = this.getTypedField(5, new TN[0]);
184     	return retVal;
185     }
186 
187 
188     /**
189      * Returns all repetitions of Phone Number (NK1-5).
190      */
191     public TN[] getNk15_PhoneNumber() {
192     	TN[] retVal = this.getTypedField(5, new TN[0]);
193     	return retVal;
194     }
195 
196 
197     /**
198      * Returns a count of the current number of repetitions of Phone Number (NK1-5).
199      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
200      * it will return zero.
201      */
202     public int getPhoneNumberReps() {
203     	return this.getReps(5);
204     }
205 
206 
207     /**
208      * Returns a specific repetition of
209      * NK1-5: "Phone Number" - creates it if necessary
210      *
211      * @param rep The repetition index (0-indexed)
212      */
213     public TN getPhoneNumber(int rep) { 
214 		TN retVal = this.getTypedField(5, rep);
215 		return retVal;
216     }
217 
218     /**
219      * Returns a specific repetition of
220      * NK1-5: "Phone Number" - creates it if necessary
221      *
222      * @param rep The repetition index (0-indexed)
223      */
224     public TN getNk15_PhoneNumber(int rep) { 
225 		TN retVal = this.getTypedField(5, rep);
226 		return retVal;
227     }
228 
229     /**
230      * Returns a count of the current number of repetitions of Phone Number (NK1-5).
231      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
232      * it will return zero.
233      */
234     public int getNk15_PhoneNumberReps() {
235     	return this.getReps(5);
236     }
237 
238 
239     /**
240      * Inserts a repetition of
241      * NK1-5: "Phone Number" at a specific index
242      *
243      * @param rep The repetition index (0-indexed)
244      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
245      */
246     public TN insertPhoneNumber(int rep) throws HL7Exception { 
247         return (TN) super.insertRepetition(5, rep);
248     }
249 
250 
251     /**
252      * Inserts a repetition of
253      * NK1-5: "Phone Number" at a specific index
254      *
255      * @param rep The repetition index (0-indexed)
256      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
257      */
258     public TN insertNk15_PhoneNumber(int rep) throws HL7Exception { 
259         return (TN) super.insertRepetition(5, rep);
260     }
261 
262 
263     /**
264      * Removes a repetition of
265      * NK1-5: "Phone Number" at a specific index
266      *
267      * @param rep The repetition index (0-indexed)
268      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
269      */
270     public TN removePhoneNumber(int rep) throws HL7Exception { 
271         return (TN) super.removeRepetition(5, rep);
272     }
273 
274 
275     /**
276      * Removes a repetition of
277      * NK1-5: "Phone Number" at a specific index
278      *
279      * @param rep The repetition index (0-indexed)
280      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
281      */
282     public TN removeNk15_PhoneNumber(int rep) throws HL7Exception { 
283         return (TN) super.removeRepetition(5, rep);
284     }
285 
286 
287 
288 
289     /**
290      * Returns
291      * NK1-6: "Business Phone Number" - creates it if necessary
292      */
293     public TN getBusinessPhoneNumber() { 
294 		TN retVal = this.getTypedField(6, 0);
295 		return retVal;
296     }
297     
298     /**
299      * Returns
300      * NK1-6: "Business Phone Number" - creates it if necessary
301      */
302     public TN getNk16_BusinessPhoneNumber() { 
303 		TN retVal = this.getTypedField(6, 0);
304 		return retVal;
305     }
306 
307 
308 
309     /**
310      * Returns
311      * NK1-7: "Contact Role" - creates it if necessary
312      */
313     public CE getContactRole() { 
314 		CE retVal = this.getTypedField(7, 0);
315 		return retVal;
316     }
317     
318     /**
319      * Returns
320      * NK1-7: "Contact Role" - creates it if necessary
321      */
322     public CE getNk17_ContactRole() { 
323 		CE retVal = this.getTypedField(7, 0);
324 		return retVal;
325     }
326 
327 
328 
329     /**
330      * Returns
331      * NK1-8: "Start Date" - creates it if necessary
332      */
333     public DT getStartDate() { 
334 		DT retVal = this.getTypedField(8, 0);
335 		return retVal;
336     }
337     
338     /**
339      * Returns
340      * NK1-8: "Start Date" - creates it if necessary
341      */
342     public DT getNk18_StartDate() { 
343 		DT retVal = this.getTypedField(8, 0);
344 		return retVal;
345     }
346 
347 
348 
349     /**
350      * Returns
351      * NK1-9: "End Date" - creates it if necessary
352      */
353     public DT getEndDate() { 
354 		DT retVal = this.getTypedField(9, 0);
355 		return retVal;
356     }
357     
358     /**
359      * Returns
360      * NK1-9: "End Date" - creates it if necessary
361      */
362     public DT getNk19_EndDate() { 
363 		DT retVal = this.getTypedField(9, 0);
364 		return retVal;
365     }
366 
367 
368 
369     /**
370      * Returns
371      * NK1-10: "Next of Kin" - creates it if necessary
372      */
373     public ST getNextOfKin() { 
374 		ST retVal = this.getTypedField(10, 0);
375 		return retVal;
376     }
377     
378     /**
379      * Returns
380      * NK1-10: "Next of Kin" - creates it if necessary
381      */
382     public ST getNk110_NextOfKin() { 
383 		ST retVal = this.getTypedField(10, 0);
384 		return retVal;
385     }
386 
387 
388 
389     /**
390      * Returns
391      * NK1-11: "Next of kin job code / class" - creates it if necessary
392      */
393     public CM_JOB_CODE getNextOfKinJobCodeClass() { 
394 		CM_JOB_CODE retVal = this.getTypedField(11, 0);
395 		return retVal;
396     }
397     
398     /**
399      * Returns
400      * NK1-11: "Next of kin job code / class" - creates it if necessary
401      */
402     public CM_JOB_CODE getNk111_NextOfKinJobCodeClass() { 
403 		CM_JOB_CODE retVal = this.getTypedField(11, 0);
404 		return retVal;
405     }
406 
407 
408 
409     /**
410      * Returns
411      * NK1-12: "Next of Kin Employee Number" - creates it if necessary
412      */
413     public ST getNextOfKinEmployeeNumber() { 
414 		ST retVal = this.getTypedField(12, 0);
415 		return retVal;
416     }
417     
418     /**
419      * Returns
420      * NK1-12: "Next of Kin Employee Number" - creates it if necessary
421      */
422     public ST getNk112_NextOfKinEmployeeNumber() { 
423 		ST retVal = this.getTypedField(12, 0);
424 		return retVal;
425     }
426 
427 
428 
429     /**
430      * Returns
431      * NK1-13: "Organization Name" - creates it if necessary
432      */
433     public ST getOrganizationName() { 
434 		ST retVal = this.getTypedField(13, 0);
435 		return retVal;
436     }
437     
438     /**
439      * Returns
440      * NK1-13: "Organization Name" - creates it if necessary
441      */
442     public ST getNk113_OrganizationName() { 
443 		ST retVal = this.getTypedField(13, 0);
444 		return retVal;
445     }
446 
447 
448 
449 
450 
451     /** {@inheritDoc} */   
452     protected Type createNewTypeWithoutReflection(int field) {
453        switch (field) {
454           case 0: return new SI(getMessage());
455           case 1: return new PN(getMessage());
456           case 2: return new CE(getMessage());
457           case 3: return new AD(getMessage());
458           case 4: return new TN(getMessage());
459           case 5: return new TN(getMessage());
460           case 6: return new CE(getMessage());
461           case 7: return new DT(getMessage());
462           case 8: return new DT(getMessage());
463           case 9: return new ST(getMessage());
464           case 10: return new CM_JOB_CODE(getMessage());
465           case 11: return new ST(getMessage());
466           case 12: return new ST(getMessage());
467           default: return null;
468        }
469    }
470 
471 
472 }
473