
001package org.hl7.fhir.r5.openehr; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r5.openehr.Enumerations.*; 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.r5.model.*; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.Block; 047 048/** 049 * Used to record details of the Instruction causing an Action. 050 */ 051@DatatypeDef(name="INSTRUCTION_DETAILS") 052public class INSTRUCTION_DETAILS extends PATHABLE implements ICompositeType { 053 054 /** 055 * Reference to causing Instruction. 056 */ 057 @Child(name = "instruction_id", type = {LOCATABLE_REF.class}, order=0, min=1, max=1, modifier=false, summary=false) 058 @Description(shortDefinition="Reference to causing Instruction", formalDefinition="Reference to causing Instruction." ) 059 protected LOCATABLE_REF instruction_id; 060 061 /** 062 * Identifier of Activity within Instruction, in the form of its archetype path. 063 */ 064 @Child(name = "activity_id", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 065 @Description(shortDefinition="Identifier of Activity within Instruction, in the form of its archetype path", formalDefinition="Identifier of Activity within Instruction, in the form of its archetype path." ) 066 protected StringType activity_id; 067 068 /** 069 * Various workflow engine state details, potentially including such things as: 070 071* condition that fired to cause this Action to be done (with actual variables substituted); 072* list of notifications which actually occurred (with all variables substituted); 073* other workflow engine state. 074 075This specification does not currently define the actual structure or semantics of this field. 076 */ 077 @Child(name = "wf_details", type = {ITEM_STRUCTURE.class}, order=2, min=0, max=1, modifier=false, summary=false) 078 @Description(shortDefinition="Various workflow engine state details", formalDefinition="Various workflow engine state details, potentially including such things as:\r\n\r\n* condition that fired to cause this Action to be done (with actual variables substituted);\r\n* list of notifications which actually occurred (with all variables substituted);\r\n* other workflow engine state.\r\n\r\nThis specification does not currently define the actual structure or semantics of this field." ) 079 protected ITEM_STRUCTURE wf_details; 080 081 private static final long serialVersionUID = -225495980L; 082 083 /** 084 * Constructor 085 */ 086 public INSTRUCTION_DETAILS() { 087 super(); 088 } 089 090 /** 091 * Constructor 092 */ 093 public INSTRUCTION_DETAILS(LOCATABLE_REF instruction_id, String activity_id) { 094 super(); 095 this.setInstruction_id(instruction_id); 096 this.setActivity_id(activity_id); 097 } 098 099 /** 100 * @return {@link #instruction_id} (Reference to causing Instruction.) 101 */ 102 public LOCATABLE_REF getInstruction_id() { 103 if (this.instruction_id == null) 104 if (Configuration.errorOnAutoCreate()) 105 throw new Error("Attempt to auto-create INSTRUCTION_DETAILS.instruction_id"); 106 else if (Configuration.doAutoCreate()) 107 this.instruction_id = new LOCATABLE_REF(); // cc 108 return this.instruction_id; 109 } 110 111 public boolean hasInstruction_id() { 112 return this.instruction_id != null && !this.instruction_id.isEmpty(); 113 } 114 115 /** 116 * @param value {@link #instruction_id} (Reference to causing Instruction.) 117 */ 118 public INSTRUCTION_DETAILS setInstruction_id(LOCATABLE_REF value) { 119 this.instruction_id = value; 120 return this; 121 } 122 123 /** 124 * @return {@link #activity_id} (Identifier of Activity within Instruction, in the form of its archetype path.). This is the underlying object with id, value and extensions. The accessor "getActivity_id" gives direct access to the value 125 */ 126 public StringType getActivity_idElement() { 127 if (this.activity_id == null) 128 if (Configuration.errorOnAutoCreate()) 129 throw new Error("Attempt to auto-create INSTRUCTION_DETAILS.activity_id"); 130 else if (Configuration.doAutoCreate()) 131 this.activity_id = new StringType(); // bb 132 return this.activity_id; 133 } 134 135 public boolean hasActivity_idElement() { 136 return this.activity_id != null && !this.activity_id.isEmpty(); 137 } 138 139 public boolean hasActivity_id() { 140 return this.activity_id != null && !this.activity_id.isEmpty(); 141 } 142 143 /** 144 * @param value {@link #activity_id} (Identifier of Activity within Instruction, in the form of its archetype path.). This is the underlying object with id, value and extensions. The accessor "getActivity_id" gives direct access to the value 145 */ 146 public INSTRUCTION_DETAILS setActivity_idElement(StringType value) { 147 this.activity_id = value; 148 return this; 149 } 150 151 /** 152 * @return Identifier of Activity within Instruction, in the form of its archetype path. 153 */ 154 public String getActivity_id() { 155 return this.activity_id == null ? null : this.activity_id.getValue(); 156 } 157 158 /** 159 * @param value Identifier of Activity within Instruction, in the form of its archetype path. 160 */ 161 public INSTRUCTION_DETAILS setActivity_id(String value) { 162 if (this.activity_id == null) 163 this.activity_id = new StringType(); 164 this.activity_id.setValue(value); 165 return this; 166 } 167 168 /** 169 * @return {@link #wf_details} (Various workflow engine state details, potentially including such things as: 170 171* condition that fired to cause this Action to be done (with actual variables substituted); 172* list of notifications which actually occurred (with all variables substituted); 173* other workflow engine state. 174 175This specification does not currently define the actual structure or semantics of this field.) 176 */ 177 public ITEM_STRUCTURE getWf_details() { 178 return this.wf_details; 179 } 180 181 public boolean hasWf_details() { 182 return this.wf_details != null && !this.wf_details.isEmpty(); 183 } 184 185 /** 186 * @param value {@link #wf_details} (Various workflow engine state details, potentially including such things as: 187 188* condition that fired to cause this Action to be done (with actual variables substituted); 189* list of notifications which actually occurred (with all variables substituted); 190* other workflow engine state. 191 192This specification does not currently define the actual structure or semantics of this field.) 193 */ 194 public INSTRUCTION_DETAILS setWf_details(ITEM_STRUCTURE value) { 195 this.wf_details = value; 196 return this; 197 } 198 199 protected void listChildren(List<Property> children) { 200 super.listChildren(children); 201 children.add(new Property("instruction_id", "http://openehr.org/fhir/StructureDefinition/LOCATABLE-REF", "Reference to causing Instruction.", 0, 1, instruction_id)); 202 children.add(new Property("activity_id", "string", "Identifier of Activity within Instruction, in the form of its archetype path.", 0, 1, activity_id)); 203 children.add(new Property("wf_details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Various workflow engine state details, potentially including such things as:\r\n\r\n* condition that fired to cause this Action to be done (with actual variables substituted);\r\n* list of notifications which actually occurred (with all variables substituted);\r\n* other workflow engine state.\r\n\r\nThis specification does not currently define the actual structure or semantics of this field.", 0, 1, wf_details)); 204 } 205 206 @Override 207 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 208 switch (_hash) { 209 case 1989251692: /*instruction_id*/ return new Property("instruction_id", "http://openehr.org/fhir/StructureDefinition/LOCATABLE-REF", "Reference to causing Instruction.", 0, 1, instruction_id); 210 case -917278645: /*activity_id*/ return new Property("activity_id", "string", "Identifier of Activity within Instruction, in the form of its archetype path.", 0, 1, activity_id); 211 case -1966053166: /*wf_details*/ return new Property("wf_details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Various workflow engine state details, potentially including such things as:\r\n\r\n* condition that fired to cause this Action to be done (with actual variables substituted);\r\n* list of notifications which actually occurred (with all variables substituted);\r\n* other workflow engine state.\r\n\r\nThis specification does not currently define the actual structure or semantics of this field.", 0, 1, wf_details); 212 default: return super.getNamedProperty(_hash, _name, _checkValid); 213 } 214 215 } 216 217 @Override 218 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 219 switch (hash) { 220 case 1989251692: /*instruction_id*/ return this.instruction_id == null ? new Base[0] : new Base[] {this.instruction_id}; // LOCATABLE_REF 221 case -917278645: /*activity_id*/ return this.activity_id == null ? new Base[0] : new Base[] {this.activity_id}; // StringType 222 case -1966053166: /*wf_details*/ return this.wf_details == null ? new Base[0] : new Base[] {this.wf_details}; // ITEM_STRUCTURE 223 default: return super.getProperty(hash, name, checkValid); 224 } 225 226 } 227 228 @Override 229 public Base setProperty(int hash, String name, Base value) throws FHIRException { 230 switch (hash) { 231 case 1989251692: // instruction_id 232 this.instruction_id = (LOCATABLE_REF) value; // LOCATABLE_REF 233 return value; 234 case -917278645: // activity_id 235 this.activity_id = TypeConvertor.castToString(value); // StringType 236 return value; 237 case -1966053166: // wf_details 238 this.wf_details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 239 return value; 240 default: return super.setProperty(hash, name, value); 241 } 242 243 } 244 245 @Override 246 public Base setProperty(String name, Base value) throws FHIRException { 247 if (name.equals("instruction_id")) { 248 this.instruction_id = (LOCATABLE_REF) value; // LOCATABLE_REF 249 } else if (name.equals("activity_id")) { 250 this.activity_id = TypeConvertor.castToString(value); // StringType 251 } else if (name.equals("wf_details")) { 252 this.wf_details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 253 } else 254 return super.setProperty(name, value); 255 return value; 256 } 257 258 @Override 259 public Base makeProperty(int hash, String name) throws FHIRException { 260 switch (hash) { 261 case 1989251692: return getInstruction_id(); 262 case -917278645: return getActivity_idElement(); 263 case -1966053166: /*div*/ 264 throw new Error("Unable to make an instance of the abstract property 'wf_details'"); 265 default: return super.makeProperty(hash, name); 266 } 267 268 } 269 270 @Override 271 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 272 switch (hash) { 273 case 1989251692: /*instruction_id*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/LOCATABLE-REF"}; 274 case -917278645: /*activity_id*/ return new String[] {"string"}; 275 case -1966053166: /*wf_details*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"}; 276 default: return super.getTypesForProperty(hash, name); 277 } 278 279 } 280 281 @Override 282 public Base addChild(String name) throws FHIRException { 283 if (name.equals("instruction_id")) { 284 this.instruction_id = new LOCATABLE_REF(); 285 return this.instruction_id; 286 } 287 else if (name.equals("activity_id")) { 288 throw new FHIRException("Cannot call addChild on a singleton property INSTRUCTION_DETAILS.activity_id"); 289 } 290 else if (name.equals("wf_details")) { 291 throw new FHIRException("Cannot call addChild on an abstract type INSTRUCTION_DETAILS.wf_details"); 292 } 293 else 294 return super.addChild(name); 295 } 296 297 public String fhirType() { 298 return "INSTRUCTION_DETAILS"; 299 300 } 301 302 public INSTRUCTION_DETAILS copy() { 303 INSTRUCTION_DETAILS dst = new INSTRUCTION_DETAILS(); 304 copyValues(dst); 305 return dst; 306 } 307 308 public void copyValues(INSTRUCTION_DETAILS dst) { 309 super.copyValues(dst); 310 dst.instruction_id = instruction_id == null ? null : instruction_id.copy(); 311 dst.activity_id = activity_id == null ? null : activity_id.copy(); 312 dst.wf_details = wf_details == null ? null : wf_details.copy(); 313 } 314 315 protected INSTRUCTION_DETAILS typedCopy() { 316 return copy(); 317 } 318 319 @Override 320 public boolean equalsDeep(Base other_) { 321 if (!super.equalsDeep(other_)) 322 return false; 323 if (!(other_ instanceof INSTRUCTION_DETAILS)) 324 return false; 325 INSTRUCTION_DETAILS o = (INSTRUCTION_DETAILS) other_; 326 return compareDeep(instruction_id, o.instruction_id, true) && compareDeep(activity_id, o.activity_id, true) 327 && compareDeep(wf_details, o.wf_details, true); 328 } 329 330 @Override 331 public boolean equalsShallow(Base other_) { 332 if (!super.equalsShallow(other_)) 333 return false; 334 if (!(other_ instanceof INSTRUCTION_DETAILS)) 335 return false; 336 INSTRUCTION_DETAILS o = (INSTRUCTION_DETAILS) other_; 337 return compareValues(activity_id, o.activity_id, true); 338 } 339 340 public boolean isEmpty() { 341 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(instruction_id, activity_id 342 , wf_details); 343 } 344 345 346} 347