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 EQP message segment (Equipment/log Service).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>EQP-1: Event type (CE) <b> </b>
027 * <li>EQP-2: File Name (ST) <b>optional </b>
028 * <li>EQP-3: Start Date/Time (TS) <b> </b>
029 * <li>EQP-4: End Date/Time (TS) <b>optional </b>
030 * <li>EQP-5: Transaction Data (FT) <b> </b>
031 * </ul>
032 */
033 public class EQP extends AbstractSegment {
034
035 /**
036 * Creates a new EQP segment
037 */
038 public EQP(Group parent, ModelClassFactory factory) {
039 super(parent, factory);
040 init(factory);
041 }
042
043 private void init(ModelClassFactory factory) {
044 try {
045 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(450) }, "Event type");
046 this.add(ST.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "File Name");
047 this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Start Date/Time");
048 this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "End Date/Time");
049 this.add(FT.class, true, 1, 65536, new Object[]{ getMessage(), new Integer(0) }, "Transaction Data");
050 } catch(HL7Exception e) {
051 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating EQP - this is probably a bug in the source code generator.", e);
052 }
053 }
054
055
056
057 /**
058 * Returns
059 * EQP-1: "Event type" - creates it if necessary
060 */
061 public CE getEventType() {
062 CE ret = null;
063 try {
064 Type t = this.getField(1, 0);
065 ret = (CE)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 * EQP-1: "Event type" - creates it if necessary
080 */
081 public CE getEqp1_EventType() {
082 CE ret = null;
083 try {
084 Type t = this.getField(1, 0);
085 ret = (CE)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 * EQP-2: "File Name" - creates it if necessary
101 */
102 public ST getFileName() {
103 ST ret = null;
104 try {
105 Type t = this.getField(2, 0);
106 ret = (ST)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 * EQP-2: "File Name" - creates it if necessary
121 */
122 public ST getEqp2_FileName() {
123 ST ret = null;
124 try {
125 Type t = this.getField(2, 0);
126 ret = (ST)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 * EQP-3: "Start Date/Time" - creates it if necessary
142 */
143 public TS getStartDateTime() {
144 TS ret = null;
145 try {
146 Type t = this.getField(3, 0);
147 ret = (TS)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 * EQP-3: "Start Date/Time" - creates it if necessary
162 */
163 public TS getEqp3_StartDateTime() {
164 TS ret = null;
165 try {
166 Type t = this.getField(3, 0);
167 ret = (TS)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 * EQP-4: "End Date/Time" - creates it if necessary
183 */
184 public TS getEndDateTime() {
185 TS ret = null;
186 try {
187 Type t = this.getField(4, 0);
188 ret = (TS)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 * EQP-4: "End Date/Time" - creates it if necessary
203 */
204 public TS getEqp4_EndDateTime() {
205 TS ret = null;
206 try {
207 Type t = this.getField(4, 0);
208 ret = (TS)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 * EQP-5: "Transaction Data" - creates it if necessary
224 */
225 public FT getTransactionData() {
226 FT ret = null;
227 try {
228 Type t = this.getField(5, 0);
229 ret = (FT)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 * EQP-5: "Transaction Data" - creates it if necessary
244 */
245 public FT getEqp5_TransactionData() {
246 FT ret = null;
247 try {
248 Type t = this.getField(5, 0);
249 ret = (FT)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 CE(getMessage());
268 case 1: return new ST(getMessage());
269 case 2: return new TS(getMessage());
270 case 3: return new TS(getMessage());
271 case 4: return new FT(getMessage());
272 default: return null;
273 }
274 }
275
276
277 }
278