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