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