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