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 "CM_SPS.java". Description: 15 * "Composite class CM_SPS" 16 * 17 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 18 * 2013. 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 package ca.uhn.hl7v2.model.v22.datatype; 34 35 import ca.uhn.hl7v2.model.DataTypeException; 36 import ca.uhn.hl7v2.model.Message; 37 import ca.uhn.hl7v2.model.Type; 38 import ca.uhn.hl7v2.model.AbstractComposite; 39 40 41 /** 42 * <p>Represents an HL7 CM_SPS (specimen source) data type. 43 * This type consists of the following components:</p> 44 * <ul> 45 * <li>Specimen source name or code (CE) 46 * <li>additives (TX) 47 * <li>freetext (TX) 48 * <li>body site (CE) 49 * <li>site modifier (CE) 50 * </ul> 51 */ 52 @SuppressWarnings("unused") 53 public class CM_SPS extends AbstractComposite { 54 55 private Type[] data; 56 57 /** 58 * Creates a new CM_SPS type 59 */ 60 public CM_SPS(Message message) { 61 super(message); 62 init(); 63 } 64 65 private void init() { 66 data = new Type[5]; 67 data[0] = new CE(getMessage()); 68 data[1] = new TX(getMessage()); 69 data[2] = new TX(getMessage()); 70 data[3] = new CE(getMessage()); 71 data[4] = new CE(getMessage()); 72 } 73 74 75 /** 76 * Returns an array containing the data elements. 77 */ 78 public Type[] getComponents() { 79 return this.data; 80 } 81 82 /** 83 * Returns an individual data component. 84 * 85 * @param number The component number (0-indexed) 86 * @throws DataTypeException if the given element number is out of range. 87 */ 88 public Type getComponent(int number) throws DataTypeException { 89 90 try { 91 return this.data[number]; 92 } catch (ArrayIndexOutOfBoundsException e) { 93 throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 94 } 95 } 96 97 98 /** 99 * Returns Specimen source name or code (component 1). This is a convenience method that saves you from 100 * casting and handling an exception. 101 */ 102 public CE getSpecimenSourceNameOrCode() { 103 return getTyped(0, CE.class); 104 } 105 106 107 /** 108 * Returns Specimen source name or code (component 1). This is a convenience method that saves you from 109 * casting and handling an exception. 110 */ 111 public CE getCm_sps1_SpecimenSourceNameOrCode() { 112 return getTyped(0, CE.class); 113 } 114 115 116 /** 117 * Returns additives (component 2). This is a convenience method that saves you from 118 * casting and handling an exception. 119 */ 120 public TX getAdditives() { 121 return getTyped(1, TX.class); 122 } 123 124 125 /** 126 * Returns additives (component 2). This is a convenience method that saves you from 127 * casting and handling an exception. 128 */ 129 public TX getCm_sps2_Additives() { 130 return getTyped(1, TX.class); 131 } 132 133 134 /** 135 * Returns freetext (component 3). This is a convenience method that saves you from 136 * casting and handling an exception. 137 */ 138 public TX getFreetext() { 139 return getTyped(2, TX.class); 140 } 141 142 143 /** 144 * Returns freetext (component 3). This is a convenience method that saves you from 145 * casting and handling an exception. 146 */ 147 public TX getCm_sps3_Freetext() { 148 return getTyped(2, TX.class); 149 } 150 151 152 /** 153 * Returns body site (component 4). This is a convenience method that saves you from 154 * casting and handling an exception. 155 */ 156 public CE getBodySite() { 157 return getTyped(3, CE.class); 158 } 159 160 161 /** 162 * Returns body site (component 4). This is a convenience method that saves you from 163 * casting and handling an exception. 164 */ 165 public CE getCm_sps4_BodySite() { 166 return getTyped(3, CE.class); 167 } 168 169 170 /** 171 * Returns site modifier (component 5). This is a convenience method that saves you from 172 * casting and handling an exception. 173 */ 174 public CE getSiteModifier() { 175 return getTyped(4, CE.class); 176 } 177 178 179 /** 180 * Returns site modifier (component 5). This is a convenience method that saves you from 181 * casting and handling an exception. 182 */ 183 public CE getCm_sps5_SiteModifier() { 184 return getTyped(4, CE.class); 185 } 186 187 188 189 } 190