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.v21.segment;
035
036// import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.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 URS message segment (UNSOLICITED SELECTION). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>URS-1: R/U WHERE SUBJECT DEFINITION (ST) <b> repeating</b>
053     * <li>URS-2: R/U WHEN DATA START DATE/TIME (TS) <b>optional </b>
054     * <li>URS-3: R/U WHEN DATA END DATE/TIME (TS) <b>optional </b>
055     * <li>URS-4: R/U WHAT USER QUALIFIER (ST) <b>optional repeating</b>
056     * <li>URS-5: R/U OTHER RESULTS SUBJECT DEFINI (ST) <b>optional repeating</b>
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class URS extends AbstractSegment {
061
062    /** 
063     * Creates a new URS segment
064     */
065    public URS(Group parent, ModelClassFactory factory) {
066       super(parent, factory);
067       init(factory);
068    }
069
070    private void init(ModelClassFactory factory) {
071       try {
072                                  this.add(ST.class, true, 0, 20, new Object[]{ getMessage() }, "R/U WHERE SUBJECT DEFINITION");
073                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "R/U WHEN DATA START DATE/TIME");
074                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "R/U WHEN DATA END DATE/TIME");
075                                  this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "R/U WHAT USER QUALIFIER");
076                                  this.add(ST.class, false, 0, 20, new Object[]{ getMessage() }, "R/U OTHER RESULTS SUBJECT DEFINI");
077       } catch(HL7Exception e) {
078          log.error("Unexpected error creating URS - this is probably a bug in the source code generator.", e);
079       }
080    }
081
082
083    /**
084     * Returns all repetitions of R/U WHERE SUBJECT DEFINITION (URS-1).
085     */
086    public ST[] getRUWHERESUBJECTDEFINITION() {
087        ST[] retVal = this.getTypedField(1, new ST[0]);
088        return retVal;
089    }
090
091
092    /**
093     * Returns all repetitions of R/U WHERE SUBJECT DEFINITION (URS-1).
094     */
095    public ST[] getUrs1_RUWHERESUBJECTDEFINITION() {
096        ST[] retVal = this.getTypedField(1, new ST[0]);
097        return retVal;
098    }
099
100
101    /**
102     * Returns a count of the current number of repetitions of R/U WHERE SUBJECT DEFINITION (URS-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 getRUWHERESUBJECTDEFINITIONReps() {
107        return this.getReps(1);
108    }
109
110
111    /**
112     * Returns a specific repetition of
113     * URS-1: "R/U WHERE SUBJECT DEFINITION" - creates it if necessary
114     *
115     * @param rep The repetition index (0-indexed)
116     */
117    public ST getRUWHERESUBJECTDEFINITION(int rep) { 
118                ST retVal = this.getTypedField(1, rep);
119                return retVal;
120    }
121
122    /**
123     * Returns a specific repetition of
124     * URS-1: "R/U WHERE SUBJECT DEFINITION" - creates it if necessary
125     *
126     * @param rep The repetition index (0-indexed)
127     */
128    public ST getUrs1_RUWHERESUBJECTDEFINITION(int rep) { 
129                ST retVal = this.getTypedField(1, rep);
130                return retVal;
131    }
132
133    /**
134     * Returns a count of the current number of repetitions of R/U WHERE SUBJECT DEFINITION (URS-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 getUrs1_RUWHERESUBJECTDEFINITIONReps() {
139        return this.getReps(1);
140    }
141
142
143    /**
144     * Inserts a repetition of
145     * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST insertRUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 
151        return (ST) super.insertRepetition(1, rep);
152    }
153
154
155    /**
156     * Inserts a repetition of
157     * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST insertUrs1_RUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 
163        return (ST) super.insertRepetition(1, rep);
164    }
165
166
167    /**
168     * Removes a repetition of
169     * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST removeRUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 
175        return (ST) super.removeRepetition(1, rep);
176    }
177
178
179    /**
180     * Removes a repetition of
181     * URS-1: "R/U WHERE SUBJECT DEFINITION" 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 ST removeUrs1_RUWHERESUBJECTDEFINITION(int rep) throws HL7Exception { 
187        return (ST) super.removeRepetition(1, rep);
188    }
189
190
191
192
193    /**
194     * Returns
195     * URS-2: "R/U WHEN DATA START DATE/TIME" - creates it if necessary
196     */
197    public TS getRUWHENDATASTARTDATETIME() { 
198                TS retVal = this.getTypedField(2, 0);
199                return retVal;
200    }
201    
202    /**
203     * Returns
204     * URS-2: "R/U WHEN DATA START DATE/TIME" - creates it if necessary
205     */
206    public TS getUrs2_RUWHENDATASTARTDATETIME() { 
207                TS retVal = this.getTypedField(2, 0);
208                return retVal;
209    }
210
211
212
213    /**
214     * Returns
215     * URS-3: "R/U WHEN DATA END DATE/TIME" - creates it if necessary
216     */
217    public TS getRUWHENDATAENDDATETIME() { 
218                TS retVal = this.getTypedField(3, 0);
219                return retVal;
220    }
221    
222    /**
223     * Returns
224     * URS-3: "R/U WHEN DATA END DATE/TIME" - creates it if necessary
225     */
226    public TS getUrs3_RUWHENDATAENDDATETIME() { 
227                TS retVal = this.getTypedField(3, 0);
228                return retVal;
229    }
230
231
232    /**
233     * Returns all repetitions of R/U WHAT USER QUALIFIER (URS-4).
234     */
235    public ST[] getRUWHATUSERQUALIFIER() {
236        ST[] retVal = this.getTypedField(4, new ST[0]);
237        return retVal;
238    }
239
240
241    /**
242     * Returns all repetitions of R/U WHAT USER QUALIFIER (URS-4).
243     */
244    public ST[] getUrs4_RUWHATUSERQUALIFIER() {
245        ST[] retVal = this.getTypedField(4, new ST[0]);
246        return retVal;
247    }
248
249
250    /**
251     * Returns a count of the current number of repetitions of R/U WHAT USER QUALIFIER (URS-4).
252     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
253     * it will return zero.
254     */
255    public int getRUWHATUSERQUALIFIERReps() {
256        return this.getReps(4);
257    }
258
259
260    /**
261     * Returns a specific repetition of
262     * URS-4: "R/U WHAT USER QUALIFIER" - creates it if necessary
263     *
264     * @param rep The repetition index (0-indexed)
265     */
266    public ST getRUWHATUSERQUALIFIER(int rep) { 
267                ST retVal = this.getTypedField(4, rep);
268                return retVal;
269    }
270
271    /**
272     * Returns a specific repetition of
273     * URS-4: "R/U WHAT USER QUALIFIER" - creates it if necessary
274     *
275     * @param rep The repetition index (0-indexed)
276     */
277    public ST getUrs4_RUWHATUSERQUALIFIER(int rep) { 
278                ST retVal = this.getTypedField(4, rep);
279                return retVal;
280    }
281
282    /**
283     * Returns a count of the current number of repetitions of R/U WHAT USER QUALIFIER (URS-4).
284     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
285     * it will return zero.
286     */
287    public int getUrs4_RUWHATUSERQUALIFIERReps() {
288        return this.getReps(4);
289    }
290
291
292    /**
293     * Inserts a repetition of
294     * URS-4: "R/U WHAT USER QUALIFIER" at a specific index
295     *
296     * @param rep The repetition index (0-indexed)
297     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
298     */
299    public ST insertRUWHATUSERQUALIFIER(int rep) throws HL7Exception { 
300        return (ST) super.insertRepetition(4, rep);
301    }
302
303
304    /**
305     * Inserts a repetition of
306     * URS-4: "R/U WHAT USER QUALIFIER" at a specific index
307     *
308     * @param rep The repetition index (0-indexed)
309     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
310     */
311    public ST insertUrs4_RUWHATUSERQUALIFIER(int rep) throws HL7Exception { 
312        return (ST) super.insertRepetition(4, rep);
313    }
314
315
316    /**
317     * Removes a repetition of
318     * URS-4: "R/U WHAT USER QUALIFIER" at a specific index
319     *
320     * @param rep The repetition index (0-indexed)
321     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
322     */
323    public ST removeRUWHATUSERQUALIFIER(int rep) throws HL7Exception { 
324        return (ST) super.removeRepetition(4, rep);
325    }
326
327
328    /**
329     * Removes a repetition of
330     * URS-4: "R/U WHAT USER QUALIFIER" at a specific index
331     *
332     * @param rep The repetition index (0-indexed)
333     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
334     */
335    public ST removeUrs4_RUWHATUSERQUALIFIER(int rep) throws HL7Exception { 
336        return (ST) super.removeRepetition(4, rep);
337    }
338
339
340
341    /**
342     * Returns all repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5).
343     */
344    public ST[] getRUOTHERRESULTSSUBJECTDEFINI() {
345        ST[] retVal = this.getTypedField(5, new ST[0]);
346        return retVal;
347    }
348
349
350    /**
351     * Returns all repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5).
352     */
353    public ST[] getUrs5_RUOTHERRESULTSSUBJECTDEFINI() {
354        ST[] retVal = this.getTypedField(5, new ST[0]);
355        return retVal;
356    }
357
358
359    /**
360     * Returns a count of the current number of repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5).
361     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
362     * it will return zero.
363     */
364    public int getRUOTHERRESULTSSUBJECTDEFINIReps() {
365        return this.getReps(5);
366    }
367
368
369    /**
370     * Returns a specific repetition of
371     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" - creates it if necessary
372     *
373     * @param rep The repetition index (0-indexed)
374     */
375    public ST getRUOTHERRESULTSSUBJECTDEFINI(int rep) { 
376                ST retVal = this.getTypedField(5, rep);
377                return retVal;
378    }
379
380    /**
381     * Returns a specific repetition of
382     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" - creates it if necessary
383     *
384     * @param rep The repetition index (0-indexed)
385     */
386    public ST getUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) { 
387                ST retVal = this.getTypedField(5, rep);
388                return retVal;
389    }
390
391    /**
392     * Returns a count of the current number of repetitions of R/U OTHER RESULTS SUBJECT DEFINI (URS-5).
393     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
394     * it will return zero.
395     */
396    public int getUrs5_RUOTHERRESULTSSUBJECTDEFINIReps() {
397        return this.getReps(5);
398    }
399
400
401    /**
402     * Inserts a repetition of
403     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index
404     *
405     * @param rep The repetition index (0-indexed)
406     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
407     */
408    public ST insertRUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 
409        return (ST) super.insertRepetition(5, rep);
410    }
411
412
413    /**
414     * Inserts a repetition of
415     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index
416     *
417     * @param rep The repetition index (0-indexed)
418     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
419     */
420    public ST insertUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 
421        return (ST) super.insertRepetition(5, rep);
422    }
423
424
425    /**
426     * Removes a repetition of
427     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index
428     *
429     * @param rep The repetition index (0-indexed)
430     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
431     */
432    public ST removeRUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 
433        return (ST) super.removeRepetition(5, rep);
434    }
435
436
437    /**
438     * Removes a repetition of
439     * URS-5: "R/U OTHER RESULTS SUBJECT DEFINI" at a specific index
440     *
441     * @param rep The repetition index (0-indexed)
442     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
443     */
444    public ST removeUrs5_RUOTHERRESULTSSUBJECTDEFINI(int rep) throws HL7Exception { 
445        return (ST) super.removeRepetition(5, rep);
446    }
447
448
449
450
451
452
453    /** {@inheritDoc} */   
454    protected Type createNewTypeWithoutReflection(int field) {
455       switch (field) {
456          case 0: return new ST(getMessage());
457          case 1: return new TS(getMessage());
458          case 2: return new TS(getMessage());
459          case 3: return new ST(getMessage());
460          case 4: return new ST(getMessage());
461          default: return null;
462       }
463   }
464
465
466}
467