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 RTB_K13_ROW_DEFINITION 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: RDF (Table Row Definition) <b> </b></li>
028 * <li>2: RDT (Table Row Data) <b>optional repeating</b></li>
029 * </ul>
030 */
031 public class RTB_K13_ROW_DEFINITION extends AbstractGroup {
032
033 /**
034 * Creates a new RTB_K13_ROW_DEFINITION group
035 */
036 public RTB_K13_ROW_DEFINITION(Group parent, ModelClassFactory factory) {
037 super(parent, factory);
038 init(factory);
039 }
040
041 private void init(ModelClassFactory factory) {
042 try {
043 this.add(RDF.class, true, false);
044 this.add(RDT.class, false, true);
045 } catch(HL7Exception e) {
046 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RTB_K13_ROW_DEFINITION - 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 * RDF (Table Row Definition) - creates it if necessary
062 */
063 public RDF getRDF() {
064 RDF ret = null;
065 try {
066 ret = (RDF)this.get("RDF");
067 } catch(HL7Exception e) {
068 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
069 throw new RuntimeException(e);
070 }
071 return ret;
072 }
073
074
075
076
077 /**
078 * Returns
079 * the first repetition of
080 * RDT (Table Row Data) - creates it if necessary
081 */
082 public RDT getRDT() {
083 RDT ret = null;
084 try {
085 ret = (RDT)this.get("RDT");
086 } catch(HL7Exception e) {
087 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
088 throw new RuntimeException(e);
089 }
090 return ret;
091 }
092
093
094 /**
095 * Returns a specific repetition of
096 * RDT (Table Row Data) - creates it if necessary
097 *
098 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
099 * @throws HL7Exception if the repetition requested is more than one
100 * greater than the number of existing repetitions.
101 */
102 public RDT getRDT(int rep) {
103 RDT ret = null;
104 try {
105 ret = (RDT)this.get("RDT", rep);
106 } catch(HL7Exception e) {
107 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
108 throw new RuntimeException(e);
109 }
110 return ret;
111 }
112
113 /**
114 * Returns the number of existing repetitions of RDT
115 */
116 public int getRDTReps() {
117 int reps = -1;
118 try {
119 reps = this.getAll("RDT").length;
120 } catch (HL7Exception e) {
121 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
122 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
123 throw new RuntimeException(message);
124 }
125 return reps;
126 }
127
128 /**
129 * Inserts a specific repetition of RDT (Table Row Data)
130 * @see AbstractGroup#insertRepetition(Structure, int)
131 */
132 public void insertRDT(RDT structure, int rep) throws HL7Exception {
133 super.insertRepetition("RDT", structure, rep);
134 }
135
136
137 /**
138 * Inserts a specific repetition of RDT (Table Row Data)
139 * @see AbstractGroup#insertRepetition(Structure, int)
140 */
141 public RDT insertRDT(int rep) throws HL7Exception {
142 return (RDT)super.insertRepetition("RDT", rep);
143 }
144
145
146 /**
147 * Removes a specific repetition of RDT (Table Row Data)
148 * @see AbstractGroup#removeRepetition(String, int)
149 */
150 public RDT removeRDT(int rep) throws HL7Exception {
151 return (RDT)super.removeRepetition("RDT", rep);
152 }
153
154
155
156 }
157