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.v26.segment;
035
036// import ca.uhn.hl7v2.model.v26.group.*;
037import ca.uhn.hl7v2.model.v26.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 OM3 message segment (Categorical Service/Test/Observation). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>OM3-1: Sequence Number - Test/Observation Master File (NM) <b>optional </b>
052     * <li>OM3-2: Preferred Coding System (CWE) <b>optional </b>
053     * <li>OM3-3: Valid Coded "Answers" (CWE) <b>optional repeating</b>
054     * <li>OM3-4: Normal Text/Codes for Categorical Observations (CWE) <b>optional repeating</b>
055     * <li>OM3-5: Abnormal Text/Codes for Categorical Observations (CWE) <b>optional repeating</b>
056     * <li>OM3-6: Critical Text/Codes for Categorical Observations (CWE) <b>optional repeating</b>
057     * <li>OM3-7: Value Type (ID) <b>optional </b>
058 * </ul>
059 */
060@SuppressWarnings("unused")
061public class OM3 extends AbstractSegment {
062
063    /** 
064     * Creates a new OM3 segment
065     */
066    public OM3(Group parent, ModelClassFactory factory) {
067       super(parent, factory);
068       init(factory);
069    }
070
071    private void init(ModelClassFactory factory) {
072       try {
073                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/Observation Master File");
074                                  this.add(CWE.class, false, 1, 250, new Object[]{ getMessage() }, "Preferred Coding System");
075                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Valid Coded \"Answers\"");
076                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Normal Text/Codes for Categorical Observations");
077                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Abnormal Text/Codes for Categorical Observations");
078                                  this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Critical Text/Codes for Categorical Observations");
079                                              this.add(ID.class, false, 1, 3, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
080       } catch(HL7Exception e) {
081          log.error("Unexpected error creating OM3 - this is probably a bug in the source code generator.", e);
082       }
083    }
084
085
086
087    /**
088     * Returns
089     * OM3-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
090     */
091    public NM getSequenceNumberTestObservationMasterFile() { 
092                NM retVal = this.getTypedField(1, 0);
093                return retVal;
094    }
095    
096    /**
097     * Returns
098     * OM3-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
099     */
100    public NM getOm31_SequenceNumberTestObservationMasterFile() { 
101                NM retVal = this.getTypedField(1, 0);
102                return retVal;
103    }
104
105
106
107    /**
108     * Returns
109     * OM3-2: "Preferred Coding System" - creates it if necessary
110     */
111    public CWE getPreferredCodingSystem() { 
112                CWE retVal = this.getTypedField(2, 0);
113                return retVal;
114    }
115    
116    /**
117     * Returns
118     * OM3-2: "Preferred Coding System" - creates it if necessary
119     */
120    public CWE getOm32_PreferredCodingSystem() { 
121                CWE retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124
125
126    /**
127     * Returns all repetitions of Valid Coded "Answers" (OM3-3).
128     */
129    public CWE[] getValidCodedAnswers() {
130        CWE[] retVal = this.getTypedField(3, new CWE[0]);
131        return retVal;
132    }
133
134
135    /**
136     * Returns all repetitions of Valid Coded "Answers" (OM3-3).
137     */
138    public CWE[] getOm33_ValidCodedAnswers() {
139        CWE[] retVal = this.getTypedField(3, new CWE[0]);
140        return retVal;
141    }
142
143
144    /**
145     * Returns a count of the current number of repetitions of Valid Coded "Answers" (OM3-3).
146     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
147     * it will return zero.
148     */
149    public int getValidCodedAnswersReps() {
150        return this.getReps(3);
151    }
152
153
154    /**
155     * Returns a specific repetition of
156     * OM3-3: "Valid Coded "Answers"" - creates it if necessary
157     *
158     * @param rep The repetition index (0-indexed)
159     */
160    public CWE getValidCodedAnswers(int rep) { 
161                CWE retVal = this.getTypedField(3, rep);
162                return retVal;
163    }
164
165    /**
166     * Returns a specific repetition of
167     * OM3-3: "Valid Coded "Answers"" - creates it if necessary
168     *
169     * @param rep The repetition index (0-indexed)
170     */
171    public CWE getOm33_ValidCodedAnswers(int rep) { 
172                CWE retVal = this.getTypedField(3, rep);
173                return retVal;
174    }
175
176    /**
177     * Returns a count of the current number of repetitions of Valid Coded "Answers" (OM3-3).
178     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
179     * it will return zero.
180     */
181    public int getOm33_ValidCodedAnswersReps() {
182        return this.getReps(3);
183    }
184
185
186    /**
187     * Inserts a repetition of
188     * OM3-3: "Valid Coded "Answers"" at a specific index
189     *
190     * @param rep The repetition index (0-indexed)
191     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
192     */
193    public CWE insertValidCodedAnswers(int rep) throws HL7Exception { 
194        return (CWE) super.insertRepetition(3, rep);
195    }
196
197
198    /**
199     * Inserts a repetition of
200     * OM3-3: "Valid Coded "Answers"" at a specific index
201     *
202     * @param rep The repetition index (0-indexed)
203     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
204     */
205    public CWE insertOm33_ValidCodedAnswers(int rep) throws HL7Exception { 
206        return (CWE) super.insertRepetition(3, rep);
207    }
208
209
210    /**
211     * Removes a repetition of
212     * OM3-3: "Valid Coded "Answers"" at a specific index
213     *
214     * @param rep The repetition index (0-indexed)
215     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
216     */
217    public CWE removeValidCodedAnswers(int rep) throws HL7Exception { 
218        return (CWE) super.removeRepetition(3, rep);
219    }
220
221
222    /**
223     * Removes a repetition of
224     * OM3-3: "Valid Coded "Answers"" at a specific index
225     *
226     * @param rep The repetition index (0-indexed)
227     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
228     */
229    public CWE removeOm33_ValidCodedAnswers(int rep) throws HL7Exception { 
230        return (CWE) super.removeRepetition(3, rep);
231    }
232
233
234
235    /**
236     * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
237     */
238    public CWE[] getNormalTextCodesForCategoricalObservations() {
239        CWE[] retVal = this.getTypedField(4, new CWE[0]);
240        return retVal;
241    }
242
243
244    /**
245     * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
246     */
247    public CWE[] getOm34_NormalTextCodesForCategoricalObservations() {
248        CWE[] retVal = this.getTypedField(4, new CWE[0]);
249        return retVal;
250    }
251
252
253    /**
254     * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
255     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
256     * it will return zero.
257     */
258    public int getNormalTextCodesForCategoricalObservationsReps() {
259        return this.getReps(4);
260    }
261
262
263    /**
264     * Returns a specific repetition of
265     * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary
266     *
267     * @param rep The repetition index (0-indexed)
268     */
269    public CWE getNormalTextCodesForCategoricalObservations(int rep) { 
270                CWE retVal = this.getTypedField(4, rep);
271                return retVal;
272    }
273
274    /**
275     * Returns a specific repetition of
276     * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary
277     *
278     * @param rep The repetition index (0-indexed)
279     */
280    public CWE getOm34_NormalTextCodesForCategoricalObservations(int rep) { 
281                CWE retVal = this.getTypedField(4, rep);
282                return retVal;
283    }
284
285    /**
286     * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
287     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
288     * it will return zero.
289     */
290    public int getOm34_NormalTextCodesForCategoricalObservationsReps() {
291        return this.getReps(4);
292    }
293
294
295    /**
296     * Inserts a repetition of
297     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
298     *
299     * @param rep The repetition index (0-indexed)
300     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
301     */
302    public CWE insertNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
303        return (CWE) super.insertRepetition(4, rep);
304    }
305
306
307    /**
308     * Inserts a repetition of
309     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
310     *
311     * @param rep The repetition index (0-indexed)
312     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
313     */
314    public CWE insertOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
315        return (CWE) super.insertRepetition(4, rep);
316    }
317
318
319    /**
320     * Removes a repetition of
321     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
322     *
323     * @param rep The repetition index (0-indexed)
324     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
325     */
326    public CWE removeNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
327        return (CWE) super.removeRepetition(4, rep);
328    }
329
330
331    /**
332     * Removes a repetition of
333     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
334     *
335     * @param rep The repetition index (0-indexed)
336     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
337     */
338    public CWE removeOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
339        return (CWE) super.removeRepetition(4, rep);
340    }
341
342
343
344    /**
345     * Returns all repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
346     */
347    public CWE[] getAbnormalTextCodesForCategoricalObservations() {
348        CWE[] retVal = this.getTypedField(5, new CWE[0]);
349        return retVal;
350    }
351
352
353    /**
354     * Returns all repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
355     */
356    public CWE[] getOm35_AbnormalTextCodesForCategoricalObservations() {
357        CWE[] retVal = this.getTypedField(5, new CWE[0]);
358        return retVal;
359    }
360
361
362    /**
363     * Returns a count of the current number of repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
364     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
365     * it will return zero.
366     */
367    public int getAbnormalTextCodesForCategoricalObservationsReps() {
368        return this.getReps(5);
369    }
370
371
372    /**
373     * Returns a specific repetition of
374     * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary
375     *
376     * @param rep The repetition index (0-indexed)
377     */
378    public CWE getAbnormalTextCodesForCategoricalObservations(int rep) { 
379                CWE retVal = this.getTypedField(5, rep);
380                return retVal;
381    }
382
383    /**
384     * Returns a specific repetition of
385     * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary
386     *
387     * @param rep The repetition index (0-indexed)
388     */
389    public CWE getOm35_AbnormalTextCodesForCategoricalObservations(int rep) { 
390                CWE retVal = this.getTypedField(5, rep);
391                return retVal;
392    }
393
394    /**
395     * Returns a count of the current number of repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
396     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
397     * it will return zero.
398     */
399    public int getOm35_AbnormalTextCodesForCategoricalObservationsReps() {
400        return this.getReps(5);
401    }
402
403
404    /**
405     * Inserts a repetition of
406     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
407     *
408     * @param rep The repetition index (0-indexed)
409     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
410     */
411    public CWE insertAbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
412        return (CWE) super.insertRepetition(5, rep);
413    }
414
415
416    /**
417     * Inserts a repetition of
418     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
419     *
420     * @param rep The repetition index (0-indexed)
421     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
422     */
423    public CWE insertOm35_AbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
424        return (CWE) super.insertRepetition(5, rep);
425    }
426
427
428    /**
429     * Removes a repetition of
430     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
431     *
432     * @param rep The repetition index (0-indexed)
433     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
434     */
435    public CWE removeAbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
436        return (CWE) super.removeRepetition(5, rep);
437    }
438
439
440    /**
441     * Removes a repetition of
442     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
443     *
444     * @param rep The repetition index (0-indexed)
445     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
446     */
447    public CWE removeOm35_AbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
448        return (CWE) super.removeRepetition(5, rep);
449    }
450
451
452
453    /**
454     * Returns all repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
455     */
456    public CWE[] getCriticalTextCodesForCategoricalObservations() {
457        CWE[] retVal = this.getTypedField(6, new CWE[0]);
458        return retVal;
459    }
460
461
462    /**
463     * Returns all repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
464     */
465    public CWE[] getOm36_CriticalTextCodesForCategoricalObservations() {
466        CWE[] retVal = this.getTypedField(6, new CWE[0]);
467        return retVal;
468    }
469
470
471    /**
472     * Returns a count of the current number of repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
473     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
474     * it will return zero.
475     */
476    public int getCriticalTextCodesForCategoricalObservationsReps() {
477        return this.getReps(6);
478    }
479
480
481    /**
482     * Returns a specific repetition of
483     * OM3-6: "Critical Text/Codes for Categorical Observations" - creates it if necessary
484     *
485     * @param rep The repetition index (0-indexed)
486     */
487    public CWE getCriticalTextCodesForCategoricalObservations(int rep) { 
488                CWE retVal = this.getTypedField(6, rep);
489                return retVal;
490    }
491
492    /**
493     * Returns a specific repetition of
494     * OM3-6: "Critical Text/Codes for Categorical Observations" - creates it if necessary
495     *
496     * @param rep The repetition index (0-indexed)
497     */
498    public CWE getOm36_CriticalTextCodesForCategoricalObservations(int rep) { 
499                CWE retVal = this.getTypedField(6, rep);
500                return retVal;
501    }
502
503    /**
504     * Returns a count of the current number of repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
505     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
506     * it will return zero.
507     */
508    public int getOm36_CriticalTextCodesForCategoricalObservationsReps() {
509        return this.getReps(6);
510    }
511
512
513    /**
514     * Inserts a repetition of
515     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
516     *
517     * @param rep The repetition index (0-indexed)
518     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
519     */
520    public CWE insertCriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
521        return (CWE) super.insertRepetition(6, rep);
522    }
523
524
525    /**
526     * Inserts a repetition of
527     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
528     *
529     * @param rep The repetition index (0-indexed)
530     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
531     */
532    public CWE insertOm36_CriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
533        return (CWE) super.insertRepetition(6, rep);
534    }
535
536
537    /**
538     * Removes a repetition of
539     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
540     *
541     * @param rep The repetition index (0-indexed)
542     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543     */
544    public CWE removeCriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
545        return (CWE) super.removeRepetition(6, rep);
546    }
547
548
549    /**
550     * Removes a repetition of
551     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
552     *
553     * @param rep The repetition index (0-indexed)
554     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555     */
556    public CWE removeOm36_CriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
557        return (CWE) super.removeRepetition(6, rep);
558    }
559
560
561
562
563    /**
564     * Returns
565     * OM3-7: "Value Type" - creates it if necessary
566     */
567    public ID getValueType() { 
568                ID retVal = this.getTypedField(7, 0);
569                return retVal;
570    }
571    
572    /**
573     * Returns
574     * OM3-7: "Value Type" - creates it if necessary
575     */
576    public ID getOm37_ValueType() { 
577                ID retVal = this.getTypedField(7, 0);
578                return retVal;
579    }
580
581
582
583
584
585    /** {@inheritDoc} */   
586    protected Type createNewTypeWithoutReflection(int field) {
587       switch (field) {
588          case 0: return new NM(getMessage());
589          case 1: return new CWE(getMessage());
590          case 2: return new CWE(getMessage());
591          case 3: return new CWE(getMessage());
592          case 4: return new CWE(getMessage());
593          case 5: return new CWE(getMessage());
594          case 6: return new ID(getMessage(), new Integer( 125 ));
595          default: return null;
596       }
597   }
598
599
600}
601