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