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 033 034package ca.uhn.hl7v2.model.v22.segment; 035 036// import ca.uhn.hl7v2.model.v22.group.*; 037import ca.uhn.hl7v2.model.v22.datatype.*; 038import ca.uhn.hl7v2.HL7Exception; 039import ca.uhn.hl7v2.parser.ModelClassFactory; 040import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 041import ca.uhn.hl7v2.model.AbstractMessage; 042import ca.uhn.hl7v2.model.Group; 043import ca.uhn.hl7v2.model.Type; 044import ca.uhn.hl7v2.model.AbstractSegment; 045import ca.uhn.hl7v2.model.Varies; 046 047 048/** 049 *<p>Represents an HL7 MFA message segment (MASTER FILE ACKNOWLEDGEMENT). 050 * This segment has the following fields:</p> 051 * <ul> 052 * <li>MFA-1: Record-level event code (ID) <b> </b> 053 * <li>MFA-2: MFN control ID (ST) <b>optional </b> 054 * <li>MFA-3: Event completion date / time (TS) <b>optional </b> 055 * <li>MFA-4: Error return code and/or text (CE) <b> </b> 056 * <li>MFA-5: Primary key value (CE) <b> repeating</b> 057 * </ul> 058 */ 059@SuppressWarnings("unused") 060public class MFA extends AbstractSegment { 061 062 /** 063 * Creates a new MFA segment 064 */ 065 public MFA(Group parent, ModelClassFactory factory) { 066 super(parent, factory); 067 init(factory); 068 } 069 070 private void init(ModelClassFactory factory) { 071 try { 072 this.add(ID.class, true, 1, 3, new Object[]{ getMessage(), new Integer(180) }, "Record-level event code"); 073 this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "MFN control ID"); 074 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Event completion date / time"); 075 this.add(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Error return code and/or text"); 076 this.add(CE.class, true, 0, 60, new Object[]{ getMessage() }, "Primary key value"); 077 } catch(HL7Exception e) { 078 log.error("Unexpected error creating MFA - this is probably a bug in the source code generator.", e); 079 } 080 } 081 082 083 084 /** 085 * Returns 086 * MFA-1: "Record-level event code" - creates it if necessary 087 */ 088 public ID getRecordLevelEventCode() { 089 ID retVal = this.getTypedField(1, 0); 090 return retVal; 091 } 092 093 /** 094 * Returns 095 * MFA-1: "Record-level event code" - creates it if necessary 096 */ 097 public ID getMfa1_RecordLevelEventCode() { 098 ID retVal = this.getTypedField(1, 0); 099 return retVal; 100 } 101 102 103 104 /** 105 * Returns 106 * MFA-2: "MFN control ID" - creates it if necessary 107 */ 108 public ST getMFNControlID() { 109 ST retVal = this.getTypedField(2, 0); 110 return retVal; 111 } 112 113 /** 114 * Returns 115 * MFA-2: "MFN control ID" - creates it if necessary 116 */ 117 public ST getMfa2_MFNControlID() { 118 ST retVal = this.getTypedField(2, 0); 119 return retVal; 120 } 121 122 123 124 /** 125 * Returns 126 * MFA-3: "Event completion date / time" - creates it if necessary 127 */ 128 public TS getEventCompletionDateTime() { 129 TS retVal = this.getTypedField(3, 0); 130 return retVal; 131 } 132 133 /** 134 * Returns 135 * MFA-3: "Event completion date / time" - creates it if necessary 136 */ 137 public TS getMfa3_EventCompletionDateTime() { 138 TS retVal = this.getTypedField(3, 0); 139 return retVal; 140 } 141 142 143 144 /** 145 * Returns 146 * MFA-4: "Error return code and/or text" - creates it if necessary 147 */ 148 public CE getErrorReturnCodeAndOrText() { 149 CE retVal = this.getTypedField(4, 0); 150 return retVal; 151 } 152 153 /** 154 * Returns 155 * MFA-4: "Error return code and/or text" - creates it if necessary 156 */ 157 public CE getMfa4_ErrorReturnCodeAndOrText() { 158 CE retVal = this.getTypedField(4, 0); 159 return retVal; 160 } 161 162 163 /** 164 * Returns all repetitions of Primary key value (MFA-5). 165 */ 166 public CE[] getPrimaryKeyValue() { 167 CE[] retVal = this.getTypedField(5, new CE[0]); 168 return retVal; 169 } 170 171 172 /** 173 * Returns all repetitions of Primary key value (MFA-5). 174 */ 175 public CE[] getMfa5_PrimaryKeyValue() { 176 CE[] retVal = this.getTypedField(5, new CE[0]); 177 return retVal; 178 } 179 180 181 /** 182 * Returns a count of the current number of repetitions of Primary key value (MFA-5). 183 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 184 * it will return zero. 185 */ 186 public int getPrimaryKeyValueReps() { 187 return this.getReps(5); 188 } 189 190 191 /** 192 * Returns a specific repetition of 193 * MFA-5: "Primary key value" - creates it if necessary 194 * 195 * @param rep The repetition index (0-indexed) 196 */ 197 public CE getPrimaryKeyValue(int rep) { 198 CE retVal = this.getTypedField(5, rep); 199 return retVal; 200 } 201 202 /** 203 * Returns a specific repetition of 204 * MFA-5: "Primary key value" - creates it if necessary 205 * 206 * @param rep The repetition index (0-indexed) 207 */ 208 public CE getMfa5_PrimaryKeyValue(int rep) { 209 CE retVal = this.getTypedField(5, rep); 210 return retVal; 211 } 212 213 /** 214 * Returns a count of the current number of repetitions of Primary key value (MFA-5). 215 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 216 * it will return zero. 217 */ 218 public int getMfa5_PrimaryKeyValueReps() { 219 return this.getReps(5); 220 } 221 222 223 /** 224 * Inserts a repetition of 225 * MFA-5: "Primary key value" at a specific index 226 * 227 * @param rep The repetition index (0-indexed) 228 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 229 */ 230 public CE insertPrimaryKeyValue(int rep) throws HL7Exception { 231 return (CE) super.insertRepetition(5, rep); 232 } 233 234 235 /** 236 * Inserts a repetition of 237 * MFA-5: "Primary key value" at a specific index 238 * 239 * @param rep The repetition index (0-indexed) 240 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 241 */ 242 public CE insertMfa5_PrimaryKeyValue(int rep) throws HL7Exception { 243 return (CE) super.insertRepetition(5, rep); 244 } 245 246 247 /** 248 * Removes a repetition of 249 * MFA-5: "Primary key value" at a specific index 250 * 251 * @param rep The repetition index (0-indexed) 252 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 253 */ 254 public CE removePrimaryKeyValue(int rep) throws HL7Exception { 255 return (CE) super.removeRepetition(5, rep); 256 } 257 258 259 /** 260 * Removes a repetition of 261 * MFA-5: "Primary key value" at a specific index 262 * 263 * @param rep The repetition index (0-indexed) 264 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 265 */ 266 public CE removeMfa5_PrimaryKeyValue(int rep) throws HL7Exception { 267 return (CE) super.removeRepetition(5, rep); 268 } 269 270 271 272 273 274 275 /** {@inheritDoc} */ 276 protected Type createNewTypeWithoutReflection(int field) { 277 switch (field) { 278 case 0: return new ID(getMessage(), new Integer( 180 )); 279 case 1: return new ST(getMessage()); 280 case 2: return new TS(getMessage()); 281 case 3: return new CE(getMessage()); 282 case 4: return new CE(getMessage()); 283 default: return null; 284 } 285 } 286 287 288} 289