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.v27.segment;
35  
36  // import ca.uhn.hl7v2.model.v27.group.*;
37  import ca.uhn.hl7v2.model.v27.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 MFI message segment (Master File Identification). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>MFI-1: Master File Identifier (CWE) <b> </b>
53       * <li>MFI-2: Master File Application Identifier (HD) <b>optional repeating</b>
54       * <li>MFI-3: File-Level Event Code (ID) <b> </b>
55       * <li>MFI-4: Entered Date/Time (DTM) <b>optional </b>
56       * <li>MFI-5: Effective Date/Time (DTM) <b>optional </b>
57       * <li>MFI-6: Response Level Code (ID) <b> </b>
58   * </ul>
59   */
60  @SuppressWarnings("unused")
61  public class MFI extends AbstractSegment {
62  
63      /** 
64       * Creates a new MFI segment
65       */
66      public MFI(Group parent, ModelClassFactory factory) {
67         super(parent, factory);
68         init(factory);
69      }
70  
71      private void init(ModelClassFactory factory) {
72         try {
73                                    this.add(CWE.class, true, 1, 0, new Object[]{ getMessage() }, "Master File Identifier");
74                                    this.add(HD.class, false, 0, 0, new Object[]{ getMessage() }, "Master File Application Identifier");
75                                                this.add(ID.class, true, 1, 3, new Object[]{ getMessage(), new Integer(178) }, "File-Level Event Code");
76                                    this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Entered Date/Time");
77                                    this.add(DTM.class, false, 1, 0, new Object[]{ getMessage() }, "Effective Date/Time");
78                                                this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(179) }, "Response Level Code");
79         } catch(HL7Exception e) {
80            log.error("Unexpected error creating MFI - this is probably a bug in the source code generator.", e);
81         }
82      }
83  
84  
85  
86      /**
87       * Returns
88       * MFI-1: "Master File Identifier" - creates it if necessary
89       */
90      public CWE getMasterFileIdentifier() { 
91  		CWE retVal = this.getTypedField(1, 0);
92  		return retVal;
93      }
94      
95      /**
96       * Returns
97       * MFI-1: "Master File Identifier" - creates it if necessary
98       */
99      public CWE getMfi1_MasterFileIdentifier() { 
100 		CWE retVal = this.getTypedField(1, 0);
101 		return retVal;
102     }
103 
104 
105     /**
106      * Returns all repetitions of Master File Application Identifier (MFI-2).
107      */
108     public HD[] getMasterFileApplicationIdentifier() {
109     	HD[] retVal = this.getTypedField(2, new HD[0]);
110     	return retVal;
111     }
112 
113 
114     /**
115      * Returns all repetitions of Master File Application Identifier (MFI-2).
116      */
117     public HD[] getMfi2_MasterFileApplicationIdentifier() {
118     	HD[] retVal = this.getTypedField(2, new HD[0]);
119     	return retVal;
120     }
121 
122 
123     /**
124      * Returns a count of the current number of repetitions of Master File Application Identifier (MFI-2).
125      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
126      * it will return zero.
127      */
128     public int getMasterFileApplicationIdentifierReps() {
129     	return this.getReps(2);
130     }
131 
132 
133     /**
134      * Returns a specific repetition of
135      * MFI-2: "Master File Application Identifier" - creates it if necessary
136      *
137      * @param rep The repetition index (0-indexed)
138      */
139     public HD getMasterFileApplicationIdentifier(int rep) { 
140 		HD retVal = this.getTypedField(2, rep);
141 		return retVal;
142     }
143 
144     /**
145      * Returns a specific repetition of
146      * MFI-2: "Master File Application Identifier" - creates it if necessary
147      *
148      * @param rep The repetition index (0-indexed)
149      */
150     public HD getMfi2_MasterFileApplicationIdentifier(int rep) { 
151 		HD retVal = this.getTypedField(2, rep);
152 		return retVal;
153     }
154 
155     /**
156      * Returns a count of the current number of repetitions of Master File Application Identifier (MFI-2).
157      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
158      * it will return zero.
159      */
160     public int getMfi2_MasterFileApplicationIdentifierReps() {
161     	return this.getReps(2);
162     }
163 
164 
165     /**
166      * Inserts a repetition of
167      * MFI-2: "Master File Application Identifier" at a specific index
168      *
169      * @param rep The repetition index (0-indexed)
170      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
171      */
172     public HD insertMasterFileApplicationIdentifier(int rep) throws HL7Exception { 
173         return (HD) super.insertRepetition(2, rep);
174     }
175 
176 
177     /**
178      * Inserts a repetition of
179      * MFI-2: "Master File Application Identifier" at a specific index
180      *
181      * @param rep The repetition index (0-indexed)
182      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
183      */
184     public HD insertMfi2_MasterFileApplicationIdentifier(int rep) throws HL7Exception { 
185         return (HD) super.insertRepetition(2, rep);
186     }
187 
188 
189     /**
190      * Removes a repetition of
191      * MFI-2: "Master File Application Identifier" at a specific index
192      *
193      * @param rep The repetition index (0-indexed)
194      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
195      */
196     public HD removeMasterFileApplicationIdentifier(int rep) throws HL7Exception { 
197         return (HD) super.removeRepetition(2, rep);
198     }
199 
200 
201     /**
202      * Removes a repetition of
203      * MFI-2: "Master File Application Identifier" at a specific index
204      *
205      * @param rep The repetition index (0-indexed)
206      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
207      */
208     public HD removeMfi2_MasterFileApplicationIdentifier(int rep) throws HL7Exception { 
209         return (HD) super.removeRepetition(2, rep);
210     }
211 
212 
213 
214 
215     /**
216      * Returns
217      * MFI-3: "File-Level Event Code" - creates it if necessary
218      */
219     public ID getFileLevelEventCode() { 
220 		ID retVal = this.getTypedField(3, 0);
221 		return retVal;
222     }
223     
224     /**
225      * Returns
226      * MFI-3: "File-Level Event Code" - creates it if necessary
227      */
228     public ID getMfi3_FileLevelEventCode() { 
229 		ID retVal = this.getTypedField(3, 0);
230 		return retVal;
231     }
232 
233 
234 
235     /**
236      * Returns
237      * MFI-4: "Entered Date/Time" - creates it if necessary
238      */
239     public DTM getEnteredDateTime() { 
240 		DTM retVal = this.getTypedField(4, 0);
241 		return retVal;
242     }
243     
244     /**
245      * Returns
246      * MFI-4: "Entered Date/Time" - creates it if necessary
247      */
248     public DTM getMfi4_EnteredDateTime() { 
249 		DTM retVal = this.getTypedField(4, 0);
250 		return retVal;
251     }
252 
253 
254 
255     /**
256      * Returns
257      * MFI-5: "Effective Date/Time" - creates it if necessary
258      */
259     public DTM getEffectiveDateTime() { 
260 		DTM retVal = this.getTypedField(5, 0);
261 		return retVal;
262     }
263     
264     /**
265      * Returns
266      * MFI-5: "Effective Date/Time" - creates it if necessary
267      */
268     public DTM getMfi5_EffectiveDateTime() { 
269 		DTM retVal = this.getTypedField(5, 0);
270 		return retVal;
271     }
272 
273 
274 
275     /**
276      * Returns
277      * MFI-6: "Response Level Code" - creates it if necessary
278      */
279     public ID getResponseLevelCode() { 
280 		ID retVal = this.getTypedField(6, 0);
281 		return retVal;
282     }
283     
284     /**
285      * Returns
286      * MFI-6: "Response Level Code" - creates it if necessary
287      */
288     public ID getMfi6_ResponseLevelCode() { 
289 		ID retVal = this.getTypedField(6, 0);
290 		return retVal;
291     }
292 
293 
294 
295 
296 
297     /** {@inheritDoc} */   
298     protected Type createNewTypeWithoutReflection(int field) {
299        switch (field) {
300           case 0: return new CWE(getMessage());
301           case 1: return new HD(getMessage());
302           case 2: return new ID(getMessage(), new Integer( 178 ));
303           case 3: return new DTM(getMessage());
304           case 4: return new DTM(getMessage());
305           case 5: return new ID(getMessage(), new Integer( 179 ));
306           default: return null;
307        }
308    }
309 
310 
311 }
312