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 * The contents of this file are subject to the Mozilla Public License Version 1.1 008 * (the "License"); you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 010 * Software distributed under the License is distributed on an "AS IS" basis, 011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 012 * specific language governing rights and limitations under the License. 013 * 014 * The Original Code is "[file_name]". Description: 015 * "[one_line_description]" 016 * 017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 018 * 2012. All Rights Reserved. 019 * 020 * Contributor(s): ______________________________________. 021 * 022 * Alternatively, the contents of this file may be used under the terms of the 023 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 024 * applicable instead of those above. If you wish to allow use of your version of this 025 * file only under the terms of the GPL and not to allow others to use your version 026 * of this file under the MPL, indicate your decision by deleting the provisions above 027 * and replace them with the notice and other provisions required by the GPL License. 028 * If you do not delete the provisions above, a recipient may use your version of 029 * this file under either the MPL or the GPL. 030 * 031 */ 032 033 034package ca.uhn.hl7v2.model.v251.segment; 035 036// import ca.uhn.hl7v2.model.v251.group.*; 037import ca.uhn.hl7v2.model.v251.datatype.*; 038import ca.uhn.hl7v2.HL7Exception; 039import ca.uhn.hl7v2.parser.ModelClassFactory; 040import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 041import ca.uhn.hl7v2.model.AbstractMessage; 042import ca.uhn.hl7v2.model.Group; 043import ca.uhn.hl7v2.model.Type; 044import ca.uhn.hl7v2.model.AbstractSegment; 045import ca.uhn.hl7v2.model.Varies; 046 047 048/** 049 *<p>Represents an HL7 AFF message segment (Professional Affiliation). 050 * This segment has the following fields:</p> 051 * <ul> 052 * <li>AFF-1: Set ID - AFF (SI) <b> </b> 053 * <li>AFF-2: Professional Organization (XON) <b> </b> 054 * <li>AFF-3: Professional Organization Address (XAD) <b>optional </b> 055 * <li>AFF-4: Professional Organization Affiliation Date Range (DR) <b>optional repeating</b> 056 * <li>AFF-5: Professional Affiliation Additional Information (ST) <b>optional </b> 057 * </ul> 058 */ 059@SuppressWarnings("unused") 060public class AFF extends AbstractSegment { 061 062 /** 063 * Creates a new AFF segment 064 */ 065 public AFF(Group parent, ModelClassFactory factory) { 066 super(parent, factory); 067 init(factory); 068 } 069 070 private void init(ModelClassFactory factory) { 071 try { 072 this.add(SI.class, true, 1, 60, new Object[]{ getMessage() }, "Set ID - AFF"); 073 this.add(XON.class, true, 1, 250, new Object[]{ getMessage() }, "Professional Organization"); 074 this.add(XAD.class, false, 1, 250, new Object[]{ getMessage() }, "Professional Organization Address"); 075 this.add(DR.class, false, 0, 52, new Object[]{ getMessage() }, "Professional Organization Affiliation Date Range"); 076 this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Professional Affiliation Additional Information"); 077 } catch(HL7Exception e) { 078 log.error("Unexpected error creating AFF - this is probably a bug in the source code generator.", e); 079 } 080 } 081 082 083 084 /** 085 * Returns 086 * AFF-1: "Set ID - AFF" - creates it if necessary 087 */ 088 public SI getSetIDAFF() { 089 SI retVal = this.getTypedField(1, 0); 090 return retVal; 091 } 092 093 /** 094 * Returns 095 * AFF-1: "Set ID - AFF" - creates it if necessary 096 */ 097 public SI getAff1_SetIDAFF() { 098 SI retVal = this.getTypedField(1, 0); 099 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