View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v251.segment;
35  
36  // import ca.uhn.hl7v2.model.v251.group.*;
37  import ca.uhn.hl7v2.model.v251.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 VTQ message segment (Virtual Table Query Request). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>VTQ-1: Query Tag (ST) <b>optional </b>
53       * <li>VTQ-2: Query/Response Format Code (ID) <b> </b>
54       * <li>VTQ-3: VT Query Name (CE) <b> </b>
55       * <li>VTQ-4: Virtual Table Name (CE) <b> </b>
56       * <li>VTQ-5: Selection Criteria (QSC) <b>optional repeating</b>
57   * </ul>
58   */
59  @SuppressWarnings("unused")
60  public class VTQ extends AbstractSegment {
61  
62      /** 
63       * Creates a new VTQ segment
64       */
65      public VTQ(Group parent, ModelClassFactory factory) {
66         super(parent, factory);
67         init(factory);
68      }
69  
70      private void init(ModelClassFactory factory) {
71         try {
72                                    this.add(ST.class, false, 1, 32, new Object[]{ getMessage() }, "Query Tag");
73                                                this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(106) }, "Query/Response Format Code");
74                                    this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "VT Query Name");
75                                    this.add(CE.class, true, 1, 250, new Object[]{ getMessage() }, "Virtual Table Name");
76                                    this.add(QSC.class, false, 0, 256, new Object[]{ getMessage() }, "Selection Criteria");
77         } catch(HL7Exception e) {
78            log.error("Unexpected error creating VTQ - this is probably a bug in the source code generator.", e);
79         }
80      }
81  
82  
83  
84      /**
85       * Returns
86       * VTQ-1: "Query Tag" - creates it if necessary
87       */
88      public ST getQueryTag() { 
89  		ST retVal = this.getTypedField(1, 0);
90  		return retVal;
91      }
92      
93      /**
94       * Returns
95       * VTQ-1: "Query Tag" - creates it if necessary
96       */
97      public ST getVtq1_QueryTag() { 
98  		ST retVal = this.getTypedField(1, 0);
99  		return retVal;
100     }
101 
102 
103 
104     /**
105      * Returns
106      * VTQ-2: "Query/Response Format Code" - creates it if necessary
107      */
108     public ID getQueryResponseFormatCode() { 
109 		ID retVal = this.getTypedField(2, 0);
110 		return retVal;
111     }
112     
113     /**
114      * Returns
115      * VTQ-2: "Query/Response Format Code" - creates it if necessary
116      */
117     public ID getVtq2_QueryResponseFormatCode() { 
118 		ID retVal = this.getTypedField(2, 0);
119 		return retVal;
120     }
121 
122 
123 
124     /**
125      * Returns
126      * VTQ-3: "VT Query Name" - creates it if necessary
127      */
128     public CE getVTQueryName() { 
129 		CE retVal = this.getTypedField(3, 0);
130 		return retVal;
131     }
132     
133     /**
134      * Returns
135      * VTQ-3: "VT Query Name" - creates it if necessary
136      */
137     public CE getVtq3_VTQueryName() { 
138 		CE retVal = this.getTypedField(3, 0);
139 		return retVal;
140     }
141 
142 
143 
144     /**
145      * Returns
146      * VTQ-4: "Virtual Table Name" - creates it if necessary
147      */
148     public CE getVirtualTableName() { 
149 		CE retVal = this.getTypedField(4, 0);
150 		return retVal;
151     }
152     
153     /**
154      * Returns
155      * VTQ-4: "Virtual Table Name" - creates it if necessary
156      */
157     public CE getVtq4_VirtualTableName() { 
158 		CE retVal = this.getTypedField(4, 0);
159 		return retVal;
160     }
161 
162 
163     /**
164      * Returns all repetitions of Selection Criteria (VTQ-5).
165      */
166     public QSC[] getSelectionCriteria() {
167     	QSC[] retVal = this.getTypedField(5, new QSC[0]);
168     	return retVal;
169     }
170 
171 
172     /**
173      * Returns all repetitions of Selection Criteria (VTQ-5).
174      */
175     public QSC[] getVtq5_SelectionCriteria() {
176     	QSC[] retVal = this.getTypedField(5, new QSC[0]);
177     	return retVal;
178     }
179 
180 
181     /**
182      * Returns a count of the current number of repetitions of Selection Criteria (VTQ-5).
183      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
184      * it will return zero.
185      */
186     public int getSelectionCriteriaReps() {
187     	return this.getReps(5);
188     }
189 
190 
191     /**
192      * Returns a specific repetition of
193      * VTQ-5: "Selection Criteria" - creates it if necessary
194      *
195      * @param rep The repetition index (0-indexed)
196      */
197     public QSC getSelectionCriteria(int rep) { 
198 		QSC retVal = this.getTypedField(5, rep);
199 		return retVal;
200     }
201 
202     /**
203      * Returns a specific repetition of
204      * VTQ-5: "Selection Criteria" - creates it if necessary
205      *
206      * @param rep The repetition index (0-indexed)
207      */
208     public QSC getVtq5_SelectionCriteria(int rep) { 
209 		QSC retVal = this.getTypedField(5, rep);
210 		return retVal;
211     }
212 
213     /**
214      * Returns a count of the current number of repetitions of Selection Criteria (VTQ-5).
215      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
216      * it will return zero.
217      */
218     public int getVtq5_SelectionCriteriaReps() {
219     	return this.getReps(5);
220     }
221 
222 
223     /**
224      * Inserts a repetition of
225      * VTQ-5: "Selection Criteria" at a specific index
226      *
227      * @param rep The repetition index (0-indexed)
228      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
229      */
230     public QSC insertSelectionCriteria(int rep) throws HL7Exception { 
231         return (QSC) super.insertRepetition(5, rep);
232     }
233 
234 
235     /**
236      * Inserts a repetition of
237      * VTQ-5: "Selection Criteria" at a specific index
238      *
239      * @param rep The repetition index (0-indexed)
240      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
241      */
242     public QSC insertVtq5_SelectionCriteria(int rep) throws HL7Exception { 
243         return (QSC) super.insertRepetition(5, rep);
244     }
245 
246 
247     /**
248      * Removes a repetition of
249      * VTQ-5: "Selection Criteria" 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 QSC removeSelectionCriteria(int rep) throws HL7Exception { 
255         return (QSC) super.removeRepetition(5, rep);
256     }
257 
258 
259     /**
260      * Removes a repetition of
261      * VTQ-5: "Selection Criteria" 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 QSC removeVtq5_SelectionCriteria(int rep) throws HL7Exception { 
267         return (QSC) super.removeRepetition(5, rep);
268     }
269 
270 
271 
272 
273 
274 
275     /** {@inheritDoc} */   
276     protected Type createNewTypeWithoutReflection(int field) {
277        switch (field) {
278           case 0: return new ST(getMessage());
279           case 1: return new ID(getMessage(), new Integer( 106 ));
280           case 2: return new CE(getMessage());
281           case 3: return new CE(getMessage());
282           case 4: return new QSC(getMessage());
283           default: return null;
284        }
285    }
286 
287 
288 }
289