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
008 package ca.uhn.hl7v2.model.v24.segment;
009
010 // import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.datatype.*;
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.Type;
019 import ca.uhn.hl7v2.model.AbstractSegment;
020 import ca.uhn.hl7v2.model.Varies;
021
022 /**
023 *<p>Represents an HL7 LCH message segment (Location Characteristic).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>LCH-1: Primary Key Value - LCH (PL) <b> </b>
027 * <li>LCH-2: Segment Action Code (ID) <b>optional </b>
028 * <li>LCH-3: Segment Unique Key (EI) <b>optional </b>
029 * <li>LCH-4: Location Characteristic ID (CE) <b> </b>
030 * <li>LCH-5: Location Characteristic Value-LCH (CE) <b> </b>
031 * </ul>
032 */
033 public class LCH extends AbstractSegment {
034
035 /**
036 * Creates a new LCH segment
037 */
038 public LCH(Group parent, ModelClassFactory factory) {
039 super(parent, factory);
040 init(factory);
041 }
042
043 private void init(ModelClassFactory factory) {
044 try {
045 this.add(PL.class, true, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Primary Key Value - LCH");
046 this.add(ID.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Action Code");
047 this.add(EI.class, false, 1, 80, new Object[]{ getMessage(), new Integer(0) }, "Segment Unique Key");
048 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(324) }, "Location Characteristic ID");
049 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(136) }, "Location Characteristic Value-LCH");
050 } catch(HL7Exception e) {
051 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating LCH - this is probably a bug in the source code generator.", e);
052 }
053 }
054
055
056
057 /**
058 * Returns
059 * LCH-1: "Primary Key Value - LCH" - creates it if necessary
060 */
061 public PL getPrimaryKeyValueLCH() {
062 PL ret = null;
063 try {
064 Type t = this.getField(1, 0);
065 ret = (PL)t;
066 } catch (ClassCastException cce) {
067 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
068 throw new RuntimeException(cce);
069 } catch (HL7Exception he) {
070 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
071 throw new RuntimeException(he);
072 }
073 return ret;
074 }
075
076
077 /**
078 * Returns
079 * LCH-1: "Primary Key Value - LCH" - creates it if necessary
080 */
081 public PL getLch1_PrimaryKeyValueLCH() {
082 PL ret = null;
083 try {
084 Type t = this.getField(1, 0);
085 ret = (PL)t;
086 } catch (ClassCastException cce) {
087 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
088 throw new RuntimeException(cce);
089 } catch (HL7Exception he) {
090 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
091 throw new RuntimeException(he);
092 }
093 return ret;
094 }
095
096
097
098 /**
099 * Returns
100 * LCH-2: "Segment Action Code" - creates it if necessary
101 */
102 public ID getSegmentActionCode() {
103 ID ret = null;
104 try {
105 Type t = this.getField(2, 0);
106 ret = (ID)t;
107 } catch (ClassCastException cce) {
108 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
109 throw new RuntimeException(cce);
110 } catch (HL7Exception he) {
111 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
112 throw new RuntimeException(he);
113 }
114 return ret;
115 }
116
117
118 /**
119 * Returns
120 * LCH-2: "Segment Action Code" - creates it if necessary
121 */
122 public ID getLch2_SegmentActionCode() {
123 ID ret = null;
124 try {
125 Type t = this.getField(2, 0);
126 ret = (ID)t;
127 } catch (ClassCastException cce) {
128 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
129 throw new RuntimeException(cce);
130 } catch (HL7Exception he) {
131 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
132 throw new RuntimeException(he);
133 }
134 return ret;
135 }
136
137
138
139 /**
140 * Returns
141 * LCH-3: "Segment Unique Key" - creates it if necessary
142 */
143 public EI getSegmentUniqueKey() {
144 EI ret = null;
145 try {
146 Type t = this.getField(3, 0);
147 ret = (EI)t;
148 } catch (ClassCastException cce) {
149 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
150 throw new RuntimeException(cce);
151 } catch (HL7Exception he) {
152 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
153 throw new RuntimeException(he);
154 }
155 return ret;
156 }
157
158
159 /**
160 * Returns
161 * LCH-3: "Segment Unique Key" - creates it if necessary
162 */
163 public EI getLch3_SegmentUniqueKey() {
164 EI ret = null;
165 try {
166 Type t = this.getField(3, 0);
167 ret = (EI)t;
168 } catch (ClassCastException cce) {
169 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
170 throw new RuntimeException(cce);
171 } catch (HL7Exception he) {
172 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
173 throw new RuntimeException(he);
174 }
175 return ret;
176 }
177
178
179
180 /**
181 * Returns
182 * LCH-4: "Location Characteristic ID" - creates it if necessary
183 */
184 public CE getLocationCharacteristicID() {
185 CE ret = null;
186 try {
187 Type t = this.getField(4, 0);
188 ret = (CE)t;
189 } catch (ClassCastException cce) {
190 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
191 throw new RuntimeException(cce);
192 } catch (HL7Exception he) {
193 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
194 throw new RuntimeException(he);
195 }
196 return ret;
197 }
198
199
200 /**
201 * Returns
202 * LCH-4: "Location Characteristic ID" - creates it if necessary
203 */
204 public CE getLch4_LocationCharacteristicID() {
205 CE ret = null;
206 try {
207 Type t = this.getField(4, 0);
208 ret = (CE)t;
209 } catch (ClassCastException cce) {
210 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
211 throw new RuntimeException(cce);
212 } catch (HL7Exception he) {
213 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
214 throw new RuntimeException(he);
215 }
216 return ret;
217 }
218
219
220
221 /**
222 * Returns
223 * LCH-5: "Location Characteristic Value-LCH" - creates it if necessary
224 */
225 public CE getLocationCharacteristicValueLCH() {
226 CE ret = null;
227 try {
228 Type t = this.getField(5, 0);
229 ret = (CE)t;
230 } catch (ClassCastException cce) {
231 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
232 throw new RuntimeException(cce);
233 } catch (HL7Exception he) {
234 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
235 throw new RuntimeException(he);
236 }
237 return ret;
238 }
239
240
241 /**
242 * Returns
243 * LCH-5: "Location Characteristic Value-LCH" - creates it if necessary
244 */
245 public CE getLch5_LocationCharacteristicValueLCH() {
246 CE ret = null;
247 try {
248 Type t = this.getField(5, 0);
249 ret = (CE)t;
250 } catch (ClassCastException cce) {
251 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
252 throw new RuntimeException(cce);
253 } catch (HL7Exception he) {
254 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
255 throw new RuntimeException(he);
256 }
257 return ret;
258 }
259
260
261
262
263
264 /** {@inheritDoc} */
265 protected Type createNewTypeWithoutReflection(int field) {
266 switch (field) {
267 case 0: return new PL(getMessage());
268 case 1: return new ID(getMessage(), new Integer( 206 ));
269 case 2: return new EI(getMessage());
270 case 3: return new CE(getMessage());
271 case 4: return new CE(getMessage());
272 default: return null;
273 }
274 }
275
276
277 }
278