001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045
046/**
047 * Detailed definition of a medicinal product, typically for uses other than
048 * direct patient care (e.g. regulatory use).
049 */
050@ResourceDef(name = "MedicinalProduct", profile = "http://hl7.org/fhir/StructureDefinition/MedicinalProduct")
051public class MedicinalProduct extends DomainResource {
052
053  @Block()
054  public static class MedicinalProductNameComponent extends BackboneElement implements IBaseBackboneElement {
055    /**
056     * The full product name.
057     */
058    @Child(name = "productName", type = {
059        StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
060    @Description(shortDefinition = "The full product name", formalDefinition = "The full product name.")
061    protected StringType productName;
062
063    /**
064     * Coding words or phrases of the name.
065     */
066    @Child(name = "namePart", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
067    @Description(shortDefinition = "Coding words or phrases of the name", formalDefinition = "Coding words or phrases of the name.")
068    protected List<MedicinalProductNameNamePartComponent> namePart;
069
070    /**
071     * Country where the name applies.
072     */
073    @Child(name = "countryLanguage", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
074    @Description(shortDefinition = "Country where the name applies", formalDefinition = "Country where the name applies.")
075    protected List<MedicinalProductNameCountryLanguageComponent> countryLanguage;
076
077    private static final long serialVersionUID = -2005005917L;
078
079    /**
080     * Constructor
081     */
082    public MedicinalProductNameComponent() {
083      super();
084    }
085
086    /**
087     * Constructor
088     */
089    public MedicinalProductNameComponent(StringType productName) {
090      super();
091      this.productName = productName;
092    }
093
094    /**
095     * @return {@link #productName} (The full product name.). This is the underlying
096     *         object with id, value and extensions. The accessor "getProductName"
097     *         gives direct access to the value
098     */
099    public StringType getProductNameElement() {
100      if (this.productName == null)
101        if (Configuration.errorOnAutoCreate())
102          throw new Error("Attempt to auto-create MedicinalProductNameComponent.productName");
103        else if (Configuration.doAutoCreate())
104          this.productName = new StringType(); // bb
105      return this.productName;
106    }
107
108    public boolean hasProductNameElement() {
109      return this.productName != null && !this.productName.isEmpty();
110    }
111
112    public boolean hasProductName() {
113      return this.productName != null && !this.productName.isEmpty();
114    }
115
116    /**
117     * @param value {@link #productName} (The full product name.). This is the
118     *              underlying object with id, value and extensions. The accessor
119     *              "getProductName" gives direct access to the value
120     */
121    public MedicinalProductNameComponent setProductNameElement(StringType value) {
122      this.productName = value;
123      return this;
124    }
125
126    /**
127     * @return The full product name.
128     */
129    public String getProductName() {
130      return this.productName == null ? null : this.productName.getValue();
131    }
132
133    /**
134     * @param value The full product name.
135     */
136    public MedicinalProductNameComponent setProductName(String value) {
137      if (this.productName == null)
138        this.productName = new StringType();
139      this.productName.setValue(value);
140      return this;
141    }
142
143    /**
144     * @return {@link #namePart} (Coding words or phrases of the name.)
145     */
146    public List<MedicinalProductNameNamePartComponent> getNamePart() {
147      if (this.namePart == null)
148        this.namePart = new ArrayList<MedicinalProductNameNamePartComponent>();
149      return this.namePart;
150    }
151
152    /**
153     * @return Returns a reference to <code>this</code> for easy method chaining
154     */
155    public MedicinalProductNameComponent setNamePart(List<MedicinalProductNameNamePartComponent> theNamePart) {
156      this.namePart = theNamePart;
157      return this;
158    }
159
160    public boolean hasNamePart() {
161      if (this.namePart == null)
162        return false;
163      for (MedicinalProductNameNamePartComponent item : this.namePart)
164        if (!item.isEmpty())
165          return true;
166      return false;
167    }
168
169    public MedicinalProductNameNamePartComponent addNamePart() { // 3
170      MedicinalProductNameNamePartComponent t = new MedicinalProductNameNamePartComponent();
171      if (this.namePart == null)
172        this.namePart = new ArrayList<MedicinalProductNameNamePartComponent>();
173      this.namePart.add(t);
174      return t;
175    }
176
177    public MedicinalProductNameComponent addNamePart(MedicinalProductNameNamePartComponent t) { // 3
178      if (t == null)
179        return this;
180      if (this.namePart == null)
181        this.namePart = new ArrayList<MedicinalProductNameNamePartComponent>();
182      this.namePart.add(t);
183      return this;
184    }
185
186    /**
187     * @return The first repetition of repeating field {@link #namePart}, creating
188     *         it if it does not already exist
189     */
190    public MedicinalProductNameNamePartComponent getNamePartFirstRep() {
191      if (getNamePart().isEmpty()) {
192        addNamePart();
193      }
194      return getNamePart().get(0);
195    }
196
197    /**
198     * @return {@link #countryLanguage} (Country where the name applies.)
199     */
200    public List<MedicinalProductNameCountryLanguageComponent> getCountryLanguage() {
201      if (this.countryLanguage == null)
202        this.countryLanguage = new ArrayList<MedicinalProductNameCountryLanguageComponent>();
203      return this.countryLanguage;
204    }
205
206    /**
207     * @return Returns a reference to <code>this</code> for easy method chaining
208     */
209    public MedicinalProductNameComponent setCountryLanguage(
210        List<MedicinalProductNameCountryLanguageComponent> theCountryLanguage) {
211      this.countryLanguage = theCountryLanguage;
212      return this;
213    }
214
215    public boolean hasCountryLanguage() {
216      if (this.countryLanguage == null)
217        return false;
218      for (MedicinalProductNameCountryLanguageComponent item : this.countryLanguage)
219        if (!item.isEmpty())
220          return true;
221      return false;
222    }
223
224    public MedicinalProductNameCountryLanguageComponent addCountryLanguage() { // 3
225      MedicinalProductNameCountryLanguageComponent t = new MedicinalProductNameCountryLanguageComponent();
226      if (this.countryLanguage == null)
227        this.countryLanguage = new ArrayList<MedicinalProductNameCountryLanguageComponent>();
228      this.countryLanguage.add(t);
229      return t;
230    }
231
232    public MedicinalProductNameComponent addCountryLanguage(MedicinalProductNameCountryLanguageComponent t) { // 3
233      if (t == null)
234        return this;
235      if (this.countryLanguage == null)
236        this.countryLanguage = new ArrayList<MedicinalProductNameCountryLanguageComponent>();
237      this.countryLanguage.add(t);
238      return this;
239    }
240
241    /**
242     * @return The first repetition of repeating field {@link #countryLanguage},
243     *         creating it if it does not already exist
244     */
245    public MedicinalProductNameCountryLanguageComponent getCountryLanguageFirstRep() {
246      if (getCountryLanguage().isEmpty()) {
247        addCountryLanguage();
248      }
249      return getCountryLanguage().get(0);
250    }
251
252    protected void listChildren(List<Property> children) {
253      super.listChildren(children);
254      children.add(new Property("productName", "string", "The full product name.", 0, 1, productName));
255      children.add(new Property("namePart", "", "Coding words or phrases of the name.", 0, java.lang.Integer.MAX_VALUE,
256          namePart));
257      children.add(new Property("countryLanguage", "", "Country where the name applies.", 0,
258          java.lang.Integer.MAX_VALUE, countryLanguage));
259    }
260
261    @Override
262    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
263      switch (_hash) {
264      case -1491817446:
265        /* productName */ return new Property("productName", "string", "The full product name.", 0, 1, productName);
266      case 1840452894:
267        /* namePart */ return new Property("namePart", "", "Coding words or phrases of the name.", 0,
268            java.lang.Integer.MAX_VALUE, namePart);
269      case -141141746:
270        /* countryLanguage */ return new Property("countryLanguage", "", "Country where the name applies.", 0,
271            java.lang.Integer.MAX_VALUE, countryLanguage);
272      default:
273        return super.getNamedProperty(_hash, _name, _checkValid);
274      }
275
276    }
277
278    @Override
279    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
280      switch (hash) {
281      case -1491817446:
282        /* productName */ return this.productName == null ? new Base[0] : new Base[] { this.productName }; // StringType
283      case 1840452894:
284        /* namePart */ return this.namePart == null ? new Base[0]
285            : this.namePart.toArray(new Base[this.namePart.size()]); // MedicinalProductNameNamePartComponent
286      case -141141746:
287        /* countryLanguage */ return this.countryLanguage == null ? new Base[0]
288            : this.countryLanguage.toArray(new Base[this.countryLanguage.size()]); // MedicinalProductNameCountryLanguageComponent
289      default:
290        return super.getProperty(hash, name, checkValid);
291      }
292
293    }
294
295    @Override
296    public Base setProperty(int hash, String name, Base value) throws FHIRException {
297      switch (hash) {
298      case -1491817446: // productName
299        this.productName = castToString(value); // StringType
300        return value;
301      case 1840452894: // namePart
302        this.getNamePart().add((MedicinalProductNameNamePartComponent) value); // MedicinalProductNameNamePartComponent
303        return value;
304      case -141141746: // countryLanguage
305        this.getCountryLanguage().add((MedicinalProductNameCountryLanguageComponent) value); // MedicinalProductNameCountryLanguageComponent
306        return value;
307      default:
308        return super.setProperty(hash, name, value);
309      }
310
311    }
312
313    @Override
314    public Base setProperty(String name, Base value) throws FHIRException {
315      if (name.equals("productName")) {
316        this.productName = castToString(value); // StringType
317      } else if (name.equals("namePart")) {
318        this.getNamePart().add((MedicinalProductNameNamePartComponent) value);
319      } else if (name.equals("countryLanguage")) {
320        this.getCountryLanguage().add((MedicinalProductNameCountryLanguageComponent) value);
321      } else
322        return super.setProperty(name, value);
323      return value;
324    }
325
326  @Override
327  public void removeChild(String name, Base value) throws FHIRException {
328      if (name.equals("productName")) {
329        this.productName = null;
330      } else if (name.equals("namePart")) {
331        this.getNamePart().remove((MedicinalProductNameNamePartComponent) value);
332      } else if (name.equals("countryLanguage")) {
333        this.getCountryLanguage().remove((MedicinalProductNameCountryLanguageComponent) value);
334      } else
335        super.removeChild(name, value);
336      
337    }
338
339    @Override
340    public Base makeProperty(int hash, String name) throws FHIRException {
341      switch (hash) {
342      case -1491817446:
343        return getProductNameElement();
344      case 1840452894:
345        return addNamePart();
346      case -141141746:
347        return addCountryLanguage();
348      default:
349        return super.makeProperty(hash, name);
350      }
351
352    }
353
354    @Override
355    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
356      switch (hash) {
357      case -1491817446:
358        /* productName */ return new String[] { "string" };
359      case 1840452894:
360        /* namePart */ return new String[] {};
361      case -141141746:
362        /* countryLanguage */ return new String[] {};
363      default:
364        return super.getTypesForProperty(hash, name);
365      }
366
367    }
368
369    @Override
370    public Base addChild(String name) throws FHIRException {
371      if (name.equals("productName")) {
372        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.productName");
373      } else if (name.equals("namePart")) {
374        return addNamePart();
375      } else if (name.equals("countryLanguage")) {
376        return addCountryLanguage();
377      } else
378        return super.addChild(name);
379    }
380
381    public MedicinalProductNameComponent copy() {
382      MedicinalProductNameComponent dst = new MedicinalProductNameComponent();
383      copyValues(dst);
384      return dst;
385    }
386
387    public void copyValues(MedicinalProductNameComponent dst) {
388      super.copyValues(dst);
389      dst.productName = productName == null ? null : productName.copy();
390      if (namePart != null) {
391        dst.namePart = new ArrayList<MedicinalProductNameNamePartComponent>();
392        for (MedicinalProductNameNamePartComponent i : namePart)
393          dst.namePart.add(i.copy());
394      }
395      ;
396      if (countryLanguage != null) {
397        dst.countryLanguage = new ArrayList<MedicinalProductNameCountryLanguageComponent>();
398        for (MedicinalProductNameCountryLanguageComponent i : countryLanguage)
399          dst.countryLanguage.add(i.copy());
400      }
401      ;
402    }
403
404    @Override
405    public boolean equalsDeep(Base other_) {
406      if (!super.equalsDeep(other_))
407        return false;
408      if (!(other_ instanceof MedicinalProductNameComponent))
409        return false;
410      MedicinalProductNameComponent o = (MedicinalProductNameComponent) other_;
411      return compareDeep(productName, o.productName, true) && compareDeep(namePart, o.namePart, true)
412          && compareDeep(countryLanguage, o.countryLanguage, true);
413    }
414
415    @Override
416    public boolean equalsShallow(Base other_) {
417      if (!super.equalsShallow(other_))
418        return false;
419      if (!(other_ instanceof MedicinalProductNameComponent))
420        return false;
421      MedicinalProductNameComponent o = (MedicinalProductNameComponent) other_;
422      return compareValues(productName, o.productName, true);
423    }
424
425    public boolean isEmpty() {
426      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productName, namePart, countryLanguage);
427    }
428
429    public String fhirType() {
430      return "MedicinalProduct.name";
431
432    }
433
434  }
435
436  @Block()
437  public static class MedicinalProductNameNamePartComponent extends BackboneElement implements IBaseBackboneElement {
438    /**
439     * A fragment of a product name.
440     */
441    @Child(name = "part", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
442    @Description(shortDefinition = "A fragment of a product name", formalDefinition = "A fragment of a product name.")
443    protected StringType part;
444
445    /**
446     * Idenifying type for this part of the name (e.g. strength part).
447     */
448    @Child(name = "type", type = { Coding.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
449    @Description(shortDefinition = "Idenifying type for this part of the name (e.g. strength part)", formalDefinition = "Idenifying type for this part of the name (e.g. strength part).")
450    protected Coding type;
451
452    private static final long serialVersionUID = -301533796L;
453
454    /**
455     * Constructor
456     */
457    public MedicinalProductNameNamePartComponent() {
458      super();
459    }
460
461    /**
462     * Constructor
463     */
464    public MedicinalProductNameNamePartComponent(StringType part, Coding type) {
465      super();
466      this.part = part;
467      this.type = type;
468    }
469
470    /**
471     * @return {@link #part} (A fragment of a product name.). This is the underlying
472     *         object with id, value and extensions. The accessor "getPart" gives
473     *         direct access to the value
474     */
475    public StringType getPartElement() {
476      if (this.part == null)
477        if (Configuration.errorOnAutoCreate())
478          throw new Error("Attempt to auto-create MedicinalProductNameNamePartComponent.part");
479        else if (Configuration.doAutoCreate())
480          this.part = new StringType(); // bb
481      return this.part;
482    }
483
484    public boolean hasPartElement() {
485      return this.part != null && !this.part.isEmpty();
486    }
487
488    public boolean hasPart() {
489      return this.part != null && !this.part.isEmpty();
490    }
491
492    /**
493     * @param value {@link #part} (A fragment of a product name.). This is the
494     *              underlying object with id, value and extensions. The accessor
495     *              "getPart" gives direct access to the value
496     */
497    public MedicinalProductNameNamePartComponent setPartElement(StringType value) {
498      this.part = value;
499      return this;
500    }
501
502    /**
503     * @return A fragment of a product name.
504     */
505    public String getPart() {
506      return this.part == null ? null : this.part.getValue();
507    }
508
509    /**
510     * @param value A fragment of a product name.
511     */
512    public MedicinalProductNameNamePartComponent setPart(String value) {
513      if (this.part == null)
514        this.part = new StringType();
515      this.part.setValue(value);
516      return this;
517    }
518
519    /**
520     * @return {@link #type} (Idenifying type for this part of the name (e.g.
521     *         strength part).)
522     */
523    public Coding getType() {
524      if (this.type == null)
525        if (Configuration.errorOnAutoCreate())
526          throw new Error("Attempt to auto-create MedicinalProductNameNamePartComponent.type");
527        else if (Configuration.doAutoCreate())
528          this.type = new Coding(); // cc
529      return this.type;
530    }
531
532    public boolean hasType() {
533      return this.type != null && !this.type.isEmpty();
534    }
535
536    /**
537     * @param value {@link #type} (Idenifying type for this part of the name (e.g.
538     *              strength part).)
539     */
540    public MedicinalProductNameNamePartComponent setType(Coding value) {
541      this.type = value;
542      return this;
543    }
544
545    protected void listChildren(List<Property> children) {
546      super.listChildren(children);
547      children.add(new Property("part", "string", "A fragment of a product name.", 0, 1, part));
548      children.add(new Property("type", "Coding", "Idenifying type for this part of the name (e.g. strength part).", 0,
549          1, type));
550    }
551
552    @Override
553    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
554      switch (_hash) {
555      case 3433459:
556        /* part */ return new Property("part", "string", "A fragment of a product name.", 0, 1, part);
557      case 3575610:
558        /* type */ return new Property("type", "Coding",
559            "Idenifying type for this part of the name (e.g. strength part).", 0, 1, type);
560      default:
561        return super.getNamedProperty(_hash, _name, _checkValid);
562      }
563
564    }
565
566    @Override
567    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
568      switch (hash) {
569      case 3433459:
570        /* part */ return this.part == null ? new Base[0] : new Base[] { this.part }; // StringType
571      case 3575610:
572        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Coding
573      default:
574        return super.getProperty(hash, name, checkValid);
575      }
576
577    }
578
579    @Override
580    public Base setProperty(int hash, String name, Base value) throws FHIRException {
581      switch (hash) {
582      case 3433459: // part
583        this.part = castToString(value); // StringType
584        return value;
585      case 3575610: // type
586        this.type = castToCoding(value); // Coding
587        return value;
588      default:
589        return super.setProperty(hash, name, value);
590      }
591
592    }
593
594    @Override
595    public Base setProperty(String name, Base value) throws FHIRException {
596      if (name.equals("part")) {
597        this.part = castToString(value); // StringType
598      } else if (name.equals("type")) {
599        this.type = castToCoding(value); // Coding
600      } else
601        return super.setProperty(name, value);
602      return value;
603    }
604
605  @Override
606  public void removeChild(String name, Base value) throws FHIRException {
607      if (name.equals("part")) {
608        this.part = null;
609      } else if (name.equals("type")) {
610        this.type = null;
611      } else
612        super.removeChild(name, value);
613      
614    }
615
616    @Override
617    public Base makeProperty(int hash, String name) throws FHIRException {
618      switch (hash) {
619      case 3433459:
620        return getPartElement();
621      case 3575610:
622        return getType();
623      default:
624        return super.makeProperty(hash, name);
625      }
626
627    }
628
629    @Override
630    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
631      switch (hash) {
632      case 3433459:
633        /* part */ return new String[] { "string" };
634      case 3575610:
635        /* type */ return new String[] { "Coding" };
636      default:
637        return super.getTypesForProperty(hash, name);
638      }
639
640    }
641
642    @Override
643    public Base addChild(String name) throws FHIRException {
644      if (name.equals("part")) {
645        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.part");
646      } else if (name.equals("type")) {
647        this.type = new Coding();
648        return this.type;
649      } else
650        return super.addChild(name);
651    }
652
653    public MedicinalProductNameNamePartComponent copy() {
654      MedicinalProductNameNamePartComponent dst = new MedicinalProductNameNamePartComponent();
655      copyValues(dst);
656      return dst;
657    }
658
659    public void copyValues(MedicinalProductNameNamePartComponent dst) {
660      super.copyValues(dst);
661      dst.part = part == null ? null : part.copy();
662      dst.type = type == null ? null : type.copy();
663    }
664
665    @Override
666    public boolean equalsDeep(Base other_) {
667      if (!super.equalsDeep(other_))
668        return false;
669      if (!(other_ instanceof MedicinalProductNameNamePartComponent))
670        return false;
671      MedicinalProductNameNamePartComponent o = (MedicinalProductNameNamePartComponent) other_;
672      return compareDeep(part, o.part, true) && compareDeep(type, o.type, true);
673    }
674
675    @Override
676    public boolean equalsShallow(Base other_) {
677      if (!super.equalsShallow(other_))
678        return false;
679      if (!(other_ instanceof MedicinalProductNameNamePartComponent))
680        return false;
681      MedicinalProductNameNamePartComponent o = (MedicinalProductNameNamePartComponent) other_;
682      return compareValues(part, o.part, true);
683    }
684
685    public boolean isEmpty() {
686      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(part, type);
687    }
688
689    public String fhirType() {
690      return "MedicinalProduct.name.namePart";
691
692    }
693
694  }
695
696  @Block()
697  public static class MedicinalProductNameCountryLanguageComponent extends BackboneElement
698      implements IBaseBackboneElement {
699    /**
700     * Country code for where this name applies.
701     */
702    @Child(name = "country", type = {
703        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
704    @Description(shortDefinition = "Country code for where this name applies", formalDefinition = "Country code for where this name applies.")
705    protected CodeableConcept country;
706
707    /**
708     * Jurisdiction code for where this name applies.
709     */
710    @Child(name = "jurisdiction", type = {
711        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
712    @Description(shortDefinition = "Jurisdiction code for where this name applies", formalDefinition = "Jurisdiction code for where this name applies.")
713    protected CodeableConcept jurisdiction;
714
715    /**
716     * Language code for this name.
717     */
718    @Child(name = "language", type = {
719        CodeableConcept.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
720    @Description(shortDefinition = "Language code for this name", formalDefinition = "Language code for this name.")
721    protected CodeableConcept language;
722
723    private static final long serialVersionUID = 1627157564L;
724
725    /**
726     * Constructor
727     */
728    public MedicinalProductNameCountryLanguageComponent() {
729      super();
730    }
731
732    /**
733     * Constructor
734     */
735    public MedicinalProductNameCountryLanguageComponent(CodeableConcept country, CodeableConcept language) {
736      super();
737      this.country = country;
738      this.language = language;
739    }
740
741    /**
742     * @return {@link #country} (Country code for where this name applies.)
743     */
744    public CodeableConcept getCountry() {
745      if (this.country == null)
746        if (Configuration.errorOnAutoCreate())
747          throw new Error("Attempt to auto-create MedicinalProductNameCountryLanguageComponent.country");
748        else if (Configuration.doAutoCreate())
749          this.country = new CodeableConcept(); // cc
750      return this.country;
751    }
752
753    public boolean hasCountry() {
754      return this.country != null && !this.country.isEmpty();
755    }
756
757    /**
758     * @param value {@link #country} (Country code for where this name applies.)
759     */
760    public MedicinalProductNameCountryLanguageComponent setCountry(CodeableConcept value) {
761      this.country = value;
762      return this;
763    }
764
765    /**
766     * @return {@link #jurisdiction} (Jurisdiction code for where this name
767     *         applies.)
768     */
769    public CodeableConcept getJurisdiction() {
770      if (this.jurisdiction == null)
771        if (Configuration.errorOnAutoCreate())
772          throw new Error("Attempt to auto-create MedicinalProductNameCountryLanguageComponent.jurisdiction");
773        else if (Configuration.doAutoCreate())
774          this.jurisdiction = new CodeableConcept(); // cc
775      return this.jurisdiction;
776    }
777
778    public boolean hasJurisdiction() {
779      return this.jurisdiction != null && !this.jurisdiction.isEmpty();
780    }
781
782    /**
783     * @param value {@link #jurisdiction} (Jurisdiction code for where this name
784     *              applies.)
785     */
786    public MedicinalProductNameCountryLanguageComponent setJurisdiction(CodeableConcept value) {
787      this.jurisdiction = value;
788      return this;
789    }
790
791    /**
792     * @return {@link #language} (Language code for this name.)
793     */
794    public CodeableConcept getLanguage() {
795      if (this.language == null)
796        if (Configuration.errorOnAutoCreate())
797          throw new Error("Attempt to auto-create MedicinalProductNameCountryLanguageComponent.language");
798        else if (Configuration.doAutoCreate())
799          this.language = new CodeableConcept(); // cc
800      return this.language;
801    }
802
803    public boolean hasLanguage() {
804      return this.language != null && !this.language.isEmpty();
805    }
806
807    /**
808     * @param value {@link #language} (Language code for this name.)
809     */
810    public MedicinalProductNameCountryLanguageComponent setLanguage(CodeableConcept value) {
811      this.language = value;
812      return this;
813    }
814
815    protected void listChildren(List<Property> children) {
816      super.listChildren(children);
817      children
818          .add(new Property("country", "CodeableConcept", "Country code for where this name applies.", 0, 1, country));
819      children.add(new Property("jurisdiction", "CodeableConcept", "Jurisdiction code for where this name applies.", 0,
820          1, jurisdiction));
821      children.add(new Property("language", "CodeableConcept", "Language code for this name.", 0, 1, language));
822    }
823
824    @Override
825    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
826      switch (_hash) {
827      case 957831062:
828        /* country */ return new Property("country", "CodeableConcept", "Country code for where this name applies.", 0,
829            1, country);
830      case -507075711:
831        /* jurisdiction */ return new Property("jurisdiction", "CodeableConcept",
832            "Jurisdiction code for where this name applies.", 0, 1, jurisdiction);
833      case -1613589672:
834        /* language */ return new Property("language", "CodeableConcept", "Language code for this name.", 0, 1,
835            language);
836      default:
837        return super.getNamedProperty(_hash, _name, _checkValid);
838      }
839
840    }
841
842    @Override
843    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
844      switch (hash) {
845      case 957831062:
846        /* country */ return this.country == null ? new Base[0] : new Base[] { this.country }; // CodeableConcept
847      case -507075711:
848        /* jurisdiction */ return this.jurisdiction == null ? new Base[0] : new Base[] { this.jurisdiction }; // CodeableConcept
849      case -1613589672:
850        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
851      default:
852        return super.getProperty(hash, name, checkValid);
853      }
854
855    }
856
857    @Override
858    public Base setProperty(int hash, String name, Base value) throws FHIRException {
859      switch (hash) {
860      case 957831062: // country
861        this.country = castToCodeableConcept(value); // CodeableConcept
862        return value;
863      case -507075711: // jurisdiction
864        this.jurisdiction = castToCodeableConcept(value); // CodeableConcept
865        return value;
866      case -1613589672: // language
867        this.language = castToCodeableConcept(value); // CodeableConcept
868        return value;
869      default:
870        return super.setProperty(hash, name, value);
871      }
872
873    }
874
875    @Override
876    public Base setProperty(String name, Base value) throws FHIRException {
877      if (name.equals("country")) {
878        this.country = castToCodeableConcept(value); // CodeableConcept
879      } else if (name.equals("jurisdiction")) {
880        this.jurisdiction = castToCodeableConcept(value); // CodeableConcept
881      } else if (name.equals("language")) {
882        this.language = castToCodeableConcept(value); // CodeableConcept
883      } else
884        return super.setProperty(name, value);
885      return value;
886    }
887
888  @Override
889  public void removeChild(String name, Base value) throws FHIRException {
890      if (name.equals("country")) {
891        this.country = null;
892      } else if (name.equals("jurisdiction")) {
893        this.jurisdiction = null;
894      } else if (name.equals("language")) {
895        this.language = null;
896      } else
897        super.removeChild(name, value);
898      
899    }
900
901    @Override
902    public Base makeProperty(int hash, String name) throws FHIRException {
903      switch (hash) {
904      case 957831062:
905        return getCountry();
906      case -507075711:
907        return getJurisdiction();
908      case -1613589672:
909        return getLanguage();
910      default:
911        return super.makeProperty(hash, name);
912      }
913
914    }
915
916    @Override
917    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
918      switch (hash) {
919      case 957831062:
920        /* country */ return new String[] { "CodeableConcept" };
921      case -507075711:
922        /* jurisdiction */ return new String[] { "CodeableConcept" };
923      case -1613589672:
924        /* language */ return new String[] { "CodeableConcept" };
925      default:
926        return super.getTypesForProperty(hash, name);
927      }
928
929    }
930
931    @Override
932    public Base addChild(String name) throws FHIRException {
933      if (name.equals("country")) {
934        this.country = new CodeableConcept();
935        return this.country;
936      } else if (name.equals("jurisdiction")) {
937        this.jurisdiction = new CodeableConcept();
938        return this.jurisdiction;
939      } else if (name.equals("language")) {
940        this.language = new CodeableConcept();
941        return this.language;
942      } else
943        return super.addChild(name);
944    }
945
946    public MedicinalProductNameCountryLanguageComponent copy() {
947      MedicinalProductNameCountryLanguageComponent dst = new MedicinalProductNameCountryLanguageComponent();
948      copyValues(dst);
949      return dst;
950    }
951
952    public void copyValues(MedicinalProductNameCountryLanguageComponent dst) {
953      super.copyValues(dst);
954      dst.country = country == null ? null : country.copy();
955      dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
956      dst.language = language == null ? null : language.copy();
957    }
958
959    @Override
960    public boolean equalsDeep(Base other_) {
961      if (!super.equalsDeep(other_))
962        return false;
963      if (!(other_ instanceof MedicinalProductNameCountryLanguageComponent))
964        return false;
965      MedicinalProductNameCountryLanguageComponent o = (MedicinalProductNameCountryLanguageComponent) other_;
966      return compareDeep(country, o.country, true) && compareDeep(jurisdiction, o.jurisdiction, true)
967          && compareDeep(language, o.language, true);
968    }
969
970    @Override
971    public boolean equalsShallow(Base other_) {
972      if (!super.equalsShallow(other_))
973        return false;
974      if (!(other_ instanceof MedicinalProductNameCountryLanguageComponent))
975        return false;
976      MedicinalProductNameCountryLanguageComponent o = (MedicinalProductNameCountryLanguageComponent) other_;
977      return true;
978    }
979
980    public boolean isEmpty() {
981      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(country, jurisdiction, language);
982    }
983
984    public String fhirType() {
985      return "MedicinalProduct.name.countryLanguage";
986
987    }
988
989  }
990
991  @Block()
992  public static class MedicinalProductManufacturingBusinessOperationComponent extends BackboneElement
993      implements IBaseBackboneElement {
994    /**
995     * The type of manufacturing operation.
996     */
997    @Child(name = "operationType", type = {
998        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
999    @Description(shortDefinition = "The type of manufacturing operation", formalDefinition = "The type of manufacturing operation.")
1000    protected CodeableConcept operationType;
1001
1002    /**
1003     * Regulatory authorization reference number.
1004     */
1005    @Child(name = "authorisationReferenceNumber", type = {
1006        Identifier.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1007    @Description(shortDefinition = "Regulatory authorization reference number", formalDefinition = "Regulatory authorization reference number.")
1008    protected Identifier authorisationReferenceNumber;
1009
1010    /**
1011     * Regulatory authorization date.
1012     */
1013    @Child(name = "effectiveDate", type = {
1014        DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1015    @Description(shortDefinition = "Regulatory authorization date", formalDefinition = "Regulatory authorization date.")
1016    protected DateTimeType effectiveDate;
1017
1018    /**
1019     * To indicate if this proces is commercially confidential.
1020     */
1021    @Child(name = "confidentialityIndicator", type = {
1022        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1023    @Description(shortDefinition = "To indicate if this proces is commercially confidential", formalDefinition = "To indicate if this proces is commercially confidential.")
1024    protected CodeableConcept confidentialityIndicator;
1025
1026    /**
1027     * The manufacturer or establishment associated with the process.
1028     */
1029    @Child(name = "manufacturer", type = {
1030        Organization.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1031    @Description(shortDefinition = "The manufacturer or establishment associated with the process", formalDefinition = "The manufacturer or establishment associated with the process.")
1032    protected List<Reference> manufacturer;
1033    /**
1034     * The actual objects that are the target of the reference (The manufacturer or
1035     * establishment associated with the process.)
1036     */
1037    protected List<Organization> manufacturerTarget;
1038
1039    /**
1040     * A regulator which oversees the operation.
1041     */
1042    @Child(name = "regulator", type = {
1043        Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1044    @Description(shortDefinition = "A regulator which oversees the operation", formalDefinition = "A regulator which oversees the operation.")
1045    protected Reference regulator;
1046
1047    /**
1048     * The actual object that is the target of the reference (A regulator which
1049     * oversees the operation.)
1050     */
1051    protected Organization regulatorTarget;
1052
1053    private static final long serialVersionUID = 1259822353L;
1054
1055    /**
1056     * Constructor
1057     */
1058    public MedicinalProductManufacturingBusinessOperationComponent() {
1059      super();
1060    }
1061
1062    /**
1063     * @return {@link #operationType} (The type of manufacturing operation.)
1064     */
1065    public CodeableConcept getOperationType() {
1066      if (this.operationType == null)
1067        if (Configuration.errorOnAutoCreate())
1068          throw new Error(
1069              "Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.operationType");
1070        else if (Configuration.doAutoCreate())
1071          this.operationType = new CodeableConcept(); // cc
1072      return this.operationType;
1073    }
1074
1075    public boolean hasOperationType() {
1076      return this.operationType != null && !this.operationType.isEmpty();
1077    }
1078
1079    /**
1080     * @param value {@link #operationType} (The type of manufacturing operation.)
1081     */
1082    public MedicinalProductManufacturingBusinessOperationComponent setOperationType(CodeableConcept value) {
1083      this.operationType = value;
1084      return this;
1085    }
1086
1087    /**
1088     * @return {@link #authorisationReferenceNumber} (Regulatory authorization
1089     *         reference number.)
1090     */
1091    public Identifier getAuthorisationReferenceNumber() {
1092      if (this.authorisationReferenceNumber == null)
1093        if (Configuration.errorOnAutoCreate())
1094          throw new Error(
1095              "Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.authorisationReferenceNumber");
1096        else if (Configuration.doAutoCreate())
1097          this.authorisationReferenceNumber = new Identifier(); // cc
1098      return this.authorisationReferenceNumber;
1099    }
1100
1101    public boolean hasAuthorisationReferenceNumber() {
1102      return this.authorisationReferenceNumber != null && !this.authorisationReferenceNumber.isEmpty();
1103    }
1104
1105    /**
1106     * @param value {@link #authorisationReferenceNumber} (Regulatory authorization
1107     *              reference number.)
1108     */
1109    public MedicinalProductManufacturingBusinessOperationComponent setAuthorisationReferenceNumber(Identifier value) {
1110      this.authorisationReferenceNumber = value;
1111      return this;
1112    }
1113
1114    /**
1115     * @return {@link #effectiveDate} (Regulatory authorization date.). This is the
1116     *         underlying object with id, value and extensions. The accessor
1117     *         "getEffectiveDate" gives direct access to the value
1118     */
1119    public DateTimeType getEffectiveDateElement() {
1120      if (this.effectiveDate == null)
1121        if (Configuration.errorOnAutoCreate())
1122          throw new Error(
1123              "Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.effectiveDate");
1124        else if (Configuration.doAutoCreate())
1125          this.effectiveDate = new DateTimeType(); // bb
1126      return this.effectiveDate;
1127    }
1128
1129    public boolean hasEffectiveDateElement() {
1130      return this.effectiveDate != null && !this.effectiveDate.isEmpty();
1131    }
1132
1133    public boolean hasEffectiveDate() {
1134      return this.effectiveDate != null && !this.effectiveDate.isEmpty();
1135    }
1136
1137    /**
1138     * @param value {@link #effectiveDate} (Regulatory authorization date.). This is
1139     *              the underlying object with id, value and extensions. The
1140     *              accessor "getEffectiveDate" gives direct access to the value
1141     */
1142    public MedicinalProductManufacturingBusinessOperationComponent setEffectiveDateElement(DateTimeType value) {
1143      this.effectiveDate = value;
1144      return this;
1145    }
1146
1147    /**
1148     * @return Regulatory authorization date.
1149     */
1150    public Date getEffectiveDate() {
1151      return this.effectiveDate == null ? null : this.effectiveDate.getValue();
1152    }
1153
1154    /**
1155     * @param value Regulatory authorization date.
1156     */
1157    public MedicinalProductManufacturingBusinessOperationComponent setEffectiveDate(Date value) {
1158      if (value == null)
1159        this.effectiveDate = null;
1160      else {
1161        if (this.effectiveDate == null)
1162          this.effectiveDate = new DateTimeType();
1163        this.effectiveDate.setValue(value);
1164      }
1165      return this;
1166    }
1167
1168    /**
1169     * @return {@link #confidentialityIndicator} (To indicate if this proces is
1170     *         commercially confidential.)
1171     */
1172    public CodeableConcept getConfidentialityIndicator() {
1173      if (this.confidentialityIndicator == null)
1174        if (Configuration.errorOnAutoCreate())
1175          throw new Error(
1176              "Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.confidentialityIndicator");
1177        else if (Configuration.doAutoCreate())
1178          this.confidentialityIndicator = new CodeableConcept(); // cc
1179      return this.confidentialityIndicator;
1180    }
1181
1182    public boolean hasConfidentialityIndicator() {
1183      return this.confidentialityIndicator != null && !this.confidentialityIndicator.isEmpty();
1184    }
1185
1186    /**
1187     * @param value {@link #confidentialityIndicator} (To indicate if this proces is
1188     *              commercially confidential.)
1189     */
1190    public MedicinalProductManufacturingBusinessOperationComponent setConfidentialityIndicator(CodeableConcept value) {
1191      this.confidentialityIndicator = value;
1192      return this;
1193    }
1194
1195    /**
1196     * @return {@link #manufacturer} (The manufacturer or establishment associated
1197     *         with the process.)
1198     */
1199    public List<Reference> getManufacturer() {
1200      if (this.manufacturer == null)
1201        this.manufacturer = new ArrayList<Reference>();
1202      return this.manufacturer;
1203    }
1204
1205    /**
1206     * @return Returns a reference to <code>this</code> for easy method chaining
1207     */
1208    public MedicinalProductManufacturingBusinessOperationComponent setManufacturer(List<Reference> theManufacturer) {
1209      this.manufacturer = theManufacturer;
1210      return this;
1211    }
1212
1213    public boolean hasManufacturer() {
1214      if (this.manufacturer == null)
1215        return false;
1216      for (Reference item : this.manufacturer)
1217        if (!item.isEmpty())
1218          return true;
1219      return false;
1220    }
1221
1222    public Reference addManufacturer() { // 3
1223      Reference t = new Reference();
1224      if (this.manufacturer == null)
1225        this.manufacturer = new ArrayList<Reference>();
1226      this.manufacturer.add(t);
1227      return t;
1228    }
1229
1230    public MedicinalProductManufacturingBusinessOperationComponent addManufacturer(Reference t) { // 3
1231      if (t == null)
1232        return this;
1233      if (this.manufacturer == null)
1234        this.manufacturer = new ArrayList<Reference>();
1235      this.manufacturer.add(t);
1236      return this;
1237    }
1238
1239    /**
1240     * @return The first repetition of repeating field {@link #manufacturer},
1241     *         creating it if it does not already exist
1242     */
1243    public Reference getManufacturerFirstRep() {
1244      if (getManufacturer().isEmpty()) {
1245        addManufacturer();
1246      }
1247      return getManufacturer().get(0);
1248    }
1249
1250    /**
1251     * @return {@link #regulator} (A regulator which oversees the operation.)
1252     */
1253    public Reference getRegulator() {
1254      if (this.regulator == null)
1255        if (Configuration.errorOnAutoCreate())
1256          throw new Error("Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.regulator");
1257        else if (Configuration.doAutoCreate())
1258          this.regulator = new Reference(); // cc
1259      return this.regulator;
1260    }
1261
1262    public boolean hasRegulator() {
1263      return this.regulator != null && !this.regulator.isEmpty();
1264    }
1265
1266    /**
1267     * @param value {@link #regulator} (A regulator which oversees the operation.)
1268     */
1269    public MedicinalProductManufacturingBusinessOperationComponent setRegulator(Reference value) {
1270      this.regulator = value;
1271      return this;
1272    }
1273
1274    /**
1275     * @return {@link #regulator} The actual object that is the target of the
1276     *         reference. The reference library doesn't populate this, but you can
1277     *         use it to hold the resource if you resolve it. (A regulator which
1278     *         oversees the operation.)
1279     */
1280    public Organization getRegulatorTarget() {
1281      if (this.regulatorTarget == null)
1282        if (Configuration.errorOnAutoCreate())
1283          throw new Error("Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.regulator");
1284        else if (Configuration.doAutoCreate())
1285          this.regulatorTarget = new Organization(); // aa
1286      return this.regulatorTarget;
1287    }
1288
1289    /**
1290     * @param value {@link #regulator} The actual object that is the target of the
1291     *              reference. The reference library doesn't use these, but you can
1292     *              use it to hold the resource if you resolve it. (A regulator
1293     *              which oversees the operation.)
1294     */
1295    public MedicinalProductManufacturingBusinessOperationComponent setRegulatorTarget(Organization value) {
1296      this.regulatorTarget = value;
1297      return this;
1298    }
1299
1300    protected void listChildren(List<Property> children) {
1301      super.listChildren(children);
1302      children.add(new Property("operationType", "CodeableConcept", "The type of manufacturing operation.", 0, 1,
1303          operationType));
1304      children.add(new Property("authorisationReferenceNumber", "Identifier",
1305          "Regulatory authorization reference number.", 0, 1, authorisationReferenceNumber));
1306      children.add(new Property("effectiveDate", "dateTime", "Regulatory authorization date.", 0, 1, effectiveDate));
1307      children.add(new Property("confidentialityIndicator", "CodeableConcept",
1308          "To indicate if this proces is commercially confidential.", 0, 1, confidentialityIndicator));
1309      children.add(new Property("manufacturer", "Reference(Organization)",
1310          "The manufacturer or establishment associated with the process.", 0, java.lang.Integer.MAX_VALUE,
1311          manufacturer));
1312      children.add(new Property("regulator", "Reference(Organization)", "A regulator which oversees the operation.", 0,
1313          1, regulator));
1314    }
1315
1316    @Override
1317    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1318      switch (_hash) {
1319      case 91999553:
1320        /* operationType */ return new Property("operationType", "CodeableConcept",
1321            "The type of manufacturing operation.", 0, 1, operationType);
1322      case -1940839884:
1323        /* authorisationReferenceNumber */ return new Property("authorisationReferenceNumber", "Identifier",
1324            "Regulatory authorization reference number.", 0, 1, authorisationReferenceNumber);
1325      case -930389515:
1326        /* effectiveDate */ return new Property("effectiveDate", "dateTime", "Regulatory authorization date.", 0, 1,
1327            effectiveDate);
1328      case -1449404791:
1329        /* confidentialityIndicator */ return new Property("confidentialityIndicator", "CodeableConcept",
1330            "To indicate if this proces is commercially confidential.", 0, 1, confidentialityIndicator);
1331      case -1969347631:
1332        /* manufacturer */ return new Property("manufacturer", "Reference(Organization)",
1333            "The manufacturer or establishment associated with the process.", 0, java.lang.Integer.MAX_VALUE,
1334            manufacturer);
1335      case 414760449:
1336        /* regulator */ return new Property("regulator", "Reference(Organization)",
1337            "A regulator which oversees the operation.", 0, 1, regulator);
1338      default:
1339        return super.getNamedProperty(_hash, _name, _checkValid);
1340      }
1341
1342    }
1343
1344    @Override
1345    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1346      switch (hash) {
1347      case 91999553:
1348        /* operationType */ return this.operationType == null ? new Base[0] : new Base[] { this.operationType }; // CodeableConcept
1349      case -1940839884:
1350        /* authorisationReferenceNumber */ return this.authorisationReferenceNumber == null ? new Base[0]
1351            : new Base[] { this.authorisationReferenceNumber }; // Identifier
1352      case -930389515:
1353        /* effectiveDate */ return this.effectiveDate == null ? new Base[0] : new Base[] { this.effectiveDate }; // DateTimeType
1354      case -1449404791:
1355        /* confidentialityIndicator */ return this.confidentialityIndicator == null ? new Base[0]
1356            : new Base[] { this.confidentialityIndicator }; // CodeableConcept
1357      case -1969347631:
1358        /* manufacturer */ return this.manufacturer == null ? new Base[0]
1359            : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
1360      case 414760449:
1361        /* regulator */ return this.regulator == null ? new Base[0] : new Base[] { this.regulator }; // Reference
1362      default:
1363        return super.getProperty(hash, name, checkValid);
1364      }
1365
1366    }
1367
1368    @Override
1369    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1370      switch (hash) {
1371      case 91999553: // operationType
1372        this.operationType = castToCodeableConcept(value); // CodeableConcept
1373        return value;
1374      case -1940839884: // authorisationReferenceNumber
1375        this.authorisationReferenceNumber = castToIdentifier(value); // Identifier
1376        return value;
1377      case -930389515: // effectiveDate
1378        this.effectiveDate = castToDateTime(value); // DateTimeType
1379        return value;
1380      case -1449404791: // confidentialityIndicator
1381        this.confidentialityIndicator = castToCodeableConcept(value); // CodeableConcept
1382        return value;
1383      case -1969347631: // manufacturer
1384        this.getManufacturer().add(castToReference(value)); // Reference
1385        return value;
1386      case 414760449: // regulator
1387        this.regulator = castToReference(value); // Reference
1388        return value;
1389      default:
1390        return super.setProperty(hash, name, value);
1391      }
1392
1393    }
1394
1395    @Override
1396    public Base setProperty(String name, Base value) throws FHIRException {
1397      if (name.equals("operationType")) {
1398        this.operationType = castToCodeableConcept(value); // CodeableConcept
1399      } else if (name.equals("authorisationReferenceNumber")) {
1400        this.authorisationReferenceNumber = castToIdentifier(value); // Identifier
1401      } else if (name.equals("effectiveDate")) {
1402        this.effectiveDate = castToDateTime(value); // DateTimeType
1403      } else if (name.equals("confidentialityIndicator")) {
1404        this.confidentialityIndicator = castToCodeableConcept(value); // CodeableConcept
1405      } else if (name.equals("manufacturer")) {
1406        this.getManufacturer().add(castToReference(value));
1407      } else if (name.equals("regulator")) {
1408        this.regulator = castToReference(value); // Reference
1409      } else
1410        return super.setProperty(name, value);
1411      return value;
1412    }
1413
1414  @Override
1415  public void removeChild(String name, Base value) throws FHIRException {
1416      if (name.equals("operationType")) {
1417        this.operationType = null;
1418      } else if (name.equals("authorisationReferenceNumber")) {
1419        this.authorisationReferenceNumber = null;
1420      } else if (name.equals("effectiveDate")) {
1421        this.effectiveDate = null;
1422      } else if (name.equals("confidentialityIndicator")) {
1423        this.confidentialityIndicator = null;
1424      } else if (name.equals("manufacturer")) {
1425        this.getManufacturer().remove(castToReference(value));
1426      } else if (name.equals("regulator")) {
1427        this.regulator = null;
1428      } else
1429        super.removeChild(name, value);
1430      
1431    }
1432
1433    @Override
1434    public Base makeProperty(int hash, String name) throws FHIRException {
1435      switch (hash) {
1436      case 91999553:
1437        return getOperationType();
1438      case -1940839884:
1439        return getAuthorisationReferenceNumber();
1440      case -930389515:
1441        return getEffectiveDateElement();
1442      case -1449404791:
1443        return getConfidentialityIndicator();
1444      case -1969347631:
1445        return addManufacturer();
1446      case 414760449:
1447        return getRegulator();
1448      default:
1449        return super.makeProperty(hash, name);
1450      }
1451
1452    }
1453
1454    @Override
1455    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1456      switch (hash) {
1457      case 91999553:
1458        /* operationType */ return new String[] { "CodeableConcept" };
1459      case -1940839884:
1460        /* authorisationReferenceNumber */ return new String[] { "Identifier" };
1461      case -930389515:
1462        /* effectiveDate */ return new String[] { "dateTime" };
1463      case -1449404791:
1464        /* confidentialityIndicator */ return new String[] { "CodeableConcept" };
1465      case -1969347631:
1466        /* manufacturer */ return new String[] { "Reference" };
1467      case 414760449:
1468        /* regulator */ return new String[] { "Reference" };
1469      default:
1470        return super.getTypesForProperty(hash, name);
1471      }
1472
1473    }
1474
1475    @Override
1476    public Base addChild(String name) throws FHIRException {
1477      if (name.equals("operationType")) {
1478        this.operationType = new CodeableConcept();
1479        return this.operationType;
1480      } else if (name.equals("authorisationReferenceNumber")) {
1481        this.authorisationReferenceNumber = new Identifier();
1482        return this.authorisationReferenceNumber;
1483      } else if (name.equals("effectiveDate")) {
1484        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.effectiveDate");
1485      } else if (name.equals("confidentialityIndicator")) {
1486        this.confidentialityIndicator = new CodeableConcept();
1487        return this.confidentialityIndicator;
1488      } else if (name.equals("manufacturer")) {
1489        return addManufacturer();
1490      } else if (name.equals("regulator")) {
1491        this.regulator = new Reference();
1492        return this.regulator;
1493      } else
1494        return super.addChild(name);
1495    }
1496
1497    public MedicinalProductManufacturingBusinessOperationComponent copy() {
1498      MedicinalProductManufacturingBusinessOperationComponent dst = new MedicinalProductManufacturingBusinessOperationComponent();
1499      copyValues(dst);
1500      return dst;
1501    }
1502
1503    public void copyValues(MedicinalProductManufacturingBusinessOperationComponent dst) {
1504      super.copyValues(dst);
1505      dst.operationType = operationType == null ? null : operationType.copy();
1506      dst.authorisationReferenceNumber = authorisationReferenceNumber == null ? null
1507          : authorisationReferenceNumber.copy();
1508      dst.effectiveDate = effectiveDate == null ? null : effectiveDate.copy();
1509      dst.confidentialityIndicator = confidentialityIndicator == null ? null : confidentialityIndicator.copy();
1510      if (manufacturer != null) {
1511        dst.manufacturer = new ArrayList<Reference>();
1512        for (Reference i : manufacturer)
1513          dst.manufacturer.add(i.copy());
1514      }
1515      ;
1516      dst.regulator = regulator == null ? null : regulator.copy();
1517    }
1518
1519    @Override
1520    public boolean equalsDeep(Base other_) {
1521      if (!super.equalsDeep(other_))
1522        return false;
1523      if (!(other_ instanceof MedicinalProductManufacturingBusinessOperationComponent))
1524        return false;
1525      MedicinalProductManufacturingBusinessOperationComponent o = (MedicinalProductManufacturingBusinessOperationComponent) other_;
1526      return compareDeep(operationType, o.operationType, true)
1527          && compareDeep(authorisationReferenceNumber, o.authorisationReferenceNumber, true)
1528          && compareDeep(effectiveDate, o.effectiveDate, true)
1529          && compareDeep(confidentialityIndicator, o.confidentialityIndicator, true)
1530          && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(regulator, o.regulator, true);
1531    }
1532
1533    @Override
1534    public boolean equalsShallow(Base other_) {
1535      if (!super.equalsShallow(other_))
1536        return false;
1537      if (!(other_ instanceof MedicinalProductManufacturingBusinessOperationComponent))
1538        return false;
1539      MedicinalProductManufacturingBusinessOperationComponent o = (MedicinalProductManufacturingBusinessOperationComponent) other_;
1540      return compareValues(effectiveDate, o.effectiveDate, true);
1541    }
1542
1543    public boolean isEmpty() {
1544      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(operationType, authorisationReferenceNumber,
1545          effectiveDate, confidentialityIndicator, manufacturer, regulator);
1546    }
1547
1548    public String fhirType() {
1549      return "MedicinalProduct.manufacturingBusinessOperation";
1550
1551    }
1552
1553  }
1554
1555  @Block()
1556  public static class MedicinalProductSpecialDesignationComponent extends BackboneElement
1557      implements IBaseBackboneElement {
1558    /**
1559     * Identifier for the designation, or procedure number.
1560     */
1561    @Child(name = "identifier", type = {
1562        Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1563    @Description(shortDefinition = "Identifier for the designation, or procedure number", formalDefinition = "Identifier for the designation, or procedure number.")
1564    protected List<Identifier> identifier;
1565
1566    /**
1567     * The type of special designation, e.g. orphan drug, minor use.
1568     */
1569    @Child(name = "type", type = {
1570        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1571    @Description(shortDefinition = "The type of special designation, e.g. orphan drug, minor use", formalDefinition = "The type of special designation, e.g. orphan drug, minor use.")
1572    protected CodeableConcept type;
1573
1574    /**
1575     * The intended use of the product, e.g. prevention, treatment.
1576     */
1577    @Child(name = "intendedUse", type = {
1578        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1579    @Description(shortDefinition = "The intended use of the product, e.g. prevention, treatment", formalDefinition = "The intended use of the product, e.g. prevention, treatment.")
1580    protected CodeableConcept intendedUse;
1581
1582    /**
1583     * Condition for which the medicinal use applies.
1584     */
1585    @Child(name = "indication", type = { CodeableConcept.class,
1586        MedicinalProductIndication.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1587    @Description(shortDefinition = "Condition for which the medicinal use applies", formalDefinition = "Condition for which the medicinal use applies.")
1588    protected Type indication;
1589
1590    /**
1591     * For example granted, pending, expired or withdrawn.
1592     */
1593    @Child(name = "status", type = {
1594        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1595    @Description(shortDefinition = "For example granted, pending, expired or withdrawn", formalDefinition = "For example granted, pending, expired or withdrawn.")
1596    protected CodeableConcept status;
1597
1598    /**
1599     * Date when the designation was granted.
1600     */
1601    @Child(name = "date", type = { DateTimeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1602    @Description(shortDefinition = "Date when the designation was granted", formalDefinition = "Date when the designation was granted.")
1603    protected DateTimeType date;
1604
1605    /**
1606     * Animal species for which this applies.
1607     */
1608    @Child(name = "species", type = {
1609        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1610    @Description(shortDefinition = "Animal species for which this applies", formalDefinition = "Animal species for which this applies.")
1611    protected CodeableConcept species;
1612
1613    private static final long serialVersionUID = -1316809207L;
1614
1615    /**
1616     * Constructor
1617     */
1618    public MedicinalProductSpecialDesignationComponent() {
1619      super();
1620    }
1621
1622    /**
1623     * @return {@link #identifier} (Identifier for the designation, or procedure
1624     *         number.)
1625     */
1626    public List<Identifier> getIdentifier() {
1627      if (this.identifier == null)
1628        this.identifier = new ArrayList<Identifier>();
1629      return this.identifier;
1630    }
1631
1632    /**
1633     * @return Returns a reference to <code>this</code> for easy method chaining
1634     */
1635    public MedicinalProductSpecialDesignationComponent setIdentifier(List<Identifier> theIdentifier) {
1636      this.identifier = theIdentifier;
1637      return this;
1638    }
1639
1640    public boolean hasIdentifier() {
1641      if (this.identifier == null)
1642        return false;
1643      for (Identifier item : this.identifier)
1644        if (!item.isEmpty())
1645          return true;
1646      return false;
1647    }
1648
1649    public Identifier addIdentifier() { // 3
1650      Identifier t = new Identifier();
1651      if (this.identifier == null)
1652        this.identifier = new ArrayList<Identifier>();
1653      this.identifier.add(t);
1654      return t;
1655    }
1656
1657    public MedicinalProductSpecialDesignationComponent addIdentifier(Identifier t) { // 3
1658      if (t == null)
1659        return this;
1660      if (this.identifier == null)
1661        this.identifier = new ArrayList<Identifier>();
1662      this.identifier.add(t);
1663      return this;
1664    }
1665
1666    /**
1667     * @return The first repetition of repeating field {@link #identifier}, creating
1668     *         it if it does not already exist
1669     */
1670    public Identifier getIdentifierFirstRep() {
1671      if (getIdentifier().isEmpty()) {
1672        addIdentifier();
1673      }
1674      return getIdentifier().get(0);
1675    }
1676
1677    /**
1678     * @return {@link #type} (The type of special designation, e.g. orphan drug,
1679     *         minor use.)
1680     */
1681    public CodeableConcept getType() {
1682      if (this.type == null)
1683        if (Configuration.errorOnAutoCreate())
1684          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.type");
1685        else if (Configuration.doAutoCreate())
1686          this.type = new CodeableConcept(); // cc
1687      return this.type;
1688    }
1689
1690    public boolean hasType() {
1691      return this.type != null && !this.type.isEmpty();
1692    }
1693
1694    /**
1695     * @param value {@link #type} (The type of special designation, e.g. orphan
1696     *              drug, minor use.)
1697     */
1698    public MedicinalProductSpecialDesignationComponent setType(CodeableConcept value) {
1699      this.type = value;
1700      return this;
1701    }
1702
1703    /**
1704     * @return {@link #intendedUse} (The intended use of the product, e.g.
1705     *         prevention, treatment.)
1706     */
1707    public CodeableConcept getIntendedUse() {
1708      if (this.intendedUse == null)
1709        if (Configuration.errorOnAutoCreate())
1710          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.intendedUse");
1711        else if (Configuration.doAutoCreate())
1712          this.intendedUse = new CodeableConcept(); // cc
1713      return this.intendedUse;
1714    }
1715
1716    public boolean hasIntendedUse() {
1717      return this.intendedUse != null && !this.intendedUse.isEmpty();
1718    }
1719
1720    /**
1721     * @param value {@link #intendedUse} (The intended use of the product, e.g.
1722     *              prevention, treatment.)
1723     */
1724    public MedicinalProductSpecialDesignationComponent setIntendedUse(CodeableConcept value) {
1725      this.intendedUse = value;
1726      return this;
1727    }
1728
1729    /**
1730     * @return {@link #indication} (Condition for which the medicinal use applies.)
1731     */
1732    public Type getIndication() {
1733      return this.indication;
1734    }
1735
1736    /**
1737     * @return {@link #indication} (Condition for which the medicinal use applies.)
1738     */
1739    public CodeableConcept getIndicationCodeableConcept() throws FHIRException {
1740      if (this.indication == null)
1741        this.indication = new CodeableConcept();
1742      if (!(this.indication instanceof CodeableConcept))
1743        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1744            + this.indication.getClass().getName() + " was encountered");
1745      return (CodeableConcept) this.indication;
1746    }
1747
1748    public boolean hasIndicationCodeableConcept() {
1749        return this.indication instanceof CodeableConcept;
1750    }
1751
1752    /**
1753     * @return {@link #indication} (Condition for which the medicinal use applies.)
1754     */
1755    public Reference getIndicationReference() throws FHIRException {
1756      if (this.indication == null)
1757        this.indication = new Reference();
1758      if (!(this.indication instanceof Reference))
1759        throw new FHIRException("Type mismatch: the type Reference was expected, but "
1760            + this.indication.getClass().getName() + " was encountered");
1761      return (Reference) this.indication;
1762    }
1763
1764    public boolean hasIndicationReference() {
1765        return this.indication instanceof Reference;
1766    }
1767
1768    public boolean hasIndication() {
1769      return this.indication != null && !this.indication.isEmpty();
1770    }
1771
1772    /**
1773     * @param value {@link #indication} (Condition for which the medicinal use
1774     *              applies.)
1775     */
1776    public MedicinalProductSpecialDesignationComponent setIndication(Type value) {
1777      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1778        throw new Error(
1779            "Not the right type for MedicinalProduct.specialDesignation.indication[x]: " + value.fhirType());
1780      this.indication = value;
1781      return this;
1782    }
1783
1784    /**
1785     * @return {@link #status} (For example granted, pending, expired or withdrawn.)
1786     */
1787    public CodeableConcept getStatus() {
1788      if (this.status == null)
1789        if (Configuration.errorOnAutoCreate())
1790          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.status");
1791        else if (Configuration.doAutoCreate())
1792          this.status = new CodeableConcept(); // cc
1793      return this.status;
1794    }
1795
1796    public boolean hasStatus() {
1797      return this.status != null && !this.status.isEmpty();
1798    }
1799
1800    /**
1801     * @param value {@link #status} (For example granted, pending, expired or
1802     *              withdrawn.)
1803     */
1804    public MedicinalProductSpecialDesignationComponent setStatus(CodeableConcept value) {
1805      this.status = value;
1806      return this;
1807    }
1808
1809    /**
1810     * @return {@link #date} (Date when the designation was granted.). This is the
1811     *         underlying object with id, value and extensions. The accessor
1812     *         "getDate" gives direct access to the value
1813     */
1814    public DateTimeType getDateElement() {
1815      if (this.date == null)
1816        if (Configuration.errorOnAutoCreate())
1817          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.date");
1818        else if (Configuration.doAutoCreate())
1819          this.date = new DateTimeType(); // bb
1820      return this.date;
1821    }
1822
1823    public boolean hasDateElement() {
1824      return this.date != null && !this.date.isEmpty();
1825    }
1826
1827    public boolean hasDate() {
1828      return this.date != null && !this.date.isEmpty();
1829    }
1830
1831    /**
1832     * @param value {@link #date} (Date when the designation was granted.). This is
1833     *              the underlying object with id, value and extensions. The
1834     *              accessor "getDate" gives direct access to the value
1835     */
1836    public MedicinalProductSpecialDesignationComponent setDateElement(DateTimeType value) {
1837      this.date = value;
1838      return this;
1839    }
1840
1841    /**
1842     * @return Date when the designation was granted.
1843     */
1844    public Date getDate() {
1845      return this.date == null ? null : this.date.getValue();
1846    }
1847
1848    /**
1849     * @param value Date when the designation was granted.
1850     */
1851    public MedicinalProductSpecialDesignationComponent setDate(Date value) {
1852      if (value == null)
1853        this.date = null;
1854      else {
1855        if (this.date == null)
1856          this.date = new DateTimeType();
1857        this.date.setValue(value);
1858      }
1859      return this;
1860    }
1861
1862    /**
1863     * @return {@link #species} (Animal species for which this applies.)
1864     */
1865    public CodeableConcept getSpecies() {
1866      if (this.species == null)
1867        if (Configuration.errorOnAutoCreate())
1868          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.species");
1869        else if (Configuration.doAutoCreate())
1870          this.species = new CodeableConcept(); // cc
1871      return this.species;
1872    }
1873
1874    public boolean hasSpecies() {
1875      return this.species != null && !this.species.isEmpty();
1876    }
1877
1878    /**
1879     * @param value {@link #species} (Animal species for which this applies.)
1880     */
1881    public MedicinalProductSpecialDesignationComponent setSpecies(CodeableConcept value) {
1882      this.species = value;
1883      return this;
1884    }
1885
1886    protected void listChildren(List<Property> children) {
1887      super.listChildren(children);
1888      children.add(new Property("identifier", "Identifier", "Identifier for the designation, or procedure number.", 0,
1889          java.lang.Integer.MAX_VALUE, identifier));
1890      children.add(new Property("type", "CodeableConcept",
1891          "The type of special designation, e.g. orphan drug, minor use.", 0, 1, type));
1892      children.add(new Property("intendedUse", "CodeableConcept",
1893          "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse));
1894      children.add(new Property("indication[x]", "CodeableConcept|Reference(MedicinalProductIndication)",
1895          "Condition for which the medicinal use applies.", 0, 1, indication));
1896      children.add(new Property("status", "CodeableConcept", "For example granted, pending, expired or withdrawn.", 0,
1897          1, status));
1898      children.add(new Property("date", "dateTime", "Date when the designation was granted.", 0, 1, date));
1899      children.add(new Property("species", "CodeableConcept", "Animal species for which this applies.", 0, 1, species));
1900    }
1901
1902    @Override
1903    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1904      switch (_hash) {
1905      case -1618432855:
1906        /* identifier */ return new Property("identifier", "Identifier",
1907            "Identifier for the designation, or procedure number.", 0, java.lang.Integer.MAX_VALUE, identifier);
1908      case 3575610:
1909        /* type */ return new Property("type", "CodeableConcept",
1910            "The type of special designation, e.g. orphan drug, minor use.", 0, 1, type);
1911      case -1618671268:
1912        /* intendedUse */ return new Property("intendedUse", "CodeableConcept",
1913            "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse);
1914      case -501208668:
1915        /* indication[x] */ return new Property("indication[x]",
1916            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1917            0, 1, indication);
1918      case -597168804:
1919        /* indication */ return new Property("indication[x]", "CodeableConcept|Reference(MedicinalProductIndication)",
1920            "Condition for which the medicinal use applies.", 0, 1, indication);
1921      case -1094003035:
1922        /* indicationCodeableConcept */ return new Property("indication[x]",
1923            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1924            0, 1, indication);
1925      case 803518799:
1926        /* indicationReference */ return new Property("indication[x]",
1927            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1928            0, 1, indication);
1929      case -892481550:
1930        /* status */ return new Property("status", "CodeableConcept",
1931            "For example granted, pending, expired or withdrawn.", 0, 1, status);
1932      case 3076014:
1933        /* date */ return new Property("date", "dateTime", "Date when the designation was granted.", 0, 1, date);
1934      case -2008465092:
1935        /* species */ return new Property("species", "CodeableConcept", "Animal species for which this applies.", 0, 1,
1936            species);
1937      default:
1938        return super.getNamedProperty(_hash, _name, _checkValid);
1939      }
1940
1941    }
1942
1943    @Override
1944    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1945      switch (hash) {
1946      case -1618432855:
1947        /* identifier */ return this.identifier == null ? new Base[0]
1948            : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1949      case 3575610:
1950        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1951      case -1618671268:
1952        /* intendedUse */ return this.intendedUse == null ? new Base[0] : new Base[] { this.intendedUse }; // CodeableConcept
1953      case -597168804:
1954        /* indication */ return this.indication == null ? new Base[0] : new Base[] { this.indication }; // Type
1955      case -892481550:
1956        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // CodeableConcept
1957      case 3076014:
1958        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
1959      case -2008465092:
1960        /* species */ return this.species == null ? new Base[0] : new Base[] { this.species }; // CodeableConcept
1961      default:
1962        return super.getProperty(hash, name, checkValid);
1963      }
1964
1965    }
1966
1967    @Override
1968    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1969      switch (hash) {
1970      case -1618432855: // identifier
1971        this.getIdentifier().add(castToIdentifier(value)); // Identifier
1972        return value;
1973      case 3575610: // type
1974        this.type = castToCodeableConcept(value); // CodeableConcept
1975        return value;
1976      case -1618671268: // intendedUse
1977        this.intendedUse = castToCodeableConcept(value); // CodeableConcept
1978        return value;
1979      case -597168804: // indication
1980        this.indication = castToType(value); // Type
1981        return value;
1982      case -892481550: // status
1983        this.status = castToCodeableConcept(value); // CodeableConcept
1984        return value;
1985      case 3076014: // date
1986        this.date = castToDateTime(value); // DateTimeType
1987        return value;
1988      case -2008465092: // species
1989        this.species = castToCodeableConcept(value); // CodeableConcept
1990        return value;
1991      default:
1992        return super.setProperty(hash, name, value);
1993      }
1994
1995    }
1996
1997    @Override
1998    public Base setProperty(String name, Base value) throws FHIRException {
1999      if (name.equals("identifier")) {
2000        this.getIdentifier().add(castToIdentifier(value));
2001      } else if (name.equals("type")) {
2002        this.type = castToCodeableConcept(value); // CodeableConcept
2003      } else if (name.equals("intendedUse")) {
2004        this.intendedUse = castToCodeableConcept(value); // CodeableConcept
2005      } else if (name.equals("indication[x]")) {
2006        this.indication = castToType(value); // Type
2007      } else if (name.equals("status")) {
2008        this.status = castToCodeableConcept(value); // CodeableConcept
2009      } else if (name.equals("date")) {
2010        this.date = castToDateTime(value); // DateTimeType
2011      } else if (name.equals("species")) {
2012        this.species = castToCodeableConcept(value); // CodeableConcept
2013      } else
2014        return super.setProperty(name, value);
2015      return value;
2016    }
2017
2018  @Override
2019  public void removeChild(String name, Base value) throws FHIRException {
2020      if (name.equals("identifier")) {
2021        this.getIdentifier().remove(castToIdentifier(value));
2022      } else if (name.equals("type")) {
2023        this.type = null;
2024      } else if (name.equals("intendedUse")) {
2025        this.intendedUse = null;
2026      } else if (name.equals("indication[x]")) {
2027        this.indication = null;
2028      } else if (name.equals("status")) {
2029        this.status = null;
2030      } else if (name.equals("date")) {
2031        this.date = null;
2032      } else if (name.equals("species")) {
2033        this.species = null;
2034      } else
2035        super.removeChild(name, value);
2036      
2037    }
2038
2039    @Override
2040    public Base makeProperty(int hash, String name) throws FHIRException {
2041      switch (hash) {
2042      case -1618432855:
2043        return addIdentifier();
2044      case 3575610:
2045        return getType();
2046      case -1618671268:
2047        return getIntendedUse();
2048      case -501208668:
2049        return getIndication();
2050      case -597168804:
2051        return getIndication();
2052      case -892481550:
2053        return getStatus();
2054      case 3076014:
2055        return getDateElement();
2056      case -2008465092:
2057        return getSpecies();
2058      default:
2059        return super.makeProperty(hash, name);
2060      }
2061
2062    }
2063
2064    @Override
2065    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2066      switch (hash) {
2067      case -1618432855:
2068        /* identifier */ return new String[] { "Identifier" };
2069      case 3575610:
2070        /* type */ return new String[] { "CodeableConcept" };
2071      case -1618671268:
2072        /* intendedUse */ return new String[] { "CodeableConcept" };
2073      case -597168804:
2074        /* indication */ return new String[] { "CodeableConcept", "Reference" };
2075      case -892481550:
2076        /* status */ return new String[] { "CodeableConcept" };
2077      case 3076014:
2078        /* date */ return new String[] { "dateTime" };
2079      case -2008465092:
2080        /* species */ return new String[] { "CodeableConcept" };
2081      default:
2082        return super.getTypesForProperty(hash, name);
2083      }
2084
2085    }
2086
2087    @Override
2088    public Base addChild(String name) throws FHIRException {
2089      if (name.equals("identifier")) {
2090        return addIdentifier();
2091      } else if (name.equals("type")) {
2092        this.type = new CodeableConcept();
2093        return this.type;
2094      } else if (name.equals("intendedUse")) {
2095        this.intendedUse = new CodeableConcept();
2096        return this.intendedUse;
2097      } else if (name.equals("indicationCodeableConcept")) {
2098        this.indication = new CodeableConcept();
2099        return this.indication;
2100      } else if (name.equals("indicationReference")) {
2101        this.indication = new Reference();
2102        return this.indication;
2103      } else if (name.equals("status")) {
2104        this.status = new CodeableConcept();
2105        return this.status;
2106      } else if (name.equals("date")) {
2107        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.date");
2108      } else if (name.equals("species")) {
2109        this.species = new CodeableConcept();
2110        return this.species;
2111      } else
2112        return super.addChild(name);
2113    }
2114
2115    public MedicinalProductSpecialDesignationComponent copy() {
2116      MedicinalProductSpecialDesignationComponent dst = new MedicinalProductSpecialDesignationComponent();
2117      copyValues(dst);
2118      return dst;
2119    }
2120
2121    public void copyValues(MedicinalProductSpecialDesignationComponent dst) {
2122      super.copyValues(dst);
2123      if (identifier != null) {
2124        dst.identifier = new ArrayList<Identifier>();
2125        for (Identifier i : identifier)
2126          dst.identifier.add(i.copy());
2127      }
2128      ;
2129      dst.type = type == null ? null : type.copy();
2130      dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
2131      dst.indication = indication == null ? null : indication.copy();
2132      dst.status = status == null ? null : status.copy();
2133      dst.date = date == null ? null : date.copy();
2134      dst.species = species == null ? null : species.copy();
2135    }
2136
2137    @Override
2138    public boolean equalsDeep(Base other_) {
2139      if (!super.equalsDeep(other_))
2140        return false;
2141      if (!(other_ instanceof MedicinalProductSpecialDesignationComponent))
2142        return false;
2143      MedicinalProductSpecialDesignationComponent o = (MedicinalProductSpecialDesignationComponent) other_;
2144      return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
2145          && compareDeep(intendedUse, o.intendedUse, true) && compareDeep(indication, o.indication, true)
2146          && compareDeep(status, o.status, true) && compareDeep(date, o.date, true)
2147          && compareDeep(species, o.species, true);
2148    }
2149
2150    @Override
2151    public boolean equalsShallow(Base other_) {
2152      if (!super.equalsShallow(other_))
2153        return false;
2154      if (!(other_ instanceof MedicinalProductSpecialDesignationComponent))
2155        return false;
2156      MedicinalProductSpecialDesignationComponent o = (MedicinalProductSpecialDesignationComponent) other_;
2157      return compareValues(date, o.date, true);
2158    }
2159
2160    public boolean isEmpty() {
2161      return super.isEmpty()
2162          && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, intendedUse, indication, status, date, species);
2163    }
2164
2165    public String fhirType() {
2166      return "MedicinalProduct.specialDesignation";
2167
2168    }
2169
2170  }
2171
2172  /**
2173   * Business identifier for this product. Could be an MPID.
2174   */
2175  @Child(name = "identifier", type = {
2176      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2177  @Description(shortDefinition = "Business identifier for this product. Could be an MPID", formalDefinition = "Business identifier for this product. Could be an MPID.")
2178  protected List<Identifier> identifier;
2179
2180  /**
2181   * Regulatory type, e.g. Investigational or Authorized.
2182   */
2183  @Child(name = "type", type = { CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
2184  @Description(shortDefinition = "Regulatory type, e.g. Investigational or Authorized", formalDefinition = "Regulatory type, e.g. Investigational or Authorized.")
2185  protected CodeableConcept type;
2186
2187  /**
2188   * If this medicine applies to human or veterinary uses.
2189   */
2190  @Child(name = "domain", type = { Coding.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
2191  @Description(shortDefinition = "If this medicine applies to human or veterinary uses", formalDefinition = "If this medicine applies to human or veterinary uses.")
2192  protected Coding domain;
2193
2194  /**
2195   * The dose form for a single part product, or combined form of a multiple part
2196   * product.
2197   */
2198  @Child(name = "combinedPharmaceuticalDoseForm", type = {
2199      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
2200  @Description(shortDefinition = "The dose form for a single part product, or combined form of a multiple part product", formalDefinition = "The dose form for a single part product, or combined form of a multiple part product.")
2201  protected CodeableConcept combinedPharmaceuticalDoseForm;
2202
2203  /**
2204   * The legal status of supply of the medicinal product as classified by the
2205   * regulator.
2206   */
2207  @Child(name = "legalStatusOfSupply", type = {
2208      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2209  @Description(shortDefinition = "The legal status of supply of the medicinal product as classified by the regulator", formalDefinition = "The legal status of supply of the medicinal product as classified by the regulator.")
2210  protected CodeableConcept legalStatusOfSupply;
2211
2212  /**
2213   * Whether the Medicinal Product is subject to additional monitoring for
2214   * regulatory reasons.
2215   */
2216  @Child(name = "additionalMonitoringIndicator", type = {
2217      CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
2218  @Description(shortDefinition = "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons", formalDefinition = "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.")
2219  protected CodeableConcept additionalMonitoringIndicator;
2220
2221  /**
2222   * Whether the Medicinal Product is subject to special measures for regulatory
2223   * reasons.
2224   */
2225  @Child(name = "specialMeasures", type = {
2226      StringType.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2227  @Description(shortDefinition = "Whether the Medicinal Product is subject to special measures for regulatory reasons", formalDefinition = "Whether the Medicinal Product is subject to special measures for regulatory reasons.")
2228  protected List<StringType> specialMeasures;
2229
2230  /**
2231   * If authorised for use in children.
2232   */
2233  @Child(name = "paediatricUseIndicator", type = {
2234      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
2235  @Description(shortDefinition = "If authorised for use in children", formalDefinition = "If authorised for use in children.")
2236  protected CodeableConcept paediatricUseIndicator;
2237
2238  /**
2239   * Allows the product to be classified by various systems.
2240   */
2241  @Child(name = "productClassification", type = {
2242      CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2243  @Description(shortDefinition = "Allows the product to be classified by various systems", formalDefinition = "Allows the product to be classified by various systems.")
2244  protected List<CodeableConcept> productClassification;
2245
2246  /**
2247   * Marketing status of the medicinal product, in contrast to marketing
2248   * authorizaton.
2249   */
2250  @Child(name = "marketingStatus", type = {
2251      MarketingStatus.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2252  @Description(shortDefinition = "Marketing status of the medicinal product, in contrast to marketing authorizaton", formalDefinition = "Marketing status of the medicinal product, in contrast to marketing authorizaton.")
2253  protected List<MarketingStatus> marketingStatus;
2254
2255  /**
2256   * Pharmaceutical aspects of product.
2257   */
2258  @Child(name = "pharmaceuticalProduct", type = {
2259      MedicinalProductPharmaceutical.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2260  @Description(shortDefinition = "Pharmaceutical aspects of product", formalDefinition = "Pharmaceutical aspects of product.")
2261  protected List<Reference> pharmaceuticalProduct;
2262  /**
2263   * The actual objects that are the target of the reference (Pharmaceutical
2264   * aspects of product.)
2265   */
2266  protected List<MedicinalProductPharmaceutical> pharmaceuticalProductTarget;
2267
2268  /**
2269   * Package representation for the product.
2270   */
2271  @Child(name = "packagedMedicinalProduct", type = {
2272      MedicinalProductPackaged.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2273  @Description(shortDefinition = "Package representation for the product", formalDefinition = "Package representation for the product.")
2274  protected List<Reference> packagedMedicinalProduct;
2275  /**
2276   * The actual objects that are the target of the reference (Package
2277   * representation for the product.)
2278   */
2279  protected List<MedicinalProductPackaged> packagedMedicinalProductTarget;
2280
2281  /**
2282   * Supporting documentation, typically for regulatory submission.
2283   */
2284  @Child(name = "attachedDocument", type = {
2285      DocumentReference.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2286  @Description(shortDefinition = "Supporting documentation, typically for regulatory submission", formalDefinition = "Supporting documentation, typically for regulatory submission.")
2287  protected List<Reference> attachedDocument;
2288  /**
2289   * The actual objects that are the target of the reference (Supporting
2290   * documentation, typically for regulatory submission.)
2291   */
2292  protected List<DocumentReference> attachedDocumentTarget;
2293
2294  /**
2295   * A master file for to the medicinal product (e.g. Pharmacovigilance System
2296   * Master File).
2297   */
2298  @Child(name = "masterFile", type = {
2299      DocumentReference.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2300  @Description(shortDefinition = "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File)", formalDefinition = "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).")
2301  protected List<Reference> masterFile;
2302  /**
2303   * The actual objects that are the target of the reference (A master file for to
2304   * the medicinal product (e.g. Pharmacovigilance System Master File).)
2305   */
2306  protected List<DocumentReference> masterFileTarget;
2307
2308  /**
2309   * A product specific contact, person (in a role), or an organization.
2310   */
2311  @Child(name = "contact", type = { Organization.class,
2312      PractitionerRole.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2313  @Description(shortDefinition = "A product specific contact, person (in a role), or an organization", formalDefinition = "A product specific contact, person (in a role), or an organization.")
2314  protected List<Reference> contact;
2315  /**
2316   * The actual objects that are the target of the reference (A product specific
2317   * contact, person (in a role), or an organization.)
2318   */
2319  protected List<Resource> contactTarget;
2320
2321  /**
2322   * Clinical trials or studies that this product is involved in.
2323   */
2324  @Child(name = "clinicalTrial", type = {
2325      ResearchStudy.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2326  @Description(shortDefinition = "Clinical trials or studies that this product is involved in", formalDefinition = "Clinical trials or studies that this product is involved in.")
2327  protected List<Reference> clinicalTrial;
2328  /**
2329   * The actual objects that are the target of the reference (Clinical trials or
2330   * studies that this product is involved in.)
2331   */
2332  protected List<ResearchStudy> clinicalTrialTarget;
2333
2334  /**
2335   * The product's name, including full name and possibly coded parts.
2336   */
2337  @Child(name = "name", type = {}, order = 16, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2338  @Description(shortDefinition = "The product's name, including full name and possibly coded parts", formalDefinition = "The product's name, including full name and possibly coded parts.")
2339  protected List<MedicinalProductNameComponent> name;
2340
2341  /**
2342   * Reference to another product, e.g. for linking authorised to investigational
2343   * product.
2344   */
2345  @Child(name = "crossReference", type = {
2346      Identifier.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2347  @Description(shortDefinition = "Reference to another product, e.g. for linking authorised to investigational product", formalDefinition = "Reference to another product, e.g. for linking authorised to investigational product.")
2348  protected List<Identifier> crossReference;
2349
2350  /**
2351   * An operation applied to the product, for manufacturing or adminsitrative
2352   * purpose.
2353   */
2354  @Child(name = "manufacturingBusinessOperation", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2355  @Description(shortDefinition = "An operation applied to the product, for manufacturing or adminsitrative purpose", formalDefinition = "An operation applied to the product, for manufacturing or adminsitrative purpose.")
2356  protected List<MedicinalProductManufacturingBusinessOperationComponent> manufacturingBusinessOperation;
2357
2358  /**
2359   * Indicates if the medicinal product has an orphan designation for the
2360   * treatment of a rare disease.
2361   */
2362  @Child(name = "specialDesignation", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2363  @Description(shortDefinition = "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease", formalDefinition = "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.")
2364  protected List<MedicinalProductSpecialDesignationComponent> specialDesignation;
2365
2366  private static final long serialVersionUID = -899196111L;
2367
2368  /**
2369   * Constructor
2370   */
2371  public MedicinalProduct() {
2372    super();
2373  }
2374
2375  /**
2376   * @return {@link #identifier} (Business identifier for this product. Could be
2377   *         an MPID.)
2378   */
2379  public List<Identifier> getIdentifier() {
2380    if (this.identifier == null)
2381      this.identifier = new ArrayList<Identifier>();
2382    return this.identifier;
2383  }
2384
2385  /**
2386   * @return Returns a reference to <code>this</code> for easy method chaining
2387   */
2388  public MedicinalProduct setIdentifier(List<Identifier> theIdentifier) {
2389    this.identifier = theIdentifier;
2390    return this;
2391  }
2392
2393  public boolean hasIdentifier() {
2394    if (this.identifier == null)
2395      return false;
2396    for (Identifier item : this.identifier)
2397      if (!item.isEmpty())
2398        return true;
2399    return false;
2400  }
2401
2402  public Identifier addIdentifier() { // 3
2403    Identifier t = new Identifier();
2404    if (this.identifier == null)
2405      this.identifier = new ArrayList<Identifier>();
2406    this.identifier.add(t);
2407    return t;
2408  }
2409
2410  public MedicinalProduct addIdentifier(Identifier t) { // 3
2411    if (t == null)
2412      return this;
2413    if (this.identifier == null)
2414      this.identifier = new ArrayList<Identifier>();
2415    this.identifier.add(t);
2416    return this;
2417  }
2418
2419  /**
2420   * @return The first repetition of repeating field {@link #identifier}, creating
2421   *         it if it does not already exist
2422   */
2423  public Identifier getIdentifierFirstRep() {
2424    if (getIdentifier().isEmpty()) {
2425      addIdentifier();
2426    }
2427    return getIdentifier().get(0);
2428  }
2429
2430  /**
2431   * @return {@link #type} (Regulatory type, e.g. Investigational or Authorized.)
2432   */
2433  public CodeableConcept getType() {
2434    if (this.type == null)
2435      if (Configuration.errorOnAutoCreate())
2436        throw new Error("Attempt to auto-create MedicinalProduct.type");
2437      else if (Configuration.doAutoCreate())
2438        this.type = new CodeableConcept(); // cc
2439    return this.type;
2440  }
2441
2442  public boolean hasType() {
2443    return this.type != null && !this.type.isEmpty();
2444  }
2445
2446  /**
2447   * @param value {@link #type} (Regulatory type, e.g. Investigational or
2448   *              Authorized.)
2449   */
2450  public MedicinalProduct setType(CodeableConcept value) {
2451    this.type = value;
2452    return this;
2453  }
2454
2455  /**
2456   * @return {@link #domain} (If this medicine applies to human or veterinary
2457   *         uses.)
2458   */
2459  public Coding getDomain() {
2460    if (this.domain == null)
2461      if (Configuration.errorOnAutoCreate())
2462        throw new Error("Attempt to auto-create MedicinalProduct.domain");
2463      else if (Configuration.doAutoCreate())
2464        this.domain = new Coding(); // cc
2465    return this.domain;
2466  }
2467
2468  public boolean hasDomain() {
2469    return this.domain != null && !this.domain.isEmpty();
2470  }
2471
2472  /**
2473   * @param value {@link #domain} (If this medicine applies to human or veterinary
2474   *              uses.)
2475   */
2476  public MedicinalProduct setDomain(Coding value) {
2477    this.domain = value;
2478    return this;
2479  }
2480
2481  /**
2482   * @return {@link #combinedPharmaceuticalDoseForm} (The dose form for a single
2483   *         part product, or combined form of a multiple part product.)
2484   */
2485  public CodeableConcept getCombinedPharmaceuticalDoseForm() {
2486    if (this.combinedPharmaceuticalDoseForm == null)
2487      if (Configuration.errorOnAutoCreate())
2488        throw new Error("Attempt to auto-create MedicinalProduct.combinedPharmaceuticalDoseForm");
2489      else if (Configuration.doAutoCreate())
2490        this.combinedPharmaceuticalDoseForm = new CodeableConcept(); // cc
2491    return this.combinedPharmaceuticalDoseForm;
2492  }
2493
2494  public boolean hasCombinedPharmaceuticalDoseForm() {
2495    return this.combinedPharmaceuticalDoseForm != null && !this.combinedPharmaceuticalDoseForm.isEmpty();
2496  }
2497
2498  /**
2499   * @param value {@link #combinedPharmaceuticalDoseForm} (The dose form for a
2500   *              single part product, or combined form of a multiple part
2501   *              product.)
2502   */
2503  public MedicinalProduct setCombinedPharmaceuticalDoseForm(CodeableConcept value) {
2504    this.combinedPharmaceuticalDoseForm = value;
2505    return this;
2506  }
2507
2508  /**
2509   * @return {@link #legalStatusOfSupply} (The legal status of supply of the
2510   *         medicinal product as classified by the regulator.)
2511   */
2512  public CodeableConcept getLegalStatusOfSupply() {
2513    if (this.legalStatusOfSupply == null)
2514      if (Configuration.errorOnAutoCreate())
2515        throw new Error("Attempt to auto-create MedicinalProduct.legalStatusOfSupply");
2516      else if (Configuration.doAutoCreate())
2517        this.legalStatusOfSupply = new CodeableConcept(); // cc
2518    return this.legalStatusOfSupply;
2519  }
2520
2521  public boolean hasLegalStatusOfSupply() {
2522    return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
2523  }
2524
2525  /**
2526   * @param value {@link #legalStatusOfSupply} (The legal status of supply of the
2527   *              medicinal product as classified by the regulator.)
2528   */
2529  public MedicinalProduct setLegalStatusOfSupply(CodeableConcept value) {
2530    this.legalStatusOfSupply = value;
2531    return this;
2532  }
2533
2534  /**
2535   * @return {@link #additionalMonitoringIndicator} (Whether the Medicinal Product
2536   *         is subject to additional monitoring for regulatory reasons.)
2537   */
2538  public CodeableConcept getAdditionalMonitoringIndicator() {
2539    if (this.additionalMonitoringIndicator == null)
2540      if (Configuration.errorOnAutoCreate())
2541        throw new Error("Attempt to auto-create MedicinalProduct.additionalMonitoringIndicator");
2542      else if (Configuration.doAutoCreate())
2543        this.additionalMonitoringIndicator = new CodeableConcept(); // cc
2544    return this.additionalMonitoringIndicator;
2545  }
2546
2547  public boolean hasAdditionalMonitoringIndicator() {
2548    return this.additionalMonitoringIndicator != null && !this.additionalMonitoringIndicator.isEmpty();
2549  }
2550
2551  /**
2552   * @param value {@link #additionalMonitoringIndicator} (Whether the Medicinal
2553   *              Product is subject to additional monitoring for regulatory
2554   *              reasons.)
2555   */
2556  public MedicinalProduct setAdditionalMonitoringIndicator(CodeableConcept value) {
2557    this.additionalMonitoringIndicator = value;
2558    return this;
2559  }
2560
2561  /**
2562   * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to
2563   *         special measures for regulatory reasons.)
2564   */
2565  public List<StringType> getSpecialMeasures() {
2566    if (this.specialMeasures == null)
2567      this.specialMeasures = new ArrayList<StringType>();
2568    return this.specialMeasures;
2569  }
2570
2571  /**
2572   * @return Returns a reference to <code>this</code> for easy method chaining
2573   */
2574  public MedicinalProduct setSpecialMeasures(List<StringType> theSpecialMeasures) {
2575    this.specialMeasures = theSpecialMeasures;
2576    return this;
2577  }
2578
2579  public boolean hasSpecialMeasures() {
2580    if (this.specialMeasures == null)
2581      return false;
2582    for (StringType item : this.specialMeasures)
2583      if (!item.isEmpty())
2584        return true;
2585    return false;
2586  }
2587
2588  /**
2589   * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to
2590   *         special measures for regulatory reasons.)
2591   */
2592  public StringType addSpecialMeasuresElement() {// 2
2593    StringType t = new StringType();
2594    if (this.specialMeasures == null)
2595      this.specialMeasures = new ArrayList<StringType>();
2596    this.specialMeasures.add(t);
2597    return t;
2598  }
2599
2600  /**
2601   * @param value {@link #specialMeasures} (Whether the Medicinal Product is
2602   *              subject to special measures for regulatory reasons.)
2603   */
2604  public MedicinalProduct addSpecialMeasures(String value) { // 1
2605    StringType t = new StringType();
2606    t.setValue(value);
2607    if (this.specialMeasures == null)
2608      this.specialMeasures = new ArrayList<StringType>();
2609    this.specialMeasures.add(t);
2610    return this;
2611  }
2612
2613  /**
2614   * @param value {@link #specialMeasures} (Whether the Medicinal Product is
2615   *              subject to special measures for regulatory reasons.)
2616   */
2617  public boolean hasSpecialMeasures(String value) {
2618    if (this.specialMeasures == null)
2619      return false;
2620    for (StringType v : this.specialMeasures)
2621      if (v.getValue().equals(value)) // string
2622        return true;
2623    return false;
2624  }
2625
2626  /**
2627   * @return {@link #paediatricUseIndicator} (If authorised for use in children.)
2628   */
2629  public CodeableConcept getPaediatricUseIndicator() {
2630    if (this.paediatricUseIndicator == null)
2631      if (Configuration.errorOnAutoCreate())
2632        throw new Error("Attempt to auto-create MedicinalProduct.paediatricUseIndicator");
2633      else if (Configuration.doAutoCreate())
2634        this.paediatricUseIndicator = new CodeableConcept(); // cc
2635    return this.paediatricUseIndicator;
2636  }
2637
2638  public boolean hasPaediatricUseIndicator() {
2639    return this.paediatricUseIndicator != null && !this.paediatricUseIndicator.isEmpty();
2640  }
2641
2642  /**
2643   * @param value {@link #paediatricUseIndicator} (If authorised for use in
2644   *              children.)
2645   */
2646  public MedicinalProduct setPaediatricUseIndicator(CodeableConcept value) {
2647    this.paediatricUseIndicator = value;
2648    return this;
2649  }
2650
2651  /**
2652   * @return {@link #productClassification} (Allows the product to be classified
2653   *         by various systems.)
2654   */
2655  public List<CodeableConcept> getProductClassification() {
2656    if (this.productClassification == null)
2657      this.productClassification = new ArrayList<CodeableConcept>();
2658    return this.productClassification;
2659  }
2660
2661  /**
2662   * @return Returns a reference to <code>this</code> for easy method chaining
2663   */
2664  public MedicinalProduct setProductClassification(List<CodeableConcept> theProductClassification) {
2665    this.productClassification = theProductClassification;
2666    return this;
2667  }
2668
2669  public boolean hasProductClassification() {
2670    if (this.productClassification == null)
2671      return false;
2672    for (CodeableConcept item : this.productClassification)
2673      if (!item.isEmpty())
2674        return true;
2675    return false;
2676  }
2677
2678  public CodeableConcept addProductClassification() { // 3
2679    CodeableConcept t = new CodeableConcept();
2680    if (this.productClassification == null)
2681      this.productClassification = new ArrayList<CodeableConcept>();
2682    this.productClassification.add(t);
2683    return t;
2684  }
2685
2686  public MedicinalProduct addProductClassification(CodeableConcept t) { // 3
2687    if (t == null)
2688      return this;
2689    if (this.productClassification == null)
2690      this.productClassification = new ArrayList<CodeableConcept>();
2691    this.productClassification.add(t);
2692    return this;
2693  }
2694
2695  /**
2696   * @return The first repetition of repeating field
2697   *         {@link #productClassification}, creating it if it does not already
2698   *         exist
2699   */
2700  public CodeableConcept getProductClassificationFirstRep() {
2701    if (getProductClassification().isEmpty()) {
2702      addProductClassification();
2703    }
2704    return getProductClassification().get(0);
2705  }
2706
2707  /**
2708   * @return {@link #marketingStatus} (Marketing status of the medicinal product,
2709   *         in contrast to marketing authorizaton.)
2710   */
2711  public List<MarketingStatus> getMarketingStatus() {
2712    if (this.marketingStatus == null)
2713      this.marketingStatus = new ArrayList<MarketingStatus>();
2714    return this.marketingStatus;
2715  }
2716
2717  /**
2718   * @return Returns a reference to <code>this</code> for easy method chaining
2719   */
2720  public MedicinalProduct setMarketingStatus(List<MarketingStatus> theMarketingStatus) {
2721    this.marketingStatus = theMarketingStatus;
2722    return this;
2723  }
2724
2725  public boolean hasMarketingStatus() {
2726    if (this.marketingStatus == null)
2727      return false;
2728    for (MarketingStatus item : this.marketingStatus)
2729      if (!item.isEmpty())
2730        return true;
2731    return false;
2732  }
2733
2734  public MarketingStatus addMarketingStatus() { // 3
2735    MarketingStatus t = new MarketingStatus();
2736    if (this.marketingStatus == null)
2737      this.marketingStatus = new ArrayList<MarketingStatus>();
2738    this.marketingStatus.add(t);
2739    return t;
2740  }
2741
2742  public MedicinalProduct addMarketingStatus(MarketingStatus t) { // 3
2743    if (t == null)
2744      return this;
2745    if (this.marketingStatus == null)
2746      this.marketingStatus = new ArrayList<MarketingStatus>();
2747    this.marketingStatus.add(t);
2748    return this;
2749  }
2750
2751  /**
2752   * @return The first repetition of repeating field {@link #marketingStatus},
2753   *         creating it if it does not already exist
2754   */
2755  public MarketingStatus getMarketingStatusFirstRep() {
2756    if (getMarketingStatus().isEmpty()) {
2757      addMarketingStatus();
2758    }
2759    return getMarketingStatus().get(0);
2760  }
2761
2762  /**
2763   * @return {@link #pharmaceuticalProduct} (Pharmaceutical aspects of product.)
2764   */
2765  public List<Reference> getPharmaceuticalProduct() {
2766    if (this.pharmaceuticalProduct == null)
2767      this.pharmaceuticalProduct = new ArrayList<Reference>();
2768    return this.pharmaceuticalProduct;
2769  }
2770
2771  /**
2772   * @return Returns a reference to <code>this</code> for easy method chaining
2773   */
2774  public MedicinalProduct setPharmaceuticalProduct(List<Reference> thePharmaceuticalProduct) {
2775    this.pharmaceuticalProduct = thePharmaceuticalProduct;
2776    return this;
2777  }
2778
2779  public boolean hasPharmaceuticalProduct() {
2780    if (this.pharmaceuticalProduct == null)
2781      return false;
2782    for (Reference item : this.pharmaceuticalProduct)
2783      if (!item.isEmpty())
2784        return true;
2785    return false;
2786  }
2787
2788  public Reference addPharmaceuticalProduct() { // 3
2789    Reference t = new Reference();
2790    if (this.pharmaceuticalProduct == null)
2791      this.pharmaceuticalProduct = new ArrayList<Reference>();
2792    this.pharmaceuticalProduct.add(t);
2793    return t;
2794  }
2795
2796  public MedicinalProduct addPharmaceuticalProduct(Reference t) { // 3
2797    if (t == null)
2798      return this;
2799    if (this.pharmaceuticalProduct == null)
2800      this.pharmaceuticalProduct = new ArrayList<Reference>();
2801    this.pharmaceuticalProduct.add(t);
2802    return this;
2803  }
2804
2805  /**
2806   * @return The first repetition of repeating field
2807   *         {@link #pharmaceuticalProduct}, creating it if it does not already
2808   *         exist
2809   */
2810  public Reference getPharmaceuticalProductFirstRep() {
2811    if (getPharmaceuticalProduct().isEmpty()) {
2812      addPharmaceuticalProduct();
2813    }
2814    return getPharmaceuticalProduct().get(0);
2815  }
2816
2817  /**
2818   * @return {@link #packagedMedicinalProduct} (Package representation for the
2819   *         product.)
2820   */
2821  public List<Reference> getPackagedMedicinalProduct() {
2822    if (this.packagedMedicinalProduct == null)
2823      this.packagedMedicinalProduct = new ArrayList<Reference>();
2824    return this.packagedMedicinalProduct;
2825  }
2826
2827  /**
2828   * @return Returns a reference to <code>this</code> for easy method chaining
2829   */
2830  public MedicinalProduct setPackagedMedicinalProduct(List<Reference> thePackagedMedicinalProduct) {
2831    this.packagedMedicinalProduct = thePackagedMedicinalProduct;
2832    return this;
2833  }
2834
2835  public boolean hasPackagedMedicinalProduct() {
2836    if (this.packagedMedicinalProduct == null)
2837      return false;
2838    for (Reference item : this.packagedMedicinalProduct)
2839      if (!item.isEmpty())
2840        return true;
2841    return false;
2842  }
2843
2844  public Reference addPackagedMedicinalProduct() { // 3
2845    Reference t = new Reference();
2846    if (this.packagedMedicinalProduct == null)
2847      this.packagedMedicinalProduct = new ArrayList<Reference>();
2848    this.packagedMedicinalProduct.add(t);
2849    return t;
2850  }
2851
2852  public MedicinalProduct addPackagedMedicinalProduct(Reference t) { // 3
2853    if (t == null)
2854      return this;
2855    if (this.packagedMedicinalProduct == null)
2856      this.packagedMedicinalProduct = new ArrayList<Reference>();
2857    this.packagedMedicinalProduct.add(t);
2858    return this;
2859  }
2860
2861  /**
2862   * @return The first repetition of repeating field
2863   *         {@link #packagedMedicinalProduct}, creating it if it does not already
2864   *         exist
2865   */
2866  public Reference getPackagedMedicinalProductFirstRep() {
2867    if (getPackagedMedicinalProduct().isEmpty()) {
2868      addPackagedMedicinalProduct();
2869    }
2870    return getPackagedMedicinalProduct().get(0);
2871  }
2872
2873  /**
2874   * @return {@link #attachedDocument} (Supporting documentation, typically for
2875   *         regulatory submission.)
2876   */
2877  public List<Reference> getAttachedDocument() {
2878    if (this.attachedDocument == null)
2879      this.attachedDocument = new ArrayList<Reference>();
2880    return this.attachedDocument;
2881  }
2882
2883  /**
2884   * @return Returns a reference to <code>this</code> for easy method chaining
2885   */
2886  public MedicinalProduct setAttachedDocument(List<Reference> theAttachedDocument) {
2887    this.attachedDocument = theAttachedDocument;
2888    return this;
2889  }
2890
2891  public boolean hasAttachedDocument() {
2892    if (this.attachedDocument == null)
2893      return false;
2894    for (Reference item : this.attachedDocument)
2895      if (!item.isEmpty())
2896        return true;
2897    return false;
2898  }
2899
2900  public Reference addAttachedDocument() { // 3
2901    Reference t = new Reference();
2902    if (this.attachedDocument == null)
2903      this.attachedDocument = new ArrayList<Reference>();
2904    this.attachedDocument.add(t);
2905    return t;
2906  }
2907
2908  public MedicinalProduct addAttachedDocument(Reference t) { // 3
2909    if (t == null)
2910      return this;
2911    if (this.attachedDocument == null)
2912      this.attachedDocument = new ArrayList<Reference>();
2913    this.attachedDocument.add(t);
2914    return this;
2915  }
2916
2917  /**
2918   * @return The first repetition of repeating field {@link #attachedDocument},
2919   *         creating it if it does not already exist
2920   */
2921  public Reference getAttachedDocumentFirstRep() {
2922    if (getAttachedDocument().isEmpty()) {
2923      addAttachedDocument();
2924    }
2925    return getAttachedDocument().get(0);
2926  }
2927
2928  /**
2929   * @return {@link #masterFile} (A master file for to the medicinal product (e.g.
2930   *         Pharmacovigilance System Master File).)
2931   */
2932  public List<Reference> getMasterFile() {
2933    if (this.masterFile == null)
2934      this.masterFile = new ArrayList<Reference>();
2935    return this.masterFile;
2936  }
2937
2938  /**
2939   * @return Returns a reference to <code>this</code> for easy method chaining
2940   */
2941  public MedicinalProduct setMasterFile(List<Reference> theMasterFile) {
2942    this.masterFile = theMasterFile;
2943    return this;
2944  }
2945
2946  public boolean hasMasterFile() {
2947    if (this.masterFile == null)
2948      return false;
2949    for (Reference item : this.masterFile)
2950      if (!item.isEmpty())
2951        return true;
2952    return false;
2953  }
2954
2955  public Reference addMasterFile() { // 3
2956    Reference t = new Reference();
2957    if (this.masterFile == null)
2958      this.masterFile = new ArrayList<Reference>();
2959    this.masterFile.add(t);
2960    return t;
2961  }
2962
2963  public MedicinalProduct addMasterFile(Reference t) { // 3
2964    if (t == null)
2965      return this;
2966    if (this.masterFile == null)
2967      this.masterFile = new ArrayList<Reference>();
2968    this.masterFile.add(t);
2969    return this;
2970  }
2971
2972  /**
2973   * @return The first repetition of repeating field {@link #masterFile}, creating
2974   *         it if it does not already exist
2975   */
2976  public Reference getMasterFileFirstRep() {
2977    if (getMasterFile().isEmpty()) {
2978      addMasterFile();
2979    }
2980    return getMasterFile().get(0);
2981  }
2982
2983  /**
2984   * @return {@link #contact} (A product specific contact, person (in a role), or
2985   *         an organization.)
2986   */
2987  public List<Reference> getContact() {
2988    if (this.contact == null)
2989      this.contact = new ArrayList<Reference>();
2990    return this.contact;
2991  }
2992
2993  /**
2994   * @return Returns a reference to <code>this</code> for easy method chaining
2995   */
2996  public MedicinalProduct setContact(List<Reference> theContact) {
2997    this.contact = theContact;
2998    return this;
2999  }
3000
3001  public boolean hasContact() {
3002    if (this.contact == null)
3003      return false;
3004    for (Reference item : this.contact)
3005      if (!item.isEmpty())
3006        return true;
3007    return false;
3008  }
3009
3010  public Reference addContact() { // 3
3011    Reference t = new Reference();
3012    if (this.contact == null)
3013      this.contact = new ArrayList<Reference>();
3014    this.contact.add(t);
3015    return t;
3016  }
3017
3018  public MedicinalProduct addContact(Reference t) { // 3
3019    if (t == null)
3020      return this;
3021    if (this.contact == null)
3022      this.contact = new ArrayList<Reference>();
3023    this.contact.add(t);
3024    return this;
3025  }
3026
3027  /**
3028   * @return The first repetition of repeating field {@link #contact}, creating it
3029   *         if it does not already exist
3030   */
3031  public Reference getContactFirstRep() {
3032    if (getContact().isEmpty()) {
3033      addContact();
3034    }
3035    return getContact().get(0);
3036  }
3037
3038  /**
3039   * @return {@link #clinicalTrial} (Clinical trials or studies that this product
3040   *         is involved in.)
3041   */
3042  public List<Reference> getClinicalTrial() {
3043    if (this.clinicalTrial == null)
3044      this.clinicalTrial = new ArrayList<Reference>();
3045    return this.clinicalTrial;
3046  }
3047
3048  /**
3049   * @return Returns a reference to <code>this</code> for easy method chaining
3050   */
3051  public MedicinalProduct setClinicalTrial(List<Reference> theClinicalTrial) {
3052    this.clinicalTrial = theClinicalTrial;
3053    return this;
3054  }
3055
3056  public boolean hasClinicalTrial() {
3057    if (this.clinicalTrial == null)
3058      return false;
3059    for (Reference item : this.clinicalTrial)
3060      if (!item.isEmpty())
3061        return true;
3062    return false;
3063  }
3064
3065  public Reference addClinicalTrial() { // 3
3066    Reference t = new Reference();
3067    if (this.clinicalTrial == null)
3068      this.clinicalTrial = new ArrayList<Reference>();
3069    this.clinicalTrial.add(t);
3070    return t;
3071  }
3072
3073  public MedicinalProduct addClinicalTrial(Reference t) { // 3
3074    if (t == null)
3075      return this;
3076    if (this.clinicalTrial == null)
3077      this.clinicalTrial = new ArrayList<Reference>();
3078    this.clinicalTrial.add(t);
3079    return this;
3080  }
3081
3082  /**
3083   * @return The first repetition of repeating field {@link #clinicalTrial},
3084   *         creating it if it does not already exist
3085   */
3086  public Reference getClinicalTrialFirstRep() {
3087    if (getClinicalTrial().isEmpty()) {
3088      addClinicalTrial();
3089    }
3090    return getClinicalTrial().get(0);
3091  }
3092
3093  /**
3094   * @return {@link #name} (The product's name, including full name and possibly
3095   *         coded parts.)
3096   */
3097  public List<MedicinalProductNameComponent> getName() {
3098    if (this.name == null)
3099      this.name = new ArrayList<MedicinalProductNameComponent>();
3100    return this.name;
3101  }
3102
3103  /**
3104   * @return Returns a reference to <code>this</code> for easy method chaining
3105   */
3106  public MedicinalProduct setName(List<MedicinalProductNameComponent> theName) {
3107    this.name = theName;
3108    return this;
3109  }
3110
3111  public boolean hasName() {
3112    if (this.name == null)
3113      return false;
3114    for (MedicinalProductNameComponent item : this.name)
3115      if (!item.isEmpty())
3116        return true;
3117    return false;
3118  }
3119
3120  public MedicinalProductNameComponent addName() { // 3
3121    MedicinalProductNameComponent t = new MedicinalProductNameComponent();
3122    if (this.name == null)
3123      this.name = new ArrayList<MedicinalProductNameComponent>();
3124    this.name.add(t);
3125    return t;
3126  }
3127
3128  public MedicinalProduct addName(MedicinalProductNameComponent t) { // 3
3129    if (t == null)
3130      return this;
3131    if (this.name == null)
3132      this.name = new ArrayList<MedicinalProductNameComponent>();
3133    this.name.add(t);
3134    return this;
3135  }
3136
3137  /**
3138   * @return The first repetition of repeating field {@link #name}, creating it if
3139   *         it does not already exist
3140   */
3141  public MedicinalProductNameComponent getNameFirstRep() {
3142    if (getName().isEmpty()) {
3143      addName();
3144    }
3145    return getName().get(0);
3146  }
3147
3148  /**
3149   * @return {@link #crossReference} (Reference to another product, e.g. for
3150   *         linking authorised to investigational product.)
3151   */
3152  public List<Identifier> getCrossReference() {
3153    if (this.crossReference == null)
3154      this.crossReference = new ArrayList<Identifier>();
3155    return this.crossReference;
3156  }
3157
3158  /**
3159   * @return Returns a reference to <code>this</code> for easy method chaining
3160   */
3161  public MedicinalProduct setCrossReference(List<Identifier> theCrossReference) {
3162    this.crossReference = theCrossReference;
3163    return this;
3164  }
3165
3166  public boolean hasCrossReference() {
3167    if (this.crossReference == null)
3168      return false;
3169    for (Identifier item : this.crossReference)
3170      if (!item.isEmpty())
3171        return true;
3172    return false;
3173  }
3174
3175  public Identifier addCrossReference() { // 3
3176    Identifier t = new Identifier();
3177    if (this.crossReference == null)
3178      this.crossReference = new ArrayList<Identifier>();
3179    this.crossReference.add(t);
3180    return t;
3181  }
3182
3183  public MedicinalProduct addCrossReference(Identifier t) { // 3
3184    if (t == null)
3185      return this;
3186    if (this.crossReference == null)
3187      this.crossReference = new ArrayList<Identifier>();
3188    this.crossReference.add(t);
3189    return this;
3190  }
3191
3192  /**
3193   * @return The first repetition of repeating field {@link #crossReference},
3194   *         creating it if it does not already exist
3195   */
3196  public Identifier getCrossReferenceFirstRep() {
3197    if (getCrossReference().isEmpty()) {
3198      addCrossReference();
3199    }
3200    return getCrossReference().get(0);
3201  }
3202
3203  /**
3204   * @return {@link #manufacturingBusinessOperation} (An operation applied to the
3205   *         product, for manufacturing or adminsitrative purpose.)
3206   */
3207  public List<MedicinalProductManufacturingBusinessOperationComponent> getManufacturingBusinessOperation() {
3208    if (this.manufacturingBusinessOperation == null)
3209      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3210    return this.manufacturingBusinessOperation;
3211  }
3212
3213  /**
3214   * @return Returns a reference to <code>this</code> for easy method chaining
3215   */
3216  public MedicinalProduct setManufacturingBusinessOperation(
3217      List<MedicinalProductManufacturingBusinessOperationComponent> theManufacturingBusinessOperation) {
3218    this.manufacturingBusinessOperation = theManufacturingBusinessOperation;
3219    return this;
3220  }
3221
3222  public boolean hasManufacturingBusinessOperation() {
3223    if (this.manufacturingBusinessOperation == null)
3224      return false;
3225    for (MedicinalProductManufacturingBusinessOperationComponent item : this.manufacturingBusinessOperation)
3226      if (!item.isEmpty())
3227        return true;
3228    return false;
3229  }
3230
3231  public MedicinalProductManufacturingBusinessOperationComponent addManufacturingBusinessOperation() { // 3
3232    MedicinalProductManufacturingBusinessOperationComponent t = new MedicinalProductManufacturingBusinessOperationComponent();
3233    if (this.manufacturingBusinessOperation == null)
3234      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3235    this.manufacturingBusinessOperation.add(t);
3236    return t;
3237  }
3238
3239  public MedicinalProduct addManufacturingBusinessOperation(MedicinalProductManufacturingBusinessOperationComponent t) { // 3
3240    if (t == null)
3241      return this;
3242    if (this.manufacturingBusinessOperation == null)
3243      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3244    this.manufacturingBusinessOperation.add(t);
3245    return this;
3246  }
3247
3248  /**
3249   * @return The first repetition of repeating field
3250   *         {@link #manufacturingBusinessOperation}, creating it if it does not
3251   *         already exist
3252   */
3253  public MedicinalProductManufacturingBusinessOperationComponent getManufacturingBusinessOperationFirstRep() {
3254    if (getManufacturingBusinessOperation().isEmpty()) {
3255      addManufacturingBusinessOperation();
3256    }
3257    return getManufacturingBusinessOperation().get(0);
3258  }
3259
3260  /**
3261   * @return {@link #specialDesignation} (Indicates if the medicinal product has
3262   *         an orphan designation for the treatment of a rare disease.)
3263   */
3264  public List<MedicinalProductSpecialDesignationComponent> getSpecialDesignation() {
3265    if (this.specialDesignation == null)
3266      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3267    return this.specialDesignation;
3268  }
3269
3270  /**
3271   * @return Returns a reference to <code>this</code> for easy method chaining
3272   */
3273  public MedicinalProduct setSpecialDesignation(
3274      List<MedicinalProductSpecialDesignationComponent> theSpecialDesignation) {
3275    this.specialDesignation = theSpecialDesignation;
3276    return this;
3277  }
3278
3279  public boolean hasSpecialDesignation() {
3280    if (this.specialDesignation == null)
3281      return false;
3282    for (MedicinalProductSpecialDesignationComponent item : this.specialDesignation)
3283      if (!item.isEmpty())
3284        return true;
3285    return false;
3286  }
3287
3288  public MedicinalProductSpecialDesignationComponent addSpecialDesignation() { // 3
3289    MedicinalProductSpecialDesignationComponent t = new MedicinalProductSpecialDesignationComponent();
3290    if (this.specialDesignation == null)
3291      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3292    this.specialDesignation.add(t);
3293    return t;
3294  }
3295
3296  public MedicinalProduct addSpecialDesignation(MedicinalProductSpecialDesignationComponent t) { // 3
3297    if (t == null)
3298      return this;
3299    if (this.specialDesignation == null)
3300      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3301    this.specialDesignation.add(t);
3302    return this;
3303  }
3304
3305  /**
3306   * @return The first repetition of repeating field {@link #specialDesignation},
3307   *         creating it if it does not already exist
3308   */
3309  public MedicinalProductSpecialDesignationComponent getSpecialDesignationFirstRep() {
3310    if (getSpecialDesignation().isEmpty()) {
3311      addSpecialDesignation();
3312    }
3313    return getSpecialDesignation().get(0);
3314  }
3315
3316  protected void listChildren(List<Property> children) {
3317    super.listChildren(children);
3318    children.add(new Property("identifier", "Identifier", "Business identifier for this product. Could be an MPID.", 0,
3319        java.lang.Integer.MAX_VALUE, identifier));
3320    children.add(
3321        new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.", 0, 1, type));
3322    children
3323        .add(new Property("domain", "Coding", "If this medicine applies to human or veterinary uses.", 0, 1, domain));
3324    children.add(new Property("combinedPharmaceuticalDoseForm", "CodeableConcept",
3325        "The dose form for a single part product, or combined form of a multiple part product.", 0, 1,
3326        combinedPharmaceuticalDoseForm));
3327    children.add(new Property("legalStatusOfSupply", "CodeableConcept",
3328        "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1,
3329        legalStatusOfSupply));
3330    children.add(new Property("additionalMonitoringIndicator", "CodeableConcept",
3331        "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1,
3332        additionalMonitoringIndicator));
3333    children.add(new Property("specialMeasures", "string",
3334        "Whether the Medicinal Product is subject to special measures for regulatory reasons.", 0,
3335        java.lang.Integer.MAX_VALUE, specialMeasures));
3336    children.add(new Property("paediatricUseIndicator", "CodeableConcept", "If authorised for use in children.", 0, 1,
3337        paediatricUseIndicator));
3338    children.add(new Property("productClassification", "CodeableConcept",
3339        "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE,
3340        productClassification));
3341    children.add(new Property("marketingStatus", "MarketingStatus",
3342        "Marketing status of the medicinal product, in contrast to marketing authorizaton.", 0,
3343        java.lang.Integer.MAX_VALUE, marketingStatus));
3344    children.add(new Property("pharmaceuticalProduct", "Reference(MedicinalProductPharmaceutical)",
3345        "Pharmaceutical aspects of product.", 0, java.lang.Integer.MAX_VALUE, pharmaceuticalProduct));
3346    children.add(new Property("packagedMedicinalProduct", "Reference(MedicinalProductPackaged)",
3347        "Package representation for the product.", 0, java.lang.Integer.MAX_VALUE, packagedMedicinalProduct));
3348    children.add(new Property("attachedDocument", "Reference(DocumentReference)",
3349        "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE,
3350        attachedDocument));
3351    children.add(new Property("masterFile", "Reference(DocumentReference)",
3352        "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).", 0,
3353        java.lang.Integer.MAX_VALUE, masterFile));
3354    children.add(new Property("contact", "Reference(Organization|PractitionerRole)",
3355        "A product specific contact, person (in a role), or an organization.", 0, java.lang.Integer.MAX_VALUE,
3356        contact));
3357    children.add(new Property("clinicalTrial", "Reference(ResearchStudy)",
3358        "Clinical trials or studies that this product is involved in.", 0, java.lang.Integer.MAX_VALUE, clinicalTrial));
3359    children.add(new Property("name", "", "The product's name, including full name and possibly coded parts.", 0,
3360        java.lang.Integer.MAX_VALUE, name));
3361    children.add(new Property("crossReference", "Identifier",
3362        "Reference to another product, e.g. for linking authorised to investigational product.", 0,
3363        java.lang.Integer.MAX_VALUE, crossReference));
3364    children.add(new Property("manufacturingBusinessOperation", "",
3365        "An operation applied to the product, for manufacturing or adminsitrative purpose.", 0,
3366        java.lang.Integer.MAX_VALUE, manufacturingBusinessOperation));
3367    children.add(new Property("specialDesignation", "",
3368        "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0,
3369        java.lang.Integer.MAX_VALUE, specialDesignation));
3370  }
3371
3372  @Override
3373  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3374    switch (_hash) {
3375    case -1618432855:
3376      /* identifier */ return new Property("identifier", "Identifier",
3377          "Business identifier for this product. Could be an MPID.", 0, java.lang.Integer.MAX_VALUE, identifier);
3378    case 3575610:
3379      /* type */ return new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.",
3380          0, 1, type);
3381    case -1326197564:
3382      /* domain */ return new Property("domain", "Coding", "If this medicine applies to human or veterinary uses.", 0,
3383          1, domain);
3384    case -1992898487:
3385      /* combinedPharmaceuticalDoseForm */ return new Property("combinedPharmaceuticalDoseForm", "CodeableConcept",
3386          "The dose form for a single part product, or combined form of a multiple part product.", 0, 1,
3387          combinedPharmaceuticalDoseForm);
3388    case -844874031:
3389      /* legalStatusOfSupply */ return new Property("legalStatusOfSupply", "CodeableConcept",
3390          "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1,
3391          legalStatusOfSupply);
3392    case 1935999744:
3393      /* additionalMonitoringIndicator */ return new Property("additionalMonitoringIndicator", "CodeableConcept",
3394          "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1,
3395          additionalMonitoringIndicator);
3396    case 975102638:
3397      /* specialMeasures */ return new Property("specialMeasures", "string",
3398          "Whether the Medicinal Product is subject to special measures for regulatory reasons.", 0,
3399          java.lang.Integer.MAX_VALUE, specialMeasures);
3400    case -1019867160:
3401      /* paediatricUseIndicator */ return new Property("paediatricUseIndicator", "CodeableConcept",
3402          "If authorised for use in children.", 0, 1, paediatricUseIndicator);
3403    case 1247936181:
3404      /* productClassification */ return new Property("productClassification", "CodeableConcept",
3405          "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE,
3406          productClassification);
3407    case 70767032:
3408      /* marketingStatus */ return new Property("marketingStatus", "MarketingStatus",
3409          "Marketing status of the medicinal product, in contrast to marketing authorizaton.", 0,
3410          java.lang.Integer.MAX_VALUE, marketingStatus);
3411    case 443273260:
3412      /* pharmaceuticalProduct */ return new Property("pharmaceuticalProduct",
3413          "Reference(MedicinalProductPharmaceutical)", "Pharmaceutical aspects of product.", 0,
3414          java.lang.Integer.MAX_VALUE, pharmaceuticalProduct);
3415    case -361025513:
3416      /* packagedMedicinalProduct */ return new Property("packagedMedicinalProduct",
3417          "Reference(MedicinalProductPackaged)", "Package representation for the product.", 0,
3418          java.lang.Integer.MAX_VALUE, packagedMedicinalProduct);
3419    case -513945889:
3420      /* attachedDocument */ return new Property("attachedDocument", "Reference(DocumentReference)",
3421          "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE,
3422          attachedDocument);
3423    case -2039573762:
3424      /* masterFile */ return new Property("masterFile", "Reference(DocumentReference)",
3425          "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).", 0,
3426          java.lang.Integer.MAX_VALUE, masterFile);
3427    case 951526432:
3428      /* contact */ return new Property("contact", "Reference(Organization|PractitionerRole)",
3429          "A product specific contact, person (in a role), or an organization.", 0, java.lang.Integer.MAX_VALUE,
3430          contact);
3431    case 1232866243:
3432      /* clinicalTrial */ return new Property("clinicalTrial", "Reference(ResearchStudy)",
3433          "Clinical trials or studies that this product is involved in.", 0, java.lang.Integer.MAX_VALUE,
3434          clinicalTrial);
3435    case 3373707:
3436      /* name */ return new Property("name", "", "The product's name, including full name and possibly coded parts.", 0,
3437          java.lang.Integer.MAX_VALUE, name);
3438    case -986968341:
3439      /* crossReference */ return new Property("crossReference", "Identifier",
3440          "Reference to another product, e.g. for linking authorised to investigational product.", 0,
3441          java.lang.Integer.MAX_VALUE, crossReference);
3442    case -171103255:
3443      /* manufacturingBusinessOperation */ return new Property("manufacturingBusinessOperation", "",
3444          "An operation applied to the product, for manufacturing or adminsitrative purpose.", 0,
3445          java.lang.Integer.MAX_VALUE, manufacturingBusinessOperation);
3446    case -964310658:
3447      /* specialDesignation */ return new Property("specialDesignation", "",
3448          "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0,
3449          java.lang.Integer.MAX_VALUE, specialDesignation);
3450    default:
3451      return super.getNamedProperty(_hash, _name, _checkValid);
3452    }
3453
3454  }
3455
3456  @Override
3457  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3458    switch (hash) {
3459    case -1618432855:
3460      /* identifier */ return this.identifier == null ? new Base[0]
3461          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3462    case 3575610:
3463      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3464    case -1326197564:
3465      /* domain */ return this.domain == null ? new Base[0] : new Base[] { this.domain }; // Coding
3466    case -1992898487:
3467      /* combinedPharmaceuticalDoseForm */ return this.combinedPharmaceuticalDoseForm == null ? new Base[0]
3468          : new Base[] { this.combinedPharmaceuticalDoseForm }; // CodeableConcept
3469    case -844874031:
3470      /* legalStatusOfSupply */ return this.legalStatusOfSupply == null ? new Base[0]
3471          : new Base[] { this.legalStatusOfSupply }; // CodeableConcept
3472    case 1935999744:
3473      /* additionalMonitoringIndicator */ return this.additionalMonitoringIndicator == null ? new Base[0]
3474          : new Base[] { this.additionalMonitoringIndicator }; // CodeableConcept
3475    case 975102638:
3476      /* specialMeasures */ return this.specialMeasures == null ? new Base[0]
3477          : this.specialMeasures.toArray(new Base[this.specialMeasures.size()]); // StringType
3478    case -1019867160:
3479      /* paediatricUseIndicator */ return this.paediatricUseIndicator == null ? new Base[0]
3480          : new Base[] { this.paediatricUseIndicator }; // CodeableConcept
3481    case 1247936181:
3482      /* productClassification */ return this.productClassification == null ? new Base[0]
3483          : this.productClassification.toArray(new Base[this.productClassification.size()]); // CodeableConcept
3484    case 70767032:
3485      /* marketingStatus */ return this.marketingStatus == null ? new Base[0]
3486          : this.marketingStatus.toArray(new Base[this.marketingStatus.size()]); // MarketingStatus
3487    case 443273260:
3488      /* pharmaceuticalProduct */ return this.pharmaceuticalProduct == null ? new Base[0]
3489          : this.pharmaceuticalProduct.toArray(new Base[this.pharmaceuticalProduct.size()]); // Reference
3490    case -361025513:
3491      /* packagedMedicinalProduct */ return this.packagedMedicinalProduct == null ? new Base[0]
3492          : this.packagedMedicinalProduct.toArray(new Base[this.packagedMedicinalProduct.size()]); // Reference
3493    case -513945889:
3494      /* attachedDocument */ return this.attachedDocument == null ? new Base[0]
3495          : this.attachedDocument.toArray(new Base[this.attachedDocument.size()]); // Reference
3496    case -2039573762:
3497      /* masterFile */ return this.masterFile == null ? new Base[0]
3498          : this.masterFile.toArray(new Base[this.masterFile.size()]); // Reference
3499    case 951526432:
3500      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // Reference
3501    case 1232866243:
3502      /* clinicalTrial */ return this.clinicalTrial == null ? new Base[0]
3503          : this.clinicalTrial.toArray(new Base[this.clinicalTrial.size()]); // Reference
3504    case 3373707:
3505      /* name */ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // MedicinalProductNameComponent
3506    case -986968341:
3507      /* crossReference */ return this.crossReference == null ? new Base[0]
3508          : this.crossReference.toArray(new Base[this.crossReference.size()]); // Identifier
3509    case -171103255:
3510      /* manufacturingBusinessOperation */ return this.manufacturingBusinessOperation == null ? new Base[0]
3511          : this.manufacturingBusinessOperation.toArray(new Base[this.manufacturingBusinessOperation.size()]); // MedicinalProductManufacturingBusinessOperationComponent
3512    case -964310658:
3513      /* specialDesignation */ return this.specialDesignation == null ? new Base[0]
3514          : this.specialDesignation.toArray(new Base[this.specialDesignation.size()]); // MedicinalProductSpecialDesignationComponent
3515    default:
3516      return super.getProperty(hash, name, checkValid);
3517    }
3518
3519  }
3520
3521  @Override
3522  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3523    switch (hash) {
3524    case -1618432855: // identifier
3525      this.getIdentifier().add(castToIdentifier(value)); // Identifier
3526      return value;
3527    case 3575610: // type
3528      this.type = castToCodeableConcept(value); // CodeableConcept
3529      return value;
3530    case -1326197564: // domain
3531      this.domain = castToCoding(value); // Coding
3532      return value;
3533    case -1992898487: // combinedPharmaceuticalDoseForm
3534      this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
3535      return value;
3536    case -844874031: // legalStatusOfSupply
3537      this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
3538      return value;
3539    case 1935999744: // additionalMonitoringIndicator
3540      this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
3541      return value;
3542    case 975102638: // specialMeasures
3543      this.getSpecialMeasures().add(castToString(value)); // StringType
3544      return value;
3545    case -1019867160: // paediatricUseIndicator
3546      this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
3547      return value;
3548    case 1247936181: // productClassification
3549      this.getProductClassification().add(castToCodeableConcept(value)); // CodeableConcept
3550      return value;
3551    case 70767032: // marketingStatus
3552      this.getMarketingStatus().add(castToMarketingStatus(value)); // MarketingStatus
3553      return value;
3554    case 443273260: // pharmaceuticalProduct
3555      this.getPharmaceuticalProduct().add(castToReference(value)); // Reference
3556      return value;
3557    case -361025513: // packagedMedicinalProduct
3558      this.getPackagedMedicinalProduct().add(castToReference(value)); // Reference
3559      return value;
3560    case -513945889: // attachedDocument
3561      this.getAttachedDocument().add(castToReference(value)); // Reference
3562      return value;
3563    case -2039573762: // masterFile
3564      this.getMasterFile().add(castToReference(value)); // Reference
3565      return value;
3566    case 951526432: // contact
3567      this.getContact().add(castToReference(value)); // Reference
3568      return value;
3569    case 1232866243: // clinicalTrial
3570      this.getClinicalTrial().add(castToReference(value)); // Reference
3571      return value;
3572    case 3373707: // name
3573      this.getName().add((MedicinalProductNameComponent) value); // MedicinalProductNameComponent
3574      return value;
3575    case -986968341: // crossReference
3576      this.getCrossReference().add(castToIdentifier(value)); // Identifier
3577      return value;
3578    case -171103255: // manufacturingBusinessOperation
3579      this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value); // MedicinalProductManufacturingBusinessOperationComponent
3580      return value;
3581    case -964310658: // specialDesignation
3582      this.getSpecialDesignation().add((MedicinalProductSpecialDesignationComponent) value); // MedicinalProductSpecialDesignationComponent
3583      return value;
3584    default:
3585      return super.setProperty(hash, name, value);
3586    }
3587
3588  }
3589
3590  @Override
3591  public Base setProperty(String name, Base value) throws FHIRException {
3592    if (name.equals("identifier")) {
3593      this.getIdentifier().add(castToIdentifier(value));
3594    } else if (name.equals("type")) {
3595      this.type = castToCodeableConcept(value); // CodeableConcept
3596    } else if (name.equals("domain")) {
3597      this.domain = castToCoding(value); // Coding
3598    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3599      this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
3600    } else if (name.equals("legalStatusOfSupply")) {
3601      this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
3602    } else if (name.equals("additionalMonitoringIndicator")) {
3603      this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
3604    } else if (name.equals("specialMeasures")) {
3605      this.getSpecialMeasures().add(castToString(value));
3606    } else if (name.equals("paediatricUseIndicator")) {
3607      this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
3608    } else if (name.equals("productClassification")) {
3609      this.getProductClassification().add(castToCodeableConcept(value));
3610    } else if (name.equals("marketingStatus")) {
3611      this.getMarketingStatus().add(castToMarketingStatus(value));
3612    } else if (name.equals("pharmaceuticalProduct")) {
3613      this.getPharmaceuticalProduct().add(castToReference(value));
3614    } else if (name.equals("packagedMedicinalProduct")) {
3615      this.getPackagedMedicinalProduct().add(castToReference(value));
3616    } else if (name.equals("attachedDocument")) {
3617      this.getAttachedDocument().add(castToReference(value));
3618    } else if (name.equals("masterFile")) {
3619      this.getMasterFile().add(castToReference(value));
3620    } else if (name.equals("contact")) {
3621      this.getContact().add(castToReference(value));
3622    } else if (name.equals("clinicalTrial")) {
3623      this.getClinicalTrial().add(castToReference(value));
3624    } else if (name.equals("name")) {
3625      this.getName().add((MedicinalProductNameComponent) value);
3626    } else if (name.equals("crossReference")) {
3627      this.getCrossReference().add(castToIdentifier(value));
3628    } else if (name.equals("manufacturingBusinessOperation")) {
3629      this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value);
3630    } else if (name.equals("specialDesignation")) {
3631      this.getSpecialDesignation().add((MedicinalProductSpecialDesignationComponent) value);
3632    } else
3633      return super.setProperty(name, value);
3634    return value;
3635  }
3636
3637  @Override
3638  public void removeChild(String name, Base value) throws FHIRException {
3639    if (name.equals("identifier")) {
3640      this.getIdentifier().remove(castToIdentifier(value));
3641    } else if (name.equals("type")) {
3642      this.type = null;
3643    } else if (name.equals("domain")) {
3644      this.domain = null;
3645    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3646      this.combinedPharmaceuticalDoseForm = null;
3647    } else if (name.equals("legalStatusOfSupply")) {
3648      this.legalStatusOfSupply = null;
3649    } else if (name.equals("additionalMonitoringIndicator")) {
3650      this.additionalMonitoringIndicator = null;
3651    } else if (name.equals("specialMeasures")) {
3652      this.getSpecialMeasures().remove(castToString(value));
3653    } else if (name.equals("paediatricUseIndicator")) {
3654      this.paediatricUseIndicator = null;
3655    } else if (name.equals("productClassification")) {
3656      this.getProductClassification().remove(castToCodeableConcept(value));
3657    } else if (name.equals("marketingStatus")) {
3658      this.getMarketingStatus().remove(castToMarketingStatus(value));
3659    } else if (name.equals("pharmaceuticalProduct")) {
3660      this.getPharmaceuticalProduct().remove(castToReference(value));
3661    } else if (name.equals("packagedMedicinalProduct")) {
3662      this.getPackagedMedicinalProduct().remove(castToReference(value));
3663    } else if (name.equals("attachedDocument")) {
3664      this.getAttachedDocument().remove(castToReference(value));
3665    } else if (name.equals("masterFile")) {
3666      this.getMasterFile().remove(castToReference(value));
3667    } else if (name.equals("contact")) {
3668      this.getContact().remove(castToReference(value));
3669    } else if (name.equals("clinicalTrial")) {
3670      this.getClinicalTrial().remove(castToReference(value));
3671    } else if (name.equals("name")) {
3672      this.getName().remove((MedicinalProductNameComponent) value);
3673    } else if (name.equals("crossReference")) {
3674      this.getCrossReference().remove(castToIdentifier(value));
3675    } else if (name.equals("manufacturingBusinessOperation")) {
3676      this.getManufacturingBusinessOperation().remove((MedicinalProductManufacturingBusinessOperationComponent) value);
3677    } else if (name.equals("specialDesignation")) {
3678      this.getSpecialDesignation().remove((MedicinalProductSpecialDesignationComponent) value);
3679    } else
3680      super.removeChild(name, value);
3681    
3682  }
3683
3684  @Override
3685  public Base makeProperty(int hash, String name) throws FHIRException {
3686    switch (hash) {
3687    case -1618432855:
3688      return addIdentifier();
3689    case 3575610:
3690      return getType();
3691    case -1326197564:
3692      return getDomain();
3693    case -1992898487:
3694      return getCombinedPharmaceuticalDoseForm();
3695    case -844874031:
3696      return getLegalStatusOfSupply();
3697    case 1935999744:
3698      return getAdditionalMonitoringIndicator();
3699    case 975102638:
3700      return addSpecialMeasuresElement();
3701    case -1019867160:
3702      return getPaediatricUseIndicator();
3703    case 1247936181:
3704      return addProductClassification();
3705    case 70767032:
3706      return addMarketingStatus();
3707    case 443273260:
3708      return addPharmaceuticalProduct();
3709    case -361025513:
3710      return addPackagedMedicinalProduct();
3711    case -513945889:
3712      return addAttachedDocument();
3713    case -2039573762:
3714      return addMasterFile();
3715    case 951526432:
3716      return addContact();
3717    case 1232866243:
3718      return addClinicalTrial();
3719    case 3373707:
3720      return addName();
3721    case -986968341:
3722      return addCrossReference();
3723    case -171103255:
3724      return addManufacturingBusinessOperation();
3725    case -964310658:
3726      return addSpecialDesignation();
3727    default:
3728      return super.makeProperty(hash, name);
3729    }
3730
3731  }
3732
3733  @Override
3734  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3735    switch (hash) {
3736    case -1618432855:
3737      /* identifier */ return new String[] { "Identifier" };
3738    case 3575610:
3739      /* type */ return new String[] { "CodeableConcept" };
3740    case -1326197564:
3741      /* domain */ return new String[] { "Coding" };
3742    case -1992898487:
3743      /* combinedPharmaceuticalDoseForm */ return new String[] { "CodeableConcept" };
3744    case -844874031:
3745      /* legalStatusOfSupply */ return new String[] { "CodeableConcept" };
3746    case 1935999744:
3747      /* additionalMonitoringIndicator */ return new String[] { "CodeableConcept" };
3748    case 975102638:
3749      /* specialMeasures */ return new String[] { "string" };
3750    case -1019867160:
3751      /* paediatricUseIndicator */ return new String[] { "CodeableConcept" };
3752    case 1247936181:
3753      /* productClassification */ return new String[] { "CodeableConcept" };
3754    case 70767032:
3755      /* marketingStatus */ return new String[] { "MarketingStatus" };
3756    case 443273260:
3757      /* pharmaceuticalProduct */ return new String[] { "Reference" };
3758    case -361025513:
3759      /* packagedMedicinalProduct */ return new String[] { "Reference" };
3760    case -513945889:
3761      /* attachedDocument */ return new String[] { "Reference" };
3762    case -2039573762:
3763      /* masterFile */ return new String[] { "Reference" };
3764    case 951526432:
3765      /* contact */ return new String[] { "Reference" };
3766    case 1232866243:
3767      /* clinicalTrial */ return new String[] { "Reference" };
3768    case 3373707:
3769      /* name */ return new String[] {};
3770    case -986968341:
3771      /* crossReference */ return new String[] { "Identifier" };
3772    case -171103255:
3773      /* manufacturingBusinessOperation */ return new String[] {};
3774    case -964310658:
3775      /* specialDesignation */ return new String[] {};
3776    default:
3777      return super.getTypesForProperty(hash, name);
3778    }
3779
3780  }
3781
3782  @Override
3783  public Base addChild(String name) throws FHIRException {
3784    if (name.equals("identifier")) {
3785      return addIdentifier();
3786    } else if (name.equals("type")) {
3787      this.type = new CodeableConcept();
3788      return this.type;
3789    } else if (name.equals("domain")) {
3790      this.domain = new Coding();
3791      return this.domain;
3792    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3793      this.combinedPharmaceuticalDoseForm = new CodeableConcept();
3794      return this.combinedPharmaceuticalDoseForm;
3795    } else if (name.equals("legalStatusOfSupply")) {
3796      this.legalStatusOfSupply = new CodeableConcept();
3797      return this.legalStatusOfSupply;
3798    } else if (name.equals("additionalMonitoringIndicator")) {
3799      this.additionalMonitoringIndicator = new CodeableConcept();
3800      return this.additionalMonitoringIndicator;
3801    } else if (name.equals("specialMeasures")) {
3802      throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.specialMeasures");
3803    } else if (name.equals("paediatricUseIndicator")) {
3804      this.paediatricUseIndicator = new CodeableConcept();
3805      return this.paediatricUseIndicator;
3806    } else if (name.equals("productClassification")) {
3807      return addProductClassification();
3808    } else if (name.equals("marketingStatus")) {
3809      return addMarketingStatus();
3810    } else if (name.equals("pharmaceuticalProduct")) {
3811      return addPharmaceuticalProduct();
3812    } else if (name.equals("packagedMedicinalProduct")) {
3813      return addPackagedMedicinalProduct();
3814    } else if (name.equals("attachedDocument")) {
3815      return addAttachedDocument();
3816    } else if (name.equals("masterFile")) {
3817      return addMasterFile();
3818    } else if (name.equals("contact")) {
3819      return addContact();
3820    } else if (name.equals("clinicalTrial")) {
3821      return addClinicalTrial();
3822    } else if (name.equals("name")) {
3823      return addName();
3824    } else if (name.equals("crossReference")) {
3825      return addCrossReference();
3826    } else if (name.equals("manufacturingBusinessOperation")) {
3827      return addManufacturingBusinessOperation();
3828    } else if (name.equals("specialDesignation")) {
3829      return addSpecialDesignation();
3830    } else
3831      return super.addChild(name);
3832  }
3833
3834  public String fhirType() {
3835    return "MedicinalProduct";
3836
3837  }
3838
3839  public MedicinalProduct copy() {
3840    MedicinalProduct dst = new MedicinalProduct();
3841    copyValues(dst);
3842    return dst;
3843  }
3844
3845  public void copyValues(MedicinalProduct dst) {
3846    super.copyValues(dst);
3847    if (identifier != null) {
3848      dst.identifier = new ArrayList<Identifier>();
3849      for (Identifier i : identifier)
3850        dst.identifier.add(i.copy());
3851    }
3852    ;
3853    dst.type = type == null ? null : type.copy();
3854    dst.domain = domain == null ? null : domain.copy();
3855    dst.combinedPharmaceuticalDoseForm = combinedPharmaceuticalDoseForm == null ? null
3856        : combinedPharmaceuticalDoseForm.copy();
3857    dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
3858    dst.additionalMonitoringIndicator = additionalMonitoringIndicator == null ? null
3859        : additionalMonitoringIndicator.copy();
3860    if (specialMeasures != null) {
3861      dst.specialMeasures = new ArrayList<StringType>();
3862      for (StringType i : specialMeasures)
3863        dst.specialMeasures.add(i.copy());
3864    }
3865    ;
3866    dst.paediatricUseIndicator = paediatricUseIndicator == null ? null : paediatricUseIndicator.copy();
3867    if (productClassification != null) {
3868      dst.productClassification = new ArrayList<CodeableConcept>();
3869      for (CodeableConcept i : productClassification)
3870        dst.productClassification.add(i.copy());
3871    }
3872    ;
3873    if (marketingStatus != null) {
3874      dst.marketingStatus = new ArrayList<MarketingStatus>();
3875      for (MarketingStatus i : marketingStatus)
3876        dst.marketingStatus.add(i.copy());
3877    }
3878    ;
3879    if (pharmaceuticalProduct != null) {
3880      dst.pharmaceuticalProduct = new ArrayList<Reference>();
3881      for (Reference i : pharmaceuticalProduct)
3882        dst.pharmaceuticalProduct.add(i.copy());
3883    }
3884    ;
3885    if (packagedMedicinalProduct != null) {
3886      dst.packagedMedicinalProduct = new ArrayList<Reference>();
3887      for (Reference i : packagedMedicinalProduct)
3888        dst.packagedMedicinalProduct.add(i.copy());
3889    }
3890    ;
3891    if (attachedDocument != null) {
3892      dst.attachedDocument = new ArrayList<Reference>();
3893      for (Reference i : attachedDocument)
3894        dst.attachedDocument.add(i.copy());
3895    }
3896    ;
3897    if (masterFile != null) {
3898      dst.masterFile = new ArrayList<Reference>();
3899      for (Reference i : masterFile)
3900        dst.masterFile.add(i.copy());
3901    }
3902    ;
3903    if (contact != null) {
3904      dst.contact = new ArrayList<Reference>();
3905      for (Reference i : contact)
3906        dst.contact.add(i.copy());
3907    }
3908    ;
3909    if (clinicalTrial != null) {
3910      dst.clinicalTrial = new ArrayList<Reference>();
3911      for (Reference i : clinicalTrial)
3912        dst.clinicalTrial.add(i.copy());
3913    }
3914    ;
3915    if (name != null) {
3916      dst.name = new ArrayList<MedicinalProductNameComponent>();
3917      for (MedicinalProductNameComponent i : name)
3918        dst.name.add(i.copy());
3919    }
3920    ;
3921    if (crossReference != null) {
3922      dst.crossReference = new ArrayList<Identifier>();
3923      for (Identifier i : crossReference)
3924        dst.crossReference.add(i.copy());
3925    }
3926    ;
3927    if (manufacturingBusinessOperation != null) {
3928      dst.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3929      for (MedicinalProductManufacturingBusinessOperationComponent i : manufacturingBusinessOperation)
3930        dst.manufacturingBusinessOperation.add(i.copy());
3931    }
3932    ;
3933    if (specialDesignation != null) {
3934      dst.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3935      for (MedicinalProductSpecialDesignationComponent i : specialDesignation)
3936        dst.specialDesignation.add(i.copy());
3937    }
3938    ;
3939  }
3940
3941  protected MedicinalProduct typedCopy() {
3942    return copy();
3943  }
3944
3945  @Override
3946  public boolean equalsDeep(Base other_) {
3947    if (!super.equalsDeep(other_))
3948      return false;
3949    if (!(other_ instanceof MedicinalProduct))
3950      return false;
3951    MedicinalProduct o = (MedicinalProduct) other_;
3952    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
3953        && compareDeep(domain, o.domain, true)
3954        && compareDeep(combinedPharmaceuticalDoseForm, o.combinedPharmaceuticalDoseForm, true)
3955        && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true)
3956        && compareDeep(additionalMonitoringIndicator, o.additionalMonitoringIndicator, true)
3957        && compareDeep(specialMeasures, o.specialMeasures, true)
3958        && compareDeep(paediatricUseIndicator, o.paediatricUseIndicator, true)
3959        && compareDeep(productClassification, o.productClassification, true)
3960        && compareDeep(marketingStatus, o.marketingStatus, true)
3961        && compareDeep(pharmaceuticalProduct, o.pharmaceuticalProduct, true)
3962        && compareDeep(packagedMedicinalProduct, o.packagedMedicinalProduct, true)
3963        && compareDeep(attachedDocument, o.attachedDocument, true) && compareDeep(masterFile, o.masterFile, true)
3964        && compareDeep(contact, o.contact, true) && compareDeep(clinicalTrial, o.clinicalTrial, true)
3965        && compareDeep(name, o.name, true) && compareDeep(crossReference, o.crossReference, true)
3966        && compareDeep(manufacturingBusinessOperation, o.manufacturingBusinessOperation, true)
3967        && compareDeep(specialDesignation, o.specialDesignation, true);
3968  }
3969
3970  @Override
3971  public boolean equalsShallow(Base other_) {
3972    if (!super.equalsShallow(other_))
3973      return false;
3974    if (!(other_ instanceof MedicinalProduct))
3975      return false;
3976    MedicinalProduct o = (MedicinalProduct) other_;
3977    return compareValues(specialMeasures, o.specialMeasures, true);
3978  }
3979
3980  public boolean isEmpty() {
3981    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, domain,
3982        combinedPharmaceuticalDoseForm, legalStatusOfSupply, additionalMonitoringIndicator, specialMeasures,
3983        paediatricUseIndicator, productClassification, marketingStatus, pharmaceuticalProduct, packagedMedicinalProduct,
3984        attachedDocument, masterFile, contact, clinicalTrial, name, crossReference, manufacturingBusinessOperation,
3985        specialDesignation);
3986  }
3987
3988  @Override
3989  public ResourceType getResourceType() {
3990    return ResourceType.MedicinalProduct;
3991  }
3992
3993  /**
3994   * Search parameter: <b>identifier</b>
3995   * <p>
3996   * Description: <b>Business identifier for this product. Could be an
3997   * MPID</b><br>
3998   * Type: <b>token</b><br>
3999   * Path: <b>MedicinalProduct.identifier</b><br>
4000   * </p>
4001   */
4002  @SearchParamDefinition(name = "identifier", path = "MedicinalProduct.identifier", description = "Business identifier for this product. Could be an MPID", type = "token")
4003  public static final String SP_IDENTIFIER = "identifier";
4004  /**
4005   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4006   * <p>
4007   * Description: <b>Business identifier for this product. Could be an
4008   * MPID</b><br>
4009   * Type: <b>token</b><br>
4010   * Path: <b>MedicinalProduct.identifier</b><br>
4011   * </p>
4012   */
4013  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4014      SP_IDENTIFIER);
4015
4016  /**
4017   * Search parameter: <b>name</b>
4018   * <p>
4019   * Description: <b>The full product name</b><br>
4020   * Type: <b>string</b><br>
4021   * Path: <b>MedicinalProduct.name.productName</b><br>
4022   * </p>
4023   */
4024  @SearchParamDefinition(name = "name", path = "MedicinalProduct.name.productName", description = "The full product name", type = "string")
4025  public static final String SP_NAME = "name";
4026  /**
4027   * <b>Fluent Client</b> search parameter constant for <b>name</b>
4028   * <p>
4029   * Description: <b>The full product name</b><br>
4030   * Type: <b>string</b><br>
4031   * Path: <b>MedicinalProduct.name.productName</b><br>
4032   * </p>
4033   */
4034  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
4035      SP_NAME);
4036
4037  /**
4038   * Search parameter: <b>name-language</b>
4039   * <p>
4040   * Description: <b>Language code for this name</b><br>
4041   * Type: <b>token</b><br>
4042   * Path: <b>MedicinalProduct.name.countryLanguage.language</b><br>
4043   * </p>
4044   */
4045  @SearchParamDefinition(name = "name-language", path = "MedicinalProduct.name.countryLanguage.language", description = "Language code for this name", type = "token")
4046  public static final String SP_NAME_LANGUAGE = "name-language";
4047  /**
4048   * <b>Fluent Client</b> search parameter constant for <b>name-language</b>
4049   * <p>
4050   * Description: <b>Language code for this name</b><br>
4051   * Type: <b>token</b><br>
4052   * Path: <b>MedicinalProduct.name.countryLanguage.language</b><br>
4053   * </p>
4054   */
4055  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NAME_LANGUAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4056      SP_NAME_LANGUAGE);
4057
4058}