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 SPS (Specimen Source) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>Specimen Source Name or Code (CWE)
045 * <li>Additives (CWE)
046 * <li>Specimen Collection Method (TX)
047 * <li>Body Site (CWE)
048 * <li>Site Modifier (CWE)
049 * <li>Collection Method Modifier Code (CWE)
050 * <li>Specimen Role (CWE)
051 * </ul>
052 */
053@SuppressWarnings("unused")
054public class SPS extends AbstractComposite {
055
056    private Type[] data;
057
058    /** 
059     * Creates a new SPS type
060     */
061    public SPS(Message message) {
062        super(message);
063        init();
064    }
065
066    private void init() {
067        data = new Type[7];    
068        data[0] = new CWE(getMessage());
069        data[1] = new CWE(getMessage());
070        data[2] = new TX(getMessage());
071        data[3] = new CWE(getMessage());
072        data[4] = new CWE(getMessage());
073        data[5] = new CWE(getMessage());
074        data[6] = new CWE(getMessage());
075    }
076
077
078    /**
079     * Returns an array containing the data elements.
080     */
081    public Type[] getComponents() { 
082        return this.data; 
083    }
084
085    /**
086     * Returns an individual data component.
087     *
088     * @param number The component number (0-indexed)
089     * @throws DataTypeException if the given element number is out of range.
090     */
091    public Type getComponent(int number) throws DataTypeException { 
092
093        try { 
094            return this.data[number]; 
095        } catch (ArrayIndexOutOfBoundsException e) { 
096            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
097        } 
098    } 
099
100
101    /**
102     * Returns Specimen Source Name or Code (component 1).  This is a convenience method that saves you from 
103     * casting and handling an exception.
104     */
105    public CWE getSpecimenSourceNameOrCode() {
106       return getTyped(0, CWE.class);
107    }
108
109    
110    /**
111     * Returns Specimen Source Name or Code (component 1).  This is a convenience method that saves you from 
112     * casting and handling an exception.
113     */
114    public CWE getSps1_SpecimenSourceNameOrCode() {
115       return getTyped(0, CWE.class);
116    }
117
118
119    /**
120     * Returns Additives (component 2).  This is a convenience method that saves you from 
121     * casting and handling an exception.
122     */
123    public CWE getAdditives() {
124       return getTyped(1, CWE.class);
125    }
126
127    
128    /**
129     * Returns Additives (component 2).  This is a convenience method that saves you from 
130     * casting and handling an exception.
131     */
132    public CWE getSps2_Additives() {
133       return getTyped(1, CWE.class);
134    }
135
136
137    /**
138     * Returns Specimen Collection Method (component 3).  This is a convenience method that saves you from 
139     * casting and handling an exception.
140     */
141    public TX getSpecimenCollectionMethod() {
142       return getTyped(2, TX.class);
143    }
144
145    
146    /**
147     * Returns Specimen Collection Method (component 3).  This is a convenience method that saves you from 
148     * casting and handling an exception.
149     */
150    public TX getSps3_SpecimenCollectionMethod() {
151       return getTyped(2, TX.class);
152    }
153
154
155    /**
156     * Returns Body Site (component 4).  This is a convenience method that saves you from 
157     * casting and handling an exception.
158     */
159    public CWE getBodySite() {
160       return getTyped(3, CWE.class);
161    }
162
163    
164    /**
165     * Returns Body Site (component 4).  This is a convenience method that saves you from 
166     * casting and handling an exception.
167     */
168    public CWE getSps4_BodySite() {
169       return getTyped(3, CWE.class);
170    }
171
172
173    /**
174     * Returns Site Modifier (component 5).  This is a convenience method that saves you from 
175     * casting and handling an exception.
176     */
177    public CWE getSiteModifier() {
178       return getTyped(4, CWE.class);
179    }
180
181    
182    /**
183     * Returns Site Modifier (component 5).  This is a convenience method that saves you from 
184     * casting and handling an exception.
185     */
186    public CWE getSps5_SiteModifier() {
187       return getTyped(4, CWE.class);
188    }
189
190
191    /**
192     * Returns Collection Method Modifier Code (component 6).  This is a convenience method that saves you from 
193     * casting and handling an exception.
194     */
195    public CWE getCollectionMethodModifierCode() {
196       return getTyped(5, CWE.class);
197    }
198
199    
200    /**
201     * Returns Collection Method Modifier Code (component 6).  This is a convenience method that saves you from 
202     * casting and handling an exception.
203     */
204    public CWE getSps6_CollectionMethodModifierCode() {
205       return getTyped(5, CWE.class);
206    }
207
208
209    /**
210     * Returns Specimen Role (component 7).  This is a convenience method that saves you from 
211     * casting and handling an exception.
212     */
213    public CWE getSpecimenRole() {
214       return getTyped(6, CWE.class);
215    }
216
217    
218    /**
219     * Returns Specimen Role (component 7).  This is a convenience method that saves you from 
220     * casting and handling an exception.
221     */
222    public CWE getSps7_SpecimenRole() {
223       return getTyped(6, CWE.class);
224    }
225
226
227
228}
229