
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.r5.openehr.Enumerations.*; 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.r5.model.*; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046 047/** 048 * The abstract parent of all ENTRY subtypes. An ENTRY is the root of a logical item of hard clinical information created in the clinical statement context, within a clinical session. There can be numerous such contexts in a clinical session. Observations and other Entry types only ever document information captured/created in the event documented by the enclosing Composition. An ENTRY is also the minimal unit of information any query should return, since a whole ENTRY (including subparts) records spatial structure, timing information, and contextual information, as well as the subject and generator of the information. 049 */ 050@DatatypeDef(name="ENTRY") 051public abstract class ENTRY extends CONTENT_ITEM implements ICompositeType { 052 053 /** 054 * Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages. 055 */ 056 @Child(name = "language", type = {CODE_PHRASE.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages", formalDefinition="Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages." ) 058 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-languages") 059 protected CODE_PHRASE language; 060 061 /** 062 * Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets. 063 */ 064 @Child(name = "encoding", type = {CODE_PHRASE.class}, order=1, min=1, max=1, modifier=false, summary=false) 065 @Description(shortDefinition="Name of character set in which text values in this Entry are encoded", formalDefinition="Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets." ) 066 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="https://specifications.openehr.org/fhir/valueset-character_sets") 067 protected CODE_PHRASE encoding; 068 069 /** 070 * Other participations at ENTRY level. 071 */ 072 @Child(name = "other_participations", type = {PARTICIPATION.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 073 @Description(shortDefinition="Other participations at ENTRY level", formalDefinition="Other participations at ENTRY level." ) 074 protected List<PARTICIPATION> other_participationsList; 075 076 /** 077 * Identifier of externally held workflow engine data for this workflow execution, for this subject of care. 078 */ 079 @Child(name = "workflow_id", type = {OBJECT_REF.class}, order=3, min=0, max=1, modifier=false, summary=false) 080 @Description(shortDefinition="Identifier of externally held workflow engine data for this workflow execution, for this subject of care", formalDefinition="Identifier of externally held workflow engine data for this workflow execution, for this subject of care." ) 081 protected OBJECT_REF workflow_id; 082 083 /** 084 * Id of human subject of this ENTRY, e.g.: 085 086* organ donor 087* foetus 088* a family member 089* another clinically relevant person 090 */ 091 @Child(name = "subject", type = {PARTY_PROXY.class}, order=4, min=1, max=1, modifier=false, summary=false) 092 @Description(shortDefinition="Id of human subject of this ENTRY, e.g. organ donor, foetus, a family member, or another clinically relevant person", formalDefinition="Id of human subject of this ENTRY, e.g.:\r\n\r\n* organ donor\r\n* foetus\r\n* a family member\r\n* another clinically relevant person" ) 093 protected PARTY_PROXY subject; 094 095 /** 096 * Optional identification of provider of the information in this ENTRY, which might be: 097 098* the patient 099* a patient agent, e.g. parent, guardian 100* the clinician 101* a device or software 102 103 104Generally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed. 105 */ 106 @Child(name = "provider", type = {PARTY_PROXY.class}, order=5, min=0, max=1, modifier=false, summary=false) 107 @Description(shortDefinition="Optional identification of provider of the information in this ENTRY, which might be the patient, a patient agent, the clinician, a device", formalDefinition="Optional identification of provider of the information in this ENTRY, which might be:\r\n\r\n* the patient\r\n* a patient agent, e.g. parent, guardian\r\n* the clinician\r\n* a device or software\r\n\r\n\r\nGenerally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed." ) 108 protected PARTY_PROXY provider; 109 110 private static final long serialVersionUID = -1650881402L; 111 112 /** 113 * Constructor 114 */ 115 public ENTRY() { 116 super(); 117 } 118 119 /** 120 * Constructor 121 */ 122 public ENTRY(CODE_PHRASE language, CODE_PHRASE encoding, PARTY_PROXY subject) { 123 super(); 124 this.setLanguage(language); 125 this.setEncoding(encoding); 126 this.setSubject(subject); 127 } 128 129 /** 130 * @return {@link #language} (Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages.) 131 */ 132 public CODE_PHRASE getLanguage() { 133 if (this.language == null) 134 if (Configuration.errorOnAutoCreate()) 135 throw new Error("Attempt to auto-create ENTRY.language"); 136 else if (Configuration.doAutoCreate()) 137 this.language = new CODE_PHRASE(); // cc 138 return this.language; 139 } 140 141 public boolean hasLanguage() { 142 return this.language != null && !this.language.isEmpty(); 143 } 144 145 /** 146 * @param value {@link #language} (Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages.) 147 */ 148 public ENTRY setLanguage(CODE_PHRASE value) { 149 this.language = value; 150 return this; 151 } 152 153 /** 154 * @return {@link #encoding} (Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets.) 155 */ 156 public CODE_PHRASE getEncoding() { 157 if (this.encoding == null) 158 if (Configuration.errorOnAutoCreate()) 159 throw new Error("Attempt to auto-create ENTRY.encoding"); 160 else if (Configuration.doAutoCreate()) 161 this.encoding = new CODE_PHRASE(); // cc 162 return this.encoding; 163 } 164 165 public boolean hasEncoding() { 166 return this.encoding != null && !this.encoding.isEmpty(); 167 } 168 169 /** 170 * @param value {@link #encoding} (Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets.) 171 */ 172 public ENTRY setEncoding(CODE_PHRASE value) { 173 this.encoding = value; 174 return this; 175 } 176 177 /** 178 * @return {@link #other_participations} (Other participations at ENTRY level.) 179 */ 180 public List<PARTICIPATION> getOther_participationsList() { 181 if (this.other_participationsList == null) 182 this.other_participationsList = new ArrayList<PARTICIPATION>(); 183 return this.other_participationsList; 184 } 185 186 /** 187 * @return Returns a reference to <code>this</code> for easy method chaining 188 */ 189 public ENTRY setOther_participationsList(List<PARTICIPATION> theOther_participations) { 190 this.other_participationsList = theOther_participations; 191 return this; 192 } 193 194 public boolean hasOther_participations() { 195 if (this.other_participationsList == null) 196 return false; 197 for (PARTICIPATION item : this.other_participationsList) 198 if (!item.isEmpty()) 199 return true; 200 return false; 201 } 202 203 public PARTICIPATION addOther_participations() { //3a 204 PARTICIPATION t = new PARTICIPATION(); 205 if (this.other_participationsList == null) 206 this.other_participationsList = new ArrayList<PARTICIPATION>(); 207 this.other_participationsList.add(t); 208 return t; 209 } 210 211 public ENTRY addOther_participations(PARTICIPATION t) { //3b 212 if (t == null) 213 return this; 214 if (this.other_participationsList == null) 215 this.other_participationsList = new ArrayList<PARTICIPATION>(); 216 this.other_participationsList.add(t); 217 return this; 218 } 219 220 /** 221 * @return The first repetition of repeating field {@link #other_participations}, creating it if it does not already exist {3} 222 */ 223 public PARTICIPATION getOther_participationsFirstRep() { 224 if (getOther_participationsList().isEmpty()) { 225 addOther_participations(); 226 } 227 return getOther_participationsList().get(0); 228 } 229 230 /** 231 * @return {@link #workflow_id} (Identifier of externally held workflow engine data for this workflow execution, for this subject of care.) 232 */ 233 public OBJECT_REF getWorkflow_id() { 234 if (this.workflow_id == null) 235 if (Configuration.errorOnAutoCreate()) 236 throw new Error("Attempt to auto-create ENTRY.workflow_id"); 237 else if (Configuration.doAutoCreate()) 238 this.workflow_id = new OBJECT_REF(); // cc 239 return this.workflow_id; 240 } 241 242 public boolean hasWorkflow_id() { 243 return this.workflow_id != null && !this.workflow_id.isEmpty(); 244 } 245 246 /** 247 * @param value {@link #workflow_id} (Identifier of externally held workflow engine data for this workflow execution, for this subject of care.) 248 */ 249 public ENTRY setWorkflow_id(OBJECT_REF value) { 250 this.workflow_id = value; 251 return this; 252 } 253 254 /** 255 * @return {@link #subject} (Id of human subject of this ENTRY, e.g.: 256 257* organ donor 258* foetus 259* a family member 260* another clinically relevant person) 261 */ 262 public PARTY_PROXY getSubject() { 263 return this.subject; 264 } 265 266 public boolean hasSubject() { 267 return this.subject != null && !this.subject.isEmpty(); 268 } 269 270 /** 271 * @param value {@link #subject} (Id of human subject of this ENTRY, e.g.: 272 273* organ donor 274* foetus 275* a family member 276* another clinically relevant person) 277 */ 278 public ENTRY setSubject(PARTY_PROXY value) { 279 this.subject = value; 280 return this; 281 } 282 283 /** 284 * @return {@link #provider} (Optional identification of provider of the information in this ENTRY, which might be: 285 286* the patient 287* a patient agent, e.g. parent, guardian 288* the clinician 289* a device or software 290 291 292Generally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed.) 293 */ 294 public PARTY_PROXY getProvider() { 295 return this.provider; 296 } 297 298 public boolean hasProvider() { 299 return this.provider != null && !this.provider.isEmpty(); 300 } 301 302 /** 303 * @param value {@link #provider} (Optional identification of provider of the information in this ENTRY, which might be: 304 305* the patient 306* a patient agent, e.g. parent, guardian 307* the clinician 308* a device or software 309 310 311Generally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed.) 312 */ 313 public ENTRY setProvider(PARTY_PROXY value) { 314 this.provider = value; 315 return this; 316 } 317 318 protected void listChildren(List<Property> children) { 319 super.listChildren(children); 320 children.add(new Property("language", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages.", 0, 1, language)); 321 children.add(new Property("encoding", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets.", 0, 1, encoding)); 322 children.add(new Property("other_participations", "http://openehr.org/fhir/StructureDefinition/PARTICIPATION", "Other participations at ENTRY level.", 0, java.lang.Integer.MAX_VALUE, other_participationsList)); 323 children.add(new Property("workflow_id", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Identifier of externally held workflow engine data for this workflow execution, for this subject of care.", 0, 1, workflow_id)); 324 children.add(new Property("subject", "http://openehr.org/fhir/StructureDefinition/PARTY-PROXY", "Id of human subject of this ENTRY, e.g.:\r\n\r\n* organ donor\r\n* foetus\r\n* a family member\r\n* another clinically relevant person", 0, 1, subject)); 325 children.add(new Property("provider", "http://openehr.org/fhir/StructureDefinition/PARTY-PROXY", "Optional identification of provider of the information in this ENTRY, which might be:\r\n\r\n* the patient\r\n* a patient agent, e.g. parent, guardian\r\n* the clinician\r\n* a device or software\r\n\r\n\r\nGenerally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed.", 0, 1, provider)); 326 } 327 328 @Override 329 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 330 switch (_hash) { 331 case -1613589672: /*language*/ return new Property("language", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Mandatory indicator of the localised language in which this Entry is written. Coded from openEHR Code Set languages.", 0, 1, language); 332 case 1711222099: /*encoding*/ return new Property("encoding", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Name of character set in which text values in this Entry are encoded. Coded from openEHR Code Set character sets.", 0, 1, encoding); 333 case 607783009: /*other_participations*/ return new Property("other_participations", "http://openehr.org/fhir/StructureDefinition/PARTICIPATION", "Other participations at ENTRY level.", 0, java.lang.Integer.MAX_VALUE, other_participationsList); 334 case 1712917915: /*workflow_id*/ return new Property("workflow_id", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Identifier of externally held workflow engine data for this workflow execution, for this subject of care.", 0, 1, workflow_id); 335 case -1867885268: /*subject*/ return new Property("subject", "http://openehr.org/fhir/StructureDefinition/PARTY-PROXY", "Id of human subject of this ENTRY, e.g.:\r\n\r\n* organ donor\r\n* foetus\r\n* a family member\r\n* another clinically relevant person", 0, 1, subject); 336 case -987494927: /*provider*/ return new Property("provider", "http://openehr.org/fhir/StructureDefinition/PARTY-PROXY", "Optional identification of provider of the information in this ENTRY, which might be:\r\n\r\n* the patient\r\n* a patient agent, e.g. parent, guardian\r\n* the clinician\r\n* a device or software\r\n\r\n\r\nGenerally only used when the recorder needs to make it explicit. Otherwise, Composition composer and other participants are assumed.", 0, 1, provider); 337 default: return super.getNamedProperty(_hash, _name, _checkValid); 338 } 339 340 } 341 342 @Override 343 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 344 switch (hash) { 345 case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CODE_PHRASE 346 case 1711222099: /*encoding*/ return this.encoding == null ? new Base[0] : new Base[] {this.encoding}; // CODE_PHRASE 347 case 607783009: /*other_participations*/ return this.other_participationsList == null ? new Base[0] : this.other_participationsList.toArray(new Base[this.other_participationsList.size()]); // PARTICIPATION 348 case 1712917915: /*workflow_id*/ return this.workflow_id == null ? new Base[0] : new Base[] {this.workflow_id}; // OBJECT_REF 349 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // PARTY_PROXY 350 case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // PARTY_PROXY 351 default: return super.getProperty(hash, name, checkValid); 352 } 353 354 } 355 356 @Override 357 public Base setProperty(int hash, String name, Base value) throws FHIRException { 358 switch (hash) { 359 case -1613589672: // language 360 this.language = (CODE_PHRASE) value; // CODE_PHRASE 361 return value; 362 case 1711222099: // encoding 363 this.encoding = (CODE_PHRASE) value; // CODE_PHRASE 364 return value; 365 case 607783009: // other_participations 366 this.getOther_participationsList().add((PARTICIPATION) value); // PARTICIPATION 367 return value; 368 case 1712917915: // workflow_id 369 this.workflow_id = (OBJECT_REF) value; // OBJECT_REF 370 return value; 371 case -1867885268: // subject 372 this.subject = (PARTY_PROXY) value; // PARTY_PROXY 373 return value; 374 case -987494927: // provider 375 this.provider = (PARTY_PROXY) value; // PARTY_PROXY 376 return value; 377 default: return super.setProperty(hash, name, value); 378 } 379 380 } 381 382 @Override 383 public Base setProperty(String name, Base value) throws FHIRException { 384 if (name.equals("language")) { 385 this.language = (CODE_PHRASE) value; // CODE_PHRASE 386 } else if (name.equals("encoding")) { 387 this.encoding = (CODE_PHRASE) value; // CODE_PHRASE 388 } else if (name.equals("other_participations")) { 389 this.getOther_participationsList().add((PARTICIPATION) value); // PARTICIPATION 390 } else if (name.equals("workflow_id")) { 391 this.workflow_id = (OBJECT_REF) value; // OBJECT_REF 392 } else if (name.equals("subject")) { 393 this.subject = (PARTY_PROXY) value; // PARTY_PROXY 394 } else if (name.equals("provider")) { 395 this.provider = (PARTY_PROXY) value; // PARTY_PROXY 396 } else 397 return super.setProperty(name, value); 398 return value; 399 } 400 401 @Override 402 public Base makeProperty(int hash, String name) throws FHIRException { 403 switch (hash) { 404 case -1613589672: return getLanguage(); 405 case 1711222099: return getEncoding(); 406 case 607783009: return addOther_participations(); 407 case 1712917915: return getWorkflow_id(); 408 case -1867885268: /*div*/ 409 throw new Error("Unable to make an instance of the abstract property 'subject'"); 410 case -987494927: /*div*/ 411 throw new Error("Unable to make an instance of the abstract property 'provider'"); 412 default: return super.makeProperty(hash, name); 413 } 414 415 } 416 417 @Override 418 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 419 switch (hash) { 420 case -1613589672: /*language*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/CODE-PHRASE"}; 421 case 1711222099: /*encoding*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/CODE-PHRASE"}; 422 case 607783009: /*other_participations*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/PARTICIPATION"}; 423 case 1712917915: /*workflow_id*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"}; 424 case -1867885268: /*subject*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/PARTY-PROXY"}; 425 case -987494927: /*provider*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/PARTY-PROXY"}; 426 default: return super.getTypesForProperty(hash, name); 427 } 428 429 } 430 431 @Override 432 public Base addChild(String name) throws FHIRException { 433 if (name.equals("language")) { 434 this.language = new CODE_PHRASE(); 435 return this.language; 436 } 437 else if (name.equals("encoding")) { 438 this.encoding = new CODE_PHRASE(); 439 return this.encoding; 440 } 441 else if (name.equals("other_participations")) { 442 return addOther_participations(); 443 } 444 else if (name.equals("workflow_id")) { 445 this.workflow_id = new OBJECT_REF(); 446 return this.workflow_id; 447 } 448 else if (name.equals("subject")) { 449 throw new FHIRException("Cannot call addChild on an abstract type ENTRY.subject"); 450 } 451 else if (name.equals("provider")) { 452 throw new FHIRException("Cannot call addChild on an abstract type ENTRY.provider"); 453 } 454 else 455 return super.addChild(name); 456 } 457 458 public String fhirType() { 459 return "ENTRY"; 460 461 } 462 463 public abstract ENTRY copy(); 464 465 public void copyValues(ENTRY dst) { 466 super.copyValues(dst); 467 dst.language = language == null ? null : language.copy(); 468 dst.encoding = encoding == null ? null : encoding.copy(); 469 if (other_participationsList != null) { 470 dst.other_participationsList = new ArrayList<PARTICIPATION>(); 471 for (PARTICIPATION i : other_participationsList) 472 dst.other_participationsList.add(i.copy()); 473 }; 474 dst.workflow_id = workflow_id == null ? null : workflow_id.copy(); 475 dst.subject = subject == null ? null : subject.copy(); 476 dst.provider = provider == null ? null : provider.copy(); 477 } 478 479 @Override 480 public boolean equalsDeep(Base other_) { 481 if (!super.equalsDeep(other_)) 482 return false; 483 if (!(other_ instanceof ENTRY)) 484 return false; 485 ENTRY o = (ENTRY) other_; 486 return compareDeep(language, o.language, true) && compareDeep(encoding, o.encoding, true) && compareDeep(other_participationsList, o.other_participationsList, true) 487 && compareDeep(workflow_id, o.workflow_id, true) && compareDeep(subject, o.subject, true) && compareDeep(provider, o.provider, true) 488 ; 489 } 490 491 @Override 492 public boolean equalsShallow(Base other_) { 493 if (!super.equalsShallow(other_)) 494 return false; 495 if (!(other_ instanceof ENTRY)) 496 return false; 497 ENTRY o = (ENTRY) other_; 498 return true; 499 } 500 501 public boolean isEmpty() { 502 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(language, encoding, other_participationsList 503 , workflow_id, subject, provider); 504 } 505 506 507} 508