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.v27.segment;
035
036// import ca.uhn.hl7v2.model.v27.group.*;
037import ca.uhn.hl7v2.model.v27.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 AIL message segment (Appointment Information - Location Resource). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>AIL-1: Set ID - AIL (SI) <b> </b>
053     * <li>AIL-2: Segment Action Code (ID) <b>optional </b>
054     * <li>AIL-3: Location Resource ID (PL) <b>optional repeating</b>
055     * <li>AIL-4: Location Type - AIL (CWE) <b>optional </b>
056     * <li>AIL-5: Location Group (CWE) <b>optional </b>
057     * <li>AIL-6: Start Date/Time (DTM) <b>optional </b>
058     * <li>AIL-7: Start Date/Time Offset (NM) <b>optional </b>
059     * <li>AIL-8: Start Date/Time Offset Units (CNE) <b>optional </b>
060     * <li>AIL-9: Duration (NM) <b>optional </b>
061     * <li>AIL-10: Duration Units (CNE) <b>optional </b>
062     * <li>AIL-11: Allow Substitution Code (CWE) <b>optional </b>
063     * <li>AIL-12: Filler Status Code (CWE) <b>optional </b>
064 * </ul>
065 */
066@SuppressWarnings("unused")
067public class AIL extends AbstractSegment {
068
069    /** 
070     * Creates a new AIL segment
071     */
072    public AIL(Group parent, ModelClassFactory factory) {
073       super(parent, factory);
074       init(factory);
075    }
076
077    private void init(ModelClassFactory factory) {
078       try {
079                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - AIL");
080                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(206) }, "Segment Action Code");
081                                  this.add(PL.class, false, 0, 0, new Object[]{ getMessage() }, "Location Resource ID");
082                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Location Type - AIL");
083                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Location Group");
084                                  this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Start Date/Time");
085                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Start Date/Time Offset");
086                                  this.add(CNE.class, false, 1, 0, new Object[]{ getMessage() }, "Start Date/Time Offset Units");
087                                  this.add(NM.class, false, 1, 0, new Object[]{ getMessage() }, "Duration");
088                                  this.add(CNE.class, false, 1, 0, new Object[]{ getMessage() }, "Duration Units");
089                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Allow Substitution Code");
090                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Filler Status Code");
091       } catch(HL7Exception e) {
092          log.error("Unexpected error creating AIL - this is probably a bug in the source code generator.", e);
093       }
094    }
095
096
097
098    /**
099     * Returns
100     * AIL-1: "Set ID - AIL" - creates it if necessary
101     */
102    public SI getSetIDAIL() { 
103                SI retVal = this.getTypedField(1, 0);
104                return retVal;
105    }
106    
107    /**
108     * Returns
109     * AIL-1: "Set ID - AIL" - creates it if necessary
110     */
111    public SI getAil1_SetIDAIL() { 
112                SI retVal = this.getTypedField(1, 0);
113                return retVal;
114    }
115
116
117
118    /**
119     * Returns
120     * AIL-2: "Segment Action Code" - creates it if necessary
121     */
122    public ID getSegmentActionCode() { 
123                ID retVal = this.getTypedField(2, 0);
124                return retVal;
125    }
126    
127    /**
128     * Returns
129     * AIL-2: "Segment Action Code" - creates it if necessary
130     */
131    public ID getAil2_SegmentActionCode() { 
132                ID retVal = this.getTypedField(2, 0);
133                return retVal;
134    }
135
136
137    /**
138     * Returns all repetitions of Location Resource ID (AIL-3).
139     */
140    public PL[] getLocationResourceID() {
141        PL[] retVal = this.getTypedField(3, new PL[0]);
142        return retVal;
143    }
144
145
146    /**
147     * Returns all repetitions of Location Resource ID (AIL-3).
148     */
149    public PL[] getAil3_LocationResourceID() {
150        PL[] retVal = this.getTypedField(3, new PL[0]);
151        return retVal;
152    }
153
154
155    /**
156     * Returns a count of the current number of repetitions of Location Resource ID (AIL-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 getLocationResourceIDReps() {
161        return this.getReps(3);
162    }
163
164
165    /**
166     * Returns a specific repetition of
167     * AIL-3: "Location Resource ID" - creates it if necessary
168     *
169     * @param rep The repetition index (0-indexed)
170     */
171    public PL getLocationResourceID(int rep) { 
172                PL retVal = this.getTypedField(3, rep);
173                return retVal;
174    }
175
176    /**
177     * Returns a specific repetition of
178     * AIL-3: "Location Resource ID" - creates it if necessary
179     *
180     * @param rep The repetition index (0-indexed)
181     */
182    public PL getAil3_LocationResourceID(int rep) { 
183                PL retVal = this.getTypedField(3, rep);
184                return retVal;
185    }
186
187    /**
188     * Returns a count of the current number of repetitions of Location Resource ID (AIL-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 getAil3_LocationResourceIDReps() {
193        return this.getReps(3);
194    }
195
196
197    /**
198     * Inserts a repetition of
199     * AIL-3: "Location Resource ID" 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 PL insertLocationResourceID(int rep) throws HL7Exception { 
205        return (PL) super.insertRepetition(3, rep);
206    }
207
208
209    /**
210     * Inserts a repetition of
211     * AIL-3: "Location Resource ID" 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 PL insertAil3_LocationResourceID(int rep) throws HL7Exception { 
217        return (PL) super.insertRepetition(3, rep);
218    }
219
220
221    /**
222     * Removes a repetition of
223     * AIL-3: "Location Resource ID" 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 PL removeLocationResourceID(int rep) throws HL7Exception { 
229        return (PL) super.removeRepetition(3, rep);
230    }
231
232
233    /**
234     * Removes a repetition of
235     * AIL-3: "Location Resource ID" 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 PL removeAil3_LocationResourceID(int rep) throws HL7Exception { 
241        return (PL) super.removeRepetition(3, rep);
242    }
243
244
245
246
247    /**
248     * Returns
249     * AIL-4: "Location Type - AIL" - creates it if necessary
250     */
251    public CWE getLocationTypeAIL() { 
252                CWE retVal = this.getTypedField(4, 0);
253                return retVal;
254    }
255    
256    /**
257     * Returns
258     * AIL-4: "Location Type - AIL" - creates it if necessary
259     */
260    public CWE getAil4_LocationTypeAIL() { 
261                CWE retVal = this.getTypedField(4, 0);
262                return retVal;
263    }
264
265
266
267    /**
268     * Returns
269     * AIL-5: "Location Group" - creates it if necessary
270     */
271    public CWE getLocationGroup() { 
272                CWE retVal = this.getTypedField(5, 0);
273                return retVal;
274    }
275    
276    /**
277     * Returns
278     * AIL-5: "Location Group" - creates it if necessary
279     */
280    public CWE getAil5_LocationGroup() { 
281                CWE retVal = this.getTypedField(5, 0);
282                return retVal;
283    }
284
285
286
287    /**
288     * Returns
289     * AIL-6: "Start Date/Time" - creates it if necessary
290     */
291    public DTM getStartDateTime() { 
292                DTM retVal = this.getTypedField(6, 0);
293                return retVal;
294    }
295    
296    /**
297     * Returns
298     * AIL-6: "Start Date/Time" - creates it if necessary
299     */
300    public DTM getAil6_StartDateTime() { 
301                DTM retVal = this.getTypedField(6, 0);
302                return retVal;
303    }
304
305
306
307    /**
308     * Returns
309     * AIL-7: "Start Date/Time Offset" - creates it if necessary
310     */
311    public NM getStartDateTimeOffset() { 
312                NM retVal = this.getTypedField(7, 0);
313                return retVal;
314    }
315    
316    /**
317     * Returns
318     * AIL-7: "Start Date/Time Offset" - creates it if necessary
319     */
320    public NM getAil7_StartDateTimeOffset() { 
321                NM retVal = this.getTypedField(7, 0);
322                return retVal;
323    }
324
325
326
327    /**
328     * Returns
329     * AIL-8: "Start Date/Time Offset Units" - creates it if necessary
330     */
331    public CNE getStartDateTimeOffsetUnits() { 
332                CNE retVal = this.getTypedField(8, 0);
333                return retVal;
334    }
335    
336    /**
337     * Returns
338     * AIL-8: "Start Date/Time Offset Units" - creates it if necessary
339     */
340    public CNE getAil8_StartDateTimeOffsetUnits() { 
341                CNE retVal = this.getTypedField(8, 0);
342                return retVal;
343    }
344
345
346
347    /**
348     * Returns
349     * AIL-9: "Duration" - creates it if necessary
350     */
351    public NM getDuration() { 
352                NM retVal = this.getTypedField(9, 0);
353                return retVal;
354    }
355    
356    /**
357     * Returns
358     * AIL-9: "Duration" - creates it if necessary
359     */
360    public NM getAil9_Duration() { 
361                NM retVal = this.getTypedField(9, 0);
362                return retVal;
363    }
364
365
366
367    /**
368     * Returns
369     * AIL-10: "Duration Units" - creates it if necessary
370     */
371    public CNE getDurationUnits() { 
372                CNE retVal = this.getTypedField(10, 0);
373                return retVal;
374    }
375    
376    /**
377     * Returns
378     * AIL-10: "Duration Units" - creates it if necessary
379     */
380    public CNE getAil10_DurationUnits() { 
381                CNE retVal = this.getTypedField(10, 0);
382                return retVal;
383    }
384
385
386
387    /**
388     * Returns
389     * AIL-11: "Allow Substitution Code" - creates it if necessary
390     */
391    public CWE getAllowSubstitutionCode() { 
392                CWE retVal = this.getTypedField(11, 0);
393                return retVal;
394    }
395    
396    /**
397     * Returns
398     * AIL-11: "Allow Substitution Code" - creates it if necessary
399     */
400    public CWE getAil11_AllowSubstitutionCode() { 
401                CWE retVal = this.getTypedField(11, 0);
402                return retVal;
403    }
404
405
406
407    /**
408     * Returns
409     * AIL-12: "Filler Status Code" - creates it if necessary
410     */
411    public CWE getFillerStatusCode() { 
412                CWE retVal = this.getTypedField(12, 0);
413                return retVal;
414    }
415    
416    /**
417     * Returns
418     * AIL-12: "Filler Status Code" - creates it if necessary
419     */
420    public CWE getAil12_FillerStatusCode() { 
421                CWE retVal = this.getTypedField(12, 0);
422                return retVal;
423    }
424
425
426
427
428
429    /** {@inheritDoc} */   
430    protected Type createNewTypeWithoutReflection(int field) {
431       switch (field) {
432          case 0: return new SI(getMessage());
433          case 1: return new ID(getMessage(), new Integer( 206 ));
434          case 2: return new PL(getMessage());
435          case 3: return new CWE(getMessage());
436          case 4: return new CWE(getMessage());
437          case 5: return new DTM(getMessage());
438          case 6: return new NM(getMessage());
439          case 7: return new CNE(getMessage());
440          case 8: return new NM(getMessage());
441          case 9: return new CNE(getMessage());
442          case 10: return new CWE(getMessage());
443          case 11: return new CWE(getMessage());
444          default: return null;
445       }
446   }
447
448
449}
450