View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v24.segment;
35  
36  // import ca.uhn.hl7v2.model.v24.group.*;
37  import ca.uhn.hl7v2.model.v24.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 AFF message segment (Professional Affiliation). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>AFF-1: Set ID - AFF (SI) <b> </b>
53       * <li>AFF-2: Professional Organization (XON) <b> </b>
54       * <li>AFF-3: Professional Organization Address (XAD) <b>optional </b>
55       * <li>AFF-4: Professional Organization Affiliation Date Range (DR) <b>optional repeating</b>
56       * <li>AFF-5: Professional Affiliation Additional Information (ST) <b>optional </b>
57   * </ul>
58   */
59  @SuppressWarnings("unused")
60  public class AFF extends AbstractSegment {
61  
62      /** 
63       * Creates a new AFF segment
64       */
65      public AFF(Group parent, ModelClassFactory factory) {
66         super(parent, factory);
67         init(factory);
68      }
69  
70      private void init(ModelClassFactory factory) {
71         try {
72                                    this.add(SI.class, true, 1, 60, new Object[]{ getMessage() }, "Set ID - AFF");
73                                    this.add(XON.class, true, 1, 250, new Object[]{ getMessage() }, "Professional Organization");
74                                    this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "Professional Organization Address");
75                                    this.add(DR.class, false, 0, 52, new Object[]{ getMessage() }, "Professional Organization Affiliation Date Range");
76                                    this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Professional Affiliation Additional Information");
77         } catch(HL7Exception e) {
78            log.error("Unexpected error creating AFF - this is probably a bug in the source code generator.", e);
79         }
80      }
81  
82  
83  
84      /**
85       * Returns
86       * AFF-1: "Set ID - AFF" - creates it if necessary
87       */
88      public SI getSetIDAFF() { 
89  		SI retVal = this.getTypedField(1, 0);
90  		return retVal;
91      }
92      
93      /**
94       * Returns
95       * AFF-1: "Set ID - AFF" - creates it if necessary
96       */
97      public SI getAff1_SetIDAFF() { 
98  		SI retVal = this.getTypedField(1, 0);
99  		return retVal;
100     }
101 
102 
103 
104     /**
105      * Returns
106      * AFF-2: "Professional Organization" - creates it if necessary
107      */
108     public XON getProfessionalOrganization() { 
109 		XON retVal = this.getTypedField(2, 0);
110 		return retVal;
111     }
112     
113     /**
114      * Returns
115      * AFF-2: "Professional Organization" - creates it if necessary
116      */
117     public XON getAff2_ProfessionalOrganization() { 
118 		XON retVal = this.getTypedField(2, 0);
119 		return retVal;
120     }
121 
122 
123 
124     /**
125      * Returns
126      * AFF-3: "Professional Organization Address" - creates it if necessary
127      */
128     public XAD getProfessionalOrganizationAddress() { 
129 		XAD retVal = this.getTypedField(3, 0);
130 		return retVal;
131     }
132     
133     /**
134      * Returns
135      * AFF-3: "Professional Organization Address" - creates it if necessary
136      */
137     public XAD getAff3_ProfessionalOrganizationAddress() { 
138 		XAD retVal = this.getTypedField(3, 0);
139 		return retVal;
140     }
141 
142 
143     /**
144      * Returns all repetitions of Professional Organization Affiliation Date Range (AFF-4).
145      */
146     public DR[] getProfessionalOrganizationAffiliationDateRange() {
147     	DR[] retVal = this.getTypedField(4, new DR[0]);
148     	return retVal;
149     }
150 
151 
152     /**
153      * Returns all repetitions of Professional Organization Affiliation Date Range (AFF-4).
154      */
155     public DR[] getAff4_ProfessionalOrganizationAffiliationDateRange() {
156     	DR[] retVal = this.getTypedField(4, new DR[0]);
157     	return retVal;
158     }
159 
160 
161     /**
162      * Returns a count of the current number of repetitions of Professional Organization Affiliation Date Range (AFF-4).
163      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
164      * it will return zero.
165      */
166     public int getProfessionalOrganizationAffiliationDateRangeReps() {
167     	return this.getReps(4);
168     }
169 
170 
171     /**
172      * Returns a specific repetition of
173      * AFF-4: "Professional Organization Affiliation Date Range" - creates it if necessary
174      *
175      * @param rep The repetition index (0-indexed)
176      */
177     public DR getProfessionalOrganizationAffiliationDateRange(int rep) { 
178 		DR retVal = this.getTypedField(4, rep);
179 		return retVal;
180     }
181 
182     /**
183      * Returns a specific repetition of
184      * AFF-4: "Professional Organization Affiliation Date Range" - creates it if necessary
185      *
186      * @param rep The repetition index (0-indexed)
187      */
188     public DR getAff4_ProfessionalOrganizationAffiliationDateRange(int rep) { 
189 		DR retVal = this.getTypedField(4, rep);
190 		return retVal;
191     }
192 
193     /**
194      * Returns a count of the current number of repetitions of Professional Organization Affiliation Date Range (AFF-4).
195      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
196      * it will return zero.
197      */
198     public int getAff4_ProfessionalOrganizationAffiliationDateRangeReps() {
199     	return this.getReps(4);
200     }
201 
202 
203     /**
204      * Inserts a repetition of
205      * AFF-4: "Professional Organization Affiliation Date Range" at a specific index
206      *
207      * @param rep The repetition index (0-indexed)
208      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
209      */
210     public DR insertProfessionalOrganizationAffiliationDateRange(int rep) throws HL7Exception { 
211         return (DR) super.insertRepetition(4, rep);
212     }
213 
214 
215     /**
216      * Inserts a repetition of
217      * AFF-4: "Professional Organization Affiliation Date Range" at a specific index
218      *
219      * @param rep The repetition index (0-indexed)
220      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
221      */
222     public DR insertAff4_ProfessionalOrganizationAffiliationDateRange(int rep) throws HL7Exception { 
223         return (DR) super.insertRepetition(4, rep);
224     }
225 
226 
227     /**
228      * Removes a repetition of
229      * AFF-4: "Professional Organization Affiliation Date Range" at a specific index
230      *
231      * @param rep The repetition index (0-indexed)
232      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
233      */
234     public DR removeProfessionalOrganizationAffiliationDateRange(int rep) throws HL7Exception { 
235         return (DR) super.removeRepetition(4, rep);
236     }
237 
238 
239     /**
240      * Removes a repetition of
241      * AFF-4: "Professional Organization Affiliation Date Range" at a specific index
242      *
243      * @param rep The repetition index (0-indexed)
244      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
245      */
246     public DR removeAff4_ProfessionalOrganizationAffiliationDateRange(int rep) throws HL7Exception { 
247         return (DR) super.removeRepetition(4, rep);
248     }
249 
250 
251 
252 
253     /**
254      * Returns
255      * AFF-5: "Professional Affiliation Additional Information" - creates it if necessary
256      */
257     public ST getProfessionalAffiliationAdditionalInformation() { 
258 		ST retVal = this.getTypedField(5, 0);
259 		return retVal;
260     }
261     
262     /**
263      * Returns
264      * AFF-5: "Professional Affiliation Additional Information" - creates it if necessary
265      */
266     public ST getAff5_ProfessionalAffiliationAdditionalInformation() { 
267 		ST retVal = this.getTypedField(5, 0);
268 		return retVal;
269     }
270 
271 
272 
273 
274 
275     /** {@inheritDoc} */   
276     protected Type createNewTypeWithoutReflection(int field) {
277        switch (field) {
278           case 0: return new SI(getMessage());
279           case 1: return new XON(getMessage());
280           case 2: return new XAD(getMessage());
281           case 3: return new DR(getMessage());
282           case 4: return new ST(getMessage());
283           default: return null;
284        }
285    }
286 
287 
288 }
289