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