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
008 package ca.uhn.hl7v2.model.v24.segment;
009
010 // import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.datatype.*;
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.Type;
019 import ca.uhn.hl7v2.model.AbstractSegment;
020 import ca.uhn.hl7v2.model.Varies;
021
022 /**
023 *<p>Represents an HL7 EQU message segment (Equipment Detail).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>EQU-1: Equipment Instance Identifier (EI) <b> </b>
027 * <li>EQU-2: Event Date/Time (TS) <b> </b>
028 * <li>EQU-3: Equipment State (CE) <b>optional </b>
029 * <li>EQU-4: Local/Remote Control State (CE) <b>optional </b>
030 * <li>EQU-5: Alert Level (CE) <b>optional </b>
031 * </ul>
032 */
033 public class EQU extends AbstractSegment {
034
035 /**
036 * Creates a new EQU segment
037 */
038 public EQU(Group parent, ModelClassFactory factory) {
039 super(parent, factory);
040 init(factory);
041 }
042
043 private void init(ModelClassFactory factory) {
044 try {
045 this.add(EI.class, true, 1, 22, new Object[]{ getMessage(), new Integer(0) }, "Equipment Instance Identifier");
046 this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Event Date/Time");
047 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(365) }, "Equipment State");
048 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(366) }, "Local/Remote Control State");
049 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(367) }, "Alert Level");
050 } catch(HL7Exception e) {
051 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating EQU - this is probably a bug in the source code generator.", e);
052 }
053 }
054
055
056
057 /**
058 * Returns
059 * EQU-1: "Equipment Instance Identifier" - creates it if necessary
060 */
061 public EI getEquipmentInstanceIdentifier() {
062 EI ret = null;
063 try {
064 Type t = this.getField(1, 0);
065 ret = (EI)t;
066 } catch (ClassCastException cce) {
067 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
068 throw new RuntimeException(cce);
069 } catch (HL7Exception he) {
070 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
071 throw new RuntimeException(he);
072 }
073 return ret;
074 }
075
076
077 /**
078 * Returns
079 * EQU-1: "Equipment Instance Identifier" - creates it if necessary
080 */
081 public EI getEqu1_EquipmentInstanceIdentifier() {
082 EI ret = null;
083 try {
084 Type t = this.getField(1, 0);
085 ret = (EI)t;
086 } catch (ClassCastException cce) {
087 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
088 throw new RuntimeException(cce);
089 } catch (HL7Exception he) {
090 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
091 throw new RuntimeException(he);
092 }
093 return ret;
094 }
095
096
097
098 /**
099 * Returns
100 * EQU-2: "Event Date/Time" - creates it if necessary
101 */
102 public TS getEventDateTime() {
103 TS ret = null;
104 try {
105 Type t = this.getField(2, 0);
106 ret = (TS)t;
107 } catch (ClassCastException cce) {
108 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
109 throw new RuntimeException(cce);
110 } catch (HL7Exception he) {
111 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
112 throw new RuntimeException(he);
113 }
114 return ret;
115 }
116
117
118 /**
119 * Returns
120 * EQU-2: "Event Date/Time" - creates it if necessary
121 */
122 public TS getEqu2_EventDateTime() {
123 TS ret = null;
124 try {
125 Type t = this.getField(2, 0);
126 ret = (TS)t;
127 } catch (ClassCastException cce) {
128 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
129 throw new RuntimeException(cce);
130 } catch (HL7Exception he) {
131 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
132 throw new RuntimeException(he);
133 }
134 return ret;
135 }
136
137
138
139 /**
140 * Returns
141 * EQU-3: "Equipment State" - creates it if necessary
142 */
143 public CE getEquipmentState() {
144 CE ret = null;
145 try {
146 Type t = this.getField(3, 0);
147 ret = (CE)t;
148 } catch (ClassCastException cce) {
149 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
150 throw new RuntimeException(cce);
151 } catch (HL7Exception he) {
152 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
153 throw new RuntimeException(he);
154 }
155 return ret;
156 }
157
158
159 /**
160 * Returns
161 * EQU-3: "Equipment State" - creates it if necessary
162 */
163 public CE getEqu3_EquipmentState() {
164 CE ret = null;
165 try {
166 Type t = this.getField(3, 0);
167 ret = (CE)t;
168 } catch (ClassCastException cce) {
169 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
170 throw new RuntimeException(cce);
171 } catch (HL7Exception he) {
172 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
173 throw new RuntimeException(he);
174 }
175 return ret;
176 }
177
178
179
180 /**
181 * Returns
182 * EQU-4: "Local/Remote Control State" - creates it if necessary
183 */
184 public CE getLocalRemoteControlState() {
185 CE ret = null;
186 try {
187 Type t = this.getField(4, 0);
188 ret = (CE)t;
189 } catch (ClassCastException cce) {
190 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
191 throw new RuntimeException(cce);
192 } catch (HL7Exception he) {
193 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
194 throw new RuntimeException(he);
195 }
196 return ret;
197 }
198
199
200 /**
201 * Returns
202 * EQU-4: "Local/Remote Control State" - creates it if necessary
203 */
204 public CE getEqu4_LocalRemoteControlState() {
205 CE ret = null;
206 try {
207 Type t = this.getField(4, 0);
208 ret = (CE)t;
209 } catch (ClassCastException cce) {
210 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
211 throw new RuntimeException(cce);
212 } catch (HL7Exception he) {
213 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
214 throw new RuntimeException(he);
215 }
216 return ret;
217 }
218
219
220
221 /**
222 * Returns
223 * EQU-5: "Alert Level" - creates it if necessary
224 */
225 public CE getAlertLevel() {
226 CE ret = null;
227 try {
228 Type t = this.getField(5, 0);
229 ret = (CE)t;
230 } catch (ClassCastException cce) {
231 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
232 throw new RuntimeException(cce);
233 } catch (HL7Exception he) {
234 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
235 throw new RuntimeException(he);
236 }
237 return ret;
238 }
239
240
241 /**
242 * Returns
243 * EQU-5: "Alert Level" - creates it if necessary
244 */
245 public CE getEqu5_AlertLevel() {
246 CE ret = null;
247 try {
248 Type t = this.getField(5, 0);
249 ret = (CE)t;
250 } catch (ClassCastException cce) {
251 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
252 throw new RuntimeException(cce);
253 } catch (HL7Exception he) {
254 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
255 throw new RuntimeException(he);
256 }
257 return ret;
258 }
259
260
261
262
263
264 /** {@inheritDoc} */
265 protected Type createNewTypeWithoutReflection(int field) {
266 switch (field) {
267 case 0: return new EI(getMessage());
268 case 1: return new TS(getMessage());
269 case 2: return new CE(getMessage());
270 case 3: return new CE(getMessage());
271 case 4: return new CE(getMessage());
272 default: return null;
273 }
274 }
275
276
277 }
278