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.v251.segment;
035
036// import ca.uhn.hl7v2.model.v251.group.*;
037import ca.uhn.hl7v2.model.v251.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 IPC message segment (Imaging Procedure Control Segment). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>IPC-1: Accession Identifier (EI) <b> </b>
052     * <li>IPC-2: Requested Procedure ID (EI) <b> </b>
053     * <li>IPC-3: Study Instance UID (EI) <b> </b>
054     * <li>IPC-4: Scheduled Procedure Step ID (EI) <b> </b>
055     * <li>IPC-5: Modality (CE) <b>optional </b>
056     * <li>IPC-6: Protocol Code (CE) <b>optional repeating</b>
057     * <li>IPC-7: Scheduled Station Name (EI) <b>optional </b>
058     * <li>IPC-8: Scheduled Procedure Step Location (CE) <b>optional repeating</b>
059     * <li>IPC-9: Scheduled AE Title (ST) <b>optional </b>
060 * </ul>
061 */
062@SuppressWarnings("unused")
063public class IPC extends AbstractSegment {
064
065    /** 
066     * Creates a new IPC segment
067     */
068    public IPC(Group parent, ModelClassFactory factory) {
069       super(parent, factory);
070       init(factory);
071    }
072
073    private void init(ModelClassFactory factory) {
074       try {
075                                  this.add(EI.class, true, 1, 80, new Object[]{ getMessage() }, "Accession Identifier");
076                                  this.add(EI.class, true, 1, 22, new Object[]{ getMessage() }, "Requested Procedure ID");
077                                  this.add(EI.class, true, 1, 70, new Object[]{ getMessage() }, "Study Instance UID");
078                                  this.add(EI.class, true, 1, 22, new Object[]{ getMessage() }, "Scheduled Procedure Step ID");
079                                  this.add(CE.class, false, 1, 16, new Object[]{ getMessage() }, "Modality");
080                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Protocol Code");
081                                  this.add(EI.class, false, 1, 22, new Object[]{ getMessage() }, "Scheduled Station Name");
082                                  this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Scheduled Procedure Step Location");
083                                  this.add(ST.class, false, 1, 16, new Object[]{ getMessage() }, "Scheduled AE Title");
084       } catch(HL7Exception e) {
085          log.error("Unexpected error creating IPC - this is probably a bug in the source code generator.", e);
086       }
087    }
088
089
090
091    /**
092     * Returns
093     * IPC-1: "Accession Identifier" - creates it if necessary
094     */
095    public EI getAccessionIdentifier() { 
096                EI retVal = this.getTypedField(1, 0);
097                return retVal;
098    }
099    
100    /**
101     * Returns
102     * IPC-1: "Accession Identifier" - creates it if necessary
103     */
104    public EI getIpc1_AccessionIdentifier() { 
105                EI retVal = this.getTypedField(1, 0);
106                return retVal;
107    }
108
109
110
111    /**
112     * Returns
113     * IPC-2: "Requested Procedure ID" - creates it if necessary
114     */
115    public EI getRequestedProcedureID() { 
116                EI retVal = this.getTypedField(2, 0);
117                return retVal;
118    }
119    
120    /**
121     * Returns
122     * IPC-2: "Requested Procedure ID" - creates it if necessary
123     */
124    public EI getIpc2_RequestedProcedureID() { 
125                EI retVal = this.getTypedField(2, 0);
126                return retVal;
127    }
128
129
130
131    /**
132     * Returns
133     * IPC-3: "Study Instance UID" - creates it if necessary
134     */
135    public EI getStudyInstanceUID() { 
136                EI retVal = this.getTypedField(3, 0);
137                return retVal;
138    }
139    
140    /**
141     * Returns
142     * IPC-3: "Study Instance UID" - creates it if necessary
143     */
144    public EI getIpc3_StudyInstanceUID() { 
145                EI retVal = this.getTypedField(3, 0);
146                return retVal;
147    }
148
149
150
151    /**
152     * Returns
153     * IPC-4: "Scheduled Procedure Step ID" - creates it if necessary
154     */
155    public EI getScheduledProcedureStepID() { 
156                EI retVal = this.getTypedField(4, 0);
157                return retVal;
158    }
159    
160    /**
161     * Returns
162     * IPC-4: "Scheduled Procedure Step ID" - creates it if necessary
163     */
164    public EI getIpc4_ScheduledProcedureStepID() { 
165                EI retVal = this.getTypedField(4, 0);
166                return retVal;
167    }
168
169
170
171    /**
172     * Returns
173     * IPC-5: "Modality" - creates it if necessary
174     */
175    public CE getModality() { 
176                CE retVal = this.getTypedField(5, 0);
177                return retVal;
178    }
179    
180    /**
181     * Returns
182     * IPC-5: "Modality" - creates it if necessary
183     */
184    public CE getIpc5_Modality() { 
185                CE retVal = this.getTypedField(5, 0);
186                return retVal;
187    }
188
189
190    /**
191     * Returns all repetitions of Protocol Code (IPC-6).
192     */
193    public CE[] getProtocolCode() {
194        CE[] retVal = this.getTypedField(6, new CE[0]);
195        return retVal;
196    }
197
198
199    /**
200     * Returns all repetitions of Protocol Code (IPC-6).
201     */
202    public CE[] getIpc6_ProtocolCode() {
203        CE[] retVal = this.getTypedField(6, new CE[0]);
204        return retVal;
205    }
206
207
208    /**
209     * Returns a count of the current number of repetitions of Protocol Code (IPC-6).
210     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
211     * it will return zero.
212     */
213    public int getProtocolCodeReps() {
214        return this.getReps(6);
215    }
216
217
218    /**
219     * Returns a specific repetition of
220     * IPC-6: "Protocol Code" - creates it if necessary
221     *
222     * @param rep The repetition index (0-indexed)
223     */
224    public CE getProtocolCode(int rep) { 
225                CE retVal = this.getTypedField(6, rep);
226                return retVal;
227    }
228
229    /**
230     * Returns a specific repetition of
231     * IPC-6: "Protocol Code" - creates it if necessary
232     *
233     * @param rep The repetition index (0-indexed)
234     */
235    public CE getIpc6_ProtocolCode(int rep) { 
236                CE retVal = this.getTypedField(6, rep);
237                return retVal;
238    }
239
240    /**
241     * Returns a count of the current number of repetitions of Protocol Code (IPC-6).
242     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
243     * it will return zero.
244     */
245    public int getIpc6_ProtocolCodeReps() {
246        return this.getReps(6);
247    }
248
249
250    /**
251     * Inserts a repetition of
252     * IPC-6: "Protocol Code" at a specific index
253     *
254     * @param rep The repetition index (0-indexed)
255     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
256     */
257    public CE insertProtocolCode(int rep) throws HL7Exception { 
258        return (CE) super.insertRepetition(6, rep);
259    }
260
261
262    /**
263     * Inserts a repetition of
264     * IPC-6: "Protocol Code" at a specific index
265     *
266     * @param rep The repetition index (0-indexed)
267     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
268     */
269    public CE insertIpc6_ProtocolCode(int rep) throws HL7Exception { 
270        return (CE) super.insertRepetition(6, rep);
271    }
272
273
274    /**
275     * Removes a repetition of
276     * IPC-6: "Protocol Code" at a specific index
277     *
278     * @param rep The repetition index (0-indexed)
279     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
280     */
281    public CE removeProtocolCode(int rep) throws HL7Exception { 
282        return (CE) super.removeRepetition(6, rep);
283    }
284
285
286    /**
287     * Removes a repetition of
288     * IPC-6: "Protocol Code" at a specific index
289     *
290     * @param rep The repetition index (0-indexed)
291     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
292     */
293    public CE removeIpc6_ProtocolCode(int rep) throws HL7Exception { 
294        return (CE) super.removeRepetition(6, rep);
295    }
296
297
298
299
300    /**
301     * Returns
302     * IPC-7: "Scheduled Station Name" - creates it if necessary
303     */
304    public EI getScheduledStationName() { 
305                EI retVal = this.getTypedField(7, 0);
306                return retVal;
307    }
308    
309    /**
310     * Returns
311     * IPC-7: "Scheduled Station Name" - creates it if necessary
312     */
313    public EI getIpc7_ScheduledStationName() { 
314                EI retVal = this.getTypedField(7, 0);
315                return retVal;
316    }
317
318
319    /**
320     * Returns all repetitions of Scheduled Procedure Step Location (IPC-8).
321     */
322    public CE[] getScheduledProcedureStepLocation() {
323        CE[] retVal = this.getTypedField(8, new CE[0]);
324        return retVal;
325    }
326
327
328    /**
329     * Returns all repetitions of Scheduled Procedure Step Location (IPC-8).
330     */
331    public CE[] getIpc8_ScheduledProcedureStepLocation() {
332        CE[] retVal = this.getTypedField(8, new CE[0]);
333        return retVal;
334    }
335
336
337    /**
338     * Returns a count of the current number of repetitions of Scheduled Procedure Step Location (IPC-8).
339     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
340     * it will return zero.
341     */
342    public int getScheduledProcedureStepLocationReps() {
343        return this.getReps(8);
344    }
345
346
347    /**
348     * Returns a specific repetition of
349     * IPC-8: "Scheduled Procedure Step Location" - creates it if necessary
350     *
351     * @param rep The repetition index (0-indexed)
352     */
353    public CE getScheduledProcedureStepLocation(int rep) { 
354                CE retVal = this.getTypedField(8, rep);
355                return retVal;
356    }
357
358    /**
359     * Returns a specific repetition of
360     * IPC-8: "Scheduled Procedure Step Location" - creates it if necessary
361     *
362     * @param rep The repetition index (0-indexed)
363     */
364    public CE getIpc8_ScheduledProcedureStepLocation(int rep) { 
365                CE retVal = this.getTypedField(8, rep);
366                return retVal;
367    }
368
369    /**
370     * Returns a count of the current number of repetitions of Scheduled Procedure Step Location (IPC-8).
371     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
372     * it will return zero.
373     */
374    public int getIpc8_ScheduledProcedureStepLocationReps() {
375        return this.getReps(8);
376    }
377
378
379    /**
380     * Inserts a repetition of
381     * IPC-8: "Scheduled Procedure Step Location" 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 CE insertScheduledProcedureStepLocation(int rep) throws HL7Exception { 
387        return (CE) super.insertRepetition(8, rep);
388    }
389
390
391    /**
392     * Inserts a repetition of
393     * IPC-8: "Scheduled Procedure Step Location" 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 CE insertIpc8_ScheduledProcedureStepLocation(int rep) throws HL7Exception { 
399        return (CE) super.insertRepetition(8, rep);
400    }
401
402
403    /**
404     * Removes a repetition of
405     * IPC-8: "Scheduled Procedure Step Location" at a specific index
406     *
407     * @param rep The repetition index (0-indexed)
408     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
409     */
410    public CE removeScheduledProcedureStepLocation(int rep) throws HL7Exception { 
411        return (CE) super.removeRepetition(8, rep);
412    }
413
414
415    /**
416     * Removes a repetition of
417     * IPC-8: "Scheduled Procedure Step Location" at a specific index
418     *
419     * @param rep The repetition index (0-indexed)
420     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
421     */
422    public CE removeIpc8_ScheduledProcedureStepLocation(int rep) throws HL7Exception { 
423        return (CE) super.removeRepetition(8, rep);
424    }
425
426
427
428
429    /**
430     * Returns
431     * IPC-9: "Scheduled AE Title" - creates it if necessary
432     */
433    public ST getScheduledAETitle() { 
434                ST retVal = this.getTypedField(9, 0);
435                return retVal;
436    }
437    
438    /**
439     * Returns
440     * IPC-9: "Scheduled AE Title" - creates it if necessary
441     */
442    public ST getIpc9_ScheduledAETitle() { 
443                ST retVal = this.getTypedField(9, 0);
444                return retVal;
445    }
446
447
448
449
450
451    /** {@inheritDoc} */   
452    protected Type createNewTypeWithoutReflection(int field) {
453       switch (field) {
454          case 0: return new EI(getMessage());
455          case 1: return new EI(getMessage());
456          case 2: return new EI(getMessage());
457          case 3: return new EI(getMessage());
458          case 4: return new CE(getMessage());
459          case 5: return new CE(getMessage());
460          case 6: return new EI(getMessage());
461          case 7: return new CE(getMessage());
462          case 8: return new ST(getMessage());
463          default: return null;
464       }
465   }
466
467
468}
469