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.group;
035
036import ca.uhn.hl7v2.model.v26.segment.*;
037
038import java.util.List;
039
040import ca.uhn.hl7v2.HL7Exception;
041import ca.uhn.hl7v2.parser.ModelClassFactory;
042import ca.uhn.hl7v2.model.*;
043
044/**
045 * <p>Represents a OPL_O37_ORDER_PRIOR group structure (a Group object).
046 * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
047 * This Group contains the following elements:  
048 * </p>
049 * <ul>
050                 * <li>1: OBR (Observation Request) <b> </b></li>
051                 * <li>2: ORC (Common Order) <b>optional </b></li>
052                 * <li>3: ROL (Role) <b>optional repeating</b></li>
053                 * <li>4: OPL_O37_TIMING (a Group object) <b>optional </b></li>
054                 * <li>5: OBX (Observation/Result) <b> repeating</b></li>
055 * </ul>
056 */
057@SuppressWarnings("unused")
058public class OPL_O37_ORDER_PRIOR extends AbstractGroup {
059
060    /** 
061     * Creates a new OPL_O37_ORDER_PRIOR group
062     */
063    public OPL_O37_ORDER_PRIOR(Group parent, ModelClassFactory factory) {
064       super(parent, factory);
065       init(factory);
066    }
067
068    private void init(ModelClassFactory factory) {
069       try {
070                          this.add(OBR.class, true, false);
071                          this.add(ORC.class, false, false);
072                          this.add(ROL.class, false, true);
073                          this.add(OPL_O37_TIMING.class, false, false);
074                          this.add(OBX.class, true, true);
075       } catch(HL7Exception e) {
076          log.error("Unexpected error creating OPL_O37_ORDER_PRIOR - this is probably a bug in the source code generator.", e);
077       }
078    }
079
080    /** 
081     * Returns "2.6"
082     */
083    public String getVersion() {
084       return "2.6";
085    }
086
087
088
089    /**
090     * Returns
091     * OBR (Observation Request) - creates it if necessary
092     */
093    public OBR getOBR() { 
094       OBR retVal = getTyped("OBR", OBR.class);
095       return retVal;
096    }
097
098
099
100
101    /**
102     * Returns
103     * ORC (Common Order) - creates it if necessary
104     */
105    public ORC getORC() { 
106       ORC retVal = getTyped("ORC", ORC.class);
107       return retVal;
108    }
109
110
111
112
113    /**
114     * Returns
115     * the first repetition of 
116     * ROL (Role) - creates it if necessary
117     */
118    public ROL getROL() { 
119       ROL retVal = getTyped("ROL", ROL.class);
120       return retVal;
121    }
122
123
124    /**
125     * Returns a specific repetition of
126     * ROL (Role) - creates it if necessary
127     *
128     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
129     * @throws HL7Exception if the repetition requested is more than one 
130     *     greater than the number of existing repetitions.
131     */
132    public ROL getROL(int rep) { 
133       ROL retVal = getTyped("ROL", rep, ROL.class);
134       return retVal;
135    }
136
137    /** 
138     * Returns the number of existing repetitions of ROL 
139     */ 
140    public int getROLReps() {  
141        return getReps("ROL");
142    } 
143
144    /** 
145     * <p>
146     * Returns a non-modifiable List containing all current existing repetitions of ROL.
147     * <p>
148     * <p>
149     * Note that unlike {@link #getROL()}, this method will not create any reps
150     * if none are already present, so an empty list may be returned.
151     * </p>
152     */ 
153    public List<ROL> getROLAll() throws HL7Exception {
154        return getAllAsList("ROL", ROL.class);
155    } 
156
157    /**
158     * Inserts a specific repetition of ROL (Role)
159     * @see AbstractGroup#insertRepetition(Structure, int) 
160     */
161    public void insertROL(ROL structure, int rep) throws HL7Exception { 
162       super.insertRepetition("ROL", structure, rep);
163    }
164
165
166    /**
167     * Inserts a specific repetition of ROL (Role)
168     * @see AbstractGroup#insertRepetition(Structure, int) 
169     */
170    public ROL insertROL(int rep) throws HL7Exception { 
171       return (ROL)super.insertRepetition("ROL", rep);
172    }
173
174
175    /**
176     * Removes a specific repetition of ROL (Role)
177     * @see AbstractGroup#removeRepetition(String, int) 
178     */
179    public ROL removeROL(int rep) throws HL7Exception { 
180       return (ROL)super.removeRepetition("ROL", rep);
181    }
182
183
184
185    /**
186     * Returns
187     * TIMING (a Group object) - creates it if necessary
188     */
189    public OPL_O37_TIMING getTIMING() { 
190       OPL_O37_TIMING retVal = getTyped("TIMING", OPL_O37_TIMING.class);
191       return retVal;
192    }
193
194
195
196
197    /**
198     * Returns
199     * the first repetition of 
200     * OBX (Observation/Result) - creates it if necessary
201     */
202    public OBX getOBX() { 
203       OBX retVal = getTyped("OBX", OBX.class);
204       return retVal;
205    }
206
207
208    /**
209     * Returns a specific repetition of
210     * OBX (Observation/Result) - creates it if necessary
211     *
212     * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
213     * @throws HL7Exception if the repetition requested is more than one 
214     *     greater than the number of existing repetitions.
215     */
216    public OBX getOBX(int rep) { 
217       OBX retVal = getTyped("OBX", rep, OBX.class);
218       return retVal;
219    }
220
221    /** 
222     * Returns the number of existing repetitions of OBX 
223     */ 
224    public int getOBXReps() {  
225        return getReps("OBX");
226    } 
227
228    /** 
229     * <p>
230     * Returns a non-modifiable List containing all current existing repetitions of OBX.
231     * <p>
232     * <p>
233     * Note that unlike {@link #getOBX()}, this method will not create any reps
234     * if none are already present, so an empty list may be returned.
235     * </p>
236     */ 
237    public List<OBX> getOBXAll() throws HL7Exception {
238        return getAllAsList("OBX", OBX.class);
239    } 
240
241    /**
242     * Inserts a specific repetition of OBX (Observation/Result)
243     * @see AbstractGroup#insertRepetition(Structure, int) 
244     */
245    public void insertOBX(OBX structure, int rep) throws HL7Exception { 
246       super.insertRepetition("OBX", structure, rep);
247    }
248
249
250    /**
251     * Inserts a specific repetition of OBX (Observation/Result)
252     * @see AbstractGroup#insertRepetition(Structure, int) 
253     */
254    public OBX insertOBX(int rep) throws HL7Exception { 
255       return (OBX)super.insertRepetition("OBX", rep);
256    }
257
258
259    /**
260     * Removes a specific repetition of OBX (Observation/Result)
261     * @see AbstractGroup#removeRepetition(String, int) 
262     */
263    public OBX removeOBX(int rep) throws HL7Exception { 
264       return (OBX)super.removeRepetition("OBX", rep);
265    }
266
267
268
269}
270