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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v26.segment;
035
036// import ca.uhn.hl7v2.model.v26.group.*;
037import ca.uhn.hl7v2.model.v26.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047/**
048 *<p>Represents an HL7 MFA message segment (Master File Acknowledgment). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>MFA-1: Record-Level Event Code (ID) <b> </b>
052     * <li>MFA-2: MFN Control ID (ST) <b>optional </b>
053     * <li>MFA-3: Event Completion Date/Time (DTM) <b>optional </b>
054     * <li>MFA-4: MFN Record Level Error Return (CWE) <b> </b>
055     * <li>MFA-5: Primary Key Value - MFA (Varies) <b> repeating</b>
056     * <li>MFA-6: Primary Key Value Type - MFA (ID) <b> repeating</b>
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class MFA extends AbstractSegment {
061
062    /** 
063     * Creates a new MFA segment
064     */
065    public MFA(Group parent, ModelClassFactory factory) {
066       super(parent, factory);
067       init(factory);
068    }
069
070    private void init(ModelClassFactory factory) {
071       try {
072                                              this.add(ID.class, true, 1, 3, new Object[]{ getMessage(), new Integer(180) }, "Record-Level Event Code");
073                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "MFN Control ID");
074                                  this.add(DTM.class, false, 1, 24, new Object[]{ getMessage() }, "Event Completion Date/Time");
075                                  this.add(CWE.class, true, 1, 250, new Object[]{ getMessage() }, "MFN Record Level Error Return");
076                                  this.add(Varies.class, true, 0, 250, new Object[]{ getMessage() }, "Primary Key Value - MFA");
077                                              this.add(ID.class, true, 0, 3, new Object[]{ getMessage(), new Integer(355) }, "Primary Key Value Type - MFA");
078       } catch(HL7Exception e) {
079          log.error("Unexpected error creating MFA - this is probably a bug in the source code generator.", e);
080       }
081    }
082
083
084
085    /**
086     * Returns
087     * MFA-1: "Record-Level Event Code" - creates it if necessary
088     */
089    public ID getRecordLevelEventCode() { 
090                ID retVal = this.getTypedField(1, 0);
091                return retVal;
092    }
093    
094    /**
095     * Returns
096     * MFA-1: "Record-Level Event Code" - creates it if necessary
097     */
098    public ID getMfa1_RecordLevelEventCode() { 
099                ID retVal = this.getTypedField(1, 0);
100                return retVal;
101    }
102
103
104
105    /**
106     * Returns
107     * MFA-2: "MFN Control ID" - creates it if necessary
108     */
109    public ST getMFNControlID() { 
110                ST retVal = this.getTypedField(2, 0);
111                return retVal;
112    }
113    
114    /**
115     * Returns
116     * MFA-2: "MFN Control ID" - creates it if necessary
117     */
118    public ST getMfa2_MFNControlID() { 
119                ST retVal = this.getTypedField(2, 0);
120                return retVal;
121    }
122
123
124
125    /**
126     * Returns
127     * MFA-3: "Event Completion Date/Time" - creates it if necessary
128     */
129    public DTM getEventCompletionDateTime() { 
130                DTM retVal = this.getTypedField(3, 0);
131                return retVal;
132    }
133    
134    /**
135     * Returns
136     * MFA-3: "Event Completion Date/Time" - creates it if necessary
137     */
138    public DTM getMfa3_EventCompletionDateTime() { 
139                DTM retVal = this.getTypedField(3, 0);
140                return retVal;
141    }
142
143
144
145    /**
146     * Returns
147     * MFA-4: "MFN Record Level Error Return" - creates it if necessary
148     */
149    public CWE getMFNRecordLevelErrorReturn() { 
150                CWE retVal = this.getTypedField(4, 0);
151                return retVal;
152    }
153    
154    /**
155     * Returns
156     * MFA-4: "MFN Record Level Error Return" - creates it if necessary
157     */
158    public CWE getMfa4_MFNRecordLevelErrorReturn() { 
159                CWE retVal = this.getTypedField(4, 0);
160                return retVal;
161    }
162
163
164    /**
165     * Returns all repetitions of Primary Key Value - MFA (MFA-5).
166     */
167    public Varies[] getPrimaryKeyValueMFA() {
168        Varies[] retVal = this.getTypedField(5, new Varies[0]);
169        return retVal;
170    }
171
172
173    /**
174     * Returns all repetitions of Primary Key Value - MFA (MFA-5).
175     */
176    public Varies[] getMfa5_PrimaryKeyValueMFA() {
177        Varies[] retVal = this.getTypedField(5, new Varies[0]);
178        return retVal;
179    }
180
181
182    /**
183     * Returns a count of the current number of repetitions of Primary Key Value - MFA (MFA-5).
184     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
185     * it will return zero.
186     */
187    public int getPrimaryKeyValueMFAReps() {
188        return this.getReps(5);
189    }
190
191
192    /**
193     * Returns a specific repetition of
194     * MFA-5: "Primary Key Value - MFA" - creates it if necessary
195     *
196     * @param rep The repetition index (0-indexed)
197     */
198    public Varies getPrimaryKeyValueMFA(int rep) { 
199                Varies retVal = this.getTypedField(5, rep);
200                return retVal;
201    }
202
203    /**
204     * Returns a specific repetition of
205     * MFA-5: "Primary Key Value - MFA" - creates it if necessary
206     *
207     * @param rep The repetition index (0-indexed)
208     */
209    public Varies getMfa5_PrimaryKeyValueMFA(int rep) { 
210                Varies retVal = this.getTypedField(5, rep);
211                return retVal;
212    }
213
214    /**
215     * Returns a count of the current number of repetitions of Primary Key Value - MFA (MFA-5).
216     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
217     * it will return zero.
218     */
219    public int getMfa5_PrimaryKeyValueMFAReps() {
220        return this.getReps(5);
221    }
222
223
224    /**
225     * Inserts a repetition of
226     * MFA-5: "Primary Key Value - MFA" at a specific index
227     *
228     * @param rep The repetition index (0-indexed)
229     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
230     */
231    public Varies insertPrimaryKeyValueMFA(int rep) throws HL7Exception { 
232        return (Varies) super.insertRepetition(5, rep);
233    }
234
235
236    /**
237     * Inserts a repetition of
238     * MFA-5: "Primary Key Value - MFA" at a specific index
239     *
240     * @param rep The repetition index (0-indexed)
241     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
242     */
243    public Varies insertMfa5_PrimaryKeyValueMFA(int rep) throws HL7Exception { 
244        return (Varies) super.insertRepetition(5, rep);
245    }
246
247
248    /**
249     * Removes a repetition of
250     * MFA-5: "Primary Key Value - MFA" at a specific index
251     *
252     * @param rep The repetition index (0-indexed)
253     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
254     */
255    public Varies removePrimaryKeyValueMFA(int rep) throws HL7Exception { 
256        return (Varies) super.removeRepetition(5, rep);
257    }
258
259
260    /**
261     * Removes a repetition of
262     * MFA-5: "Primary Key Value - MFA" at a specific index
263     *
264     * @param rep The repetition index (0-indexed)
265     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
266     */
267    public Varies removeMfa5_PrimaryKeyValueMFA(int rep) throws HL7Exception { 
268        return (Varies) super.removeRepetition(5, rep);
269    }
270
271
272
273    /**
274     * Returns all repetitions of Primary Key Value Type - MFA (MFA-6).
275     */
276    public ID[] getPrimaryKeyValueTypeMFA() {
277        ID[] retVal = this.getTypedField(6, new ID[0]);
278        return retVal;
279    }
280
281
282    /**
283     * Returns all repetitions of Primary Key Value Type - MFA (MFA-6).
284     */
285    public ID[] getMfa6_PrimaryKeyValueTypeMFA() {
286        ID[] retVal = this.getTypedField(6, new ID[0]);
287        return retVal;
288    }
289
290
291    /**
292     * Returns a count of the current number of repetitions of Primary Key Value Type - MFA (MFA-6).
293     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
294     * it will return zero.
295     */
296    public int getPrimaryKeyValueTypeMFAReps() {
297        return this.getReps(6);
298    }
299
300
301    /**
302     * Returns a specific repetition of
303     * MFA-6: "Primary Key Value Type - MFA" - creates it if necessary
304     *
305     * @param rep The repetition index (0-indexed)
306     */
307    public ID getPrimaryKeyValueTypeMFA(int rep) { 
308                ID retVal = this.getTypedField(6, rep);
309                return retVal;
310    }
311
312    /**
313     * Returns a specific repetition of
314     * MFA-6: "Primary Key Value Type - MFA" - creates it if necessary
315     *
316     * @param rep The repetition index (0-indexed)
317     */
318    public ID getMfa6_PrimaryKeyValueTypeMFA(int rep) { 
319                ID retVal = this.getTypedField(6, rep);
320                return retVal;
321    }
322
323    /**
324     * Returns a count of the current number of repetitions of Primary Key Value Type - MFA (MFA-6).
325     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
326     * it will return zero.
327     */
328    public int getMfa6_PrimaryKeyValueTypeMFAReps() {
329        return this.getReps(6);
330    }
331
332
333    /**
334     * Inserts a repetition of
335     * MFA-6: "Primary Key Value Type - MFA" at a specific index
336     *
337     * @param rep The repetition index (0-indexed)
338     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
339     */
340    public ID insertPrimaryKeyValueTypeMFA(int rep) throws HL7Exception { 
341        return (ID) super.insertRepetition(6, rep);
342    }
343
344
345    /**
346     * Inserts a repetition of
347     * MFA-6: "Primary Key Value Type - MFA" at a specific index
348     *
349     * @param rep The repetition index (0-indexed)
350     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
351     */
352    public ID insertMfa6_PrimaryKeyValueTypeMFA(int rep) throws HL7Exception { 
353        return (ID) super.insertRepetition(6, rep);
354    }
355
356
357    /**
358     * Removes a repetition of
359     * MFA-6: "Primary Key Value Type - MFA" at a specific index
360     *
361     * @param rep The repetition index (0-indexed)
362     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
363     */
364    public ID removePrimaryKeyValueTypeMFA(int rep) throws HL7Exception { 
365        return (ID) super.removeRepetition(6, rep);
366    }
367
368
369    /**
370     * Removes a repetition of
371     * MFA-6: "Primary Key Value Type - MFA" at a specific index
372     *
373     * @param rep The repetition index (0-indexed)
374     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
375     */
376    public ID removeMfa6_PrimaryKeyValueTypeMFA(int rep) throws HL7Exception { 
377        return (ID) super.removeRepetition(6, rep);
378    }
379
380
381
382
383
384
385    /** {@inheritDoc} */   
386    protected Type createNewTypeWithoutReflection(int field) {
387       switch (field) {
388          case 0: return new ID(getMessage(), new Integer( 180 ));
389          case 1: return new ST(getMessage());
390          case 2: return new DTM(getMessage());
391          case 3: return new CWE(getMessage());
392          case 4: return new Varies(getMessage());
393          case 5: return new ID(getMessage(), new Integer( 355 ));
394          default: return null;
395       }
396   }
397
398
399}
400