
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 * A text item whose value must be the rubric from a controlled terminology, the key (i.e. the 'code') of which is the defining_code attribute. In other words: a DV_CODED_TEXT is a combination of a CODE_PHRASE (effectively a code) and the rubric of that term, from a terminology service, in the language in which the data were authored. 049 */ 050@DatatypeDef(name="DV_CODED_TEXT") 051public class DV_CODED_TEXT extends DV_TEXT implements ICompositeType { 052 053 /** 054 * Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service. 055 */ 056 @Child(name = "defining_code", type = {CODE_PHRASE.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Displayable rendition of the item, regardless of its underlying structure", formalDefinition="Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service." ) 058 protected CODE_PHRASE defining_code; 059 060 private static final long serialVersionUID = 599862763L; 061 062 /** 063 * Constructor 064 */ 065 public DV_CODED_TEXT() { 066 super(); 067 } 068 069 /** 070 * Constructor 071 */ 072 public DV_CODED_TEXT(CODE_PHRASE defining_code) { 073 super(); 074 this.setDefining_code(defining_code); 075 } 076 077 /** 078 * @return {@link #defining_code} (Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.) 079 */ 080 public CODE_PHRASE getDefining_code() { 081 if (this.defining_code == null) 082 if (Configuration.errorOnAutoCreate()) 083 throw new Error("Attempt to auto-create DV_CODED_TEXT.defining_code"); 084 else if (Configuration.doAutoCreate()) 085 this.defining_code = new CODE_PHRASE(); // cc 086 return this.defining_code; 087 } 088 089 public boolean hasDefining_code() { 090 return this.defining_code != null && !this.defining_code.isEmpty(); 091 } 092 093 /** 094 * @param value {@link #defining_code} (Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.) 095 */ 096 public DV_CODED_TEXT setDefining_code(CODE_PHRASE value) { 097 this.defining_code = value; 098 return this; 099 } 100 101 protected void listChildren(List<Property> children) { 102 super.listChildren(children); 103 children.add(new Property("defining_code", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.", 0, 1, defining_code)); 104 } 105 106 @Override 107 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 108 switch (_hash) { 109 case 2053146132: /*defining_code*/ return new Property("defining_code", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.", 0, 1, defining_code); 110 default: return super.getNamedProperty(_hash, _name, _checkValid); 111 } 112 113 } 114 115 @Override 116 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 117 switch (hash) { 118 case 2053146132: /*defining_code*/ return this.defining_code == null ? new Base[0] : new Base[] {this.defining_code}; // CODE_PHRASE 119 default: return super.getProperty(hash, name, checkValid); 120 } 121 122 } 123 124 @Override 125 public Base setProperty(int hash, String name, Base value) throws FHIRException { 126 switch (hash) { 127 case 2053146132: // defining_code 128 this.defining_code = (CODE_PHRASE) value; // CODE_PHRASE 129 return value; 130 default: return super.setProperty(hash, name, value); 131 } 132 133 } 134 135 @Override 136 public Base setProperty(String name, Base value) throws FHIRException { 137 if (name.equals("defining_code")) { 138 this.defining_code = (CODE_PHRASE) value; // CODE_PHRASE 139 } else 140 return super.setProperty(name, value); 141 return value; 142 } 143 144 @Override 145 public Base makeProperty(int hash, String name) throws FHIRException { 146 switch (hash) { 147 case 2053146132: return getDefining_code(); 148 default: return super.makeProperty(hash, name); 149 } 150 151 } 152 153 @Override 154 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 155 switch (hash) { 156 case 2053146132: /*defining_code*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/CODE-PHRASE"}; 157 default: return super.getTypesForProperty(hash, name); 158 } 159 160 } 161 162 @Override 163 public Base addChild(String name) throws FHIRException { 164 if (name.equals("defining_code")) { 165 this.defining_code = new CODE_PHRASE(); 166 return this.defining_code; 167 } 168 else 169 return super.addChild(name); 170 } 171 172 public String fhirType() { 173 return "DV_CODED_TEXT"; 174 175 } 176 177 public DV_CODED_TEXT copy() { 178 DV_CODED_TEXT dst = new DV_CODED_TEXT(); 179 copyValues(dst); 180 return dst; 181 } 182 183 public void copyValues(DV_CODED_TEXT dst) { 184 super.copyValues(dst); 185 dst.defining_code = defining_code == null ? null : defining_code.copy(); 186 } 187 188 protected DV_CODED_TEXT typedCopy() { 189 return copy(); 190 } 191 192 @Override 193 public boolean equalsDeep(Base other_) { 194 if (!super.equalsDeep(other_)) 195 return false; 196 if (!(other_ instanceof DV_CODED_TEXT)) 197 return false; 198 DV_CODED_TEXT o = (DV_CODED_TEXT) other_; 199 return compareDeep(defining_code, o.defining_code, true); 200 } 201 202 @Override 203 public boolean equalsShallow(Base other_) { 204 if (!super.equalsShallow(other_)) 205 return false; 206 if (!(other_ instanceof DV_CODED_TEXT)) 207 return false; 208 DV_CODED_TEXT o = (DV_CODED_TEXT) other_; 209 return true; 210 } 211 212 public boolean isEmpty() { 213 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(defining_code); 214 } 215 216 217} 218