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 RCP message segment (Response Control Parameter). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>RCP-1: Query Priority (ID) <b>optional </b>
052     * <li>RCP-2: Quantity Limited Request (CQ) <b>optional </b>
053     * <li>RCP-3: Response Modality (CNE) <b>optional </b>
054     * <li>RCP-4: Execution and Delivery Time (DTM) <b>optional </b>
055     * <li>RCP-5: Modify Indicator (ID) <b>optional </b>
056     * <li>RCP-6: Sort-by Field (SRT) <b>optional repeating</b>
057     * <li>RCP-7: Segment group inclusion (ID) <b>optional repeating</b>
058 * </ul>
059 */
060@SuppressWarnings("unused")
061public class RCP extends AbstractSegment {
062
063    /** 
064     * Creates a new RCP segment
065     */
066    public RCP(Group parent, ModelClassFactory factory) {
067       super(parent, factory);
068       init(factory);
069    }
070
071    private void init(ModelClassFactory factory) {
072       try {
073                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(91) }, "Query Priority");
074                                  this.add(CQ.class, false, 1, 10, new Object[]{ getMessage() }, "Quantity Limited Request");
075                                  this.add(CNE.class, false, 1, 250, new Object[]{ getMessage() }, "Response Modality");
076                                  this.add(DTM.class, false, 1, 24, new Object[]{ getMessage() }, "Execution and Delivery Time");
077                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(395) }, "Modify Indicator");
078                                  this.add(SRT.class, false, 0, 512, new Object[]{ getMessage() }, "Sort-by Field");
079                                              this.add(ID.class, false, 0, 256, new Object[]{ getMessage(), new Integer(391) }, "Segment group inclusion");
080       } catch(HL7Exception e) {
081          log.error("Unexpected error creating RCP - this is probably a bug in the source code generator.", e);
082       }
083    }
084
085
086
087    /**
088     * Returns
089     * RCP-1: "Query Priority" - creates it if necessary
090     */
091    public ID getQueryPriority() { 
092                ID retVal = this.getTypedField(1, 0);
093                return retVal;
094    }
095    
096    /**
097     * Returns
098     * RCP-1: "Query Priority" - creates it if necessary
099     */
100    public ID getRcp1_QueryPriority() { 
101                ID retVal = this.getTypedField(1, 0);
102                return retVal;
103    }
104
105
106
107    /**
108     * Returns
109     * RCP-2: "Quantity Limited Request" - creates it if necessary
110     */
111    public CQ getQuantityLimitedRequest() { 
112                CQ retVal = this.getTypedField(2, 0);
113                return retVal;
114    }
115    
116    /**
117     * Returns
118     * RCP-2: "Quantity Limited Request" - creates it if necessary
119     */
120    public CQ getRcp2_QuantityLimitedRequest() { 
121                CQ retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124
125
126
127    /**
128     * Returns
129     * RCP-3: "Response Modality" - creates it if necessary
130     */
131    public CNE getResponseModality() { 
132                CNE retVal = this.getTypedField(3, 0);
133                return retVal;
134    }
135    
136    /**
137     * Returns
138     * RCP-3: "Response Modality" - creates it if necessary
139     */
140    public CNE getRcp3_ResponseModality() { 
141                CNE retVal = this.getTypedField(3, 0);
142                return retVal;
143    }
144
145
146
147    /**
148     * Returns
149     * RCP-4: "Execution and Delivery Time" - creates it if necessary
150     */
151    public DTM getExecutionAndDeliveryTime() { 
152                DTM retVal = this.getTypedField(4, 0);
153                return retVal;
154    }
155    
156    /**
157     * Returns
158     * RCP-4: "Execution and Delivery Time" - creates it if necessary
159     */
160    public DTM getRcp4_ExecutionAndDeliveryTime() { 
161                DTM retVal = this.getTypedField(4, 0);
162                return retVal;
163    }
164
165
166
167    /**
168     * Returns
169     * RCP-5: "Modify Indicator" - creates it if necessary
170     */
171    public ID getModifyIndicator() { 
172                ID retVal = this.getTypedField(5, 0);
173                return retVal;
174    }
175    
176    /**
177     * Returns
178     * RCP-5: "Modify Indicator" - creates it if necessary
179     */
180    public ID getRcp5_ModifyIndicator() { 
181                ID retVal = this.getTypedField(5, 0);
182                return retVal;
183    }
184
185
186    /**
187     * Returns all repetitions of Sort-by Field (RCP-6).
188     */
189    public SRT[] getSortByField() {
190        SRT[] retVal = this.getTypedField(6, new SRT[0]);
191        return retVal;
192    }
193
194
195    /**
196     * Returns all repetitions of Sort-by Field (RCP-6).
197     */
198    public SRT[] getRcp6_SortByField() {
199        SRT[] retVal = this.getTypedField(6, new SRT[0]);
200        return retVal;
201    }
202
203
204    /**
205     * Returns a count of the current number of repetitions of Sort-by Field (RCP-6).
206     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
207     * it will return zero.
208     */
209    public int getSortByFieldReps() {
210        return this.getReps(6);
211    }
212
213
214    /**
215     * Returns a specific repetition of
216     * RCP-6: "Sort-by Field" - creates it if necessary
217     *
218     * @param rep The repetition index (0-indexed)
219     */
220    public SRT getSortByField(int rep) { 
221                SRT retVal = this.getTypedField(6, rep);
222                return retVal;
223    }
224
225    /**
226     * Returns a specific repetition of
227     * RCP-6: "Sort-by Field" - creates it if necessary
228     *
229     * @param rep The repetition index (0-indexed)
230     */
231    public SRT getRcp6_SortByField(int rep) { 
232                SRT retVal = this.getTypedField(6, rep);
233                return retVal;
234    }
235
236    /**
237     * Returns a count of the current number of repetitions of Sort-by Field (RCP-6).
238     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
239     * it will return zero.
240     */
241    public int getRcp6_SortByFieldReps() {
242        return this.getReps(6);
243    }
244
245
246    /**
247     * Inserts a repetition of
248     * RCP-6: "Sort-by Field" at a specific index
249     *
250     * @param rep The repetition index (0-indexed)
251     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
252     */
253    public SRT insertSortByField(int rep) throws HL7Exception { 
254        return (SRT) super.insertRepetition(6, rep);
255    }
256
257
258    /**
259     * Inserts a repetition of
260     * RCP-6: "Sort-by Field" at a specific index
261     *
262     * @param rep The repetition index (0-indexed)
263     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
264     */
265    public SRT insertRcp6_SortByField(int rep) throws HL7Exception { 
266        return (SRT) super.insertRepetition(6, rep);
267    }
268
269
270    /**
271     * Removes a repetition of
272     * RCP-6: "Sort-by Field" at a specific index
273     *
274     * @param rep The repetition index (0-indexed)
275     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
276     */
277    public SRT removeSortByField(int rep) throws HL7Exception { 
278        return (SRT) super.removeRepetition(6, rep);
279    }
280
281
282    /**
283     * Removes a repetition of
284     * RCP-6: "Sort-by Field" at a specific index
285     *
286     * @param rep The repetition index (0-indexed)
287     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
288     */
289    public SRT removeRcp6_SortByField(int rep) throws HL7Exception { 
290        return (SRT) super.removeRepetition(6, rep);
291    }
292
293
294
295    /**
296     * Returns all repetitions of Segment group inclusion (RCP-7).
297     */
298    public ID[] getSegmentGroupInclusion() {
299        ID[] retVal = this.getTypedField(7, new ID[0]);
300        return retVal;
301    }
302
303
304    /**
305     * Returns all repetitions of Segment group inclusion (RCP-7).
306     */
307    public ID[] getRcp7_SegmentGroupInclusion() {
308        ID[] retVal = this.getTypedField(7, new ID[0]);
309        return retVal;
310    }
311
312
313    /**
314     * Returns a count of the current number of repetitions of Segment group inclusion (RCP-7).
315     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
316     * it will return zero.
317     */
318    public int getSegmentGroupInclusionReps() {
319        return this.getReps(7);
320    }
321
322
323    /**
324     * Returns a specific repetition of
325     * RCP-7: "Segment group inclusion" - creates it if necessary
326     *
327     * @param rep The repetition index (0-indexed)
328     */
329    public ID getSegmentGroupInclusion(int rep) { 
330                ID retVal = this.getTypedField(7, rep);
331                return retVal;
332    }
333
334    /**
335     * Returns a specific repetition of
336     * RCP-7: "Segment group inclusion" - creates it if necessary
337     *
338     * @param rep The repetition index (0-indexed)
339     */
340    public ID getRcp7_SegmentGroupInclusion(int rep) { 
341                ID retVal = this.getTypedField(7, rep);
342                return retVal;
343    }
344
345    /**
346     * Returns a count of the current number of repetitions of Segment group inclusion (RCP-7).
347     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
348     * it will return zero.
349     */
350    public int getRcp7_SegmentGroupInclusionReps() {
351        return this.getReps(7);
352    }
353
354
355    /**
356     * Inserts a repetition of
357     * RCP-7: "Segment group inclusion" at a specific index
358     *
359     * @param rep The repetition index (0-indexed)
360     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
361     */
362    public ID insertSegmentGroupInclusion(int rep) throws HL7Exception { 
363        return (ID) super.insertRepetition(7, rep);
364    }
365
366
367    /**
368     * Inserts a repetition of
369     * RCP-7: "Segment group inclusion" at a specific index
370     *
371     * @param rep The repetition index (0-indexed)
372     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
373     */
374    public ID insertRcp7_SegmentGroupInclusion(int rep) throws HL7Exception { 
375        return (ID) super.insertRepetition(7, rep);
376    }
377
378
379    /**
380     * Removes a repetition of
381     * RCP-7: "Segment group inclusion" at a specific index
382     *
383     * @param rep The repetition index (0-indexed)
384     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
385     */
386    public ID removeSegmentGroupInclusion(int rep) throws HL7Exception { 
387        return (ID) super.removeRepetition(7, rep);
388    }
389
390
391    /**
392     * Removes a repetition of
393     * RCP-7: "Segment group inclusion" at a specific index
394     *
395     * @param rep The repetition index (0-indexed)
396     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
397     */
398    public ID removeRcp7_SegmentGroupInclusion(int rep) throws HL7Exception { 
399        return (ID) super.removeRepetition(7, rep);
400    }
401
402
403
404
405
406
407    /** {@inheritDoc} */   
408    protected Type createNewTypeWithoutReflection(int field) {
409       switch (field) {
410          case 0: return new ID(getMessage(), new Integer( 91 ));
411          case 1: return new CQ(getMessage());
412          case 2: return new CNE(getMessage());
413          case 3: return new DTM(getMessage());
414          case 4: return new ID(getMessage(), new Integer( 395 ));
415          case 5: return new SRT(getMessage());
416          case 6: return new ID(getMessage(), new Integer( 391 ));
417          default: return null;
418       }
419   }
420
421
422}
423