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 RGR_RGR_DEFINTION 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: QRD (Original-Style Query Definition) <b> </b></li>
028 * <li>2: QRF (Original Style Query Filter) <b>optional </b></li>
029 * <li>3: RGR_RGR_PATIENT (a Group object) <b>optional </b></li>
030 * <li>4: RGR_RGR_ORDER (a Group object) <b> repeating</b></li>
031 * </ul>
032 */
033 public class RGR_RGR_DEFINTION extends AbstractGroup {
034
035 /**
036 * Creates a new RGR_RGR_DEFINTION group
037 */
038 public RGR_RGR_DEFINTION(Group parent, ModelClassFactory factory) {
039 super(parent, factory);
040 init(factory);
041 }
042
043 private void init(ModelClassFactory factory) {
044 try {
045 this.add(QRD.class, true, false);
046 this.add(QRF.class, false, false);
047 this.add(RGR_RGR_PATIENT.class, false, false);
048 this.add(RGR_RGR_ORDER.class, true, true);
049 } catch(HL7Exception e) {
050 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RGR_RGR_DEFINTION - this is probably a bug in the source code generator.", e);
051 }
052 }
053
054 /**
055 * Returns "2.4"
056 */
057 public String getVersion() {
058 return "2.4";
059 }
060
061
062
063 /**
064 * Returns
065 * QRD (Original-Style Query Definition) - creates it if necessary
066 */
067 public QRD getQRD() {
068 QRD ret = null;
069 try {
070 ret = (QRD)this.get("QRD");
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 * QRF (Original Style Query Filter) - creates it if necessary
084 */
085 public QRF getQRF() {
086 QRF ret = null;
087 try {
088 ret = (QRF)this.get("QRF");
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 * PATIENT (a Group object) - creates it if necessary
102 */
103 public RGR_RGR_PATIENT getPATIENT() {
104 RGR_RGR_PATIENT ret = null;
105 try {
106 ret = (RGR_RGR_PATIENT)this.get("PATIENT");
107 } catch(HL7Exception e) {
108 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
109 throw new RuntimeException(e);
110 }
111 return ret;
112 }
113
114
115
116
117 /**
118 * Returns
119 * the first repetition of
120 * ORDER (a Group object) - creates it if necessary
121 */
122 public RGR_RGR_ORDER getORDER() {
123 RGR_RGR_ORDER ret = null;
124 try {
125 ret = (RGR_RGR_ORDER)this.get("ORDER");
126 } catch(HL7Exception e) {
127 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
128 throw new RuntimeException(e);
129 }
130 return ret;
131 }
132
133
134 /**
135 * Returns a specific repetition of
136 * ORDER (a Group object) - creates it if necessary
137 *
138 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
139 * @throws HL7Exception if the repetition requested is more than one
140 * greater than the number of existing repetitions.
141 */
142 public RGR_RGR_ORDER getORDER(int rep) {
143 RGR_RGR_ORDER ret = null;
144 try {
145 ret = (RGR_RGR_ORDER)this.get("ORDER", rep);
146 } catch(HL7Exception e) {
147 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
148 throw new RuntimeException(e);
149 }
150 return ret;
151 }
152
153 /**
154 * Returns the number of existing repetitions of ORDER
155 */
156 public int getORDERReps() {
157 int reps = -1;
158 try {
159 reps = this.getAll("ORDER").length;
160 } catch (HL7Exception e) {
161 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
162 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
163 throw new RuntimeException(message);
164 }
165 return reps;
166 }
167
168 /**
169 * Inserts a specific repetition of ORDER (a Group object)
170 * @see AbstractGroup#insertRepetition(Structure, int)
171 */
172 public void insertORDER(RGR_RGR_ORDER structure, int rep) throws HL7Exception {
173 super.insertRepetition("ORDER", structure, rep);
174 }
175
176
177 /**
178 * Inserts a specific repetition of ORDER (a Group object)
179 * @see AbstractGroup#insertRepetition(Structure, int)
180 */
181 public RGR_RGR_ORDER insertORDER(int rep) throws HL7Exception {
182 return (RGR_RGR_ORDER)super.insertRepetition("ORDER", rep);
183 }
184
185
186 /**
187 * Removes a specific repetition of ORDER (a Group object)
188 * @see AbstractGroup#removeRepetition(String, int)
189 */
190 public RGR_RGR_ORDER removeORDER(int rep) throws HL7Exception {
191 return (RGR_RGR_ORDER)super.removeRepetition("ORDER", rep);
192 }
193
194
195
196 }
197