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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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 TEST/OBSERVATION). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OM3-1: Segment Type ID (ST) <b>optional </b>
053     * <li>OM3-2: Sequence Number - Test/ Observation Master File (NM) <b>optional </b>
054     * <li>OM3-3: Preferred Coding System (ID) <b>optional </b>
055     * <li>OM3-4: Valid coded answers (CE) <b>optional repeating</b>
056     * <li>OM3-5: Normal test codes for categorical observations (CE) <b>optional repeating</b>
057     * <li>OM3-6: Abnormal test codes for categorical observations (CE) <b>optional </b>
058     * <li>OM3-7: Critical test codes for categorical observations (CE) <b>optional </b>
059     * <li>OM3-8: Data Type (ID) <b>optional </b>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class OM3 extends AbstractSegment {
064
065    /** 
066     * Creates a new OM3 segment
067     */
068    public OM3(Group parent, ModelClassFactory factory) {
069       super(parent, factory);
070       init(factory);
071    }
072
073    private void init(ModelClassFactory factory) {
074       try {
075                                  this.add(ST.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Type ID");
076                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File");
077                                              this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "Preferred Coding System");
078                                  this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "Valid coded answers");
079                                  this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Normal test codes for categorical observations");
080                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Abnormal test codes for categorical observations");
081                                  this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Critical test codes for categorical observations");
082                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Data Type");
083       } catch(HL7Exception e) {
084          log.error("Unexpected error creating OM3 - this is probably a bug in the source code generator.", e);
085       }
086    }
087
088
089
090    /**
091     * Returns
092     * OM3-1: "Segment Type ID" - creates it if necessary
093     */
094    public ST getSegmentTypeID() { 
095                ST retVal = this.getTypedField(1, 0);
096                return retVal;
097    }
098    
099    /**
100     * Returns
101     * OM3-1: "Segment Type ID" - creates it if necessary
102     */
103    public ST getOm31_SegmentTypeID() { 
104                ST retVal = this.getTypedField(1, 0);
105                return retVal;
106    }
107
108
109
110    /**
111     * Returns
112     * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
113     */
114    public NM getSequenceNumberTestObservationMasterFile() { 
115                NM retVal = this.getTypedField(2, 0);
116                return retVal;
117    }
118    
119    /**
120     * Returns
121     * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
122     */
123    public NM getOm32_SequenceNumberTestObservationMasterFile() { 
124                NM retVal = this.getTypedField(2, 0);
125                return retVal;
126    }
127
128
129
130    /**
131     * Returns
132     * OM3-3: "Preferred Coding System" - creates it if necessary
133     */
134    public ID getPreferredCodingSystem() { 
135                ID retVal = this.getTypedField(3, 0);
136                return retVal;
137    }
138    
139    /**
140     * Returns
141     * OM3-3: "Preferred Coding System" - creates it if necessary
142     */
143    public ID getOm33_PreferredCodingSystem() { 
144                ID retVal = this.getTypedField(3, 0);
145                return retVal;
146    }
147
148
149    /**
150     * Returns all repetitions of Valid coded answers (OM3-4).
151     */
152    public CE[] getValidCodedAnswers() {
153        CE[] retVal = this.getTypedField(4, new CE[0]);
154        return retVal;
155    }
156
157
158    /**
159     * Returns all repetitions of Valid coded answers (OM3-4).
160     */
161    public CE[] getOm34_ValidCodedAnswers() {
162        CE[] retVal = this.getTypedField(4, new CE[0]);
163        return retVal;
164    }
165
166
167    /**
168     * Returns a count of the current number of repetitions of Valid coded answers (OM3-4).
169     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
170     * it will return zero.
171     */
172    public int getValidCodedAnswersReps() {
173        return this.getReps(4);
174    }
175
176
177    /**
178     * Returns a specific repetition of
179     * OM3-4: "Valid coded answers" - creates it if necessary
180     *
181     * @param rep The repetition index (0-indexed)
182     */
183    public CE getValidCodedAnswers(int rep) { 
184                CE retVal = this.getTypedField(4, rep);
185                return retVal;
186    }
187
188    /**
189     * Returns a specific repetition of
190     * OM3-4: "Valid coded answers" - creates it if necessary
191     *
192     * @param rep The repetition index (0-indexed)
193     */
194    public CE getOm34_ValidCodedAnswers(int rep) { 
195                CE retVal = this.getTypedField(4, rep);
196                return retVal;
197    }
198
199    /**
200     * Returns a count of the current number of repetitions of Valid coded answers (OM3-4).
201     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
202     * it will return zero.
203     */
204    public int getOm34_ValidCodedAnswersReps() {
205        return this.getReps(4);
206    }
207
208
209    /**
210     * Inserts a repetition of
211     * OM3-4: "Valid coded answers" at a specific index
212     *
213     * @param rep The repetition index (0-indexed)
214     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
215     */
216    public CE insertValidCodedAnswers(int rep) throws HL7Exception { 
217        return (CE) super.insertRepetition(4, rep);
218    }
219
220
221    /**
222     * Inserts a repetition of
223     * OM3-4: "Valid coded answers" at a specific index
224     *
225     * @param rep The repetition index (0-indexed)
226     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
227     */
228    public CE insertOm34_ValidCodedAnswers(int rep) throws HL7Exception { 
229        return (CE) super.insertRepetition(4, rep);
230    }
231
232
233    /**
234     * Removes a repetition of
235     * OM3-4: "Valid coded answers" at a specific index
236     *
237     * @param rep The repetition index (0-indexed)
238     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
239     */
240    public CE removeValidCodedAnswers(int rep) throws HL7Exception { 
241        return (CE) super.removeRepetition(4, rep);
242    }
243
244
245    /**
246     * Removes a repetition of
247     * OM3-4: "Valid coded answers" at a specific index
248     *
249     * @param rep The repetition index (0-indexed)
250     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
251     */
252    public CE removeOm34_ValidCodedAnswers(int rep) throws HL7Exception { 
253        return (CE) super.removeRepetition(4, rep);
254    }
255
256
257
258    /**
259     * Returns all repetitions of Normal test codes for categorical observations (OM3-5).
260     */
261    public CE[] getNormalTestCodesForCategoricalObservations() {
262        CE[] retVal = this.getTypedField(5, new CE[0]);
263        return retVal;
264    }
265
266
267    /**
268     * Returns all repetitions of Normal test codes for categorical observations (OM3-5).
269     */
270    public CE[] getOm35_NormalTestCodesForCategoricalObservations() {
271        CE[] retVal = this.getTypedField(5, new CE[0]);
272        return retVal;
273    }
274
275
276    /**
277     * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5).
278     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
279     * it will return zero.
280     */
281    public int getNormalTestCodesForCategoricalObservationsReps() {
282        return this.getReps(5);
283    }
284
285
286    /**
287     * Returns a specific repetition of
288     * OM3-5: "Normal test codes for categorical observations" - creates it if necessary
289     *
290     * @param rep The repetition index (0-indexed)
291     */
292    public CE getNormalTestCodesForCategoricalObservations(int rep) { 
293                CE retVal = this.getTypedField(5, rep);
294                return retVal;
295    }
296
297    /**
298     * Returns a specific repetition of
299     * OM3-5: "Normal test codes for categorical observations" - creates it if necessary
300     *
301     * @param rep The repetition index (0-indexed)
302     */
303    public CE getOm35_NormalTestCodesForCategoricalObservations(int rep) { 
304                CE retVal = this.getTypedField(5, rep);
305                return retVal;
306    }
307
308    /**
309     * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5).
310     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
311     * it will return zero.
312     */
313    public int getOm35_NormalTestCodesForCategoricalObservationsReps() {
314        return this.getReps(5);
315    }
316
317
318    /**
319     * Inserts a repetition of
320     * OM3-5: "Normal test codes for categorical observations" at a specific index
321     *
322     * @param rep The repetition index (0-indexed)
323     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
324     */
325    public CE insertNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 
326        return (CE) super.insertRepetition(5, rep);
327    }
328
329
330    /**
331     * Inserts a repetition of
332     * OM3-5: "Normal test codes for categorical observations" at a specific index
333     *
334     * @param rep The repetition index (0-indexed)
335     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
336     */
337    public CE insertOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 
338        return (CE) super.insertRepetition(5, rep);
339    }
340
341
342    /**
343     * Removes a repetition of
344     * OM3-5: "Normal test codes for categorical observations" at a specific index
345     *
346     * @param rep The repetition index (0-indexed)
347     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
348     */
349    public CE removeNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 
350        return (CE) super.removeRepetition(5, rep);
351    }
352
353
354    /**
355     * Removes a repetition of
356     * OM3-5: "Normal test codes for categorical observations" at a specific index
357     *
358     * @param rep The repetition index (0-indexed)
359     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
360     */
361    public CE removeOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 
362        return (CE) super.removeRepetition(5, rep);
363    }
364
365
366
367
368    /**
369     * Returns
370     * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary
371     */
372    public CE getAbnormalTestCodesForCategoricalObservations() { 
373                CE retVal = this.getTypedField(6, 0);
374                return retVal;
375    }
376    
377    /**
378     * Returns
379     * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary
380     */
381    public CE getOm36_AbnormalTestCodesForCategoricalObservations() { 
382                CE retVal = this.getTypedField(6, 0);
383                return retVal;
384    }
385
386
387
388    /**
389     * Returns
390     * OM3-7: "Critical test codes for categorical observations" - creates it if necessary
391     */
392    public CE getCriticalTestCodesForCategoricalObservations() { 
393                CE retVal = this.getTypedField(7, 0);
394                return retVal;
395    }
396    
397    /**
398     * Returns
399     * OM3-7: "Critical test codes for categorical observations" - creates it if necessary
400     */
401    public CE getOm37_CriticalTestCodesForCategoricalObservations() { 
402                CE retVal = this.getTypedField(7, 0);
403                return retVal;
404    }
405
406
407
408    /**
409     * Returns
410     * OM3-8: "Data Type" - creates it if necessary
411     */
412    public ID getDataType() { 
413                ID retVal = this.getTypedField(8, 0);
414                return retVal;
415    }
416    
417    /**
418     * Returns
419     * OM3-8: "Data Type" - creates it if necessary
420     */
421    public ID getOm38_DataType() { 
422                ID retVal = this.getTypedField(8, 0);
423                return retVal;
424    }
425
426
427
428
429
430    /** {@inheritDoc} */   
431    protected Type createNewTypeWithoutReflection(int field) {
432       switch (field) {
433          case 0: return new ST(getMessage());
434          case 1: return new NM(getMessage());
435          case 2: return new ID(getMessage(), new Integer( 0 ));
436          case 3: return new CE(getMessage());
437          case 4: return new CE(getMessage());
438          case 5: return new CE(getMessage());
439          case 6: return new CE(getMessage());
440          case 7: return new ID(getMessage(), new Integer( 0 ));
441          default: return null;
442       }
443   }
444
445
446}
447