View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v281.segment;
35  
36  // import ca.uhn.hl7v2.model.v281.group.*;
37  import ca.uhn.hl7v2.model.v281.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 PAC message segment (Shipment Package). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>PAC-1: Set Id - PAC (SI) <b> </b>
53       * <li>PAC-2: Package ID (EI) <b>optional </b>
54       * <li>PAC-3: Parent Package ID (EI) <b>optional </b>
55       * <li>PAC-4: Position in Parent Package (NA) <b>optional </b>
56       * <li>PAC-5: Package Type (CWE) <b> </b>
57       * <li>PAC-6: Package Condition (CWE) <b>optional repeating</b>
58       * <li>PAC-7: Package Handling Code (CWE) <b>optional repeating</b>
59       * <li>PAC-8: Package Risk Code (CWE) <b>optional repeating</b>
60   * </ul>
61   */
62  @SuppressWarnings("unused")
63  public class PAC extends AbstractSegment {
64  
65      /** 
66       * Creates a new PAC segment
67       */
68      public PAC(Group parent, ModelClassFactory factory) {
69         super(parent, factory);
70         init(factory);
71      }
72  
73      private void init(ModelClassFactory factory) {
74         try {
75                                    this.add(SI.class, true, 1, 0, new Object[]{ getMessage() }, "Set Id - PAC");
76                                    this.add(EI.class, false, 1, 0, new Object[]{ getMessage() }, "Package ID");
77                                    this.add(EI.class, false, 1, 0, new Object[]{ getMessage() }, "Parent Package ID");
78                                    this.add(NA.class, false, 1, 0, new Object[]{ getMessage() }, "Position in Parent Package");
79                                    this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Package Type");
80                                    this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Condition");
81                                    this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Handling Code");
82                                    this.add(CWE.class, false, 0, 0, new Object[]{ getMessage() }, "Package Risk Code");
83         } catch(HL7Exception e) {
84            log.error("Unexpected error creating PAC - this is probably a bug in the source code generator.", e);
85         }
86      }
87  
88  
89  
90      /**
91       * Returns
92       * PAC-1: "Set Id - PAC" - creates it if necessary
93       */
94      public SI getSetIdPAC() { 
95  		SI retVal = this.getTypedField(1, 0);
96  		return retVal;
97      }
98      
99      /**
100      * Returns
101      * PAC-1: "Set Id - PAC" - creates it if necessary
102      */
103     public SI getPac1_SetIdPAC() { 
104 		SI retVal = this.getTypedField(1, 0);
105 		return retVal;
106     }
107 
108 
109 
110     /**
111      * Returns
112      * PAC-2: "Package ID" - creates it if necessary
113      */
114     public EI getPackageID() { 
115 		EI retVal = this.getTypedField(2, 0);
116 		return retVal;
117     }
118     
119     /**
120      * Returns
121      * PAC-2: "Package ID" - creates it if necessary
122      */
123     public EI getPac2_PackageID() { 
124 		EI retVal = this.getTypedField(2, 0);
125 		return retVal;
126     }
127 
128 
129 
130     /**
131      * Returns
132      * PAC-3: "Parent Package ID" - creates it if necessary
133      */
134     public EI getParentPackageID() { 
135 		EI retVal = this.getTypedField(3, 0);
136 		return retVal;
137     }
138     
139     /**
140      * Returns
141      * PAC-3: "Parent Package ID" - creates it if necessary
142      */
143     public EI getPac3_ParentPackageID() { 
144 		EI retVal = this.getTypedField(3, 0);
145 		return retVal;
146     }
147 
148 
149 
150     /**
151      * Returns
152      * PAC-4: "Position in Parent Package" - creates it if necessary
153      */
154     public NA getPositionInParentPackage() { 
155 		NA retVal = this.getTypedField(4, 0);
156 		return retVal;
157     }
158     
159     /**
160      * Returns
161      * PAC-4: "Position in Parent Package" - creates it if necessary
162      */
163     public NA getPac4_PositionInParentPackage() { 
164 		NA retVal = this.getTypedField(4, 0);
165 		return retVal;
166     }
167 
168 
169 
170     /**
171      * Returns
172      * PAC-5: "Package Type" - creates it if necessary
173      */
174     public CWE getPackageType() { 
175 		CWE retVal = this.getTypedField(5, 0);
176 		return retVal;
177     }
178     
179     /**
180      * Returns
181      * PAC-5: "Package Type" - creates it if necessary
182      */
183     public CWE getPac5_PackageType() { 
184 		CWE retVal = this.getTypedField(5, 0);
185 		return retVal;
186     }
187 
188 
189     /**
190      * Returns all repetitions of Package Condition (PAC-6).
191      */
192     public CWE[] getPackageCondition() {
193     	CWE[] retVal = this.getTypedField(6, new CWE[0]);
194     	return retVal;
195     }
196 
197 
198     /**
199      * Returns all repetitions of Package Condition (PAC-6).
200      */
201     public CWE[] getPac6_PackageCondition() {
202     	CWE[] retVal = this.getTypedField(6, new CWE[0]);
203     	return retVal;
204     }
205 
206 
207     /**
208      * Returns a count of the current number of repetitions of Package Condition (PAC-6).
209      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
210      * it will return zero.
211      */
212     public int getPackageConditionReps() {
213     	return this.getReps(6);
214     }
215 
216 
217     /**
218      * Returns a specific repetition of
219      * PAC-6: "Package Condition" - creates it if necessary
220      *
221      * @param rep The repetition index (0-indexed)
222      */
223     public CWE getPackageCondition(int rep) { 
224 		CWE retVal = this.getTypedField(6, rep);
225 		return retVal;
226     }
227 
228     /**
229      * Returns a specific repetition of
230      * PAC-6: "Package Condition" - creates it if necessary
231      *
232      * @param rep The repetition index (0-indexed)
233      */
234     public CWE getPac6_PackageCondition(int rep) { 
235 		CWE retVal = this.getTypedField(6, rep);
236 		return retVal;
237     }
238 
239     /**
240      * Returns a count of the current number of repetitions of Package Condition (PAC-6).
241      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
242      * it will return zero.
243      */
244     public int getPac6_PackageConditionReps() {
245     	return this.getReps(6);
246     }
247 
248 
249     /**
250      * Inserts a repetition of
251      * PAC-6: "Package Condition" 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 CWE insertPackageCondition(int rep) throws HL7Exception { 
257         return (CWE) super.insertRepetition(6, rep);
258     }
259 
260 
261     /**
262      * Inserts a repetition of
263      * PAC-6: "Package Condition" 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 CWE insertPac6_PackageCondition(int rep) throws HL7Exception { 
269         return (CWE) super.insertRepetition(6, rep);
270     }
271 
272 
273     /**
274      * Removes a repetition of
275      * PAC-6: "Package Condition" 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 CWE removePackageCondition(int rep) throws HL7Exception { 
281         return (CWE) super.removeRepetition(6, rep);
282     }
283 
284 
285     /**
286      * Removes a repetition of
287      * PAC-6: "Package Condition" at a specific index
288      *
289      * @param rep The repetition index (0-indexed)
290      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
291      */
292     public CWE removePac6_PackageCondition(int rep) throws HL7Exception { 
293         return (CWE) super.removeRepetition(6, rep);
294     }
295 
296 
297 
298     /**
299      * Returns all repetitions of Package Handling Code (PAC-7).
300      */
301     public CWE[] getPackageHandlingCode() {
302     	CWE[] retVal = this.getTypedField(7, new CWE[0]);
303     	return retVal;
304     }
305 
306 
307     /**
308      * Returns all repetitions of Package Handling Code (PAC-7).
309      */
310     public CWE[] getPac7_PackageHandlingCode() {
311     	CWE[] retVal = this.getTypedField(7, new CWE[0]);
312     	return retVal;
313     }
314 
315 
316     /**
317      * Returns a count of the current number of repetitions of Package Handling Code (PAC-7).
318      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
319      * it will return zero.
320      */
321     public int getPackageHandlingCodeReps() {
322     	return this.getReps(7);
323     }
324 
325 
326     /**
327      * Returns a specific repetition of
328      * PAC-7: "Package Handling Code" - creates it if necessary
329      *
330      * @param rep The repetition index (0-indexed)
331      */
332     public CWE getPackageHandlingCode(int rep) { 
333 		CWE retVal = this.getTypedField(7, rep);
334 		return retVal;
335     }
336 
337     /**
338      * Returns a specific repetition of
339      * PAC-7: "Package Handling Code" - creates it if necessary
340      *
341      * @param rep The repetition index (0-indexed)
342      */
343     public CWE getPac7_PackageHandlingCode(int rep) { 
344 		CWE retVal = this.getTypedField(7, rep);
345 		return retVal;
346     }
347 
348     /**
349      * Returns a count of the current number of repetitions of Package Handling Code (PAC-7).
350      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
351      * it will return zero.
352      */
353     public int getPac7_PackageHandlingCodeReps() {
354     	return this.getReps(7);
355     }
356 
357 
358     /**
359      * Inserts a repetition of
360      * PAC-7: "Package Handling Code" at a specific index
361      *
362      * @param rep The repetition index (0-indexed)
363      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
364      */
365     public CWE insertPackageHandlingCode(int rep) throws HL7Exception { 
366         return (CWE) super.insertRepetition(7, rep);
367     }
368 
369 
370     /**
371      * Inserts a repetition of
372      * PAC-7: "Package Handling Code" at a specific index
373      *
374      * @param rep The repetition index (0-indexed)
375      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
376      */
377     public CWE insertPac7_PackageHandlingCode(int rep) throws HL7Exception { 
378         return (CWE) super.insertRepetition(7, rep);
379     }
380 
381 
382     /**
383      * Removes a repetition of
384      * PAC-7: "Package Handling Code" at a specific index
385      *
386      * @param rep The repetition index (0-indexed)
387      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
388      */
389     public CWE removePackageHandlingCode(int rep) throws HL7Exception { 
390         return (CWE) super.removeRepetition(7, rep);
391     }
392 
393 
394     /**
395      * Removes a repetition of
396      * PAC-7: "Package Handling Code" at a specific index
397      *
398      * @param rep The repetition index (0-indexed)
399      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
400      */
401     public CWE removePac7_PackageHandlingCode(int rep) throws HL7Exception { 
402         return (CWE) super.removeRepetition(7, rep);
403     }
404 
405 
406 
407     /**
408      * Returns all repetitions of Package Risk Code (PAC-8).
409      */
410     public CWE[] getPackageRiskCode() {
411     	CWE[] retVal = this.getTypedField(8, new CWE[0]);
412     	return retVal;
413     }
414 
415 
416     /**
417      * Returns all repetitions of Package Risk Code (PAC-8).
418      */
419     public CWE[] getPac8_PackageRiskCode() {
420     	CWE[] retVal = this.getTypedField(8, new CWE[0]);
421     	return retVal;
422     }
423 
424 
425     /**
426      * Returns a count of the current number of repetitions of Package Risk Code (PAC-8).
427      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
428      * it will return zero.
429      */
430     public int getPackageRiskCodeReps() {
431     	return this.getReps(8);
432     }
433 
434 
435     /**
436      * Returns a specific repetition of
437      * PAC-8: "Package Risk Code" - creates it if necessary
438      *
439      * @param rep The repetition index (0-indexed)
440      */
441     public CWE getPackageRiskCode(int rep) { 
442 		CWE retVal = this.getTypedField(8, rep);
443 		return retVal;
444     }
445 
446     /**
447      * Returns a specific repetition of
448      * PAC-8: "Package Risk Code" - creates it if necessary
449      *
450      * @param rep The repetition index (0-indexed)
451      */
452     public CWE getPac8_PackageRiskCode(int rep) { 
453 		CWE retVal = this.getTypedField(8, rep);
454 		return retVal;
455     }
456 
457     /**
458      * Returns a count of the current number of repetitions of Package Risk Code (PAC-8).
459      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
460      * it will return zero.
461      */
462     public int getPac8_PackageRiskCodeReps() {
463     	return this.getReps(8);
464     }
465 
466 
467     /**
468      * Inserts a repetition of
469      * PAC-8: "Package Risk Code" at a specific index
470      *
471      * @param rep The repetition index (0-indexed)
472      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
473      */
474     public CWE insertPackageRiskCode(int rep) throws HL7Exception { 
475         return (CWE) super.insertRepetition(8, rep);
476     }
477 
478 
479     /**
480      * Inserts a repetition of
481      * PAC-8: "Package Risk Code" at a specific index
482      *
483      * @param rep The repetition index (0-indexed)
484      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
485      */
486     public CWE insertPac8_PackageRiskCode(int rep) throws HL7Exception { 
487         return (CWE) super.insertRepetition(8, rep);
488     }
489 
490 
491     /**
492      * Removes a repetition of
493      * PAC-8: "Package Risk Code" at a specific index
494      *
495      * @param rep The repetition index (0-indexed)
496      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
497      */
498     public CWE removePackageRiskCode(int rep) throws HL7Exception { 
499         return (CWE) super.removeRepetition(8, rep);
500     }
501 
502 
503     /**
504      * Removes a repetition of
505      * PAC-8: "Package Risk Code" at a specific index
506      *
507      * @param rep The repetition index (0-indexed)
508      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
509      */
510     public CWE removePac8_PackageRiskCode(int rep) throws HL7Exception { 
511         return (CWE) super.removeRepetition(8, rep);
512     }
513 
514 
515 
516 
517 
518 
519     /** {@inheritDoc} */   
520     protected Type createNewTypeWithoutReflection(int field) {
521        switch (field) {
522           case 0: return new SI(getMessage());
523           case 1: return new EI(getMessage());
524           case 2: return new EI(getMessage());
525           case 3: return new NA(getMessage());
526           case 4: return new CWE(getMessage());
527           case 5: return new CWE(getMessage());
528           case 6: return new CWE(getMessage());
529           case 7: return new CWE(getMessage());
530           default: return null;
531        }
532    }
533 
534 
535 }
536