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.v24.segment; 035 036// import ca.uhn.hl7v2.model.v24.group.*; 037import ca.uhn.hl7v2.model.v24.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 *<p>Represents an HL7 OM5 message segment (Observation Batteries (Sets)). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>OM5-1: Sequence Number - Test/ Observation Master File (NM) <b>optional </b> 052 * <li>OM5-2: Test/Observations Included within an Ordered Test Battery (CE) <b>optional repeating</b> 053 * <li>OM5-3: Observation ID Suffixes (ST) <b>optional </b> 054 * </ul> 055 */ 056@SuppressWarnings("unused") 057public class OM5 extends AbstractSegment { 058 059 /** 060 * Creates a new OM5 segment 061 */ 062 public OM5(Group parent, ModelClassFactory factory) { 063 super(parent, factory); 064 init(factory); 065 } 066 067 private void init(ModelClassFactory factory) { 068 try { 069 this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File"); 070 this.add(CE.class, false, 0, 250, new Object[]{ getMessage() }, "Test/Observations Included within an Ordered Test Battery"); 071 this.add(ST.class, false, 1, 250, new Object[]{ getMessage() }, "Observation ID Suffixes"); 072 } catch(HL7Exception e) { 073 log.error("Unexpected error creating OM5 - this is probably a bug in the source code generator.", e); 074 } 075 } 076 077 078 079 /** 080 * Returns 081 * OM5-1: "Sequence Number - Test/ Observation Master File" - creates it if necessary 082 */ 083 public NM getSequenceNumberTestObservationMasterFile() { 084 NM retVal = this.getTypedField(1, 0); 085 return retVal; 086 } 087 088 /** 089 * Returns 090 * OM5-1: "Sequence Number - Test/ Observation Master File" - creates it if necessary 091 */ 092 public NM getOm51_SequenceNumberTestObservationMasterFile() { 093 NM retVal = this.getTypedField(1, 0); 094 return retVal; 095 } 096 097 098 /** 099 * Returns all repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2). 100 */ 101 public CE[] getTestObservationsIncludedWithinAnOrderedTestBattery() { 102 CE[] retVal = this.getTypedField(2, new CE[0]); 103 return retVal; 104 } 105 106 107 /** 108 * Returns all repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2). 109 */ 110 public CE[] getOm52_TestObservationsIncludedWithinAnOrderedTestBattery() { 111 CE[] retVal = this.getTypedField(2, new CE[0]); 112 return retVal; 113 } 114 115 116 /** 117 * Returns a count of the current number of repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2). 118 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 119 * it will return zero. 120 */ 121 public int getTestObservationsIncludedWithinAnOrderedTestBatteryReps() { 122 return this.getReps(2); 123 } 124 125 126 /** 127 * Returns a specific repetition of 128 * OM5-2: "Test/Observations Included within an Ordered Test Battery" - creates it if necessary 129 * 130 * @param rep The repetition index (0-indexed) 131 */ 132 public CE getTestObservationsIncludedWithinAnOrderedTestBattery(int rep) { 133 CE retVal = this.getTypedField(2, rep); 134 return retVal; 135 } 136 137 /** 138 * Returns a specific repetition of 139 * OM5-2: "Test/Observations Included within an Ordered Test Battery" - creates it if necessary 140 * 141 * @param rep The repetition index (0-indexed) 142 */ 143 public CE getOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) { 144 CE retVal = this.getTypedField(2, rep); 145 return retVal; 146 } 147 148 /** 149 * Returns a count of the current number of repetitions of Test/Observations Included within an Ordered Test Battery (OM5-2). 150 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 151 * it will return zero. 152 */ 153 public int getOm52_TestObservationsIncludedWithinAnOrderedTestBatteryReps() { 154 return this.getReps(2); 155 } 156 157 158 /** 159 * Inserts a repetition of 160 * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index 161 * 162 * @param rep The repetition index (0-indexed) 163 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 164 */ 165 public CE insertTestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 166 return (CE) super.insertRepetition(2, rep); 167 } 168 169 170 /** 171 * Inserts a repetition of 172 * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index 173 * 174 * @param rep The repetition index (0-indexed) 175 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 176 */ 177 public CE insertOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 178 return (CE) super.insertRepetition(2, rep); 179 } 180 181 182 /** 183 * Removes a repetition of 184 * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index 185 * 186 * @param rep The repetition index (0-indexed) 187 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 188 */ 189 public CE removeTestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 190 return (CE) super.removeRepetition(2, rep); 191 } 192 193 194 /** 195 * Removes a repetition of 196 * OM5-2: "Test/Observations Included within an Ordered Test Battery" at a specific index 197 * 198 * @param rep The repetition index (0-indexed) 199 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 200 */ 201 public CE removeOm52_TestObservationsIncludedWithinAnOrderedTestBattery(int rep) throws HL7Exception { 202 return (CE) super.removeRepetition(2, rep); 203 } 204 205 206 207 208 /** 209 * Returns 210 * OM5-3: "Observation ID Suffixes" - creates it if necessary 211 */ 212 public ST getObservationIDSuffixes() { 213 ST retVal = this.getTypedField(3, 0); 214 return retVal; 215 } 216 217 /** 218 * Returns 219 * OM5-3: "Observation ID Suffixes" - creates it if necessary 220 */ 221 public ST getOm53_ObservationIDSuffixes() { 222 ST retVal = this.getTypedField(3, 0); 223 return retVal; 224 } 225 226 227 228 229 230 /** {@inheritDoc} */ 231 protected Type createNewTypeWithoutReflection(int field) { 232 switch (field) { 233 case 0: return new NM(getMessage()); 234 case 1: return new CE(getMessage()); 235 case 2: return new ST(getMessage()); 236 default: return null; 237 } 238 } 239 240 241} 242