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.group;
009
010 import ca.uhn.hl7v2.model.v24.segment.*;
011
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.AbstractGroup;
019 import ca.uhn.hl7v2.model.GenericSegment;
020
021 /**
022 * <p>Represents a CSU_C09_STUDY_PHASE group structure (a Group object).
023 * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024 * This Group contains the following elements:
025 * </p>
026 * <ul>
027 * <li>1: CSP (Clinical Study Phase) <b>optional repeating</b></li>
028 * <li>2: CSU_C09_STUDY_SCHEDULE (a Group object) <b> repeating</b></li>
029 * </ul>
030 */
031 public class CSU_C09_STUDY_PHASE extends AbstractGroup {
032
033 /**
034 * Creates a new CSU_C09_STUDY_PHASE group
035 */
036 public CSU_C09_STUDY_PHASE(Group parent, ModelClassFactory factory) {
037 super(parent, factory);
038 init(factory);
039 }
040
041 private void init(ModelClassFactory factory) {
042 try {
043 this.add(CSP.class, false, true);
044 this.add(CSU_C09_STUDY_SCHEDULE.class, true, true);
045 } catch(HL7Exception e) {
046 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating CSU_C09_STUDY_PHASE - this is probably a bug in the source code generator.", e);
047 }
048 }
049
050 /**
051 * Returns "2.4"
052 */
053 public String getVersion() {
054 return "2.4";
055 }
056
057
058
059 /**
060 * Returns
061 * the first repetition of
062 * CSP (Clinical Study Phase) - creates it if necessary
063 */
064 public CSP getCSP() {
065 CSP ret = null;
066 try {
067 ret = (CSP)this.get("CSP");
068 } catch(HL7Exception e) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
070 throw new RuntimeException(e);
071 }
072 return ret;
073 }
074
075
076 /**
077 * Returns a specific repetition of
078 * CSP (Clinical Study Phase) - creates it if necessary
079 *
080 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
081 * @throws HL7Exception if the repetition requested is more than one
082 * greater than the number of existing repetitions.
083 */
084 public CSP getCSP(int rep) {
085 CSP ret = null;
086 try {
087 ret = (CSP)this.get("CSP", rep);
088 } catch(HL7Exception e) {
089 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
090 throw new RuntimeException(e);
091 }
092 return ret;
093 }
094
095 /**
096 * Returns the number of existing repetitions of CSP
097 */
098 public int getCSPReps() {
099 int reps = -1;
100 try {
101 reps = this.getAll("CSP").length;
102 } catch (HL7Exception e) {
103 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
104 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
105 throw new RuntimeException(message);
106 }
107 return reps;
108 }
109
110 /**
111 * Inserts a specific repetition of CSP (Clinical Study Phase)
112 * @see AbstractGroup#insertRepetition(Structure, int)
113 */
114 public void insertCSP(CSP structure, int rep) throws HL7Exception {
115 super.insertRepetition("CSP", structure, rep);
116 }
117
118
119 /**
120 * Inserts a specific repetition of CSP (Clinical Study Phase)
121 * @see AbstractGroup#insertRepetition(Structure, int)
122 */
123 public CSP insertCSP(int rep) throws HL7Exception {
124 return (CSP)super.insertRepetition("CSP", rep);
125 }
126
127
128 /**
129 * Removes a specific repetition of CSP (Clinical Study Phase)
130 * @see AbstractGroup#removeRepetition(String, int)
131 */
132 public CSP removeCSP(int rep) throws HL7Exception {
133 return (CSP)super.removeRepetition("CSP", rep);
134 }
135
136
137
138 /**
139 * Returns
140 * the first repetition of
141 * STUDY_SCHEDULE (a Group object) - creates it if necessary
142 */
143 public CSU_C09_STUDY_SCHEDULE getSTUDY_SCHEDULE() {
144 CSU_C09_STUDY_SCHEDULE ret = null;
145 try {
146 ret = (CSU_C09_STUDY_SCHEDULE)this.get("STUDY_SCHEDULE");
147 } catch(HL7Exception e) {
148 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
149 throw new RuntimeException(e);
150 }
151 return ret;
152 }
153
154
155 /**
156 * Returns a specific repetition of
157 * STUDY_SCHEDULE (a Group object) - creates it if necessary
158 *
159 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
160 * @throws HL7Exception if the repetition requested is more than one
161 * greater than the number of existing repetitions.
162 */
163 public CSU_C09_STUDY_SCHEDULE getSTUDY_SCHEDULE(int rep) {
164 CSU_C09_STUDY_SCHEDULE ret = null;
165 try {
166 ret = (CSU_C09_STUDY_SCHEDULE)this.get("STUDY_SCHEDULE", rep);
167 } catch(HL7Exception e) {
168 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
169 throw new RuntimeException(e);
170 }
171 return ret;
172 }
173
174 /**
175 * Returns the number of existing repetitions of STUDY_SCHEDULE
176 */
177 public int getSTUDY_SCHEDULEReps() {
178 int reps = -1;
179 try {
180 reps = this.getAll("STUDY_SCHEDULE").length;
181 } catch (HL7Exception e) {
182 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
183 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
184 throw new RuntimeException(message);
185 }
186 return reps;
187 }
188
189 /**
190 * Inserts a specific repetition of STUDY_SCHEDULE (a Group object)
191 * @see AbstractGroup#insertRepetition(Structure, int)
192 */
193 public void insertSTUDY_SCHEDULE(CSU_C09_STUDY_SCHEDULE structure, int rep) throws HL7Exception {
194 super.insertRepetition("STUDY_SCHEDULE", structure, rep);
195 }
196
197
198 /**
199 * Inserts a specific repetition of STUDY_SCHEDULE (a Group object)
200 * @see AbstractGroup#insertRepetition(Structure, int)
201 */
202 public CSU_C09_STUDY_SCHEDULE insertSTUDY_SCHEDULE(int rep) throws HL7Exception {
203 return (CSU_C09_STUDY_SCHEDULE)super.insertRepetition("STUDY_SCHEDULE", rep);
204 }
205
206
207 /**
208 * Removes a specific repetition of STUDY_SCHEDULE (a Group object)
209 * @see AbstractGroup#removeRepetition(String, int)
210 */
211 public CSU_C09_STUDY_SCHEDULE removeSTUDY_SCHEDULE(int rep) throws HL7Exception {
212 return (CSU_C09_STUDY_SCHEDULE)super.removeRepetition("STUDY_SCHEDULE", rep);
213 }
214
215
216
217 }
218