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.v24.group;
009    
010    import ca.uhn.hl7v2.model.v24.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 NMR_N01_CLOCK_AND_STATS_WITH_NOTES_ALT 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: NCK (System clock) <b>optional </b></li>
028                     * <li>2: NTE (Notes and Comments) <b>optional repeating</b></li>
029                     * <li>3: NST (Application control level statistics) <b>optional </b></li>
030                     * <li>4: NTE (Notes and Comments) <b>optional repeating</b></li>
031                     * <li>5: NSC (Application status change) <b>optional </b></li>
032                     * <li>6: NTE (Notes and Comments) <b>optional repeating</b></li>
033     * </ul>
034     */
035    public class NMR_N01_CLOCK_AND_STATS_WITH_NOTES_ALT extends AbstractGroup {
036    
037        /** 
038         * Creates a new NMR_N01_CLOCK_AND_STATS_WITH_NOTES_ALT group
039         */
040        public NMR_N01_CLOCK_AND_STATS_WITH_NOTES_ALT(Group parent, ModelClassFactory factory) {
041           super(parent, factory);
042           init(factory);
043        }
044    
045        private void init(ModelClassFactory factory) {
046           try {
047                              this.add(NCK.class, false, false);
048                              this.add(NTE.class, false, true);
049                              this.add(NST.class, false, false);
050                              this.add(NTE.class, false, true);
051                              this.add(NSC.class, false, false);
052                              this.add(NTE.class, false, true);
053           } catch(HL7Exception e) {
054              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating NMR_N01_CLOCK_AND_STATS_WITH_NOTES_ALT - this is probably a bug in the source code generator.", e);
055           }
056        }
057    
058        /** 
059         * Returns "2.4"
060         */
061        public String getVersion() {
062           return "2.4";
063        }
064    
065    
066    
067        /**
068         * Returns
069         * NCK (System clock) - creates it if necessary
070         */
071        public NCK getNCK() { 
072           NCK ret = null;
073           try {
074              ret = (NCK)this.get("NCK");
075           } catch(HL7Exception e) {
076              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
077              throw new RuntimeException(e);
078           }
079           return ret;
080        }
081    
082    
083    
084    
085        /**
086         * Returns
087         * the first repetition of 
088         * NTE (Notes and Comments) - creates it if necessary
089         */
090        public NTE getNTE() { 
091           NTE ret = null;
092           try {
093              ret = (NTE)this.get("NTE");
094           } catch(HL7Exception e) {
095              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
096              throw new RuntimeException(e);
097           }
098           return ret;
099        }
100    
101    
102        /**
103         * Returns a specific repetition of
104         * NTE (Notes and Comments) - creates it if necessary
105         *
106         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
107         * @throws HL7Exception if the repetition requested is more than one 
108         *     greater than the number of existing repetitions.
109         */
110        public NTE getNTE(int rep) { 
111           NTE ret = null;
112           try {
113              ret = (NTE)this.get("NTE", rep);
114           } catch(HL7Exception e) {
115              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
116              throw new RuntimeException(e);
117           }
118           return ret;
119        }
120    
121        /** 
122         * Returns the number of existing repetitions of NTE 
123         */ 
124        public int getNTEReps() { 
125            int reps = -1; 
126            try { 
127                reps = this.getAll("NTE").length; 
128            } catch (HL7Exception e) { 
129                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
130                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
131                throw new RuntimeException(message);
132            } 
133            return reps; 
134        } 
135    
136        /**
137         * Inserts a specific repetition of NTE (Notes and Comments)
138         * @see AbstractGroup#insertRepetition(Structure, int) 
139         */
140        public void insertNTE(NTE structure, int rep) throws HL7Exception { 
141           super.insertRepetition("NTE", structure, rep);
142        }
143    
144    
145        /**
146         * Inserts a specific repetition of NTE (Notes and Comments)
147         * @see AbstractGroup#insertRepetition(Structure, int) 
148         */
149        public NTE insertNTE(int rep) throws HL7Exception { 
150           return (NTE)super.insertRepetition("NTE", rep);
151        }
152    
153    
154        /**
155         * Removes a specific repetition of NTE (Notes and Comments)
156         * @see AbstractGroup#removeRepetition(String, int) 
157         */
158        public NTE removeNTE(int rep) throws HL7Exception { 
159           return (NTE)super.removeRepetition("NTE", rep);
160        }
161    
162    
163    
164        /**
165         * Returns
166         * NST (Application control level statistics) - creates it if necessary
167         */
168        public NST getNST() { 
169           NST ret = null;
170           try {
171              ret = (NST)this.get("NST");
172           } catch(HL7Exception e) {
173              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
174              throw new RuntimeException(e);
175           }
176           return ret;
177        }
178    
179    
180    
181    
182        /**
183         * Returns
184         * the first repetition of 
185         * NTE2 (Notes and Comments) - creates it if necessary
186         */
187        public NTE getNTE2() { 
188           NTE ret = null;
189           try {
190              ret = (NTE)this.get("NTE2");
191           } catch(HL7Exception e) {
192              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
193              throw new RuntimeException(e);
194           }
195           return ret;
196        }
197    
198    
199        /**
200         * Returns a specific repetition of
201         * NTE (Notes and Comments) - creates it if necessary
202         *
203         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
204         * @throws HL7Exception if the repetition requested is more than one 
205         *     greater than the number of existing repetitions.
206         */
207        public NTE getNTE2(int rep) { 
208           NTE ret = null;
209           try {
210              ret = (NTE)this.get("NTE2", rep);
211           } catch(HL7Exception e) {
212              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
213              throw new RuntimeException(e);
214           }
215           return ret;
216        }
217    
218        /** 
219         * Returns the number of existing repetitions of NTE2 
220         */ 
221        public int getNTE2Reps() { 
222            int reps = -1; 
223            try { 
224                reps = this.getAll("NTE2").length; 
225            } catch (HL7Exception e) { 
226                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
227                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
228                throw new RuntimeException(message);
229            } 
230            return reps; 
231        } 
232    
233        /**
234         * Inserts a specific repetition of NTE2 (Notes and Comments)
235         * @see AbstractGroup#insertRepetition(Structure, int) 
236         */
237        public void insertNTE2(NTE structure, int rep) throws HL7Exception { 
238           super.insertRepetition("NTE2", structure, rep);
239        }
240    
241    
242        /**
243         * Inserts a specific repetition of NTE2 (Notes and Comments)
244         * @see AbstractGroup#insertRepetition(Structure, int) 
245         */
246        public NTE insertNTE2(int rep) throws HL7Exception { 
247           return (NTE)super.insertRepetition("NTE2", rep);
248        }
249    
250    
251        /**
252         * Removes a specific repetition of NTE2 (Notes and Comments)
253         * @see AbstractGroup#removeRepetition(String, int) 
254         */
255        public NTE removeNTE2(int rep) throws HL7Exception { 
256           return (NTE)super.removeRepetition("NTE2", rep);
257        }
258    
259    
260    
261        /**
262         * Returns
263         * NSC (Application status change) - creates it if necessary
264         */
265        public NSC getNSC() { 
266           NSC ret = null;
267           try {
268              ret = (NSC)this.get("NSC");
269           } catch(HL7Exception e) {
270              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
271              throw new RuntimeException(e);
272           }
273           return ret;
274        }
275    
276    
277    
278    
279        /**
280         * Returns
281         * the first repetition of 
282         * NTE3 (Notes and Comments) - creates it if necessary
283         */
284        public NTE getNTE3() { 
285           NTE ret = null;
286           try {
287              ret = (NTE)this.get("NTE3");
288           } catch(HL7Exception e) {
289              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
290              throw new RuntimeException(e);
291           }
292           return ret;
293        }
294    
295    
296        /**
297         * Returns a specific repetition of
298         * NTE (Notes and Comments) - creates it if necessary
299         *
300         * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
301         * @throws HL7Exception if the repetition requested is more than one 
302         *     greater than the number of existing repetitions.
303         */
304        public NTE getNTE3(int rep) { 
305           NTE ret = null;
306           try {
307              ret = (NTE)this.get("NTE3", rep);
308           } catch(HL7Exception e) {
309              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
310              throw new RuntimeException(e);
311           }
312           return ret;
313        }
314    
315        /** 
316         * Returns the number of existing repetitions of NTE3 
317         */ 
318        public int getNTE3Reps() { 
319            int reps = -1; 
320            try { 
321                reps = this.getAll("NTE3").length; 
322            } catch (HL7Exception e) { 
323                String message = "Unexpected error accessing data - this is probably a bug in the source code generator."; 
324                HapiLogFactory.getHapiLog(this.getClass()).error(message, e); 
325                throw new RuntimeException(message);
326            } 
327            return reps; 
328        } 
329    
330        /**
331         * Inserts a specific repetition of NTE3 (Notes and Comments)
332         * @see AbstractGroup#insertRepetition(Structure, int) 
333         */
334        public void insertNTE3(NTE structure, int rep) throws HL7Exception { 
335           super.insertRepetition("NTE3", structure, rep);
336        }
337    
338    
339        /**
340         * Inserts a specific repetition of NTE3 (Notes and Comments)
341         * @see AbstractGroup#insertRepetition(Structure, int) 
342         */
343        public NTE insertNTE3(int rep) throws HL7Exception { 
344           return (NTE)super.insertRepetition("NTE3", rep);
345        }
346    
347    
348        /**
349         * Removes a specific repetition of NTE3 (Notes and Comments)
350         * @see AbstractGroup#removeRepetition(String, int) 
351         */
352        public NTE removeNTE3(int rep) throws HL7Exception { 
353           return (NTE)super.removeRepetition("NTE3", rep);
354        }
355    
356    
357    
358    }
359