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 SRR_S01_PERSONNEL_RESOURCE 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: AIP (Appointment Information - Personnel Resource) <b> </b></li>
028 * <li>2: NTE (Notes and Comments) <b>optional repeating</b></li>
029 * </ul>
030 */
031 public class SRR_S01_PERSONNEL_RESOURCE extends AbstractGroup {
032
033 /**
034 * Creates a new SRR_S01_PERSONNEL_RESOURCE group
035 */
036 public SRR_S01_PERSONNEL_RESOURCE(Group parent, ModelClassFactory factory) {
037 super(parent, factory);
038 init(factory);
039 }
040
041 private void init(ModelClassFactory factory) {
042 try {
043 this.add(AIP.class, true, false);
044 this.add(NTE.class, false, true);
045 } catch(HL7Exception e) {
046 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating SRR_S01_PERSONNEL_RESOURCE - 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 * AIP (Appointment Information - Personnel Resource) - creates it if necessary
062 */
063 public AIP getAIP() {
064 AIP ret = null;
065 try {
066 ret = (AIP)this.get("AIP");
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 * NTE (Notes and Comments) - creates it if necessary
081 */
082 public NTE getNTE() {
083 NTE ret = null;
084 try {
085 ret = (NTE)this.get("NTE");
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 * NTE (Notes and Comments) - 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 NTE getNTE(int rep) {
103 NTE ret = null;
104 try {
105 ret = (NTE)this.get("NTE", 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 NTE
115 */
116 public int getNTEReps() {
117 int reps = -1;
118 try {
119 reps = this.getAll("NTE").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 NTE (Notes and Comments)
130 * @see AbstractGroup#insertRepetition(Structure, int)
131 */
132 public void insertNTE(NTE structure, int rep) throws HL7Exception {
133 super.insertRepetition("NTE", structure, rep);
134 }
135
136
137 /**
138 * Inserts a specific repetition of NTE (Notes and Comments)
139 * @see AbstractGroup#insertRepetition(Structure, int)
140 */
141 public NTE insertNTE(int rep) throws HL7Exception {
142 return (NTE)super.insertRepetition("NTE", rep);
143 }
144
145
146 /**
147 * Removes a specific repetition of NTE (Notes and Comments)
148 * @see AbstractGroup#removeRepetition(String, int)
149 */
150 public NTE removeNTE(int rep) throws HL7Exception {
151 return (NTE)super.removeRepetition("NTE", rep);
152 }
153
154
155
156 }
157