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 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 (CE) <b>optional </b>
053     * <li>OM3-3: Valid Coded "Answers" (CE) <b>optional </b>
054     * <li>OM3-4: Normal Text/Codes for Categorical Observations (CE) <b>optional repeating</b>
055     * <li>OM3-5: Abnormal Text/Codes for Categorical Observations (CE) <b>optional repeating</b>
056     * <li>OM3-6: Critical Text/Codes for Categorical Observations (CE) <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(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Preferred Coding System");
075                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Valid Coded \"Answers\"");
076                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Normal Text/Codes for Categorical Observations");
077                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Abnormal Text/Codes for Categorical Observations");
078                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Critical Text/Codes for Categorical Observations");
079                                              this.add(ID.class, false, 1, 2, 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 CE getPreferredCodingSystem() { 
112                CE 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 CE getOm32_PreferredCodingSystem() { 
121                CE retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124
125
126
127    /**
128     * Returns
129     * OM3-3: "Valid Coded "Answers"" - creates it if necessary
130     */
131    public CE getValidCodedAnswers() { 
132                CE retVal = this.getTypedField(3, 0);
133                return retVal;
134    }
135    
136    /**
137     * Returns
138     * OM3-3: "Valid Coded "Answers"" - creates it if necessary
139     */
140    public CE getOm33_ValidCodedAnswers() { 
141                CE retVal = this.getTypedField(3, 0);
142                return retVal;
143    }
144
145
146    /**
147     * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
148     */
149    public CE[] getNormalTextCodesForCategoricalObservations() {
150        CE[] retVal = this.getTypedField(4, new CE[0]);
151        return retVal;
152    }
153
154
155    /**
156     * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
157     */
158    public CE[] getOm34_NormalTextCodesForCategoricalObservations() {
159        CE[] retVal = this.getTypedField(4, new CE[0]);
160        return retVal;
161    }
162
163
164    /**
165     * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
166     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
167     * it will return zero.
168     */
169    public int getNormalTextCodesForCategoricalObservationsReps() {
170        return this.getReps(4);
171    }
172
173
174    /**
175     * Returns a specific repetition of
176     * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary
177     *
178     * @param rep The repetition index (0-indexed)
179     */
180    public CE getNormalTextCodesForCategoricalObservations(int rep) { 
181                CE retVal = this.getTypedField(4, rep);
182                return retVal;
183    }
184
185    /**
186     * Returns a specific repetition of
187     * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary
188     *
189     * @param rep The repetition index (0-indexed)
190     */
191    public CE getOm34_NormalTextCodesForCategoricalObservations(int rep) { 
192                CE retVal = this.getTypedField(4, rep);
193                return retVal;
194    }
195
196    /**
197     * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4).
198     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
199     * it will return zero.
200     */
201    public int getOm34_NormalTextCodesForCategoricalObservationsReps() {
202        return this.getReps(4);
203    }
204
205
206    /**
207     * Inserts a repetition of
208     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
209     *
210     * @param rep The repetition index (0-indexed)
211     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
212     */
213    public CE insertNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
214        return (CE) super.insertRepetition(4, rep);
215    }
216
217
218    /**
219     * Inserts a repetition of
220     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
221     *
222     * @param rep The repetition index (0-indexed)
223     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
224     */
225    public CE insertOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
226        return (CE) super.insertRepetition(4, rep);
227    }
228
229
230    /**
231     * Removes a repetition of
232     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
233     *
234     * @param rep The repetition index (0-indexed)
235     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
236     */
237    public CE removeNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
238        return (CE) super.removeRepetition(4, rep);
239    }
240
241
242    /**
243     * Removes a repetition of
244     * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index
245     *
246     * @param rep The repetition index (0-indexed)
247     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
248     */
249    public CE removeOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
250        return (CE) super.removeRepetition(4, rep);
251    }
252
253
254
255    /**
256     * Returns all repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
257     */
258    public CE[] getAbnormalTextCodesForCategoricalObservations() {
259        CE[] retVal = this.getTypedField(5, new CE[0]);
260        return retVal;
261    }
262
263
264    /**
265     * Returns all repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
266     */
267    public CE[] getOm35_AbnormalTextCodesForCategoricalObservations() {
268        CE[] retVal = this.getTypedField(5, new CE[0]);
269        return retVal;
270    }
271
272
273    /**
274     * Returns a count of the current number of repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
275     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
276     * it will return zero.
277     */
278    public int getAbnormalTextCodesForCategoricalObservationsReps() {
279        return this.getReps(5);
280    }
281
282
283    /**
284     * Returns a specific repetition of
285     * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary
286     *
287     * @param rep The repetition index (0-indexed)
288     */
289    public CE getAbnormalTextCodesForCategoricalObservations(int rep) { 
290                CE retVal = this.getTypedField(5, rep);
291                return retVal;
292    }
293
294    /**
295     * Returns a specific repetition of
296     * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary
297     *
298     * @param rep The repetition index (0-indexed)
299     */
300    public CE getOm35_AbnormalTextCodesForCategoricalObservations(int rep) { 
301                CE retVal = this.getTypedField(5, rep);
302                return retVal;
303    }
304
305    /**
306     * Returns a count of the current number of repetitions of Abnormal Text/Codes for Categorical Observations (OM3-5).
307     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
308     * it will return zero.
309     */
310    public int getOm35_AbnormalTextCodesForCategoricalObservationsReps() {
311        return this.getReps(5);
312    }
313
314
315    /**
316     * Inserts a repetition of
317     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
318     *
319     * @param rep The repetition index (0-indexed)
320     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
321     */
322    public CE insertAbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
323        return (CE) super.insertRepetition(5, rep);
324    }
325
326
327    /**
328     * Inserts a repetition of
329     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
330     *
331     * @param rep The repetition index (0-indexed)
332     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
333     */
334    public CE insertOm35_AbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
335        return (CE) super.insertRepetition(5, rep);
336    }
337
338
339    /**
340     * Removes a repetition of
341     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
342     *
343     * @param rep The repetition index (0-indexed)
344     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
345     */
346    public CE removeAbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
347        return (CE) super.removeRepetition(5, rep);
348    }
349
350
351    /**
352     * Removes a repetition of
353     * OM3-5: "Abnormal Text/Codes for Categorical Observations" at a specific index
354     *
355     * @param rep The repetition index (0-indexed)
356     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
357     */
358    public CE removeOm35_AbnormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
359        return (CE) super.removeRepetition(5, rep);
360    }
361
362
363
364    /**
365     * Returns all repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
366     */
367    public CE[] getCriticalTextCodesForCategoricalObservations() {
368        CE[] retVal = this.getTypedField(6, new CE[0]);
369        return retVal;
370    }
371
372
373    /**
374     * Returns all repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
375     */
376    public CE[] getOm36_CriticalTextCodesForCategoricalObservations() {
377        CE[] retVal = this.getTypedField(6, new CE[0]);
378        return retVal;
379    }
380
381
382    /**
383     * Returns a count of the current number of repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
384     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
385     * it will return zero.
386     */
387    public int getCriticalTextCodesForCategoricalObservationsReps() {
388        return this.getReps(6);
389    }
390
391
392    /**
393     * Returns a specific repetition of
394     * OM3-6: "Critical Text/Codes for Categorical Observations" - creates it if necessary
395     *
396     * @param rep The repetition index (0-indexed)
397     */
398    public CE getCriticalTextCodesForCategoricalObservations(int rep) { 
399                CE retVal = this.getTypedField(6, rep);
400                return retVal;
401    }
402
403    /**
404     * Returns a specific repetition of
405     * OM3-6: "Critical Text/Codes for Categorical Observations" - creates it if necessary
406     *
407     * @param rep The repetition index (0-indexed)
408     */
409    public CE getOm36_CriticalTextCodesForCategoricalObservations(int rep) { 
410                CE retVal = this.getTypedField(6, rep);
411                return retVal;
412    }
413
414    /**
415     * Returns a count of the current number of repetitions of Critical Text/Codes for Categorical Observations (OM3-6).
416     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
417     * it will return zero.
418     */
419    public int getOm36_CriticalTextCodesForCategoricalObservationsReps() {
420        return this.getReps(6);
421    }
422
423
424    /**
425     * Inserts a repetition of
426     * OM3-6: "Critical Text/Codes for Categorical Observations" 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 CE insertCriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
432        return (CE) super.insertRepetition(6, rep);
433    }
434
435
436    /**
437     * Inserts a repetition of
438     * OM3-6: "Critical Text/Codes for Categorical Observations" 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 CE insertOm36_CriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
444        return (CE) super.insertRepetition(6, rep);
445    }
446
447
448    /**
449     * Removes a repetition of
450     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
451     *
452     * @param rep The repetition index (0-indexed)
453     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
454     */
455    public CE removeCriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
456        return (CE) super.removeRepetition(6, rep);
457    }
458
459
460    /**
461     * Removes a repetition of
462     * OM3-6: "Critical Text/Codes for Categorical Observations" at a specific index
463     *
464     * @param rep The repetition index (0-indexed)
465     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
466     */
467    public CE removeOm36_CriticalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 
468        return (CE) super.removeRepetition(6, rep);
469    }
470
471
472
473
474    /**
475     * Returns
476     * OM3-7: "Value Type" - creates it if necessary
477     */
478    public ID getValueType() { 
479                ID retVal = this.getTypedField(7, 0);
480                return retVal;
481    }
482    
483    /**
484     * Returns
485     * OM3-7: "Value Type" - creates it if necessary
486     */
487    public ID getOm37_ValueType() { 
488                ID retVal = this.getTypedField(7, 0);
489                return retVal;
490    }
491
492
493
494
495
496    /** {@inheritDoc} */   
497    protected Type createNewTypeWithoutReflection(int field) {
498       switch (field) {
499          case 0: return new NM(getMessage());
500          case 1: return new CE(getMessage());
501          case 2: return new CE(getMessage());
502          case 3: return new CE(getMessage());
503          case 4: return new CE(getMessage());
504          case 5: return new CE(getMessage());
505          case 6: return new ID(getMessage(), new Integer( 125 ));
506          default: return null;
507       }
508   }
509
510
511}
512