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 RRO_O02_PIDNTEORCRXONTERXRRXCNTE 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: RRO_O02_PIDNTE (a Group object) <b>optional </b></li>
028                     * <li>2: RRO_O02_ORCRXONTERXRRXCNTE (a Group object) <b> repeating</b></li>
029     * </ul>
030     */
031    public class RRO_O02_PIDNTEORCRXONTERXRRXCNTE extends AbstractGroup {
032    
033        /** 
034         * Creates a new RRO_O02_PIDNTEORCRXONTERXRRXCNTE group
035         */
036        public RRO_O02_PIDNTEORCRXONTERXRRXCNTE(Group parent, ModelClassFactory factory) {
037           super(parent, factory);
038           init(factory);
039        }
040    
041        private void init(ModelClassFactory factory) {
042           try {
043                              this.add(RRO_O02_PIDNTE.class, false, false);
044                              this.add(RRO_O02_ORCRXONTERXRRXCNTE.class, true, true);
045           } catch(HL7Exception e) {
046              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RRO_O02_PIDNTEORCRXONTERXRRXCNTE - this is probably a bug in the source code generator.", e);
047           }
048        }
049    
050        /** 
051         * Returns "2.3.1"
052         */
053        public String getVersion() {
054           return "2.3.1";
055        }
056    
057    
058    
059        /**
060         * Returns
061         * PIDNTE (a Group object) - creates it if necessary
062         */
063        public RRO_O02_PIDNTE getPIDNTE() { 
064           RRO_O02_PIDNTE ret = null;
065           try {
066              ret = (RRO_O02_PIDNTE)this.get("PIDNTE");
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         * ORCRXONTERXRRXCNTE (a Group object) - creates it if necessary
081         */
082        public RRO_O02_ORCRXONTERXRRXCNTE getORCRXONTERXRRXCNTE() { 
083           RRO_O02_ORCRXONTERXRRXCNTE ret = null;
084           try {
085              ret = (RRO_O02_ORCRXONTERXRRXCNTE)this.get("ORCRXONTERXRRXCNTE");
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         * ORCRXONTERXRRXCNTE (a Group object) - 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 RRO_O02_ORCRXONTERXRRXCNTE getORCRXONTERXRRXCNTE(int rep) { 
103           RRO_O02_ORCRXONTERXRRXCNTE ret = null;
104           try {
105              ret = (RRO_O02_ORCRXONTERXRRXCNTE)this.get("ORCRXONTERXRRXCNTE", 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 ORCRXONTERXRRXCNTE 
115         */ 
116        public int getORCRXONTERXRRXCNTEReps() { 
117            int reps = -1; 
118            try { 
119                reps = this.getAll("ORCRXONTERXRRXCNTE").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 ORCRXONTERXRRXCNTE (a Group object)
130         * @see AbstractGroup#insertRepetition(Structure, int) 
131         */
132        public void insertORCRXONTERXRRXCNTE(RRO_O02_ORCRXONTERXRRXCNTE structure, int rep) throws HL7Exception { 
133           super.insertRepetition("ORCRXONTERXRRXCNTE", structure, rep);
134        }
135    
136    
137        /**
138         * Inserts a specific repetition of ORCRXONTERXRRXCNTE (a Group object)
139         * @see AbstractGroup#insertRepetition(Structure, int) 
140         */
141        public RRO_O02_ORCRXONTERXRRXCNTE insertORCRXONTERXRRXCNTE(int rep) throws HL7Exception { 
142           return (RRO_O02_ORCRXONTERXRRXCNTE)super.insertRepetition("ORCRXONTERXRRXCNTE", rep);
143        }
144    
145    
146        /**
147         * Removes a specific repetition of ORCRXONTERXRRXCNTE (a Group object)
148         * @see AbstractGroup#removeRepetition(String, int) 
149         */
150        public RRO_O02_ORCRXONTERXRRXCNTE removeORCRXONTERXRRXCNTE(int rep) throws HL7Exception { 
151           return (RRO_O02_ORCRXONTERXRRXCNTE)super.removeRepetition("ORCRXONTERXRRXCNTE", rep);
152        }
153    
154    
155    
156    }
157