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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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 OM4 message segment (OBSERVATION that require specimens). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>OM4-1: Segment Type ID (ST) <b>optional </b>
052     * <li>OM4-2: Sequence Number - Test/ Observation Master File (NM) <b>optional </b>
053     * <li>OM4-3: Derived Specimen (ID) <b>optional </b>
054     * <li>OM4-4: Container Description (TX) <b>optional </b>
055     * <li>OM4-5: Container Volume (NM) <b>optional </b>
056     * <li>OM4-6: Container Units (CE) <b>optional </b>
057     * <li>OM4-7: Specimen (CE) <b>optional </b>
058     * <li>OM4-8: Additive (CE) <b>optional </b>
059     * <li>OM4-9: Preparation (TX) <b>optional </b>
060     * <li>OM4-10: Special Handling Requirements (TX) <b>optional </b>
061     * <li>OM4-11: Normal Collection Volume (CQ_QUANTITY) <b>optional </b>
062     * <li>OM4-12: Minimum Collection Volume (CQ_QUANTITY) <b>optional </b>
063     * <li>OM4-13: Specimen Requirements (TX) <b>optional </b>
064     * <li>OM4-14: Specimen Priorities (ID) <b>optional repeating</b>
065     * <li>OM4-15: Specimen Retention Time (CQ_QUANTITY) <b>optional </b>
066 * </ul>
067 */
068@SuppressWarnings("unused")
069public class OM4 extends AbstractSegment {
070
071    /** 
072     * Creates a new OM4 segment
073     */
074    public OM4(Group parent, ModelClassFactory factory) {
075       super(parent, factory);
076       init(factory);
077    }
078
079    private void init(ModelClassFactory factory) {
080       try {
081                                  this.add(ST.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Type ID");
082                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File");
083                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(170) }, "Derived Specimen");
084                                  this.add(TX.class, false, 1, 60, new Object[]{ getMessage() }, "Container Description");
085                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Container Volume");
086                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Container Units");
087                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Specimen");
088                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Additive");
089                                  this.add(TX.class, false, 1, 10240, new Object[]{ getMessage() }, "Preparation");
090                                  this.add(TX.class, false, 1, 10240, new Object[]{ getMessage() }, "Special Handling Requirements");
091                                  this.add(CQ_QUANTITY.class, false, 1, 20, new Object[]{ getMessage() }, "Normal Collection Volume");
092                                  this.add(CQ_QUANTITY.class, false, 1, 20, new Object[]{ getMessage() }, "Minimum Collection Volume");
093                                  this.add(TX.class, false, 1, 10240, new Object[]{ getMessage() }, "Specimen Requirements");
094                                              this.add(ID.class, false, 0, 60, new Object[]{ getMessage(), new Integer(27) }, "Specimen Priorities");
095                                  this.add(CQ_QUANTITY.class, false, 1, 20, new Object[]{ getMessage() }, "Specimen Retention Time");
096       } catch(HL7Exception e) {
097          log.error("Unexpected error creating OM4 - this is probably a bug in the source code generator.", e);
098       }
099    }
100
101
102
103    /**
104     * Returns
105     * OM4-1: "Segment Type ID" - creates it if necessary
106     */
107    public ST getSegmentTypeID() { 
108                ST retVal = this.getTypedField(1, 0);
109                return retVal;
110    }
111    
112    /**
113     * Returns
114     * OM4-1: "Segment Type ID" - creates it if necessary
115     */
116    public ST getOm41_SegmentTypeID() { 
117                ST retVal = this.getTypedField(1, 0);
118                return retVal;
119    }
120
121
122
123    /**
124     * Returns
125     * OM4-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
126     */
127    public NM getSequenceNumberTestObservationMasterFile() { 
128                NM retVal = this.getTypedField(2, 0);
129                return retVal;
130    }
131    
132    /**
133     * Returns
134     * OM4-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
135     */
136    public NM getOm42_SequenceNumberTestObservationMasterFile() { 
137                NM retVal = this.getTypedField(2, 0);
138                return retVal;
139    }
140
141
142
143    /**
144     * Returns
145     * OM4-3: "Derived Specimen" - creates it if necessary
146     */
147    public ID getDerivedSpecimen() { 
148                ID retVal = this.getTypedField(3, 0);
149                return retVal;
150    }
151    
152    /**
153     * Returns
154     * OM4-3: "Derived Specimen" - creates it if necessary
155     */
156    public ID getOm43_DerivedSpecimen() { 
157                ID retVal = this.getTypedField(3, 0);
158                return retVal;
159    }
160
161
162
163    /**
164     * Returns
165     * OM4-4: "Container Description" - creates it if necessary
166     */
167    public TX getContainerDescription() { 
168                TX retVal = this.getTypedField(4, 0);
169                return retVal;
170    }
171    
172    /**
173     * Returns
174     * OM4-4: "Container Description" - creates it if necessary
175     */
176    public TX getOm44_ContainerDescription() { 
177                TX retVal = this.getTypedField(4, 0);
178                return retVal;
179    }
180
181
182
183    /**
184     * Returns
185     * OM4-5: "Container Volume" - creates it if necessary
186     */
187    public NM getContainerVolume() { 
188                NM retVal = this.getTypedField(5, 0);
189                return retVal;
190    }
191    
192    /**
193     * Returns
194     * OM4-5: "Container Volume" - creates it if necessary
195     */
196    public NM getOm45_ContainerVolume() { 
197                NM retVal = this.getTypedField(5, 0);
198                return retVal;
199    }
200
201
202
203    /**
204     * Returns
205     * OM4-6: "Container Units" - creates it if necessary
206     */
207    public CE getContainerUnits() { 
208                CE retVal = this.getTypedField(6, 0);
209                return retVal;
210    }
211    
212    /**
213     * Returns
214     * OM4-6: "Container Units" - creates it if necessary
215     */
216    public CE getOm46_ContainerUnits() { 
217                CE retVal = this.getTypedField(6, 0);
218                return retVal;
219    }
220
221
222
223    /**
224     * Returns
225     * OM4-7: "Specimen" - creates it if necessary
226     */
227    public CE getSpecimen() { 
228                CE retVal = this.getTypedField(7, 0);
229                return retVal;
230    }
231    
232    /**
233     * Returns
234     * OM4-7: "Specimen" - creates it if necessary
235     */
236    public CE getOm47_Specimen() { 
237                CE retVal = this.getTypedField(7, 0);
238                return retVal;
239    }
240
241
242
243    /**
244     * Returns
245     * OM4-8: "Additive" - creates it if necessary
246     */
247    public CE getAdditive() { 
248                CE retVal = this.getTypedField(8, 0);
249                return retVal;
250    }
251    
252    /**
253     * Returns
254     * OM4-8: "Additive" - creates it if necessary
255     */
256    public CE getOm48_Additive() { 
257                CE retVal = this.getTypedField(8, 0);
258                return retVal;
259    }
260
261
262
263    /**
264     * Returns
265     * OM4-9: "Preparation" - creates it if necessary
266     */
267    public TX getPreparation() { 
268                TX retVal = this.getTypedField(9, 0);
269                return retVal;
270    }
271    
272    /**
273     * Returns
274     * OM4-9: "Preparation" - creates it if necessary
275     */
276    public TX getOm49_Preparation() { 
277                TX retVal = this.getTypedField(9, 0);
278                return retVal;
279    }
280
281
282
283    /**
284     * Returns
285     * OM4-10: "Special Handling Requirements" - creates it if necessary
286     */
287    public TX getSpecialHandlingRequirements() { 
288                TX retVal = this.getTypedField(10, 0);
289                return retVal;
290    }
291    
292    /**
293     * Returns
294     * OM4-10: "Special Handling Requirements" - creates it if necessary
295     */
296    public TX getOm410_SpecialHandlingRequirements() { 
297                TX retVal = this.getTypedField(10, 0);
298                return retVal;
299    }
300
301
302
303    /**
304     * Returns
305     * OM4-11: "Normal Collection Volume" - creates it if necessary
306     */
307    public CQ_QUANTITY getNormalCollectionVolume() { 
308                CQ_QUANTITY retVal = this.getTypedField(11, 0);
309                return retVal;
310    }
311    
312    /**
313     * Returns
314     * OM4-11: "Normal Collection Volume" - creates it if necessary
315     */
316    public CQ_QUANTITY getOm411_NormalCollectionVolume() { 
317                CQ_QUANTITY retVal = this.getTypedField(11, 0);
318                return retVal;
319    }
320
321
322
323    /**
324     * Returns
325     * OM4-12: "Minimum Collection Volume" - creates it if necessary
326     */
327    public CQ_QUANTITY getMinimumCollectionVolume() { 
328                CQ_QUANTITY retVal = this.getTypedField(12, 0);
329                return retVal;
330    }
331    
332    /**
333     * Returns
334     * OM4-12: "Minimum Collection Volume" - creates it if necessary
335     */
336    public CQ_QUANTITY getOm412_MinimumCollectionVolume() { 
337                CQ_QUANTITY retVal = this.getTypedField(12, 0);
338                return retVal;
339    }
340
341
342
343    /**
344     * Returns
345     * OM4-13: "Specimen Requirements" - creates it if necessary
346     */
347    public TX getSpecimenRequirements() { 
348                TX retVal = this.getTypedField(13, 0);
349                return retVal;
350    }
351    
352    /**
353     * Returns
354     * OM4-13: "Specimen Requirements" - creates it if necessary
355     */
356    public TX getOm413_SpecimenRequirements() { 
357                TX retVal = this.getTypedField(13, 0);
358                return retVal;
359    }
360
361
362    /**
363     * Returns all repetitions of Specimen Priorities (OM4-14).
364     */
365    public ID[] getSpecimenPriorities() {
366        ID[] retVal = this.getTypedField(14, new ID[0]);
367        return retVal;
368    }
369
370
371    /**
372     * Returns all repetitions of Specimen Priorities (OM4-14).
373     */
374    public ID[] getOm414_SpecimenPriorities() {
375        ID[] retVal = this.getTypedField(14, new ID[0]);
376        return retVal;
377    }
378
379
380    /**
381     * Returns a count of the current number of repetitions of Specimen Priorities (OM4-14).
382     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
383     * it will return zero.
384     */
385    public int getSpecimenPrioritiesReps() {
386        return this.getReps(14);
387    }
388
389
390    /**
391     * Returns a specific repetition of
392     * OM4-14: "Specimen Priorities" - creates it if necessary
393     *
394     * @param rep The repetition index (0-indexed)
395     */
396    public ID getSpecimenPriorities(int rep) { 
397                ID retVal = this.getTypedField(14, rep);
398                return retVal;
399    }
400
401    /**
402     * Returns a specific repetition of
403     * OM4-14: "Specimen Priorities" - creates it if necessary
404     *
405     * @param rep The repetition index (0-indexed)
406     */
407    public ID getOm414_SpecimenPriorities(int rep) { 
408                ID retVal = this.getTypedField(14, rep);
409                return retVal;
410    }
411
412    /**
413     * Returns a count of the current number of repetitions of Specimen Priorities (OM4-14).
414     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
415     * it will return zero.
416     */
417    public int getOm414_SpecimenPrioritiesReps() {
418        return this.getReps(14);
419    }
420
421
422    /**
423     * Inserts a repetition of
424     * OM4-14: "Specimen Priorities" at a specific index
425     *
426     * @param rep The repetition index (0-indexed)
427     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
428     */
429    public ID insertSpecimenPriorities(int rep) throws HL7Exception { 
430        return (ID) super.insertRepetition(14, rep);
431    }
432
433
434    /**
435     * Inserts a repetition of
436     * OM4-14: "Specimen Priorities" at a specific index
437     *
438     * @param rep The repetition index (0-indexed)
439     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
440     */
441    public ID insertOm414_SpecimenPriorities(int rep) throws HL7Exception { 
442        return (ID) super.insertRepetition(14, rep);
443    }
444
445
446    /**
447     * Removes a repetition of
448     * OM4-14: "Specimen Priorities" at a specific index
449     *
450     * @param rep The repetition index (0-indexed)
451     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
452     */
453    public ID removeSpecimenPriorities(int rep) throws HL7Exception { 
454        return (ID) super.removeRepetition(14, rep);
455    }
456
457
458    /**
459     * Removes a repetition of
460     * OM4-14: "Specimen Priorities" at a specific index
461     *
462     * @param rep The repetition index (0-indexed)
463     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
464     */
465    public ID removeOm414_SpecimenPriorities(int rep) throws HL7Exception { 
466        return (ID) super.removeRepetition(14, rep);
467    }
468
469
470
471
472    /**
473     * Returns
474     * OM4-15: "Specimen Retention Time" - creates it if necessary
475     */
476    public CQ_QUANTITY getSpecimenRetentionTime() { 
477                CQ_QUANTITY retVal = this.getTypedField(15, 0);
478                return retVal;
479    }
480    
481    /**
482     * Returns
483     * OM4-15: "Specimen Retention Time" - creates it if necessary
484     */
485    public CQ_QUANTITY getOm415_SpecimenRetentionTime() { 
486                CQ_QUANTITY retVal = this.getTypedField(15, 0);
487                return retVal;
488    }
489
490
491
492
493
494    /** {@inheritDoc} */   
495    protected Type createNewTypeWithoutReflection(int field) {
496       switch (field) {
497          case 0: return new ST(getMessage());
498          case 1: return new NM(getMessage());
499          case 2: return new ID(getMessage(), new Integer( 170 ));
500          case 3: return new TX(getMessage());
501          case 4: return new NM(getMessage());
502          case 5: return new CE(getMessage());
503          case 6: return new CE(getMessage());
504          case 7: return new CE(getMessage());
505          case 8: return new TX(getMessage());
506          case 9: return new TX(getMessage());
507          case 10: return new CQ_QUANTITY(getMessage());
508          case 11: return new CQ_QUANTITY(getMessage());
509          case 12: return new TX(getMessage());
510          case 13: return new ID(getMessage(), new Integer( 27 ));
511          case 14: return new CQ_QUANTITY(getMessage());
512          default: return null;
513       }
514   }
515
516
517}
518