
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 LINK type defines a logical relationship between two items, such as two ENTRYs or an ENTRY and a COMPOSITION. Links can be used across compositions, and across EHRs. Links can potentially be used between interior (i.e. non archetype root) nodes, although this probably should be prevented in archetypes. Multiple LINKs can be attached to the root object of any LINK structure to give the effect of a 1?N link. 1:1 and 1:N relationships between LINK content elements (e.g. ENTRYs) can be expressed by using one, or more than one, respectively, LINKs. Chains of links can be used to see problem threads or other logical groupings of items. Links should be between LINK structures only, i.e. between objects representing complete domain concepts because relationships between sub-elements of whole concepts are not necessarily meaningful, and may be downright confusing. Sensible links only exist between whole ENTRYs, SECTIONs, COMPOSITIONs and so on. 049 */ 050@DatatypeDef(name="LINK") 051public class LINK extends LogicalBase implements ICompositeType { 052 053 /** 054 * Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management . 055 */ 056 @Child(name = "meaning", type = {DV_TEXT.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Used to describe the relationship, usually in clinical terms", formalDefinition="Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management ." ) 058 protected DV_TEXT meaning; 059 060 /** 061 * The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created. 062 */ 063 @Child(name = "type", type = {DV_TEXT.class}, order=1, min=1, max=1, modifier=false, summary=false) 064 @Description(shortDefinition="The type attribute is used to indicate a clinical or domain-level meaning for the kind of link", formalDefinition="The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created." ) 065 protected DV_TEXT type; 066 067 /** 068 * The logical to object in the link relation, as per the linguistic sense of the meaning attribute. 069 */ 070 @Child(name = "target", type = {DV_EHR_URI.class}, order=2, min=1, max=1, modifier=false, summary=false) 071 @Description(shortDefinition="The logical to object in the link relation", formalDefinition="The logical to object in the link relation, as per the linguistic sense of the meaning attribute." ) 072 protected DV_EHR_URI target; 073 074 private static final long serialVersionUID = -611201093L; 075 076 /** 077 * Constructor 078 */ 079 public LINK() { 080 super(); 081 } 082 083 /** 084 * Constructor 085 */ 086 public LINK(DV_TEXT meaning, DV_TEXT type, DV_EHR_URI target) { 087 super(); 088 this.setMeaning(meaning); 089 this.setType(type); 090 this.setTarget(target); 091 } 092 093 /** 094 * @return {@link #meaning} (Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management .) 095 */ 096 public DV_TEXT getMeaning() { 097 if (this.meaning == null) 098 if (Configuration.errorOnAutoCreate()) 099 throw new Error("Attempt to auto-create LINK.meaning"); 100 else if (Configuration.doAutoCreate()) 101 this.meaning = new DV_TEXT(); // cc 102 return this.meaning; 103 } 104 105 public boolean hasMeaning() { 106 return this.meaning != null && !this.meaning.isEmpty(); 107 } 108 109 /** 110 * @param value {@link #meaning} (Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management .) 111 */ 112 public LINK setMeaning(DV_TEXT value) { 113 this.meaning = value; 114 return this; 115 } 116 117 /** 118 * @return {@link #type} (The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created.) 119 */ 120 public DV_TEXT getType() { 121 if (this.type == null) 122 if (Configuration.errorOnAutoCreate()) 123 throw new Error("Attempt to auto-create LINK.type"); 124 else if (Configuration.doAutoCreate()) 125 this.type = new DV_TEXT(); // cc 126 return this.type; 127 } 128 129 public boolean hasType() { 130 return this.type != null && !this.type.isEmpty(); 131 } 132 133 /** 134 * @param value {@link #type} (The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created.) 135 */ 136 public LINK setType(DV_TEXT value) { 137 this.type = value; 138 return this; 139 } 140 141 /** 142 * @return {@link #target} (The logical to object in the link relation, as per the linguistic sense of the meaning attribute.) 143 */ 144 public DV_EHR_URI getTarget() { 145 if (this.target == null) 146 if (Configuration.errorOnAutoCreate()) 147 throw new Error("Attempt to auto-create LINK.target"); 148 else if (Configuration.doAutoCreate()) 149 this.target = new DV_EHR_URI(); // cc 150 return this.target; 151 } 152 153 public boolean hasTarget() { 154 return this.target != null && !this.target.isEmpty(); 155 } 156 157 /** 158 * @param value {@link #target} (The logical to object in the link relation, as per the linguistic sense of the meaning attribute.) 159 */ 160 public LINK setTarget(DV_EHR_URI value) { 161 this.target = value; 162 return this; 163 } 164 165 protected void listChildren(List<Property> children) { 166 super.listChildren(children); 167 children.add(new Property("meaning", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management .", 0, 1, meaning)); 168 children.add(new Property("type", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created.", 0, 1, type)); 169 children.add(new Property("target", "http://openehr.org/fhir/StructureDefinition/DV-EHR-URI", "The logical to object in the link relation, as per the linguistic sense of the meaning attribute.", 0, 1, target)); 170 } 171 172 @Override 173 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 174 switch (_hash) { 175 case 938160637: /*meaning*/ return new Property("meaning", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "Used to describe the relationship, usually in clinical terms, such as in response to (the relationship between test results and an order), follow-up to and so on. Such relationships can represent any clinically meaningful connection between pieces of information. Values for meaning include those described in Annex C, ENV 13606 pt 2 under the categories of generic , documenting and reporting , organisational , clinical , circumstancial , and view management .", 0, 1, meaning); 176 case 3575610: /*type*/ return new Property("type", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "The type attribute is used to indicate a clinical or domain-level meaning for the kind of link, for example problem or issue . If type values are designed appropriately, they can be used by the requestor of EHR extracts to categorise links which must be followed and which can be broken when the extract is created.", 0, 1, type); 177 case -880905839: /*target*/ return new Property("target", "http://openehr.org/fhir/StructureDefinition/DV-EHR-URI", "The logical to object in the link relation, as per the linguistic sense of the meaning attribute.", 0, 1, target); 178 default: return super.getNamedProperty(_hash, _name, _checkValid); 179 } 180 181 } 182 183 @Override 184 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 185 switch (hash) { 186 case 938160637: /*meaning*/ return this.meaning == null ? new Base[0] : new Base[] {this.meaning}; // DV_TEXT 187 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // DV_TEXT 188 case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // DV_EHR_URI 189 default: return super.getProperty(hash, name, checkValid); 190 } 191 192 } 193 194 @Override 195 public Base setProperty(int hash, String name, Base value) throws FHIRException { 196 switch (hash) { 197 case 938160637: // meaning 198 this.meaning = (DV_TEXT) value; // DV_TEXT 199 return value; 200 case 3575610: // type 201 this.type = (DV_TEXT) value; // DV_TEXT 202 return value; 203 case -880905839: // target 204 this.target = (DV_EHR_URI) value; // DV_EHR_URI 205 return value; 206 default: return super.setProperty(hash, name, value); 207 } 208 209 } 210 211 @Override 212 public Base setProperty(String name, Base value) throws FHIRException { 213 if (name.equals("meaning")) { 214 this.meaning = (DV_TEXT) value; // DV_TEXT 215 } else if (name.equals("type")) { 216 this.type = (DV_TEXT) value; // DV_TEXT 217 } else if (name.equals("target")) { 218 this.target = (DV_EHR_URI) value; // DV_EHR_URI 219 } else 220 return super.setProperty(name, value); 221 return value; 222 } 223 224 @Override 225 public Base makeProperty(int hash, String name) throws FHIRException { 226 switch (hash) { 227 case 938160637: return getMeaning(); 228 case 3575610: return getType(); 229 case -880905839: return getTarget(); 230 default: return super.makeProperty(hash, name); 231 } 232 233 } 234 235 @Override 236 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 237 switch (hash) { 238 case 938160637: /*meaning*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-TEXT"}; 239 case 3575610: /*type*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-TEXT"}; 240 case -880905839: /*target*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-EHR-URI"}; 241 default: return super.getTypesForProperty(hash, name); 242 } 243 244 } 245 246 @Override 247 public Base addChild(String name) throws FHIRException { 248 if (name.equals("meaning")) { 249 this.meaning = new DV_TEXT(); 250 return this.meaning; 251 } 252 else if (name.equals("type")) { 253 this.type = new DV_TEXT(); 254 return this.type; 255 } 256 else if (name.equals("target")) { 257 this.target = new DV_EHR_URI(); 258 return this.target; 259 } 260 else 261 return super.addChild(name); 262 } 263 264 public String fhirType() { 265 return "LINK"; 266 267 } 268 269 public LINK copy() { 270 LINK dst = new LINK(); 271 copyValues(dst); 272 return dst; 273 } 274 275 public void copyValues(LINK dst) { 276 super.copyValues(dst); 277 dst.meaning = meaning == null ? null : meaning.copy(); 278 dst.type = type == null ? null : type.copy(); 279 dst.target = target == null ? null : target.copy(); 280 } 281 282 protected LINK typedCopy() { 283 return copy(); 284 } 285 286 @Override 287 public boolean equalsDeep(Base other_) { 288 if (!super.equalsDeep(other_)) 289 return false; 290 if (!(other_ instanceof LINK)) 291 return false; 292 LINK o = (LINK) other_; 293 return compareDeep(meaning, o.meaning, true) && compareDeep(type, o.type, true) && compareDeep(target, o.target, true) 294 ; 295 } 296 297 @Override 298 public boolean equalsShallow(Base other_) { 299 if (!super.equalsShallow(other_)) 300 return false; 301 if (!(other_ instanceof LINK)) 302 return false; 303 LINK o = (LINK) other_; 304 return true; 305 } 306 307 public boolean isEmpty() { 308 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(meaning, type, target); 309 } 310 311 312} 313