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 CM1 message segment (Clinical Study Phase Master).
024 * This segment has the following fields:</p>
025 * <ul>
026 * <li>CM1-1: Set ID - CM1 (SI) <b> </b>
027 * <li>CM1-2: Study Phase Identifier (CE) <b> </b>
028 * <li>CM1-3: Description of Study Phase (ST) <b> </b>
029 * </ul>
030 */
031 public class CM1 extends AbstractSegment {
032
033 /**
034 * Creates a new CM1 segment
035 */
036 public CM1(Group parent, ModelClassFactory factory) {
037 super(parent, factory);
038 init(factory);
039 }
040
041 private void init(ModelClassFactory factory) {
042 try {
043 this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - CM1");
044 this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Study Phase Identifier");
045 this.add(ST.class, true, 1, 300, new Object[]{ getMessage(), new Integer(0) }, "Description of Study Phase");
046 } catch(HL7Exception e) {
047 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating CM1 - this is probably a bug in the source code generator.", e);
048 }
049 }
050
051
052
053 /**
054 * Returns
055 * CM1-1: "Set ID - CM1" - creates it if necessary
056 */
057 public SI getSetIDCM1() {
058 SI ret = null;
059 try {
060 Type t = this.getField(1, 0);
061 ret = (SI)t;
062 } catch (ClassCastException cce) {
063 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
064 throw new RuntimeException(cce);
065 } catch (HL7Exception he) {
066 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
067 throw new RuntimeException(he);
068 }
069 return ret;
070 }
071
072
073 /**
074 * Returns
075 * CM1-1: "Set ID - CM1" - creates it if necessary
076 */
077 public SI getCm11_SetIDCM1() {
078 SI ret = null;
079 try {
080 Type t = this.getField(1, 0);
081 ret = (SI)t;
082 } catch (ClassCastException cce) {
083 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
084 throw new RuntimeException(cce);
085 } catch (HL7Exception he) {
086 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
087 throw new RuntimeException(he);
088 }
089 return ret;
090 }
091
092
093
094 /**
095 * Returns
096 * CM1-2: "Study Phase Identifier" - creates it if necessary
097 */
098 public CE getStudyPhaseIdentifier() {
099 CE ret = null;
100 try {
101 Type t = this.getField(2, 0);
102 ret = (CE)t;
103 } catch (ClassCastException cce) {
104 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
105 throw new RuntimeException(cce);
106 } catch (HL7Exception he) {
107 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
108 throw new RuntimeException(he);
109 }
110 return ret;
111 }
112
113
114 /**
115 * Returns
116 * CM1-2: "Study Phase Identifier" - creates it if necessary
117 */
118 public CE getCm12_StudyPhaseIdentifier() {
119 CE ret = null;
120 try {
121 Type t = this.getField(2, 0);
122 ret = (CE)t;
123 } catch (ClassCastException cce) {
124 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
125 throw new RuntimeException(cce);
126 } catch (HL7Exception he) {
127 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
128 throw new RuntimeException(he);
129 }
130 return ret;
131 }
132
133
134
135 /**
136 * Returns
137 * CM1-3: "Description of Study Phase" - creates it if necessary
138 */
139 public ST getDescriptionOfStudyPhase() {
140 ST ret = null;
141 try {
142 Type t = this.getField(3, 0);
143 ret = (ST)t;
144 } catch (ClassCastException cce) {
145 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
146 throw new RuntimeException(cce);
147 } catch (HL7Exception he) {
148 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
149 throw new RuntimeException(he);
150 }
151 return ret;
152 }
153
154
155 /**
156 * Returns
157 * CM1-3: "Description of Study Phase" - creates it if necessary
158 */
159 public ST getCm13_DescriptionOfStudyPhase() {
160 ST ret = null;
161 try {
162 Type t = this.getField(3, 0);
163 ret = (ST)t;
164 } catch (ClassCastException cce) {
165 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce);
166 throw new RuntimeException(cce);
167 } catch (HL7Exception he) {
168 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he);
169 throw new RuntimeException(he);
170 }
171 return ret;
172 }
173
174
175
176
177
178 /** {@inheritDoc} */
179 protected Type createNewTypeWithoutReflection(int field) {
180 switch (field) {
181 case 0: return new SI(getMessage());
182 case 1: return new CE(getMessage());
183 case 2: return new ST(getMessage());
184 default: return null;
185 }
186 }
187
188
189 }
190