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