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 MFI message segment (Master File Identification).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>MFI-1: Master File Identifier (CE) <b> </b>
027 * <li>MFI-2: Master File Application Identifier (HD) <b>optional </b>
028 * <li>MFI-3: File-Level Event Code (ID) <b> </b>
029 * <li>MFI-4: Entered Date/Time (TS) <b>optional </b>
030 * <li>MFI-5: Effective Date/Time (TS) <b>optional </b>
031 * <li>MFI-6: Response Level Code (ID) <b> </b>
032 * </ul>
033 */
034 public class MFI extends AbstractSegment {
035
036 /**
037 * Creates a new MFI segment
038 */
039 public MFI(Group parent, ModelClassFactory factory) {
040 super(parent, factory);
041 init(factory);
042 }
043
044 private void init(ModelClassFactory factory) {
045 try {
046 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(175) }, "Master File Identifier");
047 this.add(HD.class, false, 1, 180, new Object[]{ getMessage(), new Integer(0) }, "Master File Application Identifier");
048 this.add(ID.class, true, 1, 3, new Object[]{ getMessage() }, "File-Level Event Code");
049 this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Entered Date/Time");
050 this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Effective Date/Time");
051 this.add(ID.class, true, 1, 2, new Object[]{ getMessage() }, "Response Level Code");
052 } catch(HL7Exception e) {
053 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating MFI - this is probably a bug in the source code generator.", e);
054 }
055 }
056
057
058
059 /**
060 * Returns
061 * MFI-1: "Master File Identifier" - creates it if necessary
062 */
063 public CE getMasterFileIdentifier() {
064 CE ret = null;
065 try {
066 Type t = this.getField(1, 0);
067 ret = (CE)t;
068 } catch (ClassCastException cce) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
070 throw new RuntimeException(cce);
071 } catch (HL7Exception he) {
072 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
073 throw new RuntimeException(he);
074 }
075 return ret;
076 }
077
078
079 /**
080 * Returns
081 * MFI-1: "Master File Identifier" - creates it if necessary
082 */
083 public CE getMfi1_MasterFileIdentifier() {
084 CE ret = null;
085 try {
086 Type t = this.getField(1, 0);
087 ret = (CE)t;
088 } catch (ClassCastException cce) {
089 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
090 throw new RuntimeException(cce);
091 } catch (HL7Exception he) {
092 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
093 throw new RuntimeException(he);
094 }
095 return ret;
096 }
097
098
099
100 /**
101 * Returns
102 * MFI-2: "Master File Application Identifier" - creates it if necessary
103 */
104 public HD getMasterFileApplicationIdentifier() {
105 HD ret = null;
106 try {
107 Type t = this.getField(2, 0);
108 ret = (HD)t;
109 } catch (ClassCastException cce) {
110 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
111 throw new RuntimeException(cce);
112 } catch (HL7Exception he) {
113 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
114 throw new RuntimeException(he);
115 }
116 return ret;
117 }
118
119
120 /**
121 * Returns
122 * MFI-2: "Master File Application Identifier" - creates it if necessary
123 */
124 public HD getMfi2_MasterFileApplicationIdentifier() {
125 HD ret = null;
126 try {
127 Type t = this.getField(2, 0);
128 ret = (HD)t;
129 } catch (ClassCastException cce) {
130 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
131 throw new RuntimeException(cce);
132 } catch (HL7Exception he) {
133 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
134 throw new RuntimeException(he);
135 }
136 return ret;
137 }
138
139
140
141 /**
142 * Returns
143 * MFI-3: "File-Level Event Code" - creates it if necessary
144 */
145 public ID getFileLevelEventCode() {
146 ID ret = null;
147 try {
148 Type t = this.getField(3, 0);
149 ret = (ID)t;
150 } catch (ClassCastException cce) {
151 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
152 throw new RuntimeException(cce);
153 } catch (HL7Exception he) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
155 throw new RuntimeException(he);
156 }
157 return ret;
158 }
159
160
161 /**
162 * Returns
163 * MFI-3: "File-Level Event Code" - creates it if necessary
164 */
165 public ID getMfi3_FileLevelEventCode() {
166 ID ret = null;
167 try {
168 Type t = this.getField(3, 0);
169 ret = (ID)t;
170 } catch (ClassCastException cce) {
171 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
172 throw new RuntimeException(cce);
173 } catch (HL7Exception he) {
174 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
175 throw new RuntimeException(he);
176 }
177 return ret;
178 }
179
180
181
182 /**
183 * Returns
184 * MFI-4: "Entered Date/Time" - creates it if necessary
185 */
186 public TS getEnteredDateTime() {
187 TS ret = null;
188 try {
189 Type t = this.getField(4, 0);
190 ret = (TS)t;
191 } catch (ClassCastException cce) {
192 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
193 throw new RuntimeException(cce);
194 } catch (HL7Exception he) {
195 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
196 throw new RuntimeException(he);
197 }
198 return ret;
199 }
200
201
202 /**
203 * Returns
204 * MFI-4: "Entered Date/Time" - creates it if necessary
205 */
206 public TS getMfi4_EnteredDateTime() {
207 TS ret = null;
208 try {
209 Type t = this.getField(4, 0);
210 ret = (TS)t;
211 } catch (ClassCastException cce) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
213 throw new RuntimeException(cce);
214 } catch (HL7Exception he) {
215 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
216 throw new RuntimeException(he);
217 }
218 return ret;
219 }
220
221
222
223 /**
224 * Returns
225 * MFI-5: "Effective Date/Time" - creates it if necessary
226 */
227 public TS getEffectiveDateTime() {
228 TS ret = null;
229 try {
230 Type t = this.getField(5, 0);
231 ret = (TS)t;
232 } catch (ClassCastException cce) {
233 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
234 throw new RuntimeException(cce);
235 } catch (HL7Exception he) {
236 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
237 throw new RuntimeException(he);
238 }
239 return ret;
240 }
241
242
243 /**
244 * Returns
245 * MFI-5: "Effective Date/Time" - creates it if necessary
246 */
247 public TS getMfi5_EffectiveDateTime() {
248 TS ret = null;
249 try {
250 Type t = this.getField(5, 0);
251 ret = (TS)t;
252 } catch (ClassCastException cce) {
253 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
254 throw new RuntimeException(cce);
255 } catch (HL7Exception he) {
256 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
257 throw new RuntimeException(he);
258 }
259 return ret;
260 }
261
262
263
264 /**
265 * Returns
266 * MFI-6: "Response Level Code" - creates it if necessary
267 */
268 public ID getResponseLevelCode() {
269 ID ret = null;
270 try {
271 Type t = this.getField(6, 0);
272 ret = (ID)t;
273 } catch (ClassCastException cce) {
274 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
275 throw new RuntimeException(cce);
276 } catch (HL7Exception he) {
277 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
278 throw new RuntimeException(he);
279 }
280 return ret;
281 }
282
283
284 /**
285 * Returns
286 * MFI-6: "Response Level Code" - creates it if necessary
287 */
288 public ID getMfi6_ResponseLevelCode() {
289 ID ret = null;
290 try {
291 Type t = this.getField(6, 0);
292 ret = (ID)t;
293 } catch (ClassCastException cce) {
294 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
295 throw new RuntimeException(cce);
296 } catch (HL7Exception he) {
297 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
298 throw new RuntimeException(he);
299 }
300 return ret;
301 }
302
303
304
305
306
307 /** {@inheritDoc} */
308 protected Type createNewTypeWithoutReflection(int field) {
309 switch (field) {
310 case 0: return new CE(getMessage());
311 case 1: return new HD(getMessage());
312 case 2: return new ID(getMessage(), new Integer( 178 ));
313 case 3: return new TS(getMessage());
314 case 4: return new TS(getMessage());
315 case 5: return new ID(getMessage(), new Integer( 179 ));
316 default: return null;
317 }
318 }
319
320
321 }
322