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.v231.group;
009
010 import ca.uhn.hl7v2.model.v231.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 ORM_O01_ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG 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: ORC (ORC - common order segment) <b> </b></li>
028 * <li>2: ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE (a Group object) <b>optional </b></li>
029 * <li>3: CTI (CTI - clinical trial identification segment) <b>optional repeating</b></li>
030 * <li>4: BLG (BLG - billing segment) <b>optional </b></li>
031 * </ul>
032 */
033 public class ORM_O01_ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG extends AbstractGroup {
034
035 /**
036 * Creates a new ORM_O01_ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG group
037 */
038 public ORM_O01_ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG(Group parent, ModelClassFactory factory) {
039 super(parent, factory);
040 init(factory);
041 }
042
043 private void init(ModelClassFactory factory) {
044 try {
045 this.add(ORC.class, true, false);
046 this.add(ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE.class, false, false);
047 this.add(CTI.class, false, true);
048 this.add(BLG.class, false, false);
049 } catch(HL7Exception e) {
050 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ORM_O01_ORCOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTECTIBLG - this is probably a bug in the source code generator.", e);
051 }
052 }
053
054 /**
055 * Returns "2.3.1"
056 */
057 public String getVersion() {
058 return "2.3.1";
059 }
060
061
062
063 /**
064 * Returns
065 * ORC (ORC - common order segment) - creates it if necessary
066 */
067 public ORC getORC() {
068 ORC ret = null;
069 try {
070 ret = (ORC)this.get("ORC");
071 } catch(HL7Exception e) {
072 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
073 throw new RuntimeException(e);
074 }
075 return ret;
076 }
077
078
079
080
081 /**
082 * Returns
083 * OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE (a Group object) - creates it if necessary
084 */
085 public ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE getOBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE() {
086 ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE ret = null;
087 try {
088 ret = (ORM_O01_OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE)this.get("OBRRQDRQ1ODSODTRXONTEDG1RXRRXCNTEOBXNTE");
089 } catch(HL7Exception e) {
090 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
091 throw new RuntimeException(e);
092 }
093 return ret;
094 }
095
096
097
098
099 /**
100 * Returns
101 * the first repetition of
102 * CTI (CTI - clinical trial identification segment) - creates it if necessary
103 */
104 public CTI getCTI() {
105 CTI ret = null;
106 try {
107 ret = (CTI)this.get("CTI");
108 } catch(HL7Exception e) {
109 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
110 throw new RuntimeException(e);
111 }
112 return ret;
113 }
114
115
116 /**
117 * Returns a specific repetition of
118 * CTI (CTI - clinical trial identification segment) - creates it if necessary
119 *
120 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
121 * @throws HL7Exception if the repetition requested is more than one
122 * greater than the number of existing repetitions.
123 */
124 public CTI getCTI(int rep) {
125 CTI ret = null;
126 try {
127 ret = (CTI)this.get("CTI", rep);
128 } catch(HL7Exception e) {
129 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
130 throw new RuntimeException(e);
131 }
132 return ret;
133 }
134
135 /**
136 * Returns the number of existing repetitions of CTI
137 */
138 public int getCTIReps() {
139 int reps = -1;
140 try {
141 reps = this.getAll("CTI").length;
142 } catch (HL7Exception e) {
143 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
144 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
145 throw new RuntimeException(message);
146 }
147 return reps;
148 }
149
150 /**
151 * Inserts a specific repetition of CTI (CTI - clinical trial identification segment)
152 * @see AbstractGroup#insertRepetition(Structure, int)
153 */
154 public void insertCTI(CTI structure, int rep) throws HL7Exception {
155 super.insertRepetition("CTI", structure, rep);
156 }
157
158
159 /**
160 * Inserts a specific repetition of CTI (CTI - clinical trial identification segment)
161 * @see AbstractGroup#insertRepetition(Structure, int)
162 */
163 public CTI insertCTI(int rep) throws HL7Exception {
164 return (CTI)super.insertRepetition("CTI", rep);
165 }
166
167
168 /**
169 * Removes a specific repetition of CTI (CTI - clinical trial identification segment)
170 * @see AbstractGroup#removeRepetition(String, int)
171 */
172 public CTI removeCTI(int rep) throws HL7Exception {
173 return (CTI)super.removeRepetition("CTI", rep);
174 }
175
176
177
178 /**
179 * Returns
180 * BLG (BLG - billing segment) - creates it if necessary
181 */
182 public BLG getBLG() {
183 BLG ret = null;
184 try {
185 ret = (BLG)this.get("BLG");
186 } catch(HL7Exception e) {
187 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
188 throw new RuntimeException(e);
189 }
190 return ret;
191 }
192
193
194
195
196 }
197