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.v231.group;
009    
010    import ca.uhn.hl7v2.model.v231.segment.*;
011    
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.AbstractGroup;
019    import ca.uhn.hl7v2.model.GenericSegment;
020    
021    /**
022     * <p>Represents a CSU_C09_CSSORCOBROBXORCRXARXR group structure (a Group object).
023     * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024     * This Group contains the following elements:  
025     * </p>
026     * <ul>
027                     * <li>1: CSS (CSS - clinical study data schedule segment) <b>optional </b></li>
028                     * <li>2: CSU_C09_ORCOBROBX (a Group object) <b> repeating</b></li>
029                     * <li>3: CSU_C09_ORCRXARXR (a Group object) <b> repeating</b></li>
030     * </ul>
031     */
032    public class CSU_C09_CSSORCOBROBXORCRXARXR extends AbstractGroup {
033    
034        /** 
035         * Creates a new CSU_C09_CSSORCOBROBXORCRXARXR group
036         */
037        public CSU_C09_CSSORCOBROBXORCRXARXR(Group parent, ModelClassFactory factory) {
038           super(parent, factory);
039           init(factory);
040        }
041    
042        private void init(ModelClassFactory factory) {
043           try {
044                              this.add(CSS.class, false, false);
045                              this.add(CSU_C09_ORCOBROBX.class, true, true);
046                              this.add(CSU_C09_ORCRXARXR.class, true, true);
047           } catch(HL7Exception e) {
048              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating CSU_C09_CSSORCOBROBXORCRXARXR - this is probably a bug in the source code generator.", e);
049           }
050        }
051    
052        /** 
053         * Returns "2.3.1"
054         */
055        public String getVersion() {
056           return "2.3.1";
057        }
058    
059    
060    
061        /**
062         * Returns
063         * CSS (CSS - clinical study data schedule segment) - creates it if necessary
064         */
065        public CSS getCSS() { 
066           CSS ret = null;
067           try {
068              ret = (CSS)this.get("CSS");
069           } catch(HL7Exception e) {
070              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
071              throw new RuntimeException(e);
072           }
073           return ret;
074        }
075    
076    
077    
078    
079        /**
080         * Returns
081         * the first repetition of 
082         * ORCOBROBX (a Group object) - creates it if necessary
083         */
084        public CSU_C09_ORCOBROBX getORCOBROBX() { 
085           CSU_C09_ORCOBROBX ret = null;
086           try {
087              ret = (CSU_C09_ORCOBROBX)this.get("ORCOBROBX");
088           } catch(HL7Exception e) {
089              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
090              throw new RuntimeException(e);
091           }
092           return ret;
093        }
094    
095    
096        /**
097         * Returns a specific repetition of
098         * ORCOBROBX (a Group object) - creates it if necessary
099         *
100         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
101         * @throws HL7Exception if the repetition requested is more than one 
102         *     greater than the number of existing repetitions.
103         */
104        public CSU_C09_ORCOBROBX getORCOBROBX(int rep) { 
105           CSU_C09_ORCOBROBX ret = null;
106           try {
107              ret = (CSU_C09_ORCOBROBX)this.get("ORCOBROBX", rep);
108           } catch(HL7Exception e) {
109              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
110              throw new RuntimeException(e);
111           }
112           return ret;
113        }
114    
115        /** 
116         * Returns the number of existing repetitions of ORCOBROBX 
117         */ 
118        public int getORCOBROBXReps() { 
119            int reps = -1; 
120            try { 
121                reps = this.getAll("ORCOBROBX").length; 
122            } catch (HL7Exception e) { 
123                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
124                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
125                throw new RuntimeException(message);
126            } 
127            return reps; 
128        } 
129    
130        /**
131         * Inserts a specific repetition of ORCOBROBX (a Group object)
132         * @see AbstractGroup#insertRepetition(Structure, int) 
133         */
134        public void insertORCOBROBX(CSU_C09_ORCOBROBX structure, int rep) throws HL7Exception { 
135           super.insertRepetition("ORCOBROBX", structure, rep);
136        }
137    
138    
139        /**
140         * Inserts a specific repetition of ORCOBROBX (a Group object)
141         * @see AbstractGroup#insertRepetition(Structure, int) 
142         */
143        public CSU_C09_ORCOBROBX insertORCOBROBX(int rep) throws HL7Exception { 
144           return (CSU_C09_ORCOBROBX)super.insertRepetition("ORCOBROBX", rep);
145        }
146    
147    
148        /**
149         * Removes a specific repetition of ORCOBROBX (a Group object)
150         * @see AbstractGroup#removeRepetition(String, int) 
151         */
152        public CSU_C09_ORCOBROBX removeORCOBROBX(int rep) throws HL7Exception { 
153           return (CSU_C09_ORCOBROBX)super.removeRepetition("ORCOBROBX", rep);
154        }
155    
156    
157    
158        /**
159         * Returns
160         * the first repetition of 
161         * ORCRXARXR (a Group object) - creates it if necessary
162         */
163        public CSU_C09_ORCRXARXR getORCRXARXR() { 
164           CSU_C09_ORCRXARXR ret = null;
165           try {
166              ret = (CSU_C09_ORCRXARXR)this.get("ORCRXARXR");
167           } catch(HL7Exception e) {
168              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
169              throw new RuntimeException(e);
170           }
171           return ret;
172        }
173    
174    
175        /**
176         * Returns a specific repetition of
177         * ORCRXARXR (a Group object) - creates it if necessary
178         *
179         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
180         * @throws HL7Exception if the repetition requested is more than one 
181         *     greater than the number of existing repetitions.
182         */
183        public CSU_C09_ORCRXARXR getORCRXARXR(int rep) { 
184           CSU_C09_ORCRXARXR ret = null;
185           try {
186              ret = (CSU_C09_ORCRXARXR)this.get("ORCRXARXR", rep);
187           } catch(HL7Exception e) {
188              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
189              throw new RuntimeException(e);
190           }
191           return ret;
192        }
193    
194        /** 
195         * Returns the number of existing repetitions of ORCRXARXR 
196         */ 
197        public int getORCRXARXRReps() { 
198            int reps = -1; 
199            try { 
200                reps = this.getAll("ORCRXARXR").length; 
201            } catch (HL7Exception e) { 
202                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
203                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
204                throw new RuntimeException(message);
205            } 
206            return reps; 
207        } 
208    
209        /**
210         * Inserts a specific repetition of ORCRXARXR (a Group object)
211         * @see AbstractGroup#insertRepetition(Structure, int) 
212         */
213        public void insertORCRXARXR(CSU_C09_ORCRXARXR structure, int rep) throws HL7Exception { 
214           super.insertRepetition("ORCRXARXR", structure, rep);
215        }
216    
217    
218        /**
219         * Inserts a specific repetition of ORCRXARXR (a Group object)
220         * @see AbstractGroup#insertRepetition(Structure, int) 
221         */
222        public CSU_C09_ORCRXARXR insertORCRXARXR(int rep) throws HL7Exception { 
223           return (CSU_C09_ORCRXARXR)super.insertRepetition("ORCRXARXR", rep);
224        }
225    
226    
227        /**
228         * Removes a specific repetition of ORCRXARXR (a Group object)
229         * @see AbstractGroup#removeRepetition(String, int) 
230         */
231        public CSU_C09_ORCRXARXR removeORCRXARXR(int rep) throws HL7Exception { 
232           return (CSU_C09_ORCRXARXR)super.removeRepetition("ORCRXARXR", rep);
233        }
234    
235    
236    
237    }
238