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.v24.message;
035
036import ca.uhn.hl7v2.model.v24.group.*;
037import ca.uhn.hl7v2.model.v24.segment.*;
038
039import java.util.List;
040
041import ca.uhn.hl7v2.HL7Exception;
042import ca.uhn.hl7v2.parser.ModelClassFactory;
043import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
044import ca.uhn.hl7v2.model.AbstractMessage;
045
046/**
047 * <p>Represents a MFR_M01 message structure (see chapter 8). This structure contains the 
048 * following elements: </p>
049 * <ul>
050                 * <li>1: MSH (Message Header) <b> </b></li>
051                 * <li>2: MSA (Message Acknowledgment) <b> </b></li>
052                 * <li>3: ERR (Error) <b>optional </b></li>
053                 * <li>4: QAK (Query Acknowledgment) <b>optional </b></li>
054                 * <li>5: QRD (Original-Style Query Definition) <b> </b></li>
055                 * <li>6: QRF (Original Style Query Filter) <b>optional </b></li>
056                 * <li>7: MFI (Master File Identification) <b> </b></li>
057                 * <li>8: MFR_M01_MF_QUERY (a Group object) <b> repeating</b></li>
058                 * <li>9: DSC (Continuation Pointer) <b>optional </b></li>
059 * </ul>
060 */
061@SuppressWarnings("unused")
062public class MFR_M01 extends AbstractMessage  {
063
064    /**
065     * Creates a new MFR_M01 message with DefaultModelClassFactory. 
066     */ 
067    public MFR_M01() { 
068       this(new DefaultModelClassFactory());
069    }
070
071    /** 
072     * Creates a new MFR_M01 message with custom ModelClassFactory.
073     */
074    public MFR_M01(ModelClassFactory factory) {
075       super(factory);
076       init(factory);
077    }
078
079    private void init(ModelClassFactory factory) {
080       try {
081                          this.add(MSH.class, true, false);
082                          this.add(MSA.class, true, false);
083                          this.add(ERR.class, false, false);
084                          this.add(QAK.class, false, false);
085                          this.add(QRD.class, true, false);
086                          this.add(QRF.class, false, false);
087                          this.add(MFI.class, true, false);
088                          this.add(MFR_M01_MF_QUERY.class, true, true);
089                          this.add(DSC.class, false, false);
090       } catch(HL7Exception e) {
091          log.error("Unexpected error creating MFR_M01 - this is probably a bug in the source code generator.", e);
092       }
093    }
094
095    /** 
096     * Returns "2.4"
097     */
098    public String getVersion() {
099       return "2.4";
100    }
101
102
103
104    /**
105     * Returns
106     * MSH (Message Header) - creates it if necessary
107     */
108    public MSH getMSH() { 
109       return getTyped("MSH", MSH.class);
110    }
111
112
113
114
115    /**
116     * Returns
117     * MSA (Message Acknowledgment) - creates it if necessary
118     */
119    public MSA getMSA() { 
120       return getTyped("MSA", MSA.class);
121    }
122
123
124
125
126    /**
127     * Returns
128     * ERR (Error) - creates it if necessary
129     */
130    public ERR getERR() { 
131       return getTyped("ERR", ERR.class);
132    }
133
134
135
136
137    /**
138     * Returns
139     * QAK (Query Acknowledgment) - creates it if necessary
140     */
141    public QAK getQAK() { 
142       return getTyped("QAK", QAK.class);
143    }
144
145
146
147
148    /**
149     * Returns
150     * QRD (Original-Style Query Definition) - creates it if necessary
151     */
152    public QRD getQRD() { 
153       return getTyped("QRD", QRD.class);
154    }
155
156
157
158
159    /**
160     * Returns
161     * QRF (Original Style Query Filter) - creates it if necessary
162     */
163    public QRF getQRF() { 
164       return getTyped("QRF", QRF.class);
165    }
166
167
168
169
170    /**
171     * Returns
172     * MFI (Master File Identification) - creates it if necessary
173     */
174    public MFI getMFI() { 
175       return getTyped("MFI", MFI.class);
176    }
177
178
179
180
181    /**
182     * Returns
183     * the first repetition of 
184     * MF_QUERY (a Group object) - creates it if necessary
185     */
186    public MFR_M01_MF_QUERY getMF_QUERY() { 
187       return getTyped("MF_QUERY", MFR_M01_MF_QUERY.class);
188    }
189
190
191    /**
192     * Returns a specific repetition of
193     * MF_QUERY (a Group object) - creates it if necessary
194     *
195     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
196     * @throws HL7Exception if the repetition requested is more than one 
197     *     greater than the number of existing repetitions.
198     */
199    public MFR_M01_MF_QUERY getMF_QUERY(int rep) { 
200       return getTyped("MF_QUERY", rep, MFR_M01_MF_QUERY.class);
201    }
202
203    /** 
204     * Returns the number of existing repetitions of MF_QUERY 
205     */ 
206    public int getMF_QUERYReps() { 
207        return getReps("MF_QUERY");
208    } 
209
210    /** 
211     * <p>
212     * Returns a non-modifiable List containing all current existing repetitions of MF_QUERY.
213     * <p>
214     * <p>
215     * Note that unlike {@link #getMF_QUERY()}, this method will not create any reps
216     * if none are already present, so an empty list may be returned.
217     * </p>
218     */ 
219    public List<MFR_M01_MF_QUERY> getMF_QUERYAll() throws HL7Exception {
220        return getAllAsList("MF_QUERY", MFR_M01_MF_QUERY.class);
221    } 
222
223    /**
224     * Inserts a specific repetition of MF_QUERY (a Group object)
225     * @see AbstractGroup#insertRepetition(Structure, int) 
226     */
227    public void insertMF_QUERY(MFR_M01_MF_QUERY structure, int rep) throws HL7Exception { 
228       super.insertRepetition( "MF_QUERY", structure, rep);
229    }
230
231
232    /**
233     * Inserts a specific repetition of MF_QUERY (a Group object)
234     * @see AbstractGroup#insertRepetition(Structure, int) 
235     */
236    public MFR_M01_MF_QUERY insertMF_QUERY(int rep) throws HL7Exception { 
237       return (MFR_M01_MF_QUERY)super.insertRepetition("MF_QUERY", rep);
238    }
239
240
241    /**
242     * Removes a specific repetition of MF_QUERY (a Group object)
243     * @see AbstractGroup#removeRepetition(String, int) 
244     */
245    public MFR_M01_MF_QUERY removeMF_QUERY(int rep) throws HL7Exception { 
246       return (MFR_M01_MF_QUERY)super.removeRepetition("MF_QUERY", rep);
247    }
248
249
250
251    /**
252     * Returns
253     * DSC (Continuation Pointer) - creates it if necessary
254     */
255    public DSC getDSC() { 
256       return getTyped("DSC", DSC.class);
257    }
258
259
260
261
262}
263