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 033package ca.uhn.hl7v2.model.v251.datatype; 034 035import ca.uhn.hl7v2.model.DataTypeException; 036import ca.uhn.hl7v2.model.Message; 037import ca.uhn.hl7v2.model.Type; 038import ca.uhn.hl7v2.model.AbstractComposite; 039 040/** 041 * <p>Represents an HL7 XTN (Extended Telecommunication Number) data type. 042 * This type consists of the following components:</p> 043 * <ul> 044 * <li>Telephone Number (ST) 045 * <li>Telecommunication Use Code (ID) 046 * <li>Telecommunication Equipment Type (ID) 047 * <li>Email Address (ST) 048 * <li>Country Code (NM) 049 * <li>Area/City Code (NM) 050 * <li>Local Number (NM) 051 * <li>Extension (NM) 052 * <li>Any Text (ST) 053 * <li>Extension Prefix (ST) 054 * <li>Speed Dial Code (ST) 055 * <li>Unformatted Telephone number (ST) 056 * </ul> 057 */ 058@SuppressWarnings("unused") 059public class XTN extends AbstractComposite { 060 061 private Type[] data; 062 063 /** 064 * Creates a new XTN type 065 */ 066 public XTN(Message message) { 067 super(message); 068 init(); 069 } 070 071 private void init() { 072 data = new Type[12]; 073 data[0] = new ST(getMessage()); 074 data[1] = new ID(getMessage(), 201); 075 data[2] = new ID(getMessage(), 202); 076 data[3] = new ST(getMessage()); 077 data[4] = new NM(getMessage()); 078 data[5] = new NM(getMessage()); 079 data[6] = new NM(getMessage()); 080 data[7] = new NM(getMessage()); 081 data[8] = new ST(getMessage()); 082 data[9] = new ST(getMessage()); 083 data[10] = new ST(getMessage()); 084 data[11] = new ST(getMessage()); 085 } 086 087 088 /** 089 * Returns an array containing the data elements. 090 */ 091 public Type[] getComponents() { 092 return this.data; 093 } 094 095 /** 096 * Returns an individual data component. 097 * 098 * @param number The component number (0-indexed) 099 * @throws DataTypeException if the given element number is out of range. 100 */ 101 public Type getComponent(int number) throws DataTypeException { 102 103 try { 104 return this.data[number]; 105 } catch (ArrayIndexOutOfBoundsException e) { 106 throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 107 } 108 } 109 110 111 /** 112 * Returns Telephone Number (component 1). This is a convenience method that saves you from 113 * casting and handling an exception. 114 */ 115 public ST getTelephoneNumber() { 116 return getTyped(0, ST.class); 117 } 118 119 120 /** 121 * Returns Telephone Number (component 1). This is a convenience method that saves you from 122 * casting and handling an exception. 123 */ 124 public ST getXtn1_TelephoneNumber() { 125 return getTyped(0, ST.class); 126 } 127 128 129 /** 130 * Returns Telecommunication Use Code (component 2). This is a convenience method that saves you from 131 * casting and handling an exception. 132 */ 133 public ID getTelecommunicationUseCode() { 134 return getTyped(1, ID.class); 135 } 136 137 138 /** 139 * Returns Telecommunication Use Code (component 2). This is a convenience method that saves you from 140 * casting and handling an exception. 141 */ 142 public ID getXtn2_TelecommunicationUseCode() { 143 return getTyped(1, ID.class); 144 } 145 146 147 /** 148 * Returns Telecommunication Equipment Type (component 3). This is a convenience method that saves you from 149 * casting and handling an exception. 150 */ 151 public ID getTelecommunicationEquipmentType() { 152 return getTyped(2, ID.class); 153 } 154 155 156 /** 157 * Returns Telecommunication Equipment Type (component 3). This is a convenience method that saves you from 158 * casting and handling an exception. 159 */ 160 public ID getXtn3_TelecommunicationEquipmentType() { 161 return getTyped(2, ID.class); 162 } 163 164 165 /** 166 * Returns Email Address (component 4). This is a convenience method that saves you from 167 * casting and handling an exception. 168 */ 169 public ST getEmailAddress() { 170 return getTyped(3, ST.class); 171 } 172 173 174 /** 175 * Returns Email Address (component 4). This is a convenience method that saves you from 176 * casting and handling an exception. 177 */ 178 public ST getXtn4_EmailAddress() { 179 return getTyped(3, ST.class); 180 } 181 182 183 /** 184 * Returns Country Code (component 5). This is a convenience method that saves you from 185 * casting and handling an exception. 186 */ 187 public NM getCountryCode() { 188 return getTyped(4, NM.class); 189 } 190 191 192 /** 193 * Returns Country Code (component 5). This is a convenience method that saves you from 194 * casting and handling an exception. 195 */ 196 public NM getXtn5_CountryCode() { 197 return getTyped(4, NM.class); 198 } 199 200 201 /** 202 * Returns Area/City Code (component 6). This is a convenience method that saves you from 203 * casting and handling an exception. 204 */ 205 public NM getAreaCityCode() { 206 return getTyped(5, NM.class); 207 } 208 209 210 /** 211 * Returns Area/City Code (component 6). This is a convenience method that saves you from 212 * casting and handling an exception. 213 */ 214 public NM getXtn6_AreaCityCode() { 215 return getTyped(5, NM.class); 216 } 217 218 219 /** 220 * Returns Local Number (component 7). This is a convenience method that saves you from 221 * casting and handling an exception. 222 */ 223 public NM getLocalNumber() { 224 return getTyped(6, NM.class); 225 } 226 227 228 /** 229 * Returns Local Number (component 7). This is a convenience method that saves you from 230 * casting and handling an exception. 231 */ 232 public NM getXtn7_LocalNumber() { 233 return getTyped(6, NM.class); 234 } 235 236 237 /** 238 * Returns Extension (component 8). This is a convenience method that saves you from 239 * casting and handling an exception. 240 */ 241 public NM getExtension() { 242 return getTyped(7, NM.class); 243 } 244 245 246 /** 247 * Returns Extension (component 8). This is a convenience method that saves you from 248 * casting and handling an exception. 249 */ 250 public NM getXtn8_Extension() { 251 return getTyped(7, NM.class); 252 } 253 254 255 /** 256 * Returns Any Text (component 9). This is a convenience method that saves you from 257 * casting and handling an exception. 258 */ 259 public ST getAnyText() { 260 return getTyped(8, ST.class); 261 } 262 263 264 /** 265 * Returns Any Text (component 9). This is a convenience method that saves you from 266 * casting and handling an exception. 267 */ 268 public ST getXtn9_AnyText() { 269 return getTyped(8, ST.class); 270 } 271 272 273 /** 274 * Returns Extension Prefix (component 10). This is a convenience method that saves you from 275 * casting and handling an exception. 276 */ 277 public ST getExtensionPrefix() { 278 return getTyped(9, ST.class); 279 } 280 281 282 /** 283 * Returns Extension Prefix (component 10). This is a convenience method that saves you from 284 * casting and handling an exception. 285 */ 286 public ST getXtn10_ExtensionPrefix() { 287 return getTyped(9, ST.class); 288 } 289 290 291 /** 292 * Returns Speed Dial Code (component 11). This is a convenience method that saves you from 293 * casting and handling an exception. 294 */ 295 public ST getSpeedDialCode() { 296 return getTyped(10, ST.class); 297 } 298 299 300 /** 301 * Returns Speed Dial Code (component 11). This is a convenience method that saves you from 302 * casting and handling an exception. 303 */ 304 public ST getXtn11_SpeedDialCode() { 305 return getTyped(10, ST.class); 306 } 307 308 309 /** 310 * Returns Unformatted Telephone number (component 12). This is a convenience method that saves you from 311 * casting and handling an exception. 312 */ 313 public ST getUnformattedTelephoneNumber() { 314 return getTyped(11, ST.class); 315 } 316 317 318 /** 319 * Returns Unformatted Telephone number (component 12). This is a convenience method that saves you from 320 * casting and handling an exception. 321 */ 322 public ST getXtn12_UnformattedTelephoneNumber() { 323 return getTyped(11, ST.class); 324 } 325 326 327 328} 329