001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.List;
055
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
058import org.hl7.fhir.utilities.Utilities;
059
060import ca.uhn.fhir.model.api.annotation.Block;
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.Description;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065/**
066 * The interactions of the medicinal product with other medicinal products, or other forms of interactions.
067 */
068@ResourceDef(name="MedicinalProductInteraction", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction")
069public class MedicinalProductInteraction extends DomainResource {
070
071    @Block()
072    public static class MedicinalProductInteractionInteractantComponent extends BackboneElement implements IBaseBackboneElement {
073        /**
074         * The specific medication, food or laboratory test that interacts.
075         */
076        @Child(name = "item", type = {MedicinalProduct.class, Medication.class, Substance.class, ObservationDefinition.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
077        @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." )
078        protected Type item;
079
080        private static final long serialVersionUID = 1445276561L;
081
082    /**
083     * Constructor
084     */
085      public MedicinalProductInteractionInteractantComponent() {
086        super();
087      }
088
089    /**
090     * Constructor
091     */
092      public MedicinalProductInteractionInteractantComponent(Type item) {
093        super();
094        this.item = item;
095      }
096
097        /**
098         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
099         */
100        public Type getItem() { 
101          return this.item;
102        }
103
104        /**
105         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
106         */
107        public Reference getItemReference() throws FHIRException { 
108          if (this.item == null)
109            this.item = new Reference();
110          if (!(this.item instanceof Reference))
111            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
112          return (Reference) this.item;
113        }
114
115        public boolean hasItemReference() { 
116          return this != null && this.item instanceof Reference;
117        }
118
119        /**
120         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
121         */
122        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
123          if (this.item == null)
124            this.item = new CodeableConcept();
125          if (!(this.item instanceof CodeableConcept))
126            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
127          return (CodeableConcept) this.item;
128        }
129
130        public boolean hasItemCodeableConcept() { 
131          return this != null && this.item instanceof CodeableConcept;
132        }
133
134        public boolean hasItem() { 
135          return this.item != null && !this.item.isEmpty();
136        }
137
138        /**
139         * @param value {@link #item} (The specific medication, food or laboratory test that interacts.)
140         */
141        public MedicinalProductInteractionInteractantComponent setItem(Type value) { 
142          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
143            throw new Error("Not the right type for MedicinalProductInteraction.interactant.item[x]: "+value.fhirType());
144          this.item = value;
145          return this;
146        }
147
148        protected void listChildren(List<Property> children) {
149          super.listChildren(children);
150          children.add(new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item));
151        }
152
153        @Override
154        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
155          switch (_hash) {
156          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
157          case 3242771: /*item*/  return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
158          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
159          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
160          default: return super.getNamedProperty(_hash, _name, _checkValid);
161          }
162
163        }
164
165      @Override
166      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
167        switch (hash) {
168        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type
169        default: return super.getProperty(hash, name, checkValid);
170        }
171
172      }
173
174      @Override
175      public Base setProperty(int hash, String name, Base value) throws FHIRException {
176        switch (hash) {
177        case 3242771: // item
178          this.item = castToType(value); // Type
179          return value;
180        default: return super.setProperty(hash, name, value);
181        }
182
183      }
184
185      @Override
186      public Base setProperty(String name, Base value) throws FHIRException {
187        if (name.equals("item[x]")) {
188          this.item = castToType(value); // Type
189        } else
190          return super.setProperty(name, value);
191        return value;
192      }
193
194      @Override
195      public Base makeProperty(int hash, String name) throws FHIRException {
196        switch (hash) {
197        case 2116201613:  return getItem(); 
198        case 3242771:  return getItem(); 
199        default: return super.makeProperty(hash, name);
200        }
201
202      }
203
204      @Override
205      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
206        switch (hash) {
207        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
208        default: return super.getTypesForProperty(hash, name);
209        }
210
211      }
212
213      @Override
214      public Base addChild(String name) throws FHIRException {
215        if (name.equals("itemReference")) {
216          this.item = new Reference();
217          return this.item;
218        }
219        else if (name.equals("itemCodeableConcept")) {
220          this.item = new CodeableConcept();
221          return this.item;
222        }
223        else
224          return super.addChild(name);
225      }
226
227      public MedicinalProductInteractionInteractantComponent copy() {
228        MedicinalProductInteractionInteractantComponent dst = new MedicinalProductInteractionInteractantComponent();
229        copyValues(dst);
230        dst.item = item == null ? null : item.copy();
231        return dst;
232      }
233
234      @Override
235      public boolean equalsDeep(Base other_) {
236        if (!super.equalsDeep(other_))
237          return false;
238        if (!(other_ instanceof MedicinalProductInteractionInteractantComponent))
239          return false;
240        MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_;
241        return compareDeep(item, o.item, true);
242      }
243
244      @Override
245      public boolean equalsShallow(Base other_) {
246        if (!super.equalsShallow(other_))
247          return false;
248        if (!(other_ instanceof MedicinalProductInteractionInteractantComponent))
249          return false;
250        MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_;
251        return true;
252      }
253
254      public boolean isEmpty() {
255        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
256      }
257
258  public String fhirType() {
259    return "MedicinalProductInteraction.interactant";
260
261  }
262
263  }
264
265    /**
266     * The medication for which this is a described interaction.
267     */
268    @Child(name = "subject", type = {MedicinalProduct.class, Medication.class, Substance.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
269    @Description(shortDefinition="The medication for which this is a described interaction", formalDefinition="The medication for which this is a described interaction." )
270    protected List<Reference> subject;
271    /**
272     * The actual objects that are the target of the reference (The medication for which this is a described interaction.)
273     */
274    protected List<Resource> subjectTarget;
275
276
277    /**
278     * The interaction described.
279     */
280    @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
281    @Description(shortDefinition="The interaction described", formalDefinition="The interaction described." )
282    protected StringType description;
283
284    /**
285     * The specific medication, food or laboratory test that interacts.
286     */
287    @Child(name = "interactant", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
288    @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." )
289    protected List<MedicinalProductInteractionInteractantComponent> interactant;
290
291    /**
292     * The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.
293     */
294    @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
295    @Description(shortDefinition="The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction", formalDefinition="The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction." )
296    protected CodeableConcept type;
297
298    /**
299     * The effect of the interaction, for example "reduced gastric absorption of primary medication".
300     */
301    @Child(name = "effect", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
302    @Description(shortDefinition="The effect of the interaction, for example \"reduced gastric absorption of primary medication\"", formalDefinition="The effect of the interaction, for example \"reduced gastric absorption of primary medication\"." )
303    protected CodeableConcept effect;
304
305    /**
306     * The incidence of the interaction, e.g. theoretical, observed.
307     */
308    @Child(name = "incidence", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
309    @Description(shortDefinition="The incidence of the interaction, e.g. theoretical, observed", formalDefinition="The incidence of the interaction, e.g. theoretical, observed." )
310    protected CodeableConcept incidence;
311
312    /**
313     * Actions for managing the interaction.
314     */
315    @Child(name = "management", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
316    @Description(shortDefinition="Actions for managing the interaction", formalDefinition="Actions for managing the interaction." )
317    protected CodeableConcept management;
318
319    private static final long serialVersionUID = -1872687169L;
320
321  /**
322   * Constructor
323   */
324    public MedicinalProductInteraction() {
325      super();
326    }
327
328    /**
329     * @return {@link #subject} (The medication for which this is a described interaction.)
330     */
331    public List<Reference> getSubject() { 
332      if (this.subject == null)
333        this.subject = new ArrayList<Reference>();
334      return this.subject;
335    }
336
337    /**
338     * @return Returns a reference to <code>this</code> for easy method chaining
339     */
340    public MedicinalProductInteraction setSubject(List<Reference> theSubject) { 
341      this.subject = theSubject;
342      return this;
343    }
344
345    public boolean hasSubject() { 
346      if (this.subject == null)
347        return false;
348      for (Reference item : this.subject)
349        if (!item.isEmpty())
350          return true;
351      return false;
352    }
353
354    public Reference addSubject() { //3
355      Reference t = new Reference();
356      if (this.subject == null)
357        this.subject = new ArrayList<Reference>();
358      this.subject.add(t);
359      return t;
360    }
361
362    public MedicinalProductInteraction addSubject(Reference t) { //3
363      if (t == null)
364        return this;
365      if (this.subject == null)
366        this.subject = new ArrayList<Reference>();
367      this.subject.add(t);
368      return this;
369    }
370
371    /**
372     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
373     */
374    public Reference getSubjectFirstRep() { 
375      if (getSubject().isEmpty()) {
376        addSubject();
377      }
378      return getSubject().get(0);
379    }
380
381    /**
382     * @deprecated Use Reference#setResource(IBaseResource) instead
383     */
384    @Deprecated
385    public List<Resource> getSubjectTarget() { 
386      if (this.subjectTarget == null)
387        this.subjectTarget = new ArrayList<Resource>();
388      return this.subjectTarget;
389    }
390
391    /**
392     * @return {@link #description} (The interaction described.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
393     */
394    public StringType getDescriptionElement() { 
395      if (this.description == null)
396        if (Configuration.errorOnAutoCreate())
397          throw new Error("Attempt to auto-create MedicinalProductInteraction.description");
398        else if (Configuration.doAutoCreate())
399          this.description = new StringType(); // bb
400      return this.description;
401    }
402
403    public boolean hasDescriptionElement() { 
404      return this.description != null && !this.description.isEmpty();
405    }
406
407    public boolean hasDescription() { 
408      return this.description != null && !this.description.isEmpty();
409    }
410
411    /**
412     * @param value {@link #description} (The interaction described.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
413     */
414    public MedicinalProductInteraction setDescriptionElement(StringType value) { 
415      this.description = value;
416      return this;
417    }
418
419    /**
420     * @return The interaction described.
421     */
422    public String getDescription() { 
423      return this.description == null ? null : this.description.getValue();
424    }
425
426    /**
427     * @param value The interaction described.
428     */
429    public MedicinalProductInteraction setDescription(String value) { 
430      if (Utilities.noString(value))
431        this.description = null;
432      else {
433        if (this.description == null)
434          this.description = new StringType();
435        this.description.setValue(value);
436      }
437      return this;
438    }
439
440    /**
441     * @return {@link #interactant} (The specific medication, food or laboratory test that interacts.)
442     */
443    public List<MedicinalProductInteractionInteractantComponent> getInteractant() { 
444      if (this.interactant == null)
445        this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>();
446      return this.interactant;
447    }
448
449    /**
450     * @return Returns a reference to <code>this</code> for easy method chaining
451     */
452    public MedicinalProductInteraction setInteractant(List<MedicinalProductInteractionInteractantComponent> theInteractant) { 
453      this.interactant = theInteractant;
454      return this;
455    }
456
457    public boolean hasInteractant() { 
458      if (this.interactant == null)
459        return false;
460      for (MedicinalProductInteractionInteractantComponent item : this.interactant)
461        if (!item.isEmpty())
462          return true;
463      return false;
464    }
465
466    public MedicinalProductInteractionInteractantComponent addInteractant() { //3
467      MedicinalProductInteractionInteractantComponent t = new MedicinalProductInteractionInteractantComponent();
468      if (this.interactant == null)
469        this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>();
470      this.interactant.add(t);
471      return t;
472    }
473
474    public MedicinalProductInteraction addInteractant(MedicinalProductInteractionInteractantComponent t) { //3
475      if (t == null)
476        return this;
477      if (this.interactant == null)
478        this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>();
479      this.interactant.add(t);
480      return this;
481    }
482
483    /**
484     * @return The first repetition of repeating field {@link #interactant}, creating it if it does not already exist
485     */
486    public MedicinalProductInteractionInteractantComponent getInteractantFirstRep() { 
487      if (getInteractant().isEmpty()) {
488        addInteractant();
489      }
490      return getInteractant().get(0);
491    }
492
493    /**
494     * @return {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.)
495     */
496    public CodeableConcept getType() { 
497      if (this.type == null)
498        if (Configuration.errorOnAutoCreate())
499          throw new Error("Attempt to auto-create MedicinalProductInteraction.type");
500        else if (Configuration.doAutoCreate())
501          this.type = new CodeableConcept(); // cc
502      return this.type;
503    }
504
505    public boolean hasType() { 
506      return this.type != null && !this.type.isEmpty();
507    }
508
509    /**
510     * @param value {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.)
511     */
512    public MedicinalProductInteraction setType(CodeableConcept value) { 
513      this.type = value;
514      return this;
515    }
516
517    /**
518     * @return {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".)
519     */
520    public CodeableConcept getEffect() { 
521      if (this.effect == null)
522        if (Configuration.errorOnAutoCreate())
523          throw new Error("Attempt to auto-create MedicinalProductInteraction.effect");
524        else if (Configuration.doAutoCreate())
525          this.effect = new CodeableConcept(); // cc
526      return this.effect;
527    }
528
529    public boolean hasEffect() { 
530      return this.effect != null && !this.effect.isEmpty();
531    }
532
533    /**
534     * @param value {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".)
535     */
536    public MedicinalProductInteraction setEffect(CodeableConcept value) { 
537      this.effect = value;
538      return this;
539    }
540
541    /**
542     * @return {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.)
543     */
544    public CodeableConcept getIncidence() { 
545      if (this.incidence == null)
546        if (Configuration.errorOnAutoCreate())
547          throw new Error("Attempt to auto-create MedicinalProductInteraction.incidence");
548        else if (Configuration.doAutoCreate())
549          this.incidence = new CodeableConcept(); // cc
550      return this.incidence;
551    }
552
553    public boolean hasIncidence() { 
554      return this.incidence != null && !this.incidence.isEmpty();
555    }
556
557    /**
558     * @param value {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.)
559     */
560    public MedicinalProductInteraction setIncidence(CodeableConcept value) { 
561      this.incidence = value;
562      return this;
563    }
564
565    /**
566     * @return {@link #management} (Actions for managing the interaction.)
567     */
568    public CodeableConcept getManagement() { 
569      if (this.management == null)
570        if (Configuration.errorOnAutoCreate())
571          throw new Error("Attempt to auto-create MedicinalProductInteraction.management");
572        else if (Configuration.doAutoCreate())
573          this.management = new CodeableConcept(); // cc
574      return this.management;
575    }
576
577    public boolean hasManagement() { 
578      return this.management != null && !this.management.isEmpty();
579    }
580
581    /**
582     * @param value {@link #management} (Actions for managing the interaction.)
583     */
584    public MedicinalProductInteraction setManagement(CodeableConcept value) { 
585      this.management = value;
586      return this;
587    }
588
589      protected void listChildren(List<Property> children) {
590        super.listChildren(children);
591        children.add(new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject));
592        children.add(new Property("description", "string", "The interaction described.", 0, 1, description));
593        children.add(new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant));
594        children.add(new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type));
595        children.add(new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect));
596        children.add(new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence));
597        children.add(new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management));
598      }
599
600      @Override
601      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
602        switch (_hash) {
603        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject);
604        case -1724546052: /*description*/  return new Property("description", "string", "The interaction described.", 0, 1, description);
605        case 1844097009: /*interactant*/  return new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant);
606        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type);
607        case -1306084975: /*effect*/  return new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect);
608        case -1598467132: /*incidence*/  return new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence);
609        case -1799980989: /*management*/  return new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management);
610        default: return super.getNamedProperty(_hash, _name, _checkValid);
611        }
612
613      }
614
615      @Override
616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
617        switch (hash) {
618        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
619        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
620        case 1844097009: /*interactant*/ return this.interactant == null ? new Base[0] : this.interactant.toArray(new Base[this.interactant.size()]); // MedicinalProductInteractionInteractantComponent
621        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
622        case -1306084975: /*effect*/ return this.effect == null ? new Base[0] : new Base[] {this.effect}; // CodeableConcept
623        case -1598467132: /*incidence*/ return this.incidence == null ? new Base[0] : new Base[] {this.incidence}; // CodeableConcept
624        case -1799980989: /*management*/ return this.management == null ? new Base[0] : new Base[] {this.management}; // CodeableConcept
625        default: return super.getProperty(hash, name, checkValid);
626        }
627
628      }
629
630      @Override
631      public Base setProperty(int hash, String name, Base value) throws FHIRException {
632        switch (hash) {
633        case -1867885268: // subject
634          this.getSubject().add(castToReference(value)); // Reference
635          return value;
636        case -1724546052: // description
637          this.description = castToString(value); // StringType
638          return value;
639        case 1844097009: // interactant
640          this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value); // MedicinalProductInteractionInteractantComponent
641          return value;
642        case 3575610: // type
643          this.type = castToCodeableConcept(value); // CodeableConcept
644          return value;
645        case -1306084975: // effect
646          this.effect = castToCodeableConcept(value); // CodeableConcept
647          return value;
648        case -1598467132: // incidence
649          this.incidence = castToCodeableConcept(value); // CodeableConcept
650          return value;
651        case -1799980989: // management
652          this.management = castToCodeableConcept(value); // CodeableConcept
653          return value;
654        default: return super.setProperty(hash, name, value);
655        }
656
657      }
658
659      @Override
660      public Base setProperty(String name, Base value) throws FHIRException {
661        if (name.equals("subject")) {
662          this.getSubject().add(castToReference(value));
663        } else if (name.equals("description")) {
664          this.description = castToString(value); // StringType
665        } else if (name.equals("interactant")) {
666          this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value);
667        } else if (name.equals("type")) {
668          this.type = castToCodeableConcept(value); // CodeableConcept
669        } else if (name.equals("effect")) {
670          this.effect = castToCodeableConcept(value); // CodeableConcept
671        } else if (name.equals("incidence")) {
672          this.incidence = castToCodeableConcept(value); // CodeableConcept
673        } else if (name.equals("management")) {
674          this.management = castToCodeableConcept(value); // CodeableConcept
675        } else
676          return super.setProperty(name, value);
677        return value;
678      }
679
680      @Override
681      public Base makeProperty(int hash, String name) throws FHIRException {
682        switch (hash) {
683        case -1867885268:  return addSubject(); 
684        case -1724546052:  return getDescriptionElement();
685        case 1844097009:  return addInteractant(); 
686        case 3575610:  return getType(); 
687        case -1306084975:  return getEffect(); 
688        case -1598467132:  return getIncidence(); 
689        case -1799980989:  return getManagement(); 
690        default: return super.makeProperty(hash, name);
691        }
692
693      }
694
695      @Override
696      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
697        switch (hash) {
698        case -1867885268: /*subject*/ return new String[] {"Reference"};
699        case -1724546052: /*description*/ return new String[] {"string"};
700        case 1844097009: /*interactant*/ return new String[] {};
701        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
702        case -1306084975: /*effect*/ return new String[] {"CodeableConcept"};
703        case -1598467132: /*incidence*/ return new String[] {"CodeableConcept"};
704        case -1799980989: /*management*/ return new String[] {"CodeableConcept"};
705        default: return super.getTypesForProperty(hash, name);
706        }
707
708      }
709
710      @Override
711      public Base addChild(String name) throws FHIRException {
712        if (name.equals("subject")) {
713          return addSubject();
714        }
715        else if (name.equals("description")) {
716          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductInteraction.description");
717        }
718        else if (name.equals("interactant")) {
719          return addInteractant();
720        }
721        else if (name.equals("type")) {
722          this.type = new CodeableConcept();
723          return this.type;
724        }
725        else if (name.equals("effect")) {
726          this.effect = new CodeableConcept();
727          return this.effect;
728        }
729        else if (name.equals("incidence")) {
730          this.incidence = new CodeableConcept();
731          return this.incidence;
732        }
733        else if (name.equals("management")) {
734          this.management = new CodeableConcept();
735          return this.management;
736        }
737        else
738          return super.addChild(name);
739      }
740
741  public String fhirType() {
742    return "MedicinalProductInteraction";
743
744  }
745
746      public MedicinalProductInteraction copy() {
747        MedicinalProductInteraction dst = new MedicinalProductInteraction();
748        copyValues(dst);
749        if (subject != null) {
750          dst.subject = new ArrayList<Reference>();
751          for (Reference i : subject)
752            dst.subject.add(i.copy());
753        };
754        dst.description = description == null ? null : description.copy();
755        if (interactant != null) {
756          dst.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>();
757          for (MedicinalProductInteractionInteractantComponent i : interactant)
758            dst.interactant.add(i.copy());
759        };
760        dst.type = type == null ? null : type.copy();
761        dst.effect = effect == null ? null : effect.copy();
762        dst.incidence = incidence == null ? null : incidence.copy();
763        dst.management = management == null ? null : management.copy();
764        return dst;
765      }
766
767      protected MedicinalProductInteraction typedCopy() {
768        return copy();
769      }
770
771      @Override
772      public boolean equalsDeep(Base other_) {
773        if (!super.equalsDeep(other_))
774          return false;
775        if (!(other_ instanceof MedicinalProductInteraction))
776          return false;
777        MedicinalProductInteraction o = (MedicinalProductInteraction) other_;
778        return compareDeep(subject, o.subject, true) && compareDeep(description, o.description, true) && compareDeep(interactant, o.interactant, true)
779           && compareDeep(type, o.type, true) && compareDeep(effect, o.effect, true) && compareDeep(incidence, o.incidence, true)
780           && compareDeep(management, o.management, true);
781      }
782
783      @Override
784      public boolean equalsShallow(Base other_) {
785        if (!super.equalsShallow(other_))
786          return false;
787        if (!(other_ instanceof MedicinalProductInteraction))
788          return false;
789        MedicinalProductInteraction o = (MedicinalProductInteraction) other_;
790        return compareValues(description, o.description, true);
791      }
792
793      public boolean isEmpty() {
794        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, description, interactant
795          , type, effect, incidence, management);
796      }
797
798  @Override
799  public ResourceType getResourceType() {
800    return ResourceType.MedicinalProductInteraction;
801   }
802
803 /**
804   * Search parameter: <b>subject</b>
805   * <p>
806   * Description: <b>The medication for which this is an interaction</b><br>
807   * Type: <b>reference</b><br>
808   * Path: <b>MedicinalProductInteraction.subject</b><br>
809   * </p>
810   */
811  @SearchParamDefinition(name="subject", path="MedicinalProductInteraction.subject", description="The medication for which this is an interaction", type="reference", target={Medication.class, MedicinalProduct.class, Substance.class } )
812  public static final String SP_SUBJECT = "subject";
813 /**
814   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
815   * <p>
816   * Description: <b>The medication for which this is an interaction</b><br>
817   * Type: <b>reference</b><br>
818   * Path: <b>MedicinalProductInteraction.subject</b><br>
819   * </p>
820   */
821  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
822
823/**
824   * Constant for fluent queries to be used to add include statements. Specifies
825   * the path value of "<b>MedicinalProductInteraction:subject</b>".
826   */
827  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductInteraction:subject").toLocked();
828
829
830}
831