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 APR message segment (Appointment Preferences). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>APR-1: Time Selection Criteria (SCV) <b>optional repeating</b>
053     * <li>APR-2: Resource Selection Criteria (SCV) <b>optional repeating</b>
054     * <li>APR-3: Location Selection Criteria (SCV) <b>optional repeating</b>
055     * <li>APR-4: Slot Spacing Criteria (NM) <b>optional </b>
056     * <li>APR-5: Filler Override Criteria (SCV) <b>optional repeating</b>
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class APR extends AbstractSegment {
061
062    /** 
063     * Creates a new APR segment
064     */
065    public APR(Group parent, ModelClassFactory factory) {
066       super(parent, factory);
067       init(factory);
068    }
069
070    private void init(ModelClassFactory factory) {
071       try {
072                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Time Selection Criteria");
073                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Resource Selection Criteria");
074                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Location Selection Criteria");
075                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Slot Spacing Criteria");
076                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Filler Override Criteria");
077       } catch(HL7Exception e) {
078          log.error("Unexpected error creating APR - this is probably a bug in the source code generator.", e);
079       }
080    }
081
082
083    /**
084     * Returns all repetitions of Time Selection Criteria (APR-1).
085     */
086    public SCV[] getTimeSelectionCriteria() {
087        SCV[] retVal = this.getTypedField(1, new SCV[0]);
088        return retVal;
089    }
090
091
092    /**
093     * Returns all repetitions of Time Selection Criteria (APR-1).
094     */
095    public SCV[] getApr1_TimeSelectionCriteria() {
096        SCV[] retVal = this.getTypedField(1, new SCV[0]);
097        return retVal;
098    }
099
100
101    /**
102     * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
103     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
104     * it will return zero.
105     */
106    public int getTimeSelectionCriteriaReps() {
107        return this.getReps(1);
108    }
109
110
111    /**
112     * Returns a specific repetition of
113     * APR-1: "Time Selection Criteria" - creates it if necessary
114     *
115     * @param rep The repetition index (0-indexed)
116     */
117    public SCV getTimeSelectionCriteria(int rep) { 
118                SCV retVal = this.getTypedField(1, rep);
119                return retVal;
120    }
121
122    /**
123     * Returns a specific repetition of
124     * APR-1: "Time Selection Criteria" - creates it if necessary
125     *
126     * @param rep The repetition index (0-indexed)
127     */
128    public SCV getApr1_TimeSelectionCriteria(int rep) { 
129                SCV retVal = this.getTypedField(1, rep);
130                return retVal;
131    }
132
133    /**
134     * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
135     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
136     * it will return zero.
137     */
138    public int getApr1_TimeSelectionCriteriaReps() {
139        return this.getReps(1);
140    }
141
142
143    /**
144     * Inserts a repetition of
145     * APR-1: "Time Selection Criteria" at a specific index
146     *
147     * @param rep The repetition index (0-indexed)
148     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
149     */
150    public SCV insertTimeSelectionCriteria(int rep) throws HL7Exception { 
151        return (SCV) super.insertRepetition(1, rep);
152    }
153
154
155    /**
156     * Inserts a repetition of
157     * APR-1: "Time Selection Criteria" at a specific index
158     *
159     * @param rep The repetition index (0-indexed)
160     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
161     */
162    public SCV insertApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
163        return (SCV) super.insertRepetition(1, rep);
164    }
165
166
167    /**
168     * Removes a repetition of
169     * APR-1: "Time Selection Criteria" at a specific index
170     *
171     * @param rep The repetition index (0-indexed)
172     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
173     */
174    public SCV removeTimeSelectionCriteria(int rep) throws HL7Exception { 
175        return (SCV) super.removeRepetition(1, rep);
176    }
177
178
179    /**
180     * Removes a repetition of
181     * APR-1: "Time Selection Criteria" at a specific index
182     *
183     * @param rep The repetition index (0-indexed)
184     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
185     */
186    public SCV removeApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
187        return (SCV) super.removeRepetition(1, rep);
188    }
189
190
191
192    /**
193     * Returns all repetitions of Resource Selection Criteria (APR-2).
194     */
195    public SCV[] getResourceSelectionCriteria() {
196        SCV[] retVal = this.getTypedField(2, new SCV[0]);
197        return retVal;
198    }
199
200
201    /**
202     * Returns all repetitions of Resource Selection Criteria (APR-2).
203     */
204    public SCV[] getApr2_ResourceSelectionCriteria() {
205        SCV[] retVal = this.getTypedField(2, new SCV[0]);
206        return retVal;
207    }
208
209
210    /**
211     * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
212     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
213     * it will return zero.
214     */
215    public int getResourceSelectionCriteriaReps() {
216        return this.getReps(2);
217    }
218
219
220    /**
221     * Returns a specific repetition of
222     * APR-2: "Resource Selection Criteria" - creates it if necessary
223     *
224     * @param rep The repetition index (0-indexed)
225     */
226    public SCV getResourceSelectionCriteria(int rep) { 
227                SCV retVal = this.getTypedField(2, rep);
228                return retVal;
229    }
230
231    /**
232     * Returns a specific repetition of
233     * APR-2: "Resource Selection Criteria" - creates it if necessary
234     *
235     * @param rep The repetition index (0-indexed)
236     */
237    public SCV getApr2_ResourceSelectionCriteria(int rep) { 
238                SCV retVal = this.getTypedField(2, rep);
239                return retVal;
240    }
241
242    /**
243     * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
244     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
245     * it will return zero.
246     */
247    public int getApr2_ResourceSelectionCriteriaReps() {
248        return this.getReps(2);
249    }
250
251
252    /**
253     * Inserts a repetition of
254     * APR-2: "Resource Selection Criteria" at a specific index
255     *
256     * @param rep The repetition index (0-indexed)
257     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
258     */
259    public SCV insertResourceSelectionCriteria(int rep) throws HL7Exception { 
260        return (SCV) super.insertRepetition(2, rep);
261    }
262
263
264    /**
265     * Inserts a repetition of
266     * APR-2: "Resource Selection Criteria" at a specific index
267     *
268     * @param rep The repetition index (0-indexed)
269     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
270     */
271    public SCV insertApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
272        return (SCV) super.insertRepetition(2, rep);
273    }
274
275
276    /**
277     * Removes a repetition of
278     * APR-2: "Resource Selection Criteria" at a specific index
279     *
280     * @param rep The repetition index (0-indexed)
281     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
282     */
283    public SCV removeResourceSelectionCriteria(int rep) throws HL7Exception { 
284        return (SCV) super.removeRepetition(2, rep);
285    }
286
287
288    /**
289     * Removes a repetition of
290     * APR-2: "Resource Selection Criteria" at a specific index
291     *
292     * @param rep The repetition index (0-indexed)
293     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
294     */
295    public SCV removeApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
296        return (SCV) super.removeRepetition(2, rep);
297    }
298
299
300
301    /**
302     * Returns all repetitions of Location Selection Criteria (APR-3).
303     */
304    public SCV[] getLocationSelectionCriteria() {
305        SCV[] retVal = this.getTypedField(3, new SCV[0]);
306        return retVal;
307    }
308
309
310    /**
311     * Returns all repetitions of Location Selection Criteria (APR-3).
312     */
313    public SCV[] getApr3_LocationSelectionCriteria() {
314        SCV[] retVal = this.getTypedField(3, new SCV[0]);
315        return retVal;
316    }
317
318
319    /**
320     * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
321     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
322     * it will return zero.
323     */
324    public int getLocationSelectionCriteriaReps() {
325        return this.getReps(3);
326    }
327
328
329    /**
330     * Returns a specific repetition of
331     * APR-3: "Location Selection Criteria" - creates it if necessary
332     *
333     * @param rep The repetition index (0-indexed)
334     */
335    public SCV getLocationSelectionCriteria(int rep) { 
336                SCV retVal = this.getTypedField(3, rep);
337                return retVal;
338    }
339
340    /**
341     * Returns a specific repetition of
342     * APR-3: "Location Selection Criteria" - creates it if necessary
343     *
344     * @param rep The repetition index (0-indexed)
345     */
346    public SCV getApr3_LocationSelectionCriteria(int rep) { 
347                SCV retVal = this.getTypedField(3, rep);
348                return retVal;
349    }
350
351    /**
352     * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
353     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
354     * it will return zero.
355     */
356    public int getApr3_LocationSelectionCriteriaReps() {
357        return this.getReps(3);
358    }
359
360
361    /**
362     * Inserts a repetition of
363     * APR-3: "Location Selection Criteria" at a specific index
364     *
365     * @param rep The repetition index (0-indexed)
366     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
367     */
368    public SCV insertLocationSelectionCriteria(int rep) throws HL7Exception { 
369        return (SCV) super.insertRepetition(3, rep);
370    }
371
372
373    /**
374     * Inserts a repetition of
375     * APR-3: "Location Selection Criteria" at a specific index
376     *
377     * @param rep The repetition index (0-indexed)
378     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
379     */
380    public SCV insertApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
381        return (SCV) super.insertRepetition(3, rep);
382    }
383
384
385    /**
386     * Removes a repetition of
387     * APR-3: "Location Selection Criteria" at a specific index
388     *
389     * @param rep The repetition index (0-indexed)
390     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
391     */
392    public SCV removeLocationSelectionCriteria(int rep) throws HL7Exception { 
393        return (SCV) super.removeRepetition(3, rep);
394    }
395
396
397    /**
398     * Removes a repetition of
399     * APR-3: "Location Selection Criteria" at a specific index
400     *
401     * @param rep The repetition index (0-indexed)
402     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
403     */
404    public SCV removeApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
405        return (SCV) super.removeRepetition(3, rep);
406    }
407
408
409
410
411    /**
412     * Returns
413     * APR-4: "Slot Spacing Criteria" - creates it if necessary
414     */
415    public NM getSlotSpacingCriteria() { 
416                NM retVal = this.getTypedField(4, 0);
417                return retVal;
418    }
419    
420    /**
421     * Returns
422     * APR-4: "Slot Spacing Criteria" - creates it if necessary
423     */
424    public NM getApr4_SlotSpacingCriteria() { 
425                NM retVal = this.getTypedField(4, 0);
426                return retVal;
427    }
428
429
430    /**
431     * Returns all repetitions of Filler Override Criteria (APR-5).
432     */
433    public SCV[] getFillerOverrideCriteria() {
434        SCV[] retVal = this.getTypedField(5, new SCV[0]);
435        return retVal;
436    }
437
438
439    /**
440     * Returns all repetitions of Filler Override Criteria (APR-5).
441     */
442    public SCV[] getApr5_FillerOverrideCriteria() {
443        SCV[] retVal = this.getTypedField(5, new SCV[0]);
444        return retVal;
445    }
446
447
448    /**
449     * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
450     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
451     * it will return zero.
452     */
453    public int getFillerOverrideCriteriaReps() {
454        return this.getReps(5);
455    }
456
457
458    /**
459     * Returns a specific repetition of
460     * APR-5: "Filler Override Criteria" - creates it if necessary
461     *
462     * @param rep The repetition index (0-indexed)
463     */
464    public SCV getFillerOverrideCriteria(int rep) { 
465                SCV retVal = this.getTypedField(5, rep);
466                return retVal;
467    }
468
469    /**
470     * Returns a specific repetition of
471     * APR-5: "Filler Override Criteria" - creates it if necessary
472     *
473     * @param rep The repetition index (0-indexed)
474     */
475    public SCV getApr5_FillerOverrideCriteria(int rep) { 
476                SCV retVal = this.getTypedField(5, rep);
477                return retVal;
478    }
479
480    /**
481     * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
482     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
483     * it will return zero.
484     */
485    public int getApr5_FillerOverrideCriteriaReps() {
486        return this.getReps(5);
487    }
488
489
490    /**
491     * Inserts a repetition of
492     * APR-5: "Filler Override Criteria" at a specific index
493     *
494     * @param rep The repetition index (0-indexed)
495     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
496     */
497    public SCV insertFillerOverrideCriteria(int rep) throws HL7Exception { 
498        return (SCV) super.insertRepetition(5, rep);
499    }
500
501
502    /**
503     * Inserts a repetition of
504     * APR-5: "Filler Override Criteria" at a specific index
505     *
506     * @param rep The repetition index (0-indexed)
507     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
508     */
509    public SCV insertApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
510        return (SCV) super.insertRepetition(5, rep);
511    }
512
513
514    /**
515     * Removes a repetition of
516     * APR-5: "Filler Override Criteria" at a specific index
517     *
518     * @param rep The repetition index (0-indexed)
519     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
520     */
521    public SCV removeFillerOverrideCriteria(int rep) throws HL7Exception { 
522        return (SCV) super.removeRepetition(5, rep);
523    }
524
525
526    /**
527     * Removes a repetition of
528     * APR-5: "Filler Override Criteria" at a specific index
529     *
530     * @param rep The repetition index (0-indexed)
531     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
532     */
533    public SCV removeApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
534        return (SCV) super.removeRepetition(5, rep);
535    }
536
537
538
539
540
541
542    /** {@inheritDoc} */   
543    protected Type createNewTypeWithoutReflection(int field) {
544       switch (field) {
545          case 0: return new SCV(getMessage());
546          case 1: return new SCV(getMessage());
547          case 2: return new SCV(getMessage());
548          case 3: return new NM(getMessage());
549          case 4: return new SCV(getMessage());
550          default: return null;
551       }
552   }
553
554
555}
556