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.v28.segment;
35  
36  // import ca.uhn.hl7v2.model.v28.group.*;
37  import ca.uhn.hl7v2.model.v28.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 EQU message segment (Equipment Detail). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>EQU-1: Equipment Instance Identifier (EI) <b> repeating</b>
53       * <li>EQU-2: Event Date/Time (DTM) <b> </b>
54       * <li>EQU-3: Equipment State (CWE) <b>optional </b>
55       * <li>EQU-4: Local/Remote Control State (CWE) <b>optional </b>
56       * <li>EQU-5: Alert Level (CWE) <b>optional </b>
57   * </ul>
58   */
59  @SuppressWarnings("unused")
60  public class EQU extends AbstractSegment {
61  
62      /** 
63       * Creates a new EQU segment
64       */
65      public EQU(Group parent, ModelClassFactory factory) {
66         super(parent, factory);
67         init(factory);
68      }
69  
70      private void init(ModelClassFactory factory) {
71         try {
72                                    this.add(EI.class, true, 0, 0, new Object[]{ getMessage() }, "Equipment Instance Identifier");
73                                    this.add(DTM.class, true, 1, 0, new Object[]{ getMessage() }, "Event Date/Time");
74                                    this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Equipment State");
75                                    this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Local/Remote Control State");
76                                    this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Alert Level");
77         } catch(HL7Exception e) {
78            log.error("Unexpected error creating EQU - this is probably a bug in the source code generator.", e);
79         }
80      }
81  
82  
83      /**
84       * Returns all repetitions of Equipment Instance Identifier (EQU-1).
85       */
86      public EI[] getEquipmentInstanceIdentifier() {
87      	EI[] retVal = this.getTypedField(1, new EI[0]);
88      	return retVal;
89      }
90  
91  
92      /**
93       * Returns all repetitions of Equipment Instance Identifier (EQU-1).
94       */
95      public EI[] getEqu1_EquipmentInstanceIdentifier() {
96      	EI[] retVal = this.getTypedField(1, new EI[0]);
97      	return retVal;
98      }
99  
100 
101     /**
102      * Returns a count of the current number of repetitions of Equipment Instance Identifier (EQU-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 getEquipmentInstanceIdentifierReps() {
107     	return this.getReps(1);
108     }
109 
110 
111     /**
112      * Returns a specific repetition of
113      * EQU-1: "Equipment Instance Identifier" - creates it if necessary
114      *
115      * @param rep The repetition index (0-indexed)
116      */
117     public EI getEquipmentInstanceIdentifier(int rep) { 
118 		EI retVal = this.getTypedField(1, rep);
119 		return retVal;
120     }
121 
122     /**
123      * Returns a specific repetition of
124      * EQU-1: "Equipment Instance Identifier" - creates it if necessary
125      *
126      * @param rep The repetition index (0-indexed)
127      */
128     public EI getEqu1_EquipmentInstanceIdentifier(int rep) { 
129 		EI retVal = this.getTypedField(1, rep);
130 		return retVal;
131     }
132 
133     /**
134      * Returns a count of the current number of repetitions of Equipment Instance Identifier (EQU-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 getEqu1_EquipmentInstanceIdentifierReps() {
139     	return this.getReps(1);
140     }
141 
142 
143     /**
144      * Inserts a repetition of
145      * EQU-1: "Equipment Instance Identifier" 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 EI insertEquipmentInstanceIdentifier(int rep) throws HL7Exception { 
151         return (EI) super.insertRepetition(1, rep);
152     }
153 
154 
155     /**
156      * Inserts a repetition of
157      * EQU-1: "Equipment Instance Identifier" 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 EI insertEqu1_EquipmentInstanceIdentifier(int rep) throws HL7Exception { 
163         return (EI) super.insertRepetition(1, rep);
164     }
165 
166 
167     /**
168      * Removes a repetition of
169      * EQU-1: "Equipment Instance Identifier" 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 EI removeEquipmentInstanceIdentifier(int rep) throws HL7Exception { 
175         return (EI) super.removeRepetition(1, rep);
176     }
177 
178 
179     /**
180      * Removes a repetition of
181      * EQU-1: "Equipment Instance Identifier" 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 EI removeEqu1_EquipmentInstanceIdentifier(int rep) throws HL7Exception { 
187         return (EI) super.removeRepetition(1, rep);
188     }
189 
190 
191 
192 
193     /**
194      * Returns
195      * EQU-2: "Event Date/Time" - creates it if necessary
196      */
197     public DTM getEventDateTime() { 
198 		DTM retVal = this.getTypedField(2, 0);
199 		return retVal;
200     }
201     
202     /**
203      * Returns
204      * EQU-2: "Event Date/Time" - creates it if necessary
205      */
206     public DTM getEqu2_EventDateTime() { 
207 		DTM retVal = this.getTypedField(2, 0);
208 		return retVal;
209     }
210 
211 
212 
213     /**
214      * Returns
215      * EQU-3: "Equipment State" - creates it if necessary
216      */
217     public CWE getEquipmentState() { 
218 		CWE retVal = this.getTypedField(3, 0);
219 		return retVal;
220     }
221     
222     /**
223      * Returns
224      * EQU-3: "Equipment State" - creates it if necessary
225      */
226     public CWE getEqu3_EquipmentState() { 
227 		CWE retVal = this.getTypedField(3, 0);
228 		return retVal;
229     }
230 
231 
232 
233     /**
234      * Returns
235      * EQU-4: "Local/Remote Control State" - creates it if necessary
236      */
237     public CWE getLocalRemoteControlState() { 
238 		CWE retVal = this.getTypedField(4, 0);
239 		return retVal;
240     }
241     
242     /**
243      * Returns
244      * EQU-4: "Local/Remote Control State" - creates it if necessary
245      */
246     public CWE getEqu4_LocalRemoteControlState() { 
247 		CWE retVal = this.getTypedField(4, 0);
248 		return retVal;
249     }
250 
251 
252 
253     /**
254      * Returns
255      * EQU-5: "Alert Level" - creates it if necessary
256      */
257     public CWE getAlertLevel() { 
258 		CWE retVal = this.getTypedField(5, 0);
259 		return retVal;
260     }
261     
262     /**
263      * Returns
264      * EQU-5: "Alert Level" - creates it if necessary
265      */
266     public CWE getEqu5_AlertLevel() { 
267 		CWE retVal = this.getTypedField(5, 0);
268 		return retVal;
269     }
270 
271 
272 
273 
274 
275     /** {@inheritDoc} */   
276     protected Type createNewTypeWithoutReflection(int field) {
277        switch (field) {
278           case 0: return new EI(getMessage());
279           case 1: return new DTM(getMessage());
280           case 2: return new CWE(getMessage());
281           case 3: return new CWE(getMessage());
282           case 4: return new CWE(getMessage());
283           default: return null;
284        }
285    }
286 
287 
288 }
289