
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 * Ancestor of all real-world types, including people and organisations. An actor is any real-world entity capable of taking on a role. 049 */ 050@DatatypeDef(name="ACTOR") 051public abstract class ACTOR extends PARTY implements ICompositeType { 052 053 /** 054 * Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant). 055 */ 056 @Child(name = "languages", type = {DV_TEXT.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 057 @Description(shortDefinition="Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant)", formalDefinition="Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant)." ) 058 protected List<DV_TEXT> languagesList; 059 060 /** 061 * Identifiers of the Version container for each Role played by this Party. 062 */ 063 @Child(name = "roles", type = {PARTY_REF.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 064 @Description(shortDefinition="Identifiers of the Version container for each Role played by this Party", formalDefinition="Identifiers of the Version container for each Role played by this Party." ) 065 protected List<PARTY_REF> rolesList; 066 067 private static final long serialVersionUID = 635583100L; 068 069 /** 070 * Constructor 071 */ 072 public ACTOR() { 073 super(); 074 } 075 076 /** 077 * @return {@link #languages} (Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant).) 078 */ 079 public List<DV_TEXT> getLanguagesList() { 080 if (this.languagesList == null) 081 this.languagesList = new ArrayList<DV_TEXT>(); 082 return this.languagesList; 083 } 084 085 /** 086 * @return Returns a reference to <code>this</code> for easy method chaining 087 */ 088 public ACTOR setLanguagesList(List<DV_TEXT> theLanguages) { 089 this.languagesList = theLanguages; 090 return this; 091 } 092 093 public boolean hasLanguages() { 094 if (this.languagesList == null) 095 return false; 096 for (DV_TEXT item : this.languagesList) 097 if (!item.isEmpty()) 098 return true; 099 return false; 100 } 101 102 public DV_TEXT addLanguages() { //3a 103 DV_TEXT t = new DV_TEXT(); 104 if (this.languagesList == null) 105 this.languagesList = new ArrayList<DV_TEXT>(); 106 this.languagesList.add(t); 107 return t; 108 } 109 110 public ACTOR addLanguages(DV_TEXT t) { //3b 111 if (t == null) 112 return this; 113 if (this.languagesList == null) 114 this.languagesList = new ArrayList<DV_TEXT>(); 115 this.languagesList.add(t); 116 return this; 117 } 118 119 /** 120 * @return The first repetition of repeating field {@link #languages}, creating it if it does not already exist {3} 121 */ 122 public DV_TEXT getLanguagesFirstRep() { 123 if (getLanguagesList().isEmpty()) { 124 addLanguages(); 125 } 126 return getLanguagesList().get(0); 127 } 128 129 /** 130 * @return {@link #roles} (Identifiers of the Version container for each Role played by this Party.) 131 */ 132 public List<PARTY_REF> getRolesList() { 133 if (this.rolesList == null) 134 this.rolesList = new ArrayList<PARTY_REF>(); 135 return this.rolesList; 136 } 137 138 /** 139 * @return Returns a reference to <code>this</code> for easy method chaining 140 */ 141 public ACTOR setRolesList(List<PARTY_REF> theRoles) { 142 this.rolesList = theRoles; 143 return this; 144 } 145 146 public boolean hasRoles() { 147 if (this.rolesList == null) 148 return false; 149 for (PARTY_REF item : this.rolesList) 150 if (!item.isEmpty()) 151 return true; 152 return false; 153 } 154 155 public PARTY_REF addRoles() { //3a 156 PARTY_REF t = new PARTY_REF(); 157 if (this.rolesList == null) 158 this.rolesList = new ArrayList<PARTY_REF>(); 159 this.rolesList.add(t); 160 return t; 161 } 162 163 public ACTOR addRoles(PARTY_REF t) { //3b 164 if (t == null) 165 return this; 166 if (this.rolesList == null) 167 this.rolesList = new ArrayList<PARTY_REF>(); 168 this.rolesList.add(t); 169 return this; 170 } 171 172 /** 173 * @return The first repetition of repeating field {@link #roles}, creating it if it does not already exist {3} 174 */ 175 public PARTY_REF getRolesFirstRep() { 176 if (getRolesList().isEmpty()) { 177 addRoles(); 178 } 179 return getRolesList().get(0); 180 } 181 182 protected void listChildren(List<Property> children) { 183 super.listChildren(children); 184 children.add(new Property("languages", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant).", 0, java.lang.Integer.MAX_VALUE, languagesList)); 185 children.add(new Property("roles", "http://openehr.org/fhir/StructureDefinition/PARTY-REF", "Identifiers of the Version container for each Role played by this Party.", 0, java.lang.Integer.MAX_VALUE, rolesList)); 186 } 187 188 @Override 189 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 190 switch (_hash) { 191 case 1518327835: /*languages*/ return new Property("languages", "http://openehr.org/fhir/StructureDefinition/DV-TEXT", "Languages which can be used to communicate with this actor, in preferred order of use (if known, else order irrelevant).", 0, java.lang.Integer.MAX_VALUE, languagesList); 192 case 108695229: /*roles*/ return new Property("roles", "http://openehr.org/fhir/StructureDefinition/PARTY-REF", "Identifiers of the Version container for each Role played by this Party.", 0, java.lang.Integer.MAX_VALUE, rolesList); 193 default: return super.getNamedProperty(_hash, _name, _checkValid); 194 } 195 196 } 197 198 @Override 199 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 200 switch (hash) { 201 case 1518327835: /*languages*/ return this.languagesList == null ? new Base[0] : this.languagesList.toArray(new Base[this.languagesList.size()]); // DV_TEXT 202 case 108695229: /*roles*/ return this.rolesList == null ? new Base[0] : this.rolesList.toArray(new Base[this.rolesList.size()]); // PARTY_REF 203 default: return super.getProperty(hash, name, checkValid); 204 } 205 206 } 207 208 @Override 209 public Base setProperty(int hash, String name, Base value) throws FHIRException { 210 switch (hash) { 211 case 1518327835: // languages 212 this.getLanguagesList().add((DV_TEXT) value); // DV_TEXT 213 return value; 214 case 108695229: // roles 215 this.getRolesList().add((PARTY_REF) value); // PARTY_REF 216 return value; 217 default: return super.setProperty(hash, name, value); 218 } 219 220 } 221 222 @Override 223 public Base setProperty(String name, Base value) throws FHIRException { 224 if (name.equals("languages")) { 225 this.getLanguagesList().add((DV_TEXT) value); // DV_TEXT 226 } else if (name.equals("roles")) { 227 this.getRolesList().add((PARTY_REF) value); // PARTY_REF 228 } else 229 return super.setProperty(name, value); 230 return value; 231 } 232 233 @Override 234 public Base makeProperty(int hash, String name) throws FHIRException { 235 switch (hash) { 236 case 1518327835: return addLanguages(); 237 case 108695229: return addRoles(); 238 default: return super.makeProperty(hash, name); 239 } 240 241 } 242 243 @Override 244 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 245 switch (hash) { 246 case 1518327835: /*languages*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-TEXT"}; 247 case 108695229: /*roles*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/PARTY-REF"}; 248 default: return super.getTypesForProperty(hash, name); 249 } 250 251 } 252 253 @Override 254 public Base addChild(String name) throws FHIRException { 255 if (name.equals("languages")) { 256 return addLanguages(); 257 } 258 else if (name.equals("roles")) { 259 return addRoles(); 260 } 261 else 262 return super.addChild(name); 263 } 264 265 public String fhirType() { 266 return "ACTOR"; 267 268 } 269 270 public abstract ACTOR copy(); 271 272 public void copyValues(ACTOR dst) { 273 super.copyValues(dst); 274 if (languagesList != null) { 275 dst.languagesList = new ArrayList<DV_TEXT>(); 276 for (DV_TEXT i : languagesList) 277 dst.languagesList.add(i.copy()); 278 }; 279 if (rolesList != null) { 280 dst.rolesList = new ArrayList<PARTY_REF>(); 281 for (PARTY_REF i : rolesList) 282 dst.rolesList.add(i.copy()); 283 }; 284 } 285 286 @Override 287 public boolean equalsDeep(Base other_) { 288 if (!super.equalsDeep(other_)) 289 return false; 290 if (!(other_ instanceof ACTOR)) 291 return false; 292 ACTOR o = (ACTOR) other_; 293 return compareDeep(languagesList, o.languagesList, true) && compareDeep(rolesList, o.rolesList, true) 294 ; 295 } 296 297 @Override 298 public boolean equalsShallow(Base other_) { 299 if (!super.equalsShallow(other_)) 300 return false; 301 if (!(other_ instanceof ACTOR)) 302 return false; 303 ACTOR o = (ACTOR) other_; 304 return true; 305 } 306 307 public boolean isEmpty() { 308 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(languagesList, rolesList); 309 } 310 311 312} 313