
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 clinical ENTRY subtypes. A CARE_ENTRY defines protocol and guideline attributes for all clinical Entry subtypes. 049 */ 050@DatatypeDef(name="CARE_ENTRY") 051public abstract class CARE_ENTRY extends ENTRY implements ICompositeType { 052 053 /** 054 * Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process. 055 */ 056 @Child(name = "protocol", type = {ITEM_STRUCTURE.class}, order=0, min=0, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Description of the method (i.e. how) the information in this entry was arrived at", formalDefinition="Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process." ) 058 protected ITEM_STRUCTURE protocol; 059 060 /** 061 * Optional external identifier of guideline creating this Entry if relevant. 062 */ 063 @Child(name = "guideline_id", type = {OBJECT_REF.class}, order=1, min=0, max=1, modifier=false, summary=false) 064 @Description(shortDefinition="Optional external identifier of guideline creating this Entry if relevant", formalDefinition="Optional external identifier of guideline creating this Entry if relevant." ) 065 protected OBJECT_REF guideline_id; 066 067 private static final long serialVersionUID = 1019967948L; 068 069 /** 070 * Constructor 071 */ 072 public CARE_ENTRY() { 073 super(); 074 } 075 076 /** 077 * @return {@link #protocol} (Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process.) 078 */ 079 public ITEM_STRUCTURE getProtocol() { 080 return this.protocol; 081 } 082 083 public boolean hasProtocol() { 084 return this.protocol != null && !this.protocol.isEmpty(); 085 } 086 087 /** 088 * @param value {@link #protocol} (Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process.) 089 */ 090 public CARE_ENTRY setProtocol(ITEM_STRUCTURE value) { 091 this.protocol = value; 092 return this; 093 } 094 095 /** 096 * @return {@link #guideline_id} (Optional external identifier of guideline creating this Entry if relevant.) 097 */ 098 public OBJECT_REF getGuideline_id() { 099 if (this.guideline_id == null) 100 if (Configuration.errorOnAutoCreate()) 101 throw new Error("Attempt to auto-create CARE_ENTRY.guideline_id"); 102 else if (Configuration.doAutoCreate()) 103 this.guideline_id = new OBJECT_REF(); // cc 104 return this.guideline_id; 105 } 106 107 public boolean hasGuideline_id() { 108 return this.guideline_id != null && !this.guideline_id.isEmpty(); 109 } 110 111 /** 112 * @param value {@link #guideline_id} (Optional external identifier of guideline creating this Entry if relevant.) 113 */ 114 public CARE_ENTRY setGuideline_id(OBJECT_REF value) { 115 this.guideline_id = value; 116 return this; 117 } 118 119 protected void listChildren(List<Property> children) { 120 super.listChildren(children); 121 children.add(new Property("protocol", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process.", 0, 1, protocol)); 122 children.add(new Property("guideline_id", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional external identifier of guideline creating this Entry if relevant.", 0, 1, guideline_id)); 123 } 124 125 @Override 126 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 127 switch (_hash) { 128 case -989163880: /*protocol*/ return new Property("protocol", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Description of the method (i.e. how) the information in this entry was arrived at. For OBSERVATIONs, this is a description of the method or instrument used. For EVALUATIONs, how the evaluation was arrived at. For INSTRUCTIONs, how to execute the Instruction. This may take the form of references to guidelines, including manually followed and executable; knowledge references such as a paper in Medline; clinical reasons within a larger care process.", 0, 1, protocol); 129 case 1211891402: /*guideline_id*/ return new Property("guideline_id", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional external identifier of guideline creating this Entry if relevant.", 0, 1, guideline_id); 130 default: return super.getNamedProperty(_hash, _name, _checkValid); 131 } 132 133 } 134 135 @Override 136 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 137 switch (hash) { 138 case -989163880: /*protocol*/ return this.protocol == null ? new Base[0] : new Base[] {this.protocol}; // ITEM_STRUCTURE 139 case 1211891402: /*guideline_id*/ return this.guideline_id == null ? new Base[0] : new Base[] {this.guideline_id}; // OBJECT_REF 140 default: return super.getProperty(hash, name, checkValid); 141 } 142 143 } 144 145 @Override 146 public Base setProperty(int hash, String name, Base value) throws FHIRException { 147 switch (hash) { 148 case -989163880: // protocol 149 this.protocol = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 150 return value; 151 case 1211891402: // guideline_id 152 this.guideline_id = (OBJECT_REF) value; // OBJECT_REF 153 return value; 154 default: return super.setProperty(hash, name, value); 155 } 156 157 } 158 159 @Override 160 public Base setProperty(String name, Base value) throws FHIRException { 161 if (name.equals("protocol")) { 162 this.protocol = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 163 } else if (name.equals("guideline_id")) { 164 this.guideline_id = (OBJECT_REF) value; // OBJECT_REF 165 } else 166 return super.setProperty(name, value); 167 return value; 168 } 169 170 @Override 171 public Base makeProperty(int hash, String name) throws FHIRException { 172 switch (hash) { 173 case -989163880: /*div*/ 174 throw new Error("Unable to make an instance of the abstract property 'protocol'"); 175 case 1211891402: return getGuideline_id(); 176 default: return super.makeProperty(hash, name); 177 } 178 179 } 180 181 @Override 182 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 183 switch (hash) { 184 case -989163880: /*protocol*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"}; 185 case 1211891402: /*guideline_id*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"}; 186 default: return super.getTypesForProperty(hash, name); 187 } 188 189 } 190 191 @Override 192 public Base addChild(String name) throws FHIRException { 193 if (name.equals("protocol")) { 194 throw new FHIRException("Cannot call addChild on an abstract type CARE_ENTRY.protocol"); 195 } 196 else if (name.equals("guideline_id")) { 197 this.guideline_id = new OBJECT_REF(); 198 return this.guideline_id; 199 } 200 else 201 return super.addChild(name); 202 } 203 204 public String fhirType() { 205 return "CARE_ENTRY"; 206 207 } 208 209 public abstract CARE_ENTRY copy(); 210 211 public void copyValues(CARE_ENTRY dst) { 212 super.copyValues(dst); 213 dst.protocol = protocol == null ? null : protocol.copy(); 214 dst.guideline_id = guideline_id == null ? null : guideline_id.copy(); 215 } 216 217 @Override 218 public boolean equalsDeep(Base other_) { 219 if (!super.equalsDeep(other_)) 220 return false; 221 if (!(other_ instanceof CARE_ENTRY)) 222 return false; 223 CARE_ENTRY o = (CARE_ENTRY) other_; 224 return compareDeep(protocol, o.protocol, true) && compareDeep(guideline_id, o.guideline_id, true) 225 ; 226 } 227 228 @Override 229 public boolean equalsShallow(Base other_) { 230 if (!super.equalsShallow(other_)) 231 return false; 232 if (!(other_ instanceof CARE_ENTRY)) 233 return false; 234 CARE_ENTRY o = (CARE_ENTRY) other_; 235 return true; 236 } 237 238 public boolean isEmpty() { 239 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(protocol, guideline_id); 240 } 241 242 243} 244