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 "JCC.java". Description: 015 * "Composite class JCC" 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.v28.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 JCC (Job Code/Class) data type. 043 * This type consists of the following components:</p> 044 * <ul> 045 * <li>Job Code (CWE) 046 * <li>Job Class (CWE) 047 * <li>Job Description Text (TX) 048 * </ul> 049 */ 050@SuppressWarnings("unused") 051public class JCC extends AbstractComposite { 052 053 private Type[] data; 054 055 /** 056 * Creates a new JCC type 057 */ 058 public JCC(Message message) { 059 super(message); 060 init(); 061 } 062 063 private void init() { 064 data = new Type[3]; 065 data[0] = new CWE(getMessage()); 066 data[1] = new CWE(getMessage()); 067 data[2] = new TX(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 Job Code (component 1). This is a convenience method that saves you from 096 * casting and handling an exception. 097 */ 098 public CWE getJobCode() { 099 return getTyped(0, CWE.class); 100 } 101 102 103 /** 104 * Returns Job Code (component 1). This is a convenience method that saves you from 105 * casting and handling an exception. 106 */ 107 public CWE getJcc1_JobCode() { 108 return getTyped(0, CWE.class); 109 } 110 111 112 /** 113 * Returns Job Class (component 2). This is a convenience method that saves you from 114 * casting and handling an exception. 115 */ 116 public CWE getJobClass() { 117 return getTyped(1, CWE.class); 118 } 119 120 121 /** 122 * Returns Job Class (component 2). This is a convenience method that saves you from 123 * casting and handling an exception. 124 */ 125 public CWE getJcc2_JobClass() { 126 return getTyped(1, CWE.class); 127 } 128 129 130 /** 131 * Returns Job Description Text (component 3). This is a convenience method that saves you from 132 * casting and handling an exception. 133 */ 134 public TX getJobDescriptionText() { 135 return getTyped(2, TX.class); 136 } 137 138 139 /** 140 * Returns Job Description Text (component 3). This is a convenience method that saves you from 141 * casting and handling an exception. 142 */ 143 public TX getJcc3_JobDescriptionText() { 144 return getTyped(2, TX.class); 145 } 146 147 148 149} 150