View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v251.segment;
35  
36  // import ca.uhn.hl7v2.model.v251.group.*;
37  import ca.uhn.hl7v2.model.v251.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 OM5 message segment (Observation Batteries (Sets)). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>OM5-1: Sequence Number - Test/Observation Master File (NM) <b>optional </b>
53       * <li>OM5-2: Test/Observations Included within an Ordered Test Battery (CE) <b>optional repeating</b>
54       * <li>OM5-3: Observation ID Suffixes (ST) <b>optional </b>
55   * </ul>
56   */
57  @SuppressWarnings("unused")
58  public class OM5 extends AbstractSegment {
59  
60      /** 
61       * Creates a new OM5 segment
62       */
63      public OM5(Group parent, ModelClassFactory factory) {
64         super(parent, factory);
65         init(factory);
66      }
67  
68      private void init(ModelClassFactory factory) {
69         try {
70                                    this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/Observation Master File");
71                                    this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Test/Observations Included within an Ordered Test Battery");
72                                    this.add(ST.class, false, 1, 250, new Object[]{ getMessage() }, "Observation ID Suffixes");
73         } catch(HL7Exception e) {
74            log.error("Unexpected error creating OM5 - this is probably a bug in the source code generator.", e);
75         }
76      }
77  
78  
79  
80      /**
81       * Returns
82       * OM5-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
83       */
84      public NM getSequenceNumberTestObservationMasterFile() { 
85  		NM retVal = this.getTypedField(1, 0);
86  		return retVal;
87      }
88      
89      /**
90       * Returns
91       * OM5-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
92       */
93      public NM getOm51_SequenceNumberTestObservationMasterFile() { 
94  		NM retVal = this.getTypedField(1, 0);
95  		return retVal;
96      }
97  
98  
99      /**
100      * Returns all repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2).
101      */
102     public CE[] getTestObservationsIncludedWithinAnOrderedTestBattery() {
103     	CE[] retVal = this.getTypedField(2, new CE[0]);
104     	return retVal;
105     }
106 
107 
108     /**
109      * Returns all repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2).
110      */
111     public CE[] getOm52_TestObservationsIncludedWithinAnOrderedTestBattery() {
112     	CE[] retVal = this.getTypedField(2, new CE[0]);
113     	return retVal;
114     }
115 
116 
117     /**
118      * Returns a count of the current number of repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2).
119      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
120      * it will return zero.
121      */
122     public int getTestObservationsIncludedWithinAnOrderedTestBatteryReps() {
123     	return this.getReps(2);
124     }
125 
126 
127     /**
128      * Returns a specific repetition of
129      * OM5-2: "Test/Observations Included within an Ordered Test Battery" - creates it if necessary
130      *
131      * @param rep The repetition index (0-indexed)
132      */
133     public CE getTestObservationsIncludedWithinAnOrderedTestBattery(int rep) { 
134 		CE retVal = this.getTypedField(2, rep);
135 		return retVal;
136     }
137 
138     /**
139      * Returns a specific repetition of
140      * OM5-2: "Test/Observations Included within an Ordered Test Battery" - creates it if necessary
141      *
142      * @param rep The repetition index (0-indexed)
143      */
144     public CE getOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) { 
145 		CE retVal = this.getTypedField(2, rep);
146 		return retVal;
147     }
148 
149     /**
150      * Returns a count of the current number of repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2).
151      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
152      * it will return zero.
153      */
154     public int getOm52_TestObservationsIncludedWithinAnOrderedTestBatteryReps() {
155     	return this.getReps(2);
156     }
157 
158 
159     /**
160      * Inserts a repetition of
161      * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index
162      *
163      * @param rep The repetition index (0-indexed)
164      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
165      */
166     public CE insertTestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 
167         return (CE) super.insertRepetition(2, rep);
168     }
169 
170 
171     /**
172      * Inserts a repetition of
173      * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index
174      *
175      * @param rep The repetition index (0-indexed)
176      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
177      */
178     public CE insertOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 
179         return (CE) super.insertRepetition(2, rep);
180     }
181 
182 
183     /**
184      * Removes a repetition of
185      * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index
186      *
187      * @param rep The repetition index (0-indexed)
188      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
189      */
190     public CE removeTestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 
191         return (CE) super.removeRepetition(2, rep);
192     }
193 
194 
195     /**
196      * Removes a repetition of
197      * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index
198      *
199      * @param rep The repetition index (0-indexed)
200      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
201      */
202     public CE removeOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 
203         return (CE) super.removeRepetition(2, rep);
204     }
205 
206 
207 
208 
209     /**
210      * Returns
211      * OM5-3: "Observation ID Suffixes" - creates it if necessary
212      */
213     public ST getObservationIDSuffixes() { 
214 		ST retVal = this.getTypedField(3, 0);
215 		return retVal;
216     }
217     
218     /**
219      * Returns
220      * OM5-3: "Observation ID Suffixes" - creates it if necessary
221      */
222     public ST getOm53_ObservationIDSuffixes() { 
223 		ST retVal = this.getTypedField(3, 0);
224 		return retVal;
225     }
226 
227 
228 
229 
230 
231     /** {@inheritDoc} */   
232     protected Type createNewTypeWithoutReflection(int field) {
233        switch (field) {
234           case 0: return new NM(getMessage());
235           case 1: return new CE(getMessage());
236           case 2: return new ST(getMessage());
237           default: return null;
238        }
239    }
240 
241 
242 }
243