001/*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 * 
007 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v231.segment;
035
036// import ca.uhn.hl7v2.model.v231.group.*;
037import ca.uhn.hl7v2.model.v231.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 LDP message segment (LDP - location department segment). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>LDP-1: Primary Key Value - LDP (PL) <b> </b>
053     * <li>LDP-2: Location Department (IS) <b> </b>
054     * <li>LDP-3: Location Service (IS) <b>optional repeating</b>
055     * <li>LDP-4: Specialty Type (CE) <b>optional repeating</b>
056     * <li>LDP-5: Valid Patient Classes (IS) <b>optional repeating</b>
057     * <li>LDP-6: Active/Inactive Flag (ID) <b>optional </b>
058     * <li>LDP-7: Activation Date  LDP (TS) <b>optional </b>
059     * <li>LDP-8: Inactivation Date - LDP (TS) <b>optional </b>
060     * <li>LDP-9: Inactivated Reason (ST) <b>optional </b>
061     * <li>LDP-10: Visiting Hours (VH) <b>optional repeating</b>
062     * <li>LDP-11: Contact Phone (XTN) <b>optional </b>
063 * </ul>
064 */
065@SuppressWarnings("unused")
066public class LDP extends AbstractSegment {
067
068    /** 
069     * Creates a new LDP segment
070     */
071    public LDP(Group parent, ModelClassFactory factory) {
072       super(parent, factory);
073       init(factory);
074    }
075
076    private void init(ModelClassFactory factory) {
077       try {
078                                  this.add(PL.class, true, 1, 200, new Object[]{ getMessage() }, "Primary Key Value - LDP");
079                                              this.add(IS.class, true, 1, 10, new Object[]{ getMessage(), new Integer(264) }, "Location Department");
080                                              this.add(IS.class, false, 0, 3, new Object[]{ getMessage(), new Integer(69) }, "Location Service");
081                                  this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "Specialty Type");
082                                              this.add(IS.class, false, 0, 1, new Object[]{ getMessage(), new Integer(4) }, "Valid Patient Classes");
083                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(183) }, "Active/Inactive Flag");
084                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Activation Date  LDP");
085                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Inactivation Date - LDP");
086                                  this.add(ST.class, false, 1, 80, new Object[]{ getMessage() }, "Inactivated Reason");
087                                  this.add(VH.class, false, 0, 80, new Object[]{ getMessage() }, "Visiting Hours");
088                                  this.add(XTN.class, false, 1, 40, new Object[]{ getMessage() }, "Contact Phone");
089       } catch(HL7Exception e) {
090          log.error("Unexpected error creating LDP - this is probably a bug in the source code generator.", e);
091       }
092    }
093
094
095
096    /**
097     * Returns
098     * LDP-1: "Primary Key Value - LDP" - creates it if necessary
099     */
100    public PL getPrimaryKeyValueLDP() { 
101                PL retVal = this.getTypedField(1, 0);
102                return retVal;
103    }
104    
105    /**
106     * Returns
107     * LDP-1: "Primary Key Value - LDP" - creates it if necessary
108     */
109    public PL getLdp1_PrimaryKeyValueLDP() { 
110                PL retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113
114
115
116    /**
117     * Returns
118     * LDP-2: "Location Department" - creates it if necessary
119     */
120    public IS getLocationDepartment() { 
121                IS retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124    
125    /**
126     * Returns
127     * LDP-2: "Location Department" - creates it if necessary
128     */
129    public IS getLdp2_LocationDepartment() { 
130                IS retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133
134
135    /**
136     * Returns all repetitions of Location Service (LDP-3).
137     */
138    public IS[] getLocationService() {
139        IS[] retVal = this.getTypedField(3, new IS[0]);
140        return retVal;
141    }
142
143
144    /**
145     * Returns all repetitions of Location Service (LDP-3).
146     */
147    public IS[] getLdp3_LocationService() {
148        IS[] retVal = this.getTypedField(3, new IS[0]);
149        return retVal;
150    }
151
152
153    /**
154     * Returns a count of the current number of repetitions of Location Service (LDP-3).
155     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
156     * it will return zero.
157     */
158    public int getLocationServiceReps() {
159        return this.getReps(3);
160    }
161
162
163    /**
164     * Returns a specific repetition of
165     * LDP-3: "Location Service" - creates it if necessary
166     *
167     * @param rep The repetition index (0-indexed)
168     */
169    public IS getLocationService(int rep) { 
170                IS retVal = this.getTypedField(3, rep);
171                return retVal;
172    }
173
174    /**
175     * Returns a specific repetition of
176     * LDP-3: "Location Service" - creates it if necessary
177     *
178     * @param rep The repetition index (0-indexed)
179     */
180    public IS getLdp3_LocationService(int rep) { 
181                IS retVal = this.getTypedField(3, rep);
182                return retVal;
183    }
184
185    /**
186     * Returns a count of the current number of repetitions of Location Service (LDP-3).
187     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
188     * it will return zero.
189     */
190    public int getLdp3_LocationServiceReps() {
191        return this.getReps(3);
192    }
193
194
195    /**
196     * Inserts a repetition of
197     * LDP-3: "Location Service" at a specific index
198     *
199     * @param rep The repetition index (0-indexed)
200     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
201     */
202    public IS insertLocationService(int rep) throws HL7Exception { 
203        return (IS) super.insertRepetition(3, rep);
204    }
205
206
207    /**
208     * Inserts a repetition of
209     * LDP-3: "Location Service" at a specific index
210     *
211     * @param rep The repetition index (0-indexed)
212     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
213     */
214    public IS insertLdp3_LocationService(int rep) throws HL7Exception { 
215        return (IS) super.insertRepetition(3, rep);
216    }
217
218
219    /**
220     * Removes a repetition of
221     * LDP-3: "Location Service" at a specific index
222     *
223     * @param rep The repetition index (0-indexed)
224     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
225     */
226    public IS removeLocationService(int rep) throws HL7Exception { 
227        return (IS) super.removeRepetition(3, rep);
228    }
229
230
231    /**
232     * Removes a repetition of
233     * LDP-3: "Location Service" at a specific index
234     *
235     * @param rep The repetition index (0-indexed)
236     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
237     */
238    public IS removeLdp3_LocationService(int rep) throws HL7Exception { 
239        return (IS) super.removeRepetition(3, rep);
240    }
241
242
243
244    /**
245     * Returns all repetitions of Specialty Type (LDP-4).
246     */
247    public CE[] getSpecialtyType() {
248        CE[] retVal = this.getTypedField(4, new CE[0]);
249        return retVal;
250    }
251
252
253    /**
254     * Returns all repetitions of Specialty Type (LDP-4).
255     */
256    public CE[] getLdp4_SpecialtyType() {
257        CE[] retVal = this.getTypedField(4, new CE[0]);
258        return retVal;
259    }
260
261
262    /**
263     * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
264     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
265     * it will return zero.
266     */
267    public int getSpecialtyTypeReps() {
268        return this.getReps(4);
269    }
270
271
272    /**
273     * Returns a specific repetition of
274     * LDP-4: "Specialty Type" - creates it if necessary
275     *
276     * @param rep The repetition index (0-indexed)
277     */
278    public CE getSpecialtyType(int rep) { 
279                CE retVal = this.getTypedField(4, rep);
280                return retVal;
281    }
282
283    /**
284     * Returns a specific repetition of
285     * LDP-4: "Specialty Type" - creates it if necessary
286     *
287     * @param rep The repetition index (0-indexed)
288     */
289    public CE getLdp4_SpecialtyType(int rep) { 
290                CE retVal = this.getTypedField(4, rep);
291                return retVal;
292    }
293
294    /**
295     * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
296     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
297     * it will return zero.
298     */
299    public int getLdp4_SpecialtyTypeReps() {
300        return this.getReps(4);
301    }
302
303
304    /**
305     * Inserts a repetition of
306     * LDP-4: "Specialty Type" at a specific index
307     *
308     * @param rep The repetition index (0-indexed)
309     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
310     */
311    public CE insertSpecialtyType(int rep) throws HL7Exception { 
312        return (CE) super.insertRepetition(4, rep);
313    }
314
315
316    /**
317     * Inserts a repetition of
318     * LDP-4: "Specialty Type" at a specific index
319     *
320     * @param rep The repetition index (0-indexed)
321     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
322     */
323    public CE insertLdp4_SpecialtyType(int rep) throws HL7Exception { 
324        return (CE) super.insertRepetition(4, rep);
325    }
326
327
328    /**
329     * Removes a repetition of
330     * LDP-4: "Specialty Type" at a specific index
331     *
332     * @param rep The repetition index (0-indexed)
333     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
334     */
335    public CE removeSpecialtyType(int rep) throws HL7Exception { 
336        return (CE) super.removeRepetition(4, rep);
337    }
338
339
340    /**
341     * Removes a repetition of
342     * LDP-4: "Specialty Type" at a specific index
343     *
344     * @param rep The repetition index (0-indexed)
345     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
346     */
347    public CE removeLdp4_SpecialtyType(int rep) throws HL7Exception { 
348        return (CE) super.removeRepetition(4, rep);
349    }
350
351
352
353    /**
354     * Returns all repetitions of Valid Patient Classes (LDP-5).
355     */
356    public IS[] getValidPatientClasses() {
357        IS[] retVal = this.getTypedField(5, new IS[0]);
358        return retVal;
359    }
360
361
362    /**
363     * Returns all repetitions of Valid Patient Classes (LDP-5).
364     */
365    public IS[] getLdp5_ValidPatientClasses() {
366        IS[] retVal = this.getTypedField(5, new IS[0]);
367        return retVal;
368    }
369
370
371    /**
372     * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
373     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
374     * it will return zero.
375     */
376    public int getValidPatientClassesReps() {
377        return this.getReps(5);
378    }
379
380
381    /**
382     * Returns a specific repetition of
383     * LDP-5: "Valid Patient Classes" - creates it if necessary
384     *
385     * @param rep The repetition index (0-indexed)
386     */
387    public IS getValidPatientClasses(int rep) { 
388                IS retVal = this.getTypedField(5, rep);
389                return retVal;
390    }
391
392    /**
393     * Returns a specific repetition of
394     * LDP-5: "Valid Patient Classes" - creates it if necessary
395     *
396     * @param rep The repetition index (0-indexed)
397     */
398    public IS getLdp5_ValidPatientClasses(int rep) { 
399                IS retVal = this.getTypedField(5, rep);
400                return retVal;
401    }
402
403    /**
404     * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
405     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
406     * it will return zero.
407     */
408    public int getLdp5_ValidPatientClassesReps() {
409        return this.getReps(5);
410    }
411
412
413    /**
414     * Inserts a repetition of
415     * LDP-5: "Valid Patient Classes" at a specific index
416     *
417     * @param rep The repetition index (0-indexed)
418     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
419     */
420    public IS insertValidPatientClasses(int rep) throws HL7Exception { 
421        return (IS) super.insertRepetition(5, rep);
422    }
423
424
425    /**
426     * Inserts a repetition of
427     * LDP-5: "Valid Patient Classes" at a specific index
428     *
429     * @param rep The repetition index (0-indexed)
430     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
431     */
432    public IS insertLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
433        return (IS) super.insertRepetition(5, rep);
434    }
435
436
437    /**
438     * Removes a repetition of
439     * LDP-5: "Valid Patient Classes" at a specific index
440     *
441     * @param rep The repetition index (0-indexed)
442     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
443     */
444    public IS removeValidPatientClasses(int rep) throws HL7Exception { 
445        return (IS) super.removeRepetition(5, rep);
446    }
447
448
449    /**
450     * Removes a repetition of
451     * LDP-5: "Valid Patient Classes" at a specific index
452     *
453     * @param rep The repetition index (0-indexed)
454     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
455     */
456    public IS removeLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
457        return (IS) super.removeRepetition(5, rep);
458    }
459
460
461
462
463    /**
464     * Returns
465     * LDP-6: "Active/Inactive Flag" - creates it if necessary
466     */
467    public ID getActiveInactiveFlag() { 
468                ID retVal = this.getTypedField(6, 0);
469                return retVal;
470    }
471    
472    /**
473     * Returns
474     * LDP-6: "Active/Inactive Flag" - creates it if necessary
475     */
476    public ID getLdp6_ActiveInactiveFlag() { 
477                ID retVal = this.getTypedField(6, 0);
478                return retVal;
479    }
480
481
482
483    /**
484     * Returns
485     * LDP-7: "Activation Date  LDP" - creates it if necessary
486     */
487    public TS getActivationDateLDP() { 
488                TS retVal = this.getTypedField(7, 0);
489                return retVal;
490    }
491    
492    /**
493     * Returns
494     * LDP-7: "Activation Date  LDP" - creates it if necessary
495     */
496    public TS getLdp7_ActivationDateLDP() { 
497                TS retVal = this.getTypedField(7, 0);
498                return retVal;
499    }
500
501
502
503    /**
504     * Returns
505     * LDP-8: "Inactivation Date - LDP" - creates it if necessary
506     */
507    public TS getInactivationDateLDP() { 
508                TS retVal = this.getTypedField(8, 0);
509                return retVal;
510    }
511    
512    /**
513     * Returns
514     * LDP-8: "Inactivation Date - LDP" - creates it if necessary
515     */
516    public TS getLdp8_InactivationDateLDP() { 
517                TS retVal = this.getTypedField(8, 0);
518                return retVal;
519    }
520
521
522
523    /**
524     * Returns
525     * LDP-9: "Inactivated Reason" - creates it if necessary
526     */
527    public ST getInactivatedReason() { 
528                ST retVal = this.getTypedField(9, 0);
529                return retVal;
530    }
531    
532    /**
533     * Returns
534     * LDP-9: "Inactivated Reason" - creates it if necessary
535     */
536    public ST getLdp9_InactivatedReason() { 
537                ST retVal = this.getTypedField(9, 0);
538                return retVal;
539    }
540
541
542    /**
543     * Returns all repetitions of Visiting Hours (LDP-10).
544     */
545    public VH[] getVisitingHours() {
546        VH[] retVal = this.getTypedField(10, new VH[0]);
547        return retVal;
548    }
549
550
551    /**
552     * Returns all repetitions of Visiting Hours (LDP-10).
553     */
554    public VH[] getLdp10_VisitingHours() {
555        VH[] retVal = this.getTypedField(10, new VH[0]);
556        return retVal;
557    }
558
559
560    /**
561     * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
562     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
563     * it will return zero.
564     */
565    public int getVisitingHoursReps() {
566        return this.getReps(10);
567    }
568
569
570    /**
571     * Returns a specific repetition of
572     * LDP-10: "Visiting Hours" - creates it if necessary
573     *
574     * @param rep The repetition index (0-indexed)
575     */
576    public VH getVisitingHours(int rep) { 
577                VH retVal = this.getTypedField(10, rep);
578                return retVal;
579    }
580
581    /**
582     * Returns a specific repetition of
583     * LDP-10: "Visiting Hours" - creates it if necessary
584     *
585     * @param rep The repetition index (0-indexed)
586     */
587    public VH getLdp10_VisitingHours(int rep) { 
588                VH retVal = this.getTypedField(10, rep);
589                return retVal;
590    }
591
592    /**
593     * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
594     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
595     * it will return zero.
596     */
597    public int getLdp10_VisitingHoursReps() {
598        return this.getReps(10);
599    }
600
601
602    /**
603     * Inserts a repetition of
604     * LDP-10: "Visiting Hours" at a specific index
605     *
606     * @param rep The repetition index (0-indexed)
607     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
608     */
609    public VH insertVisitingHours(int rep) throws HL7Exception { 
610        return (VH) super.insertRepetition(10, rep);
611    }
612
613
614    /**
615     * Inserts a repetition of
616     * LDP-10: "Visiting Hours" at a specific index
617     *
618     * @param rep The repetition index (0-indexed)
619     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
620     */
621    public VH insertLdp10_VisitingHours(int rep) throws HL7Exception { 
622        return (VH) super.insertRepetition(10, rep);
623    }
624
625
626    /**
627     * Removes a repetition of
628     * LDP-10: "Visiting Hours" at a specific index
629     *
630     * @param rep The repetition index (0-indexed)
631     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
632     */
633    public VH removeVisitingHours(int rep) throws HL7Exception { 
634        return (VH) super.removeRepetition(10, rep);
635    }
636
637
638    /**
639     * Removes a repetition of
640     * LDP-10: "Visiting Hours" at a specific index
641     *
642     * @param rep The repetition index (0-indexed)
643     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
644     */
645    public VH removeLdp10_VisitingHours(int rep) throws HL7Exception { 
646        return (VH) super.removeRepetition(10, rep);
647    }
648
649
650
651
652    /**
653     * Returns
654     * LDP-11: "Contact Phone" - creates it if necessary
655     */
656    public XTN getContactPhone() { 
657                XTN retVal = this.getTypedField(11, 0);
658                return retVal;
659    }
660    
661    /**
662     * Returns
663     * LDP-11: "Contact Phone" - creates it if necessary
664     */
665    public XTN getLdp11_ContactPhone() { 
666                XTN retVal = this.getTypedField(11, 0);
667                return retVal;
668    }
669
670
671
672
673
674    /** {@inheritDoc} */   
675    protected Type createNewTypeWithoutReflection(int field) {
676       switch (field) {
677          case 0: return new PL(getMessage());
678          case 1: return new IS(getMessage(), new Integer( 264 ));
679          case 2: return new IS(getMessage(), new Integer( 69 ));
680          case 3: return new CE(getMessage());
681          case 4: return new IS(getMessage(), new Integer( 4 ));
682          case 5: return new ID(getMessage(), new Integer( 183 ));
683          case 6: return new TS(getMessage());
684          case 7: return new TS(getMessage());
685          case 8: return new ST(getMessage());
686          case 9: return new VH(getMessage());
687          case 10: return new XTN(getMessage());
688          default: return null;
689       }
690   }
691
692
693}
694