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