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.v251.segment;
035
036// import ca.uhn.hl7v2.model.v251.group.*;
037import ca.uhn.hl7v2.model.v251.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 (Location Department). 
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 (CE) <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     * <li>LDP-12: Location Cost Center (CE) <b>optional </b>
064 * </ul>
065 */
066@SuppressWarnings("unused")
067public class LDP extends AbstractSegment {
068
069    /** 
070     * Creates a new LDP segment
071     */
072    public LDP(Group parent, ModelClassFactory factory) {
073       super(parent, factory);
074       init(factory);
075    }
076
077    private void init(ModelClassFactory factory) {
078       try {
079                                  this.add(PL.class, true, 1, 200, new Object[]{ getMessage() }, "Primary Key Value - LDP");
080                                  this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Location Department");
081                                              this.add(IS.class, false, 0, 3, new Object[]{ getMessage(), new Integer(69) }, "Location Service");
082                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Specialty Type");
083                                              this.add(IS.class, false, 0, 1, new Object[]{ getMessage(), new Integer(4) }, "Valid Patient Classes");
084                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(183) }, "Active/Inactive Flag");
085                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Activation Date  LDP");
086                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Inactivation Date - LDP");
087                                  this.add(ST.class, false, 1, 80, new Object[]{ getMessage() }, "Inactivated Reason");
088                                  this.add(VH.class, false, 0, 80, new Object[]{ getMessage() }, "Visiting Hours");
089                                  this.add(XTN.class, false, 1, 250, new Object[]{ getMessage() }, "Contact Phone");
090                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Location Cost Center");
091       } catch(HL7Exception e) {
092          log.error("Unexpected error creating LDP - this is probably a bug in the source code generator.", e);
093       }
094    }
095
096
097
098    /**
099     * Returns
100     * LDP-1: "Primary Key Value - LDP" - creates it if necessary
101     */
102    public PL getPrimaryKeyValueLDP() { 
103                PL retVal = this.getTypedField(1, 0);
104                return retVal;
105    }
106    
107    /**
108     * Returns
109     * LDP-1: "Primary Key Value - LDP" - creates it if necessary
110     */
111    public PL getLdp1_PrimaryKeyValueLDP() { 
112                PL retVal = this.getTypedField(1, 0);
113                return retVal;
114    }
115
116
117
118    /**
119     * Returns
120     * LDP-2: "Location Department" - creates it if necessary
121     */
122    public CE getLocationDepartment() { 
123                CE retVal = this.getTypedField(2, 0);
124                return retVal;
125    }
126    
127    /**
128     * Returns
129     * LDP-2: "Location Department" - creates it if necessary
130     */
131    public CE getLdp2_LocationDepartment() { 
132                CE retVal = this.getTypedField(2, 0);
133                return retVal;
134    }
135
136
137    /**
138     * Returns all repetitions of Location Service (LDP-3).
139     */
140    public IS[] getLocationService() {
141        IS[] retVal = this.getTypedField(3, new IS[0]);
142        return retVal;
143    }
144
145
146    /**
147     * Returns all repetitions of Location Service (LDP-3).
148     */
149    public IS[] getLdp3_LocationService() {
150        IS[] retVal = this.getTypedField(3, new IS[0]);
151        return retVal;
152    }
153
154
155    /**
156     * Returns a count of the current number of repetitions of Location Service (LDP-3).
157     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
158     * it will return zero.
159     */
160    public int getLocationServiceReps() {
161        return this.getReps(3);
162    }
163
164
165    /**
166     * Returns a specific repetition of
167     * LDP-3: "Location Service" - creates it if necessary
168     *
169     * @param rep The repetition index (0-indexed)
170     */
171    public IS getLocationService(int rep) { 
172                IS retVal = this.getTypedField(3, rep);
173                return retVal;
174    }
175
176    /**
177     * Returns a specific repetition of
178     * LDP-3: "Location Service" - creates it if necessary
179     *
180     * @param rep The repetition index (0-indexed)
181     */
182    public IS getLdp3_LocationService(int rep) { 
183                IS retVal = this.getTypedField(3, rep);
184                return retVal;
185    }
186
187    /**
188     * Returns a count of the current number of repetitions of Location Service (LDP-3).
189     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
190     * it will return zero.
191     */
192    public int getLdp3_LocationServiceReps() {
193        return this.getReps(3);
194    }
195
196
197    /**
198     * Inserts a repetition of
199     * LDP-3: "Location Service" at a specific index
200     *
201     * @param rep The repetition index (0-indexed)
202     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
203     */
204    public IS insertLocationService(int rep) throws HL7Exception { 
205        return (IS) super.insertRepetition(3, rep);
206    }
207
208
209    /**
210     * Inserts a repetition of
211     * LDP-3: "Location Service" at a specific index
212     *
213     * @param rep The repetition index (0-indexed)
214     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
215     */
216    public IS insertLdp3_LocationService(int rep) throws HL7Exception { 
217        return (IS) super.insertRepetition(3, rep);
218    }
219
220
221    /**
222     * Removes a repetition of
223     * LDP-3: "Location Service" at a specific index
224     *
225     * @param rep The repetition index (0-indexed)
226     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
227     */
228    public IS removeLocationService(int rep) throws HL7Exception { 
229        return (IS) super.removeRepetition(3, rep);
230    }
231
232
233    /**
234     * Removes a repetition of
235     * LDP-3: "Location Service" at a specific index
236     *
237     * @param rep The repetition index (0-indexed)
238     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
239     */
240    public IS removeLdp3_LocationService(int rep) throws HL7Exception { 
241        return (IS) super.removeRepetition(3, rep);
242    }
243
244
245
246    /**
247     * Returns all repetitions of Specialty Type (LDP-4).
248     */
249    public CE[] getSpecialtyType() {
250        CE[] retVal = this.getTypedField(4, new CE[0]);
251        return retVal;
252    }
253
254
255    /**
256     * Returns all repetitions of Specialty Type (LDP-4).
257     */
258    public CE[] getLdp4_SpecialtyType() {
259        CE[] retVal = this.getTypedField(4, new CE[0]);
260        return retVal;
261    }
262
263
264    /**
265     * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
266     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
267     * it will return zero.
268     */
269    public int getSpecialtyTypeReps() {
270        return this.getReps(4);
271    }
272
273
274    /**
275     * Returns a specific repetition of
276     * LDP-4: "Specialty Type" - creates it if necessary
277     *
278     * @param rep The repetition index (0-indexed)
279     */
280    public CE getSpecialtyType(int rep) { 
281                CE retVal = this.getTypedField(4, rep);
282                return retVal;
283    }
284
285    /**
286     * Returns a specific repetition of
287     * LDP-4: "Specialty Type" - creates it if necessary
288     *
289     * @param rep The repetition index (0-indexed)
290     */
291    public CE getLdp4_SpecialtyType(int rep) { 
292                CE retVal = this.getTypedField(4, rep);
293                return retVal;
294    }
295
296    /**
297     * Returns a count of the current number of repetitions of Specialty Type (LDP-4).
298     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
299     * it will return zero.
300     */
301    public int getLdp4_SpecialtyTypeReps() {
302        return this.getReps(4);
303    }
304
305
306    /**
307     * Inserts a repetition of
308     * LDP-4: "Specialty Type" at a specific index
309     *
310     * @param rep The repetition index (0-indexed)
311     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
312     */
313    public CE insertSpecialtyType(int rep) throws HL7Exception { 
314        return (CE) super.insertRepetition(4, rep);
315    }
316
317
318    /**
319     * Inserts a repetition of
320     * LDP-4: "Specialty Type" at a specific index
321     *
322     * @param rep The repetition index (0-indexed)
323     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
324     */
325    public CE insertLdp4_SpecialtyType(int rep) throws HL7Exception { 
326        return (CE) super.insertRepetition(4, rep);
327    }
328
329
330    /**
331     * Removes a repetition of
332     * LDP-4: "Specialty Type" at a specific index
333     *
334     * @param rep The repetition index (0-indexed)
335     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
336     */
337    public CE removeSpecialtyType(int rep) throws HL7Exception { 
338        return (CE) super.removeRepetition(4, rep);
339    }
340
341
342    /**
343     * Removes a repetition of
344     * LDP-4: "Specialty Type" at a specific index
345     *
346     * @param rep The repetition index (0-indexed)
347     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
348     */
349    public CE removeLdp4_SpecialtyType(int rep) throws HL7Exception { 
350        return (CE) super.removeRepetition(4, rep);
351    }
352
353
354
355    /**
356     * Returns all repetitions of Valid Patient Classes (LDP-5).
357     */
358    public IS[] getValidPatientClasses() {
359        IS[] retVal = this.getTypedField(5, new IS[0]);
360        return retVal;
361    }
362
363
364    /**
365     * Returns all repetitions of Valid Patient Classes (LDP-5).
366     */
367    public IS[] getLdp5_ValidPatientClasses() {
368        IS[] retVal = this.getTypedField(5, new IS[0]);
369        return retVal;
370    }
371
372
373    /**
374     * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
375     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
376     * it will return zero.
377     */
378    public int getValidPatientClassesReps() {
379        return this.getReps(5);
380    }
381
382
383    /**
384     * Returns a specific repetition of
385     * LDP-5: "Valid Patient Classes" - creates it if necessary
386     *
387     * @param rep The repetition index (0-indexed)
388     */
389    public IS getValidPatientClasses(int rep) { 
390                IS retVal = this.getTypedField(5, rep);
391                return retVal;
392    }
393
394    /**
395     * Returns a specific repetition of
396     * LDP-5: "Valid Patient Classes" - creates it if necessary
397     *
398     * @param rep The repetition index (0-indexed)
399     */
400    public IS getLdp5_ValidPatientClasses(int rep) { 
401                IS retVal = this.getTypedField(5, rep);
402                return retVal;
403    }
404
405    /**
406     * Returns a count of the current number of repetitions of Valid Patient Classes (LDP-5).
407     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
408     * it will return zero.
409     */
410    public int getLdp5_ValidPatientClassesReps() {
411        return this.getReps(5);
412    }
413
414
415    /**
416     * Inserts a repetition of
417     * LDP-5: "Valid Patient Classes" at a specific index
418     *
419     * @param rep The repetition index (0-indexed)
420     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
421     */
422    public IS insertValidPatientClasses(int rep) throws HL7Exception { 
423        return (IS) super.insertRepetition(5, rep);
424    }
425
426
427    /**
428     * Inserts a repetition of
429     * LDP-5: "Valid Patient Classes" at a specific index
430     *
431     * @param rep The repetition index (0-indexed)
432     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
433     */
434    public IS insertLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
435        return (IS) super.insertRepetition(5, rep);
436    }
437
438
439    /**
440     * Removes a repetition of
441     * LDP-5: "Valid Patient Classes" at a specific index
442     *
443     * @param rep The repetition index (0-indexed)
444     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
445     */
446    public IS removeValidPatientClasses(int rep) throws HL7Exception { 
447        return (IS) super.removeRepetition(5, rep);
448    }
449
450
451    /**
452     * Removes a repetition of
453     * LDP-5: "Valid Patient Classes" at a specific index
454     *
455     * @param rep The repetition index (0-indexed)
456     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
457     */
458    public IS removeLdp5_ValidPatientClasses(int rep) throws HL7Exception { 
459        return (IS) super.removeRepetition(5, rep);
460    }
461
462
463
464
465    /**
466     * Returns
467     * LDP-6: "Active/Inactive Flag" - creates it if necessary
468     */
469    public ID getActiveInactiveFlag() { 
470                ID retVal = this.getTypedField(6, 0);
471                return retVal;
472    }
473    
474    /**
475     * Returns
476     * LDP-6: "Active/Inactive Flag" - creates it if necessary
477     */
478    public ID getLdp6_ActiveInactiveFlag() { 
479                ID retVal = this.getTypedField(6, 0);
480                return retVal;
481    }
482
483
484
485    /**
486     * Returns
487     * LDP-7: "Activation Date  LDP" - creates it if necessary
488     */
489    public TS getActivationDateLDP() { 
490                TS retVal = this.getTypedField(7, 0);
491                return retVal;
492    }
493    
494    /**
495     * Returns
496     * LDP-7: "Activation Date  LDP" - creates it if necessary
497     */
498    public TS getLdp7_ActivationDateLDP() { 
499                TS retVal = this.getTypedField(7, 0);
500                return retVal;
501    }
502
503
504
505    /**
506     * Returns
507     * LDP-8: "Inactivation Date - LDP" - creates it if necessary
508     */
509    public TS getInactivationDateLDP() { 
510                TS retVal = this.getTypedField(8, 0);
511                return retVal;
512    }
513    
514    /**
515     * Returns
516     * LDP-8: "Inactivation Date - LDP" - creates it if necessary
517     */
518    public TS getLdp8_InactivationDateLDP() { 
519                TS retVal = this.getTypedField(8, 0);
520                return retVal;
521    }
522
523
524
525    /**
526     * Returns
527     * LDP-9: "Inactivated Reason" - creates it if necessary
528     */
529    public ST getInactivatedReason() { 
530                ST retVal = this.getTypedField(9, 0);
531                return retVal;
532    }
533    
534    /**
535     * Returns
536     * LDP-9: "Inactivated Reason" - creates it if necessary
537     */
538    public ST getLdp9_InactivatedReason() { 
539                ST retVal = this.getTypedField(9, 0);
540                return retVal;
541    }
542
543
544    /**
545     * Returns all repetitions of Visiting Hours (LDP-10).
546     */
547    public VH[] getVisitingHours() {
548        VH[] retVal = this.getTypedField(10, new VH[0]);
549        return retVal;
550    }
551
552
553    /**
554     * Returns all repetitions of Visiting Hours (LDP-10).
555     */
556    public VH[] getLdp10_VisitingHours() {
557        VH[] retVal = this.getTypedField(10, new VH[0]);
558        return retVal;
559    }
560
561
562    /**
563     * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
564     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
565     * it will return zero.
566     */
567    public int getVisitingHoursReps() {
568        return this.getReps(10);
569    }
570
571
572    /**
573     * Returns a specific repetition of
574     * LDP-10: "Visiting Hours" - creates it if necessary
575     *
576     * @param rep The repetition index (0-indexed)
577     */
578    public VH getVisitingHours(int rep) { 
579                VH retVal = this.getTypedField(10, rep);
580                return retVal;
581    }
582
583    /**
584     * Returns a specific repetition of
585     * LDP-10: "Visiting Hours" - creates it if necessary
586     *
587     * @param rep The repetition index (0-indexed)
588     */
589    public VH getLdp10_VisitingHours(int rep) { 
590                VH retVal = this.getTypedField(10, rep);
591                return retVal;
592    }
593
594    /**
595     * Returns a count of the current number of repetitions of Visiting Hours (LDP-10).
596     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
597     * it will return zero.
598     */
599    public int getLdp10_VisitingHoursReps() {
600        return this.getReps(10);
601    }
602
603
604    /**
605     * Inserts a repetition of
606     * LDP-10: "Visiting Hours" at a specific index
607     *
608     * @param rep The repetition index (0-indexed)
609     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
610     */
611    public VH insertVisitingHours(int rep) throws HL7Exception { 
612        return (VH) super.insertRepetition(10, rep);
613    }
614
615
616    /**
617     * Inserts a repetition of
618     * LDP-10: "Visiting Hours" at a specific index
619     *
620     * @param rep The repetition index (0-indexed)
621     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
622     */
623    public VH insertLdp10_VisitingHours(int rep) throws HL7Exception { 
624        return (VH) super.insertRepetition(10, rep);
625    }
626
627
628    /**
629     * Removes a repetition of
630     * LDP-10: "Visiting Hours" at a specific index
631     *
632     * @param rep The repetition index (0-indexed)
633     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
634     */
635    public VH removeVisitingHours(int rep) throws HL7Exception { 
636        return (VH) super.removeRepetition(10, rep);
637    }
638
639
640    /**
641     * Removes a repetition of
642     * LDP-10: "Visiting Hours" at a specific index
643     *
644     * @param rep The repetition index (0-indexed)
645     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
646     */
647    public VH removeLdp10_VisitingHours(int rep) throws HL7Exception { 
648        return (VH) super.removeRepetition(10, rep);
649    }
650
651
652
653
654    /**
655     * Returns
656     * LDP-11: "Contact Phone" - creates it if necessary
657     */
658    public XTN getContactPhone() { 
659                XTN retVal = this.getTypedField(11, 0);
660                return retVal;
661    }
662    
663    /**
664     * Returns
665     * LDP-11: "Contact Phone" - creates it if necessary
666     */
667    public XTN getLdp11_ContactPhone() { 
668                XTN retVal = this.getTypedField(11, 0);
669                return retVal;
670    }
671
672
673
674    /**
675     * Returns
676     * LDP-12: "Location Cost Center" - creates it if necessary
677     */
678    public CE getLocationCostCenter() { 
679                CE retVal = this.getTypedField(12, 0);
680                return retVal;
681    }
682    
683    /**
684     * Returns
685     * LDP-12: "Location Cost Center" - creates it if necessary
686     */
687    public CE getLdp12_LocationCostCenter() { 
688                CE retVal = this.getTypedField(12, 0);
689                return retVal;
690    }
691
692
693
694
695
696    /** {@inheritDoc} */   
697    protected Type createNewTypeWithoutReflection(int field) {
698       switch (field) {
699          case 0: return new PL(getMessage());
700          case 1: return new CE(getMessage());
701          case 2: return new IS(getMessage(), new Integer( 69 ));
702          case 3: return new CE(getMessage());
703          case 4: return new IS(getMessage(), new Integer( 4 ));
704          case 5: return new ID(getMessage(), new Integer( 183 ));
705          case 6: return new TS(getMessage());
706          case 7: return new TS(getMessage());
707          case 8: return new ST(getMessage());
708          case 9: return new VH(getMessage());
709          case 10: return new XTN(getMessage());
710          case 11: return new CE(getMessage());
711          default: return null;
712       }
713   }
714
715
716}
717