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 PTH message segment (Pathway).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>PTH-1: Action Code (ID) <b> </b>
027 * <li>PTH-2: Pathway ID (CE) <b> </b>
028 * <li>PTH-3: Pathway Instance ID (EI) <b> </b>
029 * <li>PTH-4: Pathway Established Date/Time (TS) <b> </b>
030 * <li>PTH-5: Pathway Life Cycle Status (CE) <b>optional </b>
031 * <li>PTH-6: Change Pathway Life Cycle Status Date/Time (TS) <b>optional </b>
032 * </ul>
033 */
034 public class PTH extends AbstractSegment {
035
036 /**
037 * Creates a new PTH segment
038 */
039 public PTH(Group parent, ModelClassFactory factory) {
040 super(parent, factory);
041 init(factory);
042 }
043
044 private void init(ModelClassFactory factory) {
045 try {
046 this.add(ID.class, true, 1, 2, new Object[]{ getMessage() }, "Action Code");
047 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Pathway ID");
048 this.add(EI.class, true, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Pathway Instance ID");
049 this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Pathway Established Date/Time");
050 this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Pathway Life Cycle Status");
051 this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Change Pathway Life Cycle Status Date/Time");
052 } catch(HL7Exception e) {
053 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PTH - this is probably a bug in the source code generator.", e);
054 }
055 }
056
057
058
059 /**
060 * Returns
061 * PTH-1: "Action Code" - creates it if necessary
062 */
063 public ID getActionCode() {
064 ID ret = null;
065 try {
066 Type t = this.getField(1, 0);
067 ret = (ID)t;
068 } catch (ClassCastException cce) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
070 throw new RuntimeException(cce);
071 } catch (HL7Exception he) {
072 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
073 throw new RuntimeException(he);
074 }
075 return ret;
076 }
077
078
079 /**
080 * Returns
081 * PTH-1: "Action Code" - creates it if necessary
082 */
083 public ID getPth1_ActionCode() {
084 ID ret = null;
085 try {
086 Type t = this.getField(1, 0);
087 ret = (ID)t;
088 } catch (ClassCastException cce) {
089 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
090 throw new RuntimeException(cce);
091 } catch (HL7Exception he) {
092 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
093 throw new RuntimeException(he);
094 }
095 return ret;
096 }
097
098
099
100 /**
101 * Returns
102 * PTH-2: "Pathway ID" - creates it if necessary
103 */
104 public CE getPathwayID() {
105 CE ret = null;
106 try {
107 Type t = this.getField(2, 0);
108 ret = (CE)t;
109 } catch (ClassCastException cce) {
110 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
111 throw new RuntimeException(cce);
112 } catch (HL7Exception he) {
113 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
114 throw new RuntimeException(he);
115 }
116 return ret;
117 }
118
119
120 /**
121 * Returns
122 * PTH-2: "Pathway ID" - creates it if necessary
123 */
124 public CE getPth2_PathwayID() {
125 CE ret = null;
126 try {
127 Type t = this.getField(2, 0);
128 ret = (CE)t;
129 } catch (ClassCastException cce) {
130 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
131 throw new RuntimeException(cce);
132 } catch (HL7Exception he) {
133 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
134 throw new RuntimeException(he);
135 }
136 return ret;
137 }
138
139
140
141 /**
142 * Returns
143 * PTH-3: "Pathway Instance ID" - creates it if necessary
144 */
145 public EI getPathwayInstanceID() {
146 EI ret = null;
147 try {
148 Type t = this.getField(3, 0);
149 ret = (EI)t;
150 } catch (ClassCastException cce) {
151 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
152 throw new RuntimeException(cce);
153 } catch (HL7Exception he) {
154 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
155 throw new RuntimeException(he);
156 }
157 return ret;
158 }
159
160
161 /**
162 * Returns
163 * PTH-3: "Pathway Instance ID" - creates it if necessary
164 */
165 public EI getPth3_PathwayInstanceID() {
166 EI ret = null;
167 try {
168 Type t = this.getField(3, 0);
169 ret = (EI)t;
170 } catch (ClassCastException cce) {
171 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
172 throw new RuntimeException(cce);
173 } catch (HL7Exception he) {
174 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
175 throw new RuntimeException(he);
176 }
177 return ret;
178 }
179
180
181
182 /**
183 * Returns
184 * PTH-4: "Pathway Established Date/Time" - creates it if necessary
185 */
186 public TS getPathwayEstablishedDateTime() {
187 TS ret = null;
188 try {
189 Type t = this.getField(4, 0);
190 ret = (TS)t;
191 } catch (ClassCastException cce) {
192 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
193 throw new RuntimeException(cce);
194 } catch (HL7Exception he) {
195 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
196 throw new RuntimeException(he);
197 }
198 return ret;
199 }
200
201
202 /**
203 * Returns
204 * PTH-4: "Pathway Established Date/Time" - creates it if necessary
205 */
206 public TS getPth4_PathwayEstablishedDateTime() {
207 TS ret = null;
208 try {
209 Type t = this.getField(4, 0);
210 ret = (TS)t;
211 } catch (ClassCastException cce) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
213 throw new RuntimeException(cce);
214 } catch (HL7Exception he) {
215 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
216 throw new RuntimeException(he);
217 }
218 return ret;
219 }
220
221
222
223 /**
224 * Returns
225 * PTH-5: "Pathway Life Cycle Status" - creates it if necessary
226 */
227 public CE getPathwayLifeCycleStatus() {
228 CE ret = null;
229 try {
230 Type t = this.getField(5, 0);
231 ret = (CE)t;
232 } catch (ClassCastException cce) {
233 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
234 throw new RuntimeException(cce);
235 } catch (HL7Exception he) {
236 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
237 throw new RuntimeException(he);
238 }
239 return ret;
240 }
241
242
243 /**
244 * Returns
245 * PTH-5: "Pathway Life Cycle Status" - creates it if necessary
246 */
247 public CE getPth5_PathwayLifeCycleStatus() {
248 CE ret = null;
249 try {
250 Type t = this.getField(5, 0);
251 ret = (CE)t;
252 } catch (ClassCastException cce) {
253 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
254 throw new RuntimeException(cce);
255 } catch (HL7Exception he) {
256 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
257 throw new RuntimeException(he);
258 }
259 return ret;
260 }
261
262
263
264 /**
265 * Returns
266 * PTH-6: "Change Pathway Life Cycle Status Date/Time" - creates it if necessary
267 */
268 public TS getChangePathwayLifeCycleStatusDateTime() {
269 TS ret = null;
270 try {
271 Type t = this.getField(6, 0);
272 ret = (TS)t;
273 } catch (ClassCastException cce) {
274 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
275 throw new RuntimeException(cce);
276 } catch (HL7Exception he) {
277 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
278 throw new RuntimeException(he);
279 }
280 return ret;
281 }
282
283
284 /**
285 * Returns
286 * PTH-6: "Change Pathway Life Cycle Status Date/Time" - creates it if necessary
287 */
288 public TS getPth6_ChangePathwayLifeCycleStatusDateTime() {
289 TS ret = null;
290 try {
291 Type t = this.getField(6, 0);
292 ret = (TS)t;
293 } catch (ClassCastException cce) {
294 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
295 throw new RuntimeException(cce);
296 } catch (HL7Exception he) {
297 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
298 throw new RuntimeException(he);
299 }
300 return ret;
301 }
302
303
304
305
306
307 /** {@inheritDoc} */
308 protected Type createNewTypeWithoutReflection(int field) {
309 switch (field) {
310 case 0: return new ID(getMessage(), new Integer( 287 ));
311 case 1: return new CE(getMessage());
312 case 2: return new EI(getMessage());
313 case 3: return new TS(getMessage());
314 case 4: return new CE(getMessage());
315 case 5: return new TS(getMessage());
316 default: return null;
317 }
318 }
319
320
321 }
322