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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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 *<p>Represents an HL7 AIG message segment (Appointment Information - General Resource). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>AIG-1: Set ID - AIG (SI) <b> </b>
052     * <li>AIG-2: Segment Action Code (ID) <b>optional </b>
053     * <li>AIG-3: Resource ID (CE) <b>optional </b>
054     * <li>AIG-4: Resource Type (CE) <b> </b>
055     * <li>AIG-5: Resource Group (CE) <b>optional repeating</b>
056     * <li>AIG-6: Resource Quantity (NM) <b>optional </b>
057     * <li>AIG-7: Resource Quantity Units (CE) <b>optional </b>
058     * <li>AIG-8: Start Date/Time (TS) <b>optional </b>
059     * <li>AIG-9: Start Date/Time Offset (NM) <b>optional </b>
060     * <li>AIG-10: Start Date/Time Offset Units (CE) <b>optional </b>
061     * <li>AIG-11: Duration (NM) <b>optional </b>
062     * <li>AIG-12: Duration Units (CE) <b>optional </b>
063     * <li>AIG-13: Allow Substitution Code (IS) <b>optional </b>
064     * <li>AIG-14: Filler Status Code (CE) <b>optional </b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class AIG extends AbstractSegment {
069
070    /** 
071     * Creates a new AIG segment
072     */
073    public AIG(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - AIG");
081                                              this.add(ID.class, false, 1, 3, new Object[]{ getMessage(), new Integer(206) }, "Segment Action Code");
082                                  this.add(CE.class, false, 1, 80, new Object[]{ getMessage() }, "Resource ID");
083                                  this.add(CE.class, true, 1, 15, new Object[]{ getMessage() }, "Resource Type");
084                                  this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Resource Group");
085                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Resource Quantity");
086                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Resource Quantity Units");
087                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Start Date/Time");
088                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Start Date/Time Offset");
089                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Start Date/Time Offset Units");
090                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Duration");
091                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Duration Units");
092                                              this.add(IS.class, false, 1, 10, new Object[]{ getMessage(), new Integer(279) }, "Allow Substitution Code");
093                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Filler Status Code");
094       } catch(HL7Exception e) {
095          log.error("Unexpected error creating AIG - this is probably a bug in the source code generator.", e);
096       }
097    }
098
099
100
101    /**
102     * Returns
103     * AIG-1: "Set ID - AIG" - creates it if necessary
104     */
105    public SI getSetIDAIG() { 
106                SI retVal = this.getTypedField(1, 0);
107                return retVal;
108    }
109    
110    /**
111     * Returns
112     * AIG-1: "Set ID - AIG" - creates it if necessary
113     */
114    public SI getAig1_SetIDAIG() { 
115                SI retVal = this.getTypedField(1, 0);
116                return retVal;
117    }
118
119
120
121    /**
122     * Returns
123     * AIG-2: "Segment Action Code" - creates it if necessary
124     */
125    public ID getSegmentActionCode() { 
126                ID retVal = this.getTypedField(2, 0);
127                return retVal;
128    }
129    
130    /**
131     * Returns
132     * AIG-2: "Segment Action Code" - creates it if necessary
133     */
134    public ID getAig2_SegmentActionCode() { 
135                ID retVal = this.getTypedField(2, 0);
136                return retVal;
137    }
138
139
140
141    /**
142     * Returns
143     * AIG-3: "Resource ID" - creates it if necessary
144     */
145    public CE getResourceID() { 
146                CE retVal = this.getTypedField(3, 0);
147                return retVal;
148    }
149    
150    /**
151     * Returns
152     * AIG-3: "Resource ID" - creates it if necessary
153     */
154    public CE getAig3_ResourceID() { 
155                CE retVal = this.getTypedField(3, 0);
156                return retVal;
157    }
158
159
160
161    /**
162     * Returns
163     * AIG-4: "Resource Type" - creates it if necessary
164     */
165    public CE getResourceType() { 
166                CE retVal = this.getTypedField(4, 0);
167                return retVal;
168    }
169    
170    /**
171     * Returns
172     * AIG-4: "Resource Type" - creates it if necessary
173     */
174    public CE getAig4_ResourceType() { 
175                CE retVal = this.getTypedField(4, 0);
176                return retVal;
177    }
178
179
180    /**
181     * Returns all repetitions of Resource Group (AIG-5).
182     */
183    public CE[] getResourceGroup() {
184        CE[] retVal = this.getTypedField(5, new CE[0]);
185        return retVal;
186    }
187
188
189    /**
190     * Returns all repetitions of Resource Group (AIG-5).
191     */
192    public CE[] getAig5_ResourceGroup() {
193        CE[] retVal = this.getTypedField(5, new CE[0]);
194        return retVal;
195    }
196
197
198    /**
199     * Returns a count of the current number of repetitions of Resource Group (AIG-5).
200     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
201     * it will return zero.
202     */
203    public int getResourceGroupReps() {
204        return this.getReps(5);
205    }
206
207
208    /**
209     * Returns a specific repetition of
210     * AIG-5: "Resource Group" - creates it if necessary
211     *
212     * @param rep The repetition index (0-indexed)
213     */
214    public CE getResourceGroup(int rep) { 
215                CE retVal = this.getTypedField(5, rep);
216                return retVal;
217    }
218
219    /**
220     * Returns a specific repetition of
221     * AIG-5: "Resource Group" - creates it if necessary
222     *
223     * @param rep The repetition index (0-indexed)
224     */
225    public CE getAig5_ResourceGroup(int rep) { 
226                CE retVal = this.getTypedField(5, rep);
227                return retVal;
228    }
229
230    /**
231     * Returns a count of the current number of repetitions of Resource Group (AIG-5).
232     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
233     * it will return zero.
234     */
235    public int getAig5_ResourceGroupReps() {
236        return this.getReps(5);
237    }
238
239
240    /**
241     * Inserts a repetition of
242     * AIG-5: "Resource Group" at a specific index
243     *
244     * @param rep The repetition index (0-indexed)
245     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
246     */
247    public CE insertResourceGroup(int rep) throws HL7Exception { 
248        return (CE) super.insertRepetition(5, rep);
249    }
250
251
252    /**
253     * Inserts a repetition of
254     * AIG-5: "Resource Group" at a specific index
255     *
256     * @param rep The repetition index (0-indexed)
257     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
258     */
259    public CE insertAig5_ResourceGroup(int rep) throws HL7Exception { 
260        return (CE) super.insertRepetition(5, rep);
261    }
262
263
264    /**
265     * Removes a repetition of
266     * AIG-5: "Resource Group" at a specific index
267     *
268     * @param rep The repetition index (0-indexed)
269     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
270     */
271    public CE removeResourceGroup(int rep) throws HL7Exception { 
272        return (CE) super.removeRepetition(5, rep);
273    }
274
275
276    /**
277     * Removes a repetition of
278     * AIG-5: "Resource Group" at a specific index
279     *
280     * @param rep The repetition index (0-indexed)
281     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
282     */
283    public CE removeAig5_ResourceGroup(int rep) throws HL7Exception { 
284        return (CE) super.removeRepetition(5, rep);
285    }
286
287
288
289
290    /**
291     * Returns
292     * AIG-6: "Resource Quantity" - creates it if necessary
293     */
294    public NM getResourceQuantity() { 
295                NM retVal = this.getTypedField(6, 0);
296                return retVal;
297    }
298    
299    /**
300     * Returns
301     * AIG-6: "Resource Quantity" - creates it if necessary
302     */
303    public NM getAig6_ResourceQuantity() { 
304                NM retVal = this.getTypedField(6, 0);
305                return retVal;
306    }
307
308
309
310    /**
311     * Returns
312     * AIG-7: "Resource Quantity Units" - creates it if necessary
313     */
314    public CE getResourceQuantityUnits() { 
315                CE retVal = this.getTypedField(7, 0);
316                return retVal;
317    }
318    
319    /**
320     * Returns
321     * AIG-7: "Resource Quantity Units" - creates it if necessary
322     */
323    public CE getAig7_ResourceQuantityUnits() { 
324                CE retVal = this.getTypedField(7, 0);
325                return retVal;
326    }
327
328
329
330    /**
331     * Returns
332     * AIG-8: "Start Date/Time" - creates it if necessary
333     */
334    public TS getStartDateTime() { 
335                TS retVal = this.getTypedField(8, 0);
336                return retVal;
337    }
338    
339    /**
340     * Returns
341     * AIG-8: "Start Date/Time" - creates it if necessary
342     */
343    public TS getAig8_StartDateTime() { 
344                TS retVal = this.getTypedField(8, 0);
345                return retVal;
346    }
347
348
349
350    /**
351     * Returns
352     * AIG-9: "Start Date/Time Offset" - creates it if necessary
353     */
354    public NM getStartDateTimeOffset() { 
355                NM retVal = this.getTypedField(9, 0);
356                return retVal;
357    }
358    
359    /**
360     * Returns
361     * AIG-9: "Start Date/Time Offset" - creates it if necessary
362     */
363    public NM getAig9_StartDateTimeOffset() { 
364                NM retVal = this.getTypedField(9, 0);
365                return retVal;
366    }
367
368
369
370    /**
371     * Returns
372     * AIG-10: "Start Date/Time Offset Units" - creates it if necessary
373     */
374    public CE getStartDateTimeOffsetUnits() { 
375                CE retVal = this.getTypedField(10, 0);
376                return retVal;
377    }
378    
379    /**
380     * Returns
381     * AIG-10: "Start Date/Time Offset Units" - creates it if necessary
382     */
383    public CE getAig10_StartDateTimeOffsetUnits() { 
384                CE retVal = this.getTypedField(10, 0);
385                return retVal;
386    }
387
388
389
390    /**
391     * Returns
392     * AIG-11: "Duration" - creates it if necessary
393     */
394    public NM getDuration() { 
395                NM retVal = this.getTypedField(11, 0);
396                return retVal;
397    }
398    
399    /**
400     * Returns
401     * AIG-11: "Duration" - creates it if necessary
402     */
403    public NM getAig11_Duration() { 
404                NM retVal = this.getTypedField(11, 0);
405                return retVal;
406    }
407
408
409
410    /**
411     * Returns
412     * AIG-12: "Duration Units" - creates it if necessary
413     */
414    public CE getDurationUnits() { 
415                CE retVal = this.getTypedField(12, 0);
416                return retVal;
417    }
418    
419    /**
420     * Returns
421     * AIG-12: "Duration Units" - creates it if necessary
422     */
423    public CE getAig12_DurationUnits() { 
424                CE retVal = this.getTypedField(12, 0);
425                return retVal;
426    }
427
428
429
430    /**
431     * Returns
432     * AIG-13: "Allow Substitution Code" - creates it if necessary
433     */
434    public IS getAllowSubstitutionCode() { 
435                IS retVal = this.getTypedField(13, 0);
436                return retVal;
437    }
438    
439    /**
440     * Returns
441     * AIG-13: "Allow Substitution Code" - creates it if necessary
442     */
443    public IS getAig13_AllowSubstitutionCode() { 
444                IS retVal = this.getTypedField(13, 0);
445                return retVal;
446    }
447
448
449
450    /**
451     * Returns
452     * AIG-14: "Filler Status Code" - creates it if necessary
453     */
454    public CE getFillerStatusCode() { 
455                CE retVal = this.getTypedField(14, 0);
456                return retVal;
457    }
458    
459    /**
460     * Returns
461     * AIG-14: "Filler Status Code" - creates it if necessary
462     */
463    public CE getAig14_FillerStatusCode() { 
464                CE retVal = this.getTypedField(14, 0);
465                return retVal;
466    }
467
468
469
470
471
472    /** {@inheritDoc} */   
473    protected Type createNewTypeWithoutReflection(int field) {
474       switch (field) {
475          case 0: return new SI(getMessage());
476          case 1: return new ID(getMessage(), new Integer( 206 ));
477          case 2: return new CE(getMessage());
478          case 3: return new CE(getMessage());
479          case 4: return new CE(getMessage());
480          case 5: return new NM(getMessage());
481          case 6: return new CE(getMessage());
482          case 7: return new TS(getMessage());
483          case 8: return new NM(getMessage());
484          case 9: return new CE(getMessage());
485          case 10: return new NM(getMessage());
486          case 11: return new CE(getMessage());
487          case 12: return new IS(getMessage(), new Integer( 279 ));
488          case 13: return new CE(getMessage());
489          default: return null;
490       }
491   }
492
493
494}
495