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