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