View Javadoc
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 "PIP.java".  Description:
15   * "Composite class PIP"
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.v27.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 PIP (Practitioner Institutional Privileges) data type. 
43   * This type consists of the following components:</p>
44   * <ul>
45   * <li>Privilege (CWE)
46   * <li>Privilege Class (CWE)
47   * <li>Expiration Date (DT)
48   * <li>Activation Date (DT)
49   * <li>Facility (EI)
50   * </ul>
51   */
52  @SuppressWarnings("unused")
53  public class PIP extends AbstractComposite {
54  
55      private Type[] data;
56  
57      /** 
58       * Creates a new PIP type
59       */
60      public PIP(Message message) {
61          super(message);
62          init();
63      }
64  
65      private void init() {
66          data = new Type[5];    
67          data[0] = new CWE(getMessage());
68          data[1] = new CWE(getMessage());
69          data[2] = new DT(getMessage());
70          data[3] = new DT(getMessage());
71          data[4] = new EI(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 Privilege (component 1).  This is a convenience method that saves you from 
100      * casting and handling an exception.
101      */
102     public CWE getPrivilege() {
103        return getTyped(0, CWE.class);
104     }
105 
106     
107     /**
108      * Returns Privilege (component 1).  This is a convenience method that saves you from 
109      * casting and handling an exception.
110      */
111     public CWE getPip1_Privilege() {
112        return getTyped(0, CWE.class);
113     }
114 
115 
116     /**
117      * Returns Privilege Class (component 2).  This is a convenience method that saves you from 
118      * casting and handling an exception.
119      */
120     public CWE getPrivilegeClass() {
121        return getTyped(1, CWE.class);
122     }
123 
124     
125     /**
126      * Returns Privilege Class (component 2).  This is a convenience method that saves you from 
127      * casting and handling an exception.
128      */
129     public CWE getPip2_PrivilegeClass() {
130        return getTyped(1, CWE.class);
131     }
132 
133 
134     /**
135      * Returns Expiration Date (component 3).  This is a convenience method that saves you from 
136      * casting and handling an exception.
137      */
138     public DT getExpirationDate() {
139        return getTyped(2, DT.class);
140     }
141 
142     
143     /**
144      * Returns Expiration Date (component 3).  This is a convenience method that saves you from 
145      * casting and handling an exception.
146      */
147     public DT getPip3_ExpirationDate() {
148        return getTyped(2, DT.class);
149     }
150 
151 
152     /**
153      * Returns Activation Date (component 4).  This is a convenience method that saves you from 
154      * casting and handling an exception.
155      */
156     public DT getActivationDate() {
157        return getTyped(3, DT.class);
158     }
159 
160     
161     /**
162      * Returns Activation Date (component 4).  This is a convenience method that saves you from 
163      * casting and handling an exception.
164      */
165     public DT getPip4_ActivationDate() {
166        return getTyped(3, DT.class);
167     }
168 
169 
170     /**
171      * Returns Facility (component 5).  This is a convenience method that saves you from 
172      * casting and handling an exception.
173      */
174     public EI getFacility() {
175        return getTyped(4, EI.class);
176     }
177 
178     
179     /**
180      * Returns Facility (component 5).  This is a convenience method that saves you from 
181      * casting and handling an exception.
182      */
183     public EI getPip5_Facility() {
184        return getTyped(4, EI.class);
185     }
186 
187 
188 
189 }
190