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.v231.segment;
35  
36  // import ca.uhn.hl7v2.model.v231.group.*;
37  import ca.uhn.hl7v2.model.v231.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 CTD message segment (Contact Data). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>CTD-1: Contact Role (CE) <b>optional repeating</b>
53       * <li>CTD-2: Contact Name (XPN) <b>optional repeating</b>
54       * <li>CTD-3: Contact Address (XAD) <b>optional repeating</b>
55       * <li>CTD-4: Contact Location (PL) <b>optional </b>
56       * <li>CTD-5: Contact Communication Information (XTN) <b>optional repeating</b>
57       * <li>CTD-6: Preferred Method Of Contact (CE) <b>optional </b>
58       * <li>CTD-7: Contact Identifiers (PI) <b>optional repeating</b>
59   * </ul>
60   */
61  @SuppressWarnings("unused")
62  public class CTD extends AbstractSegment {
63  
64      /** 
65       * Creates a new CTD segment
66       */
67      public CTD(Group parent, ModelClassFactory factory) {
68         super(parent, factory);
69         init(factory);
70      }
71  
72      private void init(ModelClassFactory factory) {
73         try {
74                                    this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Contact Role");
75                                    this.add(XPN.class, false, 0, 106, new Object[]{ getMessage() }, "Contact Name");
76                                    this.add(XAD.class, false, 0, 200, new Object[]{ getMessage() }, "Contact Address");
77                                    this.add(PL.class, false, 1, 60, new Object[]{ getMessage() }, "Contact Location");
78                                    this.add(XTN.class, false, 0, 100, new Object[]{ getMessage() }, "Contact Communication Information");
79                                    this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Preferred Method Of Contact");
80                                    this.add(PI.class, false, 0, 100, new Object[]{ getMessage() }, "Contact Identifiers");
81         } catch(HL7Exception e) {
82            log.error("Unexpected error creating CTD - this is probably a bug in the source code generator.", e);
83         }
84      }
85  
86  
87      /**
88       * Returns all repetitions of Contact Role (CTD-1).
89       */
90      public CE[] getContactRole() {
91      	CE[] retVal = this.getTypedField(1, new CE[0]);
92      	return retVal;
93      }
94  
95  
96      /**
97       * Returns all repetitions of Contact Role (CTD-1).
98       */
99      public CE[] getCtd1_ContactRole() {
100     	CE[] retVal = this.getTypedField(1, new CE[0]);
101     	return retVal;
102     }
103 
104 
105     /**
106      * Returns a count of the current number of repetitions of Contact Role (CTD-1).
107      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
108      * it will return zero.
109      */
110     public int getContactRoleReps() {
111     	return this.getReps(1);
112     }
113 
114 
115     /**
116      * Returns a specific repetition of
117      * CTD-1: "Contact Role" - creates it if necessary
118      *
119      * @param rep The repetition index (0-indexed)
120      */
121     public CE getContactRole(int rep) { 
122 		CE retVal = this.getTypedField(1, rep);
123 		return retVal;
124     }
125 
126     /**
127      * Returns a specific repetition of
128      * CTD-1: "Contact Role" - creates it if necessary
129      *
130      * @param rep The repetition index (0-indexed)
131      */
132     public CE getCtd1_ContactRole(int rep) { 
133 		CE retVal = this.getTypedField(1, rep);
134 		return retVal;
135     }
136 
137     /**
138      * Returns a count of the current number of repetitions of Contact Role (CTD-1).
139      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
140      * it will return zero.
141      */
142     public int getCtd1_ContactRoleReps() {
143     	return this.getReps(1);
144     }
145 
146 
147     /**
148      * Inserts a repetition of
149      * CTD-1: "Contact Role" at a specific index
150      *
151      * @param rep The repetition index (0-indexed)
152      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
153      */
154     public CE insertContactRole(int rep) throws HL7Exception { 
155         return (CE) super.insertRepetition(1, rep);
156     }
157 
158 
159     /**
160      * Inserts a repetition of
161      * CTD-1: "Contact Role" at a specific index
162      *
163      * @param rep The repetition index (0-indexed)
164      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
165      */
166     public CE insertCtd1_ContactRole(int rep) throws HL7Exception { 
167         return (CE) super.insertRepetition(1, rep);
168     }
169 
170 
171     /**
172      * Removes a repetition of
173      * CTD-1: "Contact Role" at a specific index
174      *
175      * @param rep The repetition index (0-indexed)
176      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
177      */
178     public CE removeContactRole(int rep) throws HL7Exception { 
179         return (CE) super.removeRepetition(1, rep);
180     }
181 
182 
183     /**
184      * Removes a repetition of
185      * CTD-1: "Contact Role" at a specific index
186      *
187      * @param rep The repetition index (0-indexed)
188      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
189      */
190     public CE removeCtd1_ContactRole(int rep) throws HL7Exception { 
191         return (CE) super.removeRepetition(1, rep);
192     }
193 
194 
195 
196     /**
197      * Returns all repetitions of Contact Name (CTD-2).
198      */
199     public XPN[] getContactName() {
200     	XPN[] retVal = this.getTypedField(2, new XPN[0]);
201     	return retVal;
202     }
203 
204 
205     /**
206      * Returns all repetitions of Contact Name (CTD-2).
207      */
208     public XPN[] getCtd2_ContactName() {
209     	XPN[] retVal = this.getTypedField(2, new XPN[0]);
210     	return retVal;
211     }
212 
213 
214     /**
215      * Returns a count of the current number of repetitions of Contact Name (CTD-2).
216      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
217      * it will return zero.
218      */
219     public int getContactNameReps() {
220     	return this.getReps(2);
221     }
222 
223 
224     /**
225      * Returns a specific repetition of
226      * CTD-2: "Contact Name" - creates it if necessary
227      *
228      * @param rep The repetition index (0-indexed)
229      */
230     public XPN getContactName(int rep) { 
231 		XPN retVal = this.getTypedField(2, rep);
232 		return retVal;
233     }
234 
235     /**
236      * Returns a specific repetition of
237      * CTD-2: "Contact Name" - creates it if necessary
238      *
239      * @param rep The repetition index (0-indexed)
240      */
241     public XPN getCtd2_ContactName(int rep) { 
242 		XPN retVal = this.getTypedField(2, rep);
243 		return retVal;
244     }
245 
246     /**
247      * Returns a count of the current number of repetitions of Contact Name (CTD-2).
248      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
249      * it will return zero.
250      */
251     public int getCtd2_ContactNameReps() {
252     	return this.getReps(2);
253     }
254 
255 
256     /**
257      * Inserts a repetition of
258      * CTD-2: "Contact Name" at a specific index
259      *
260      * @param rep The repetition index (0-indexed)
261      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
262      */
263     public XPN insertContactName(int rep) throws HL7Exception { 
264         return (XPN) super.insertRepetition(2, rep);
265     }
266 
267 
268     /**
269      * Inserts a repetition of
270      * CTD-2: "Contact Name" at a specific index
271      *
272      * @param rep The repetition index (0-indexed)
273      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
274      */
275     public XPN insertCtd2_ContactName(int rep) throws HL7Exception { 
276         return (XPN) super.insertRepetition(2, rep);
277     }
278 
279 
280     /**
281      * Removes a repetition of
282      * CTD-2: "Contact Name" at a specific index
283      *
284      * @param rep The repetition index (0-indexed)
285      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
286      */
287     public XPN removeContactName(int rep) throws HL7Exception { 
288         return (XPN) super.removeRepetition(2, rep);
289     }
290 
291 
292     /**
293      * Removes a repetition of
294      * CTD-2: "Contact Name" at a specific index
295      *
296      * @param rep The repetition index (0-indexed)
297      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
298      */
299     public XPN removeCtd2_ContactName(int rep) throws HL7Exception { 
300         return (XPN) super.removeRepetition(2, rep);
301     }
302 
303 
304 
305     /**
306      * Returns all repetitions of Contact Address (CTD-3).
307      */
308     public XAD[] getContactAddress() {
309     	XAD[] retVal = this.getTypedField(3, new XAD[0]);
310     	return retVal;
311     }
312 
313 
314     /**
315      * Returns all repetitions of Contact Address (CTD-3).
316      */
317     public XAD[] getCtd3_ContactAddress() {
318     	XAD[] retVal = this.getTypedField(3, new XAD[0]);
319     	return retVal;
320     }
321 
322 
323     /**
324      * Returns a count of the current number of repetitions of Contact Address (CTD-3).
325      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
326      * it will return zero.
327      */
328     public int getContactAddressReps() {
329     	return this.getReps(3);
330     }
331 
332 
333     /**
334      * Returns a specific repetition of
335      * CTD-3: "Contact Address" - creates it if necessary
336      *
337      * @param rep The repetition index (0-indexed)
338      */
339     public XAD getContactAddress(int rep) { 
340 		XAD retVal = this.getTypedField(3, rep);
341 		return retVal;
342     }
343 
344     /**
345      * Returns a specific repetition of
346      * CTD-3: "Contact Address" - creates it if necessary
347      *
348      * @param rep The repetition index (0-indexed)
349      */
350     public XAD getCtd3_ContactAddress(int rep) { 
351 		XAD retVal = this.getTypedField(3, rep);
352 		return retVal;
353     }
354 
355     /**
356      * Returns a count of the current number of repetitions of Contact Address (CTD-3).
357      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
358      * it will return zero.
359      */
360     public int getCtd3_ContactAddressReps() {
361     	return this.getReps(3);
362     }
363 
364 
365     /**
366      * Inserts a repetition of
367      * CTD-3: "Contact Address" at a specific index
368      *
369      * @param rep The repetition index (0-indexed)
370      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
371      */
372     public XAD insertContactAddress(int rep) throws HL7Exception { 
373         return (XAD) super.insertRepetition(3, rep);
374     }
375 
376 
377     /**
378      * Inserts a repetition of
379      * CTD-3: "Contact Address" at a specific index
380      *
381      * @param rep The repetition index (0-indexed)
382      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
383      */
384     public XAD insertCtd3_ContactAddress(int rep) throws HL7Exception { 
385         return (XAD) super.insertRepetition(3, rep);
386     }
387 
388 
389     /**
390      * Removes a repetition of
391      * CTD-3: "Contact Address" at a specific index
392      *
393      * @param rep The repetition index (0-indexed)
394      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
395      */
396     public XAD removeContactAddress(int rep) throws HL7Exception { 
397         return (XAD) super.removeRepetition(3, rep);
398     }
399 
400 
401     /**
402      * Removes a repetition of
403      * CTD-3: "Contact Address" at a specific index
404      *
405      * @param rep The repetition index (0-indexed)
406      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
407      */
408     public XAD removeCtd3_ContactAddress(int rep) throws HL7Exception { 
409         return (XAD) super.removeRepetition(3, rep);
410     }
411 
412 
413 
414 
415     /**
416      * Returns
417      * CTD-4: "Contact Location" - creates it if necessary
418      */
419     public PL getContactLocation() { 
420 		PL retVal = this.getTypedField(4, 0);
421 		return retVal;
422     }
423     
424     /**
425      * Returns
426      * CTD-4: "Contact Location" - creates it if necessary
427      */
428     public PL getCtd4_ContactLocation() { 
429 		PL retVal = this.getTypedField(4, 0);
430 		return retVal;
431     }
432 
433 
434     /**
435      * Returns all repetitions of Contact Communication Information (CTD-5).
436      */
437     public XTN[] getContactCommunicationInformation() {
438     	XTN[] retVal = this.getTypedField(5, new XTN[0]);
439     	return retVal;
440     }
441 
442 
443     /**
444      * Returns all repetitions of Contact Communication Information (CTD-5).
445      */
446     public XTN[] getCtd5_ContactCommunicationInformation() {
447     	XTN[] retVal = this.getTypedField(5, new XTN[0]);
448     	return retVal;
449     }
450 
451 
452     /**
453      * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5).
454      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
455      * it will return zero.
456      */
457     public int getContactCommunicationInformationReps() {
458     	return this.getReps(5);
459     }
460 
461 
462     /**
463      * Returns a specific repetition of
464      * CTD-5: "Contact Communication Information" - creates it if necessary
465      *
466      * @param rep The repetition index (0-indexed)
467      */
468     public XTN getContactCommunicationInformation(int rep) { 
469 		XTN retVal = this.getTypedField(5, rep);
470 		return retVal;
471     }
472 
473     /**
474      * Returns a specific repetition of
475      * CTD-5: "Contact Communication Information" - creates it if necessary
476      *
477      * @param rep The repetition index (0-indexed)
478      */
479     public XTN getCtd5_ContactCommunicationInformation(int rep) { 
480 		XTN retVal = this.getTypedField(5, rep);
481 		return retVal;
482     }
483 
484     /**
485      * Returns a count of the current number of repetitions of Contact Communication Information (CTD-5).
486      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
487      * it will return zero.
488      */
489     public int getCtd5_ContactCommunicationInformationReps() {
490     	return this.getReps(5);
491     }
492 
493 
494     /**
495      * Inserts a repetition of
496      * CTD-5: "Contact Communication Information" at a specific index
497      *
498      * @param rep The repetition index (0-indexed)
499      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
500      */
501     public XTN insertContactCommunicationInformation(int rep) throws HL7Exception { 
502         return (XTN) super.insertRepetition(5, rep);
503     }
504 
505 
506     /**
507      * Inserts a repetition of
508      * CTD-5: "Contact Communication Information" at a specific index
509      *
510      * @param rep The repetition index (0-indexed)
511      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
512      */
513     public XTN insertCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { 
514         return (XTN) super.insertRepetition(5, rep);
515     }
516 
517 
518     /**
519      * Removes a repetition of
520      * CTD-5: "Contact Communication Information" at a specific index
521      *
522      * @param rep The repetition index (0-indexed)
523      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
524      */
525     public XTN removeContactCommunicationInformation(int rep) throws HL7Exception { 
526         return (XTN) super.removeRepetition(5, rep);
527     }
528 
529 
530     /**
531      * Removes a repetition of
532      * CTD-5: "Contact Communication Information" at a specific index
533      *
534      * @param rep The repetition index (0-indexed)
535      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
536      */
537     public XTN removeCtd5_ContactCommunicationInformation(int rep) throws HL7Exception { 
538         return (XTN) super.removeRepetition(5, rep);
539     }
540 
541 
542 
543 
544     /**
545      * Returns
546      * CTD-6: "Preferred Method Of Contact" - creates it if necessary
547      */
548     public CE getPreferredMethodOfContact() { 
549 		CE retVal = this.getTypedField(6, 0);
550 		return retVal;
551     }
552     
553     /**
554      * Returns
555      * CTD-6: "Preferred Method Of Contact" - creates it if necessary
556      */
557     public CE getCtd6_PreferredMethodOfContact() { 
558 		CE retVal = this.getTypedField(6, 0);
559 		return retVal;
560     }
561 
562 
563     /**
564      * Returns all repetitions of Contact Identifiers (CTD-7).
565      */
566     public PI[] getContactIdentifiers() {
567     	PI[] retVal = this.getTypedField(7, new PI[0]);
568     	return retVal;
569     }
570 
571 
572     /**
573      * Returns all repetitions of Contact Identifiers (CTD-7).
574      */
575     public PI[] getCtd7_ContactIdentifiers() {
576     	PI[] retVal = this.getTypedField(7, new PI[0]);
577     	return retVal;
578     }
579 
580 
581     /**
582      * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7).
583      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
584      * it will return zero.
585      */
586     public int getContactIdentifiersReps() {
587     	return this.getReps(7);
588     }
589 
590 
591     /**
592      * Returns a specific repetition of
593      * CTD-7: "Contact Identifiers" - creates it if necessary
594      *
595      * @param rep The repetition index (0-indexed)
596      */
597     public PI getContactIdentifiers(int rep) { 
598 		PI retVal = this.getTypedField(7, rep);
599 		return retVal;
600     }
601 
602     /**
603      * Returns a specific repetition of
604      * CTD-7: "Contact Identifiers" - creates it if necessary
605      *
606      * @param rep The repetition index (0-indexed)
607      */
608     public PI getCtd7_ContactIdentifiers(int rep) { 
609 		PI retVal = this.getTypedField(7, rep);
610 		return retVal;
611     }
612 
613     /**
614      * Returns a count of the current number of repetitions of Contact Identifiers (CTD-7).
615      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
616      * it will return zero.
617      */
618     public int getCtd7_ContactIdentifiersReps() {
619     	return this.getReps(7);
620     }
621 
622 
623     /**
624      * Inserts a repetition of
625      * CTD-7: "Contact Identifiers" at a specific index
626      *
627      * @param rep The repetition index (0-indexed)
628      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
629      */
630     public PI insertContactIdentifiers(int rep) throws HL7Exception { 
631         return (PI) super.insertRepetition(7, rep);
632     }
633 
634 
635     /**
636      * Inserts a repetition of
637      * CTD-7: "Contact Identifiers" at a specific index
638      *
639      * @param rep The repetition index (0-indexed)
640      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
641      */
642     public PI insertCtd7_ContactIdentifiers(int rep) throws HL7Exception { 
643         return (PI) super.insertRepetition(7, rep);
644     }
645 
646 
647     /**
648      * Removes a repetition of
649      * CTD-7: "Contact Identifiers" at a specific index
650      *
651      * @param rep The repetition index (0-indexed)
652      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
653      */
654     public PI removeContactIdentifiers(int rep) throws HL7Exception { 
655         return (PI) super.removeRepetition(7, rep);
656     }
657 
658 
659     /**
660      * Removes a repetition of
661      * CTD-7: "Contact Identifiers" at a specific index
662      *
663      * @param rep The repetition index (0-indexed)
664      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
665      */
666     public PI removeCtd7_ContactIdentifiers(int rep) throws HL7Exception { 
667         return (PI) super.removeRepetition(7, rep);
668     }
669 
670 
671 
672 
673 
674 
675     /** {@inheritDoc} */   
676     protected Type createNewTypeWithoutReflection(int field) {
677        switch (field) {
678           case 0: return new CE(getMessage());
679           case 1: return new XPN(getMessage());
680           case 2: return new XAD(getMessage());
681           case 3: return new PL(getMessage());
682           case 4: return new XTN(getMessage());
683           case 5: return new CE(getMessage());
684           case 6: return new PI(getMessage());
685           default: return null;
686        }
687    }
688 
689 
690 }
691