001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import ca.uhn.fhir.model.api.annotation.ResourceDef; 040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.Description; 044import ca.uhn.fhir.model.api.annotation.Block; 045import org.hl7.fhir.instance.model.api.*; 046import org.hl7.fhir.exceptions.FHIRException; 047/** 048 * Describe the undesirable effects of the medicinal product. 049 */ 050@ResourceDef(name="MedicinalProductUndesirableEffect", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductUndesirableEffect") 051public class MedicinalProductUndesirableEffect extends DomainResource { 052 053 /** 054 * The medication for which this is an indication. 055 */ 056 @Child(name = "subject", type = {MedicinalProduct.class, Medication.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 057 @Description(shortDefinition="The medication for which this is an indication", formalDefinition="The medication for which this is an indication." ) 058 protected List<Reference> subject; 059 /** 060 * The actual objects that are the target of the reference (The medication for which this is an indication.) 061 */ 062 protected List<Resource> subjectTarget; 063 064 065 /** 066 * The symptom, condition or undesirable effect. 067 */ 068 @Child(name = "symptomConditionEffect", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 069 @Description(shortDefinition="The symptom, condition or undesirable effect", formalDefinition="The symptom, condition or undesirable effect." ) 070 protected CodeableConcept symptomConditionEffect; 071 072 /** 073 * Classification of the effect. 074 */ 075 @Child(name = "classification", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 076 @Description(shortDefinition="Classification of the effect", formalDefinition="Classification of the effect." ) 077 protected CodeableConcept classification; 078 079 /** 080 * The frequency of occurrence of the effect. 081 */ 082 @Child(name = "frequencyOfOccurrence", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 083 @Description(shortDefinition="The frequency of occurrence of the effect", formalDefinition="The frequency of occurrence of the effect." ) 084 protected CodeableConcept frequencyOfOccurrence; 085 086 /** 087 * The population group to which this applies. 088 */ 089 @Child(name = "population", type = {Population.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 090 @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." ) 091 protected List<Population> population; 092 093 private static final long serialVersionUID = -1960253956L; 094 095 /** 096 * Constructor 097 */ 098 public MedicinalProductUndesirableEffect() { 099 super(); 100 } 101 102 /** 103 * @return {@link #subject} (The medication for which this is an indication.) 104 */ 105 public List<Reference> getSubject() { 106 if (this.subject == null) 107 this.subject = new ArrayList<Reference>(); 108 return this.subject; 109 } 110 111 /** 112 * @return Returns a reference to <code>this</code> for easy method chaining 113 */ 114 public MedicinalProductUndesirableEffect setSubject(List<Reference> theSubject) { 115 this.subject = theSubject; 116 return this; 117 } 118 119 public boolean hasSubject() { 120 if (this.subject == null) 121 return false; 122 for (Reference item : this.subject) 123 if (!item.isEmpty()) 124 return true; 125 return false; 126 } 127 128 public Reference addSubject() { //3 129 Reference t = new Reference(); 130 if (this.subject == null) 131 this.subject = new ArrayList<Reference>(); 132 this.subject.add(t); 133 return t; 134 } 135 136 public MedicinalProductUndesirableEffect addSubject(Reference t) { //3 137 if (t == null) 138 return this; 139 if (this.subject == null) 140 this.subject = new ArrayList<Reference>(); 141 this.subject.add(t); 142 return this; 143 } 144 145 /** 146 * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist 147 */ 148 public Reference getSubjectFirstRep() { 149 if (getSubject().isEmpty()) { 150 addSubject(); 151 } 152 return getSubject().get(0); 153 } 154 155 /** 156 * @deprecated Use Reference#setResource(IBaseResource) instead 157 */ 158 @Deprecated 159 public List<Resource> getSubjectTarget() { 160 if (this.subjectTarget == null) 161 this.subjectTarget = new ArrayList<Resource>(); 162 return this.subjectTarget; 163 } 164 165 /** 166 * @return {@link #symptomConditionEffect} (The symptom, condition or undesirable effect.) 167 */ 168 public CodeableConcept getSymptomConditionEffect() { 169 if (this.symptomConditionEffect == null) 170 if (Configuration.errorOnAutoCreate()) 171 throw new Error("Attempt to auto-create MedicinalProductUndesirableEffect.symptomConditionEffect"); 172 else if (Configuration.doAutoCreate()) 173 this.symptomConditionEffect = new CodeableConcept(); // cc 174 return this.symptomConditionEffect; 175 } 176 177 public boolean hasSymptomConditionEffect() { 178 return this.symptomConditionEffect != null && !this.symptomConditionEffect.isEmpty(); 179 } 180 181 /** 182 * @param value {@link #symptomConditionEffect} (The symptom, condition or undesirable effect.) 183 */ 184 public MedicinalProductUndesirableEffect setSymptomConditionEffect(CodeableConcept value) { 185 this.symptomConditionEffect = value; 186 return this; 187 } 188 189 /** 190 * @return {@link #classification} (Classification of the effect.) 191 */ 192 public CodeableConcept getClassification() { 193 if (this.classification == null) 194 if (Configuration.errorOnAutoCreate()) 195 throw new Error("Attempt to auto-create MedicinalProductUndesirableEffect.classification"); 196 else if (Configuration.doAutoCreate()) 197 this.classification = new CodeableConcept(); // cc 198 return this.classification; 199 } 200 201 public boolean hasClassification() { 202 return this.classification != null && !this.classification.isEmpty(); 203 } 204 205 /** 206 * @param value {@link #classification} (Classification of the effect.) 207 */ 208 public MedicinalProductUndesirableEffect setClassification(CodeableConcept value) { 209 this.classification = value; 210 return this; 211 } 212 213 /** 214 * @return {@link #frequencyOfOccurrence} (The frequency of occurrence of the effect.) 215 */ 216 public CodeableConcept getFrequencyOfOccurrence() { 217 if (this.frequencyOfOccurrence == null) 218 if (Configuration.errorOnAutoCreate()) 219 throw new Error("Attempt to auto-create MedicinalProductUndesirableEffect.frequencyOfOccurrence"); 220 else if (Configuration.doAutoCreate()) 221 this.frequencyOfOccurrence = new CodeableConcept(); // cc 222 return this.frequencyOfOccurrence; 223 } 224 225 public boolean hasFrequencyOfOccurrence() { 226 return this.frequencyOfOccurrence != null && !this.frequencyOfOccurrence.isEmpty(); 227 } 228 229 /** 230 * @param value {@link #frequencyOfOccurrence} (The frequency of occurrence of the effect.) 231 */ 232 public MedicinalProductUndesirableEffect setFrequencyOfOccurrence(CodeableConcept value) { 233 this.frequencyOfOccurrence = value; 234 return this; 235 } 236 237 /** 238 * @return {@link #population} (The population group to which this applies.) 239 */ 240 public List<Population> getPopulation() { 241 if (this.population == null) 242 this.population = new ArrayList<Population>(); 243 return this.population; 244 } 245 246 /** 247 * @return Returns a reference to <code>this</code> for easy method chaining 248 */ 249 public MedicinalProductUndesirableEffect setPopulation(List<Population> thePopulation) { 250 this.population = thePopulation; 251 return this; 252 } 253 254 public boolean hasPopulation() { 255 if (this.population == null) 256 return false; 257 for (Population item : this.population) 258 if (!item.isEmpty()) 259 return true; 260 return false; 261 } 262 263 public Population addPopulation() { //3 264 Population t = new Population(); 265 if (this.population == null) 266 this.population = new ArrayList<Population>(); 267 this.population.add(t); 268 return t; 269 } 270 271 public MedicinalProductUndesirableEffect addPopulation(Population t) { //3 272 if (t == null) 273 return this; 274 if (this.population == null) 275 this.population = new ArrayList<Population>(); 276 this.population.add(t); 277 return this; 278 } 279 280 /** 281 * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist 282 */ 283 public Population getPopulationFirstRep() { 284 if (getPopulation().isEmpty()) { 285 addPopulation(); 286 } 287 return getPopulation().get(0); 288 } 289 290 protected void listChildren(List<Property> children) { 291 super.listChildren(children); 292 children.add(new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject)); 293 children.add(new Property("symptomConditionEffect", "CodeableConcept", "The symptom, condition or undesirable effect.", 0, 1, symptomConditionEffect)); 294 children.add(new Property("classification", "CodeableConcept", "Classification of the effect.", 0, 1, classification)); 295 children.add(new Property("frequencyOfOccurrence", "CodeableConcept", "The frequency of occurrence of the effect.", 0, 1, frequencyOfOccurrence)); 296 children.add(new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population)); 297 } 298 299 @Override 300 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 301 switch (_hash) { 302 case -1867885268: /*subject*/ return new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject); 303 case -650549981: /*symptomConditionEffect*/ return new Property("symptomConditionEffect", "CodeableConcept", "The symptom, condition or undesirable effect.", 0, 1, symptomConditionEffect); 304 case 382350310: /*classification*/ return new Property("classification", "CodeableConcept", "Classification of the effect.", 0, 1, classification); 305 case 791175812: /*frequencyOfOccurrence*/ return new Property("frequencyOfOccurrence", "CodeableConcept", "The frequency of occurrence of the effect.", 0, 1, frequencyOfOccurrence); 306 case -2023558323: /*population*/ return new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population); 307 default: return super.getNamedProperty(_hash, _name, _checkValid); 308 } 309 310 } 311 312 @Override 313 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 314 switch (hash) { 315 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference 316 case -650549981: /*symptomConditionEffect*/ return this.symptomConditionEffect == null ? new Base[0] : new Base[] {this.symptomConditionEffect}; // CodeableConcept 317 case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // CodeableConcept 318 case 791175812: /*frequencyOfOccurrence*/ return this.frequencyOfOccurrence == null ? new Base[0] : new Base[] {this.frequencyOfOccurrence}; // CodeableConcept 319 case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // Population 320 default: return super.getProperty(hash, name, checkValid); 321 } 322 323 } 324 325 @Override 326 public Base setProperty(int hash, String name, Base value) throws FHIRException { 327 switch (hash) { 328 case -1867885268: // subject 329 this.getSubject().add(castToReference(value)); // Reference 330 return value; 331 case -650549981: // symptomConditionEffect 332 this.symptomConditionEffect = castToCodeableConcept(value); // CodeableConcept 333 return value; 334 case 382350310: // classification 335 this.classification = castToCodeableConcept(value); // CodeableConcept 336 return value; 337 case 791175812: // frequencyOfOccurrence 338 this.frequencyOfOccurrence = castToCodeableConcept(value); // CodeableConcept 339 return value; 340 case -2023558323: // population 341 this.getPopulation().add(castToPopulation(value)); // Population 342 return value; 343 default: return super.setProperty(hash, name, value); 344 } 345 346 } 347 348 @Override 349 public Base setProperty(String name, Base value) throws FHIRException { 350 if (name.equals("subject")) { 351 this.getSubject().add(castToReference(value)); 352 } else if (name.equals("symptomConditionEffect")) { 353 this.symptomConditionEffect = castToCodeableConcept(value); // CodeableConcept 354 } else if (name.equals("classification")) { 355 this.classification = castToCodeableConcept(value); // CodeableConcept 356 } else if (name.equals("frequencyOfOccurrence")) { 357 this.frequencyOfOccurrence = castToCodeableConcept(value); // CodeableConcept 358 } else if (name.equals("population")) { 359 this.getPopulation().add(castToPopulation(value)); 360 } else 361 return super.setProperty(name, value); 362 return value; 363 } 364 365 @Override 366 public Base makeProperty(int hash, String name) throws FHIRException { 367 switch (hash) { 368 case -1867885268: return addSubject(); 369 case -650549981: return getSymptomConditionEffect(); 370 case 382350310: return getClassification(); 371 case 791175812: return getFrequencyOfOccurrence(); 372 case -2023558323: return addPopulation(); 373 default: return super.makeProperty(hash, name); 374 } 375 376 } 377 378 @Override 379 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 380 switch (hash) { 381 case -1867885268: /*subject*/ return new String[] {"Reference"}; 382 case -650549981: /*symptomConditionEffect*/ return new String[] {"CodeableConcept"}; 383 case 382350310: /*classification*/ return new String[] {"CodeableConcept"}; 384 case 791175812: /*frequencyOfOccurrence*/ return new String[] {"CodeableConcept"}; 385 case -2023558323: /*population*/ return new String[] {"Population"}; 386 default: return super.getTypesForProperty(hash, name); 387 } 388 389 } 390 391 @Override 392 public Base addChild(String name) throws FHIRException { 393 if (name.equals("subject")) { 394 return addSubject(); 395 } 396 else if (name.equals("symptomConditionEffect")) { 397 this.symptomConditionEffect = new CodeableConcept(); 398 return this.symptomConditionEffect; 399 } 400 else if (name.equals("classification")) { 401 this.classification = new CodeableConcept(); 402 return this.classification; 403 } 404 else if (name.equals("frequencyOfOccurrence")) { 405 this.frequencyOfOccurrence = new CodeableConcept(); 406 return this.frequencyOfOccurrence; 407 } 408 else if (name.equals("population")) { 409 return addPopulation(); 410 } 411 else 412 return super.addChild(name); 413 } 414 415 public String fhirType() { 416 return "MedicinalProductUndesirableEffect"; 417 418 } 419 420 public MedicinalProductUndesirableEffect copy() { 421 MedicinalProductUndesirableEffect dst = new MedicinalProductUndesirableEffect(); 422 copyValues(dst); 423 return dst; 424 } 425 426 public void copyValues(MedicinalProductUndesirableEffect dst) { 427 super.copyValues(dst); 428 if (subject != null) { 429 dst.subject = new ArrayList<Reference>(); 430 for (Reference i : subject) 431 dst.subject.add(i.copy()); 432 }; 433 dst.symptomConditionEffect = symptomConditionEffect == null ? null : symptomConditionEffect.copy(); 434 dst.classification = classification == null ? null : classification.copy(); 435 dst.frequencyOfOccurrence = frequencyOfOccurrence == null ? null : frequencyOfOccurrence.copy(); 436 if (population != null) { 437 dst.population = new ArrayList<Population>(); 438 for (Population i : population) 439 dst.population.add(i.copy()); 440 }; 441 } 442 443 protected MedicinalProductUndesirableEffect typedCopy() { 444 return copy(); 445 } 446 447 @Override 448 public boolean equalsDeep(Base other_) { 449 if (!super.equalsDeep(other_)) 450 return false; 451 if (!(other_ instanceof MedicinalProductUndesirableEffect)) 452 return false; 453 MedicinalProductUndesirableEffect o = (MedicinalProductUndesirableEffect) other_; 454 return compareDeep(subject, o.subject, true) && compareDeep(symptomConditionEffect, o.symptomConditionEffect, true) 455 && compareDeep(classification, o.classification, true) && compareDeep(frequencyOfOccurrence, o.frequencyOfOccurrence, true) 456 && compareDeep(population, o.population, true); 457 } 458 459 @Override 460 public boolean equalsShallow(Base other_) { 461 if (!super.equalsShallow(other_)) 462 return false; 463 if (!(other_ instanceof MedicinalProductUndesirableEffect)) 464 return false; 465 MedicinalProductUndesirableEffect o = (MedicinalProductUndesirableEffect) other_; 466 return true; 467 } 468 469 public boolean isEmpty() { 470 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, symptomConditionEffect 471 , classification, frequencyOfOccurrence, population); 472 } 473 474 @Override 475 public ResourceType getResourceType() { 476 return ResourceType.MedicinalProductUndesirableEffect; 477 } 478 479 /** 480 * Search parameter: <b>subject</b> 481 * <p> 482 * Description: <b>The medication for which this is an undesirable effect</b><br> 483 * Type: <b>reference</b><br> 484 * Path: <b>MedicinalProductUndesirableEffect.subject</b><br> 485 * </p> 486 */ 487 @SearchParamDefinition(name="subject", path="MedicinalProductUndesirableEffect.subject", description="The medication for which this is an undesirable effect", type="reference", target={Medication.class, MedicinalProduct.class } ) 488 public static final String SP_SUBJECT = "subject"; 489 /** 490 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 491 * <p> 492 * Description: <b>The medication for which this is an undesirable effect</b><br> 493 * Type: <b>reference</b><br> 494 * Path: <b>MedicinalProductUndesirableEffect.subject</b><br> 495 * </p> 496 */ 497 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 498 499/** 500 * Constant for fluent queries to be used to add include statements. Specifies 501 * the path value of "<b>MedicinalProductUndesirableEffect:subject</b>". 502 */ 503 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductUndesirableEffect:subject").toLocked(); 504 505 506}