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 "CM_AUI.java".  Description:
015 * "Composite class CM_AUI"
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2013.  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.v22.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/**
042 * <p>Represents an HL7 CM_AUI (authorization information) data type. 
043 * This type consists of the following components:</p>
044 * <ul>
045 * <li>authorization number (ST)
046 * <li>date (DT)
047 * <li>source (ST)
048 * </ul>
049 */
050@SuppressWarnings("unused")
051public class CM_AUI extends AbstractComposite {
052
053    private Type[] data;
054
055    /** 
056     * Creates a new CM_AUI type
057     */
058    public CM_AUI(Message message) {
059        super(message);
060        init();
061    }
062
063    private void init() {
064        data = new Type[3];    
065        data[0] = new ST(getMessage());
066        data[1] = new DT(getMessage());
067        data[2] = new ST(getMessage());
068    }
069
070
071    /**
072     * Returns an array containing the data elements.
073     */
074    public Type[] getComponents() { 
075        return this.data; 
076    }
077
078    /**
079     * Returns an individual data component.
080     *
081     * @param number The component number (0-indexed)
082     * @throws DataTypeException if the given element number is out of range.
083     */
084    public Type getComponent(int number) throws DataTypeException { 
085
086        try { 
087            return this.data[number]; 
088        } catch (ArrayIndexOutOfBoundsException e) { 
089            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
090        } 
091    } 
092
093
094    /**
095     * Returns authorization number (component 1).  This is a convenience method that saves you from 
096     * casting and handling an exception.
097     */
098    public ST getAuthorizationNumber() {
099       return getTyped(0, ST.class);
100    }
101
102    
103    /**
104     * Returns authorization number (component 1).  This is a convenience method that saves you from 
105     * casting and handling an exception.
106     */
107    public ST getCm_aui1_AuthorizationNumber() {
108       return getTyped(0, ST.class);
109    }
110
111
112    /**
113     * Returns date (component 2).  This is a convenience method that saves you from 
114     * casting and handling an exception.
115     */
116    public DT getDate() {
117       return getTyped(1, DT.class);
118    }
119
120    
121    /**
122     * Returns date (component 2).  This is a convenience method that saves you from 
123     * casting and handling an exception.
124     */
125    public DT getCm_aui2_Date() {
126       return getTyped(1, DT.class);
127    }
128
129
130    /**
131     * Returns source (component 3).  This is a convenience method that saves you from 
132     * casting and handling an exception.
133     */
134    public ST getSource() {
135       return getTyped(2, ST.class);
136    }
137
138    
139    /**
140     * Returns source (component 3).  This is a convenience method that saves you from 
141     * casting and handling an exception.
142     */
143    public ST getCm_aui3_Source() {
144       return getTyped(2, ST.class);
145    }
146
147
148
149}
150