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     * @deprecated Use Reference#setResource(IBaseResource) instead
1252     */
1253    @Deprecated
1254    public List<Organization> getManufacturerTarget() {
1255      if (this.manufacturerTarget == null)
1256        this.manufacturerTarget = new ArrayList<Organization>();
1257      return this.manufacturerTarget;
1258    }
1259
1260    /**
1261     * @deprecated Use Reference#setResource(IBaseResource) instead
1262     */
1263    @Deprecated
1264    public Organization addManufacturerTarget() {
1265      Organization r = new Organization();
1266      if (this.manufacturerTarget == null)
1267        this.manufacturerTarget = new ArrayList<Organization>();
1268      this.manufacturerTarget.add(r);
1269      return r;
1270    }
1271
1272    /**
1273     * @return {@link #regulator} (A regulator which oversees the operation.)
1274     */
1275    public Reference getRegulator() {
1276      if (this.regulator == null)
1277        if (Configuration.errorOnAutoCreate())
1278          throw new Error("Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.regulator");
1279        else if (Configuration.doAutoCreate())
1280          this.regulator = new Reference(); // cc
1281      return this.regulator;
1282    }
1283
1284    public boolean hasRegulator() {
1285      return this.regulator != null && !this.regulator.isEmpty();
1286    }
1287
1288    /**
1289     * @param value {@link #regulator} (A regulator which oversees the operation.)
1290     */
1291    public MedicinalProductManufacturingBusinessOperationComponent setRegulator(Reference value) {
1292      this.regulator = value;
1293      return this;
1294    }
1295
1296    /**
1297     * @return {@link #regulator} The actual object that is the target of the
1298     *         reference. The reference library doesn't populate this, but you can
1299     *         use it to hold the resource if you resolve it. (A regulator which
1300     *         oversees the operation.)
1301     */
1302    public Organization getRegulatorTarget() {
1303      if (this.regulatorTarget == null)
1304        if (Configuration.errorOnAutoCreate())
1305          throw new Error("Attempt to auto-create MedicinalProductManufacturingBusinessOperationComponent.regulator");
1306        else if (Configuration.doAutoCreate())
1307          this.regulatorTarget = new Organization(); // aa
1308      return this.regulatorTarget;
1309    }
1310
1311    /**
1312     * @param value {@link #regulator} The actual object that is the target of the
1313     *              reference. The reference library doesn't use these, but you can
1314     *              use it to hold the resource if you resolve it. (A regulator
1315     *              which oversees the operation.)
1316     */
1317    public MedicinalProductManufacturingBusinessOperationComponent setRegulatorTarget(Organization value) {
1318      this.regulatorTarget = value;
1319      return this;
1320    }
1321
1322    protected void listChildren(List<Property> children) {
1323      super.listChildren(children);
1324      children.add(new Property("operationType", "CodeableConcept", "The type of manufacturing operation.", 0, 1,
1325          operationType));
1326      children.add(new Property("authorisationReferenceNumber", "Identifier",
1327          "Regulatory authorization reference number.", 0, 1, authorisationReferenceNumber));
1328      children.add(new Property("effectiveDate", "dateTime", "Regulatory authorization date.", 0, 1, effectiveDate));
1329      children.add(new Property("confidentialityIndicator", "CodeableConcept",
1330          "To indicate if this proces is commercially confidential.", 0, 1, confidentialityIndicator));
1331      children.add(new Property("manufacturer", "Reference(Organization)",
1332          "The manufacturer or establishment associated with the process.", 0, java.lang.Integer.MAX_VALUE,
1333          manufacturer));
1334      children.add(new Property("regulator", "Reference(Organization)", "A regulator which oversees the operation.", 0,
1335          1, regulator));
1336    }
1337
1338    @Override
1339    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1340      switch (_hash) {
1341      case 91999553:
1342        /* operationType */ return new Property("operationType", "CodeableConcept",
1343            "The type of manufacturing operation.", 0, 1, operationType);
1344      case -1940839884:
1345        /* authorisationReferenceNumber */ return new Property("authorisationReferenceNumber", "Identifier",
1346            "Regulatory authorization reference number.", 0, 1, authorisationReferenceNumber);
1347      case -930389515:
1348        /* effectiveDate */ return new Property("effectiveDate", "dateTime", "Regulatory authorization date.", 0, 1,
1349            effectiveDate);
1350      case -1449404791:
1351        /* confidentialityIndicator */ return new Property("confidentialityIndicator", "CodeableConcept",
1352            "To indicate if this proces is commercially confidential.", 0, 1, confidentialityIndicator);
1353      case -1969347631:
1354        /* manufacturer */ return new Property("manufacturer", "Reference(Organization)",
1355            "The manufacturer or establishment associated with the process.", 0, java.lang.Integer.MAX_VALUE,
1356            manufacturer);
1357      case 414760449:
1358        /* regulator */ return new Property("regulator", "Reference(Organization)",
1359            "A regulator which oversees the operation.", 0, 1, regulator);
1360      default:
1361        return super.getNamedProperty(_hash, _name, _checkValid);
1362      }
1363
1364    }
1365
1366    @Override
1367    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1368      switch (hash) {
1369      case 91999553:
1370        /* operationType */ return this.operationType == null ? new Base[0] : new Base[] { this.operationType }; // CodeableConcept
1371      case -1940839884:
1372        /* authorisationReferenceNumber */ return this.authorisationReferenceNumber == null ? new Base[0]
1373            : new Base[] { this.authorisationReferenceNumber }; // Identifier
1374      case -930389515:
1375        /* effectiveDate */ return this.effectiveDate == null ? new Base[0] : new Base[] { this.effectiveDate }; // DateTimeType
1376      case -1449404791:
1377        /* confidentialityIndicator */ return this.confidentialityIndicator == null ? new Base[0]
1378            : new Base[] { this.confidentialityIndicator }; // CodeableConcept
1379      case -1969347631:
1380        /* manufacturer */ return this.manufacturer == null ? new Base[0]
1381            : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
1382      case 414760449:
1383        /* regulator */ return this.regulator == null ? new Base[0] : new Base[] { this.regulator }; // Reference
1384      default:
1385        return super.getProperty(hash, name, checkValid);
1386      }
1387
1388    }
1389
1390    @Override
1391    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1392      switch (hash) {
1393      case 91999553: // operationType
1394        this.operationType = castToCodeableConcept(value); // CodeableConcept
1395        return value;
1396      case -1940839884: // authorisationReferenceNumber
1397        this.authorisationReferenceNumber = castToIdentifier(value); // Identifier
1398        return value;
1399      case -930389515: // effectiveDate
1400        this.effectiveDate = castToDateTime(value); // DateTimeType
1401        return value;
1402      case -1449404791: // confidentialityIndicator
1403        this.confidentialityIndicator = castToCodeableConcept(value); // CodeableConcept
1404        return value;
1405      case -1969347631: // manufacturer
1406        this.getManufacturer().add(castToReference(value)); // Reference
1407        return value;
1408      case 414760449: // regulator
1409        this.regulator = castToReference(value); // Reference
1410        return value;
1411      default:
1412        return super.setProperty(hash, name, value);
1413      }
1414
1415    }
1416
1417    @Override
1418    public Base setProperty(String name, Base value) throws FHIRException {
1419      if (name.equals("operationType")) {
1420        this.operationType = castToCodeableConcept(value); // CodeableConcept
1421      } else if (name.equals("authorisationReferenceNumber")) {
1422        this.authorisationReferenceNumber = castToIdentifier(value); // Identifier
1423      } else if (name.equals("effectiveDate")) {
1424        this.effectiveDate = castToDateTime(value); // DateTimeType
1425      } else if (name.equals("confidentialityIndicator")) {
1426        this.confidentialityIndicator = castToCodeableConcept(value); // CodeableConcept
1427      } else if (name.equals("manufacturer")) {
1428        this.getManufacturer().add(castToReference(value));
1429      } else if (name.equals("regulator")) {
1430        this.regulator = castToReference(value); // Reference
1431      } else
1432        return super.setProperty(name, value);
1433      return value;
1434    }
1435
1436  @Override
1437  public void removeChild(String name, Base value) throws FHIRException {
1438      if (name.equals("operationType")) {
1439        this.operationType = null;
1440      } else if (name.equals("authorisationReferenceNumber")) {
1441        this.authorisationReferenceNumber = null;
1442      } else if (name.equals("effectiveDate")) {
1443        this.effectiveDate = null;
1444      } else if (name.equals("confidentialityIndicator")) {
1445        this.confidentialityIndicator = null;
1446      } else if (name.equals("manufacturer")) {
1447        this.getManufacturer().remove(castToReference(value));
1448      } else if (name.equals("regulator")) {
1449        this.regulator = null;
1450      } else
1451        super.removeChild(name, value);
1452      
1453    }
1454
1455    @Override
1456    public Base makeProperty(int hash, String name) throws FHIRException {
1457      switch (hash) {
1458      case 91999553:
1459        return getOperationType();
1460      case -1940839884:
1461        return getAuthorisationReferenceNumber();
1462      case -930389515:
1463        return getEffectiveDateElement();
1464      case -1449404791:
1465        return getConfidentialityIndicator();
1466      case -1969347631:
1467        return addManufacturer();
1468      case 414760449:
1469        return getRegulator();
1470      default:
1471        return super.makeProperty(hash, name);
1472      }
1473
1474    }
1475
1476    @Override
1477    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1478      switch (hash) {
1479      case 91999553:
1480        /* operationType */ return new String[] { "CodeableConcept" };
1481      case -1940839884:
1482        /* authorisationReferenceNumber */ return new String[] { "Identifier" };
1483      case -930389515:
1484        /* effectiveDate */ return new String[] { "dateTime" };
1485      case -1449404791:
1486        /* confidentialityIndicator */ return new String[] { "CodeableConcept" };
1487      case -1969347631:
1488        /* manufacturer */ return new String[] { "Reference" };
1489      case 414760449:
1490        /* regulator */ return new String[] { "Reference" };
1491      default:
1492        return super.getTypesForProperty(hash, name);
1493      }
1494
1495    }
1496
1497    @Override
1498    public Base addChild(String name) throws FHIRException {
1499      if (name.equals("operationType")) {
1500        this.operationType = new CodeableConcept();
1501        return this.operationType;
1502      } else if (name.equals("authorisationReferenceNumber")) {
1503        this.authorisationReferenceNumber = new Identifier();
1504        return this.authorisationReferenceNumber;
1505      } else if (name.equals("effectiveDate")) {
1506        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.effectiveDate");
1507      } else if (name.equals("confidentialityIndicator")) {
1508        this.confidentialityIndicator = new CodeableConcept();
1509        return this.confidentialityIndicator;
1510      } else if (name.equals("manufacturer")) {
1511        return addManufacturer();
1512      } else if (name.equals("regulator")) {
1513        this.regulator = new Reference();
1514        return this.regulator;
1515      } else
1516        return super.addChild(name);
1517    }
1518
1519    public MedicinalProductManufacturingBusinessOperationComponent copy() {
1520      MedicinalProductManufacturingBusinessOperationComponent dst = new MedicinalProductManufacturingBusinessOperationComponent();
1521      copyValues(dst);
1522      return dst;
1523    }
1524
1525    public void copyValues(MedicinalProductManufacturingBusinessOperationComponent dst) {
1526      super.copyValues(dst);
1527      dst.operationType = operationType == null ? null : operationType.copy();
1528      dst.authorisationReferenceNumber = authorisationReferenceNumber == null ? null
1529          : authorisationReferenceNumber.copy();
1530      dst.effectiveDate = effectiveDate == null ? null : effectiveDate.copy();
1531      dst.confidentialityIndicator = confidentialityIndicator == null ? null : confidentialityIndicator.copy();
1532      if (manufacturer != null) {
1533        dst.manufacturer = new ArrayList<Reference>();
1534        for (Reference i : manufacturer)
1535          dst.manufacturer.add(i.copy());
1536      }
1537      ;
1538      dst.regulator = regulator == null ? null : regulator.copy();
1539    }
1540
1541    @Override
1542    public boolean equalsDeep(Base other_) {
1543      if (!super.equalsDeep(other_))
1544        return false;
1545      if (!(other_ instanceof MedicinalProductManufacturingBusinessOperationComponent))
1546        return false;
1547      MedicinalProductManufacturingBusinessOperationComponent o = (MedicinalProductManufacturingBusinessOperationComponent) other_;
1548      return compareDeep(operationType, o.operationType, true)
1549          && compareDeep(authorisationReferenceNumber, o.authorisationReferenceNumber, true)
1550          && compareDeep(effectiveDate, o.effectiveDate, true)
1551          && compareDeep(confidentialityIndicator, o.confidentialityIndicator, true)
1552          && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(regulator, o.regulator, true);
1553    }
1554
1555    @Override
1556    public boolean equalsShallow(Base other_) {
1557      if (!super.equalsShallow(other_))
1558        return false;
1559      if (!(other_ instanceof MedicinalProductManufacturingBusinessOperationComponent))
1560        return false;
1561      MedicinalProductManufacturingBusinessOperationComponent o = (MedicinalProductManufacturingBusinessOperationComponent) other_;
1562      return compareValues(effectiveDate, o.effectiveDate, true);
1563    }
1564
1565    public boolean isEmpty() {
1566      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(operationType, authorisationReferenceNumber,
1567          effectiveDate, confidentialityIndicator, manufacturer, regulator);
1568    }
1569
1570    public String fhirType() {
1571      return "MedicinalProduct.manufacturingBusinessOperation";
1572
1573    }
1574
1575  }
1576
1577  @Block()
1578  public static class MedicinalProductSpecialDesignationComponent extends BackboneElement
1579      implements IBaseBackboneElement {
1580    /**
1581     * Identifier for the designation, or procedure number.
1582     */
1583    @Child(name = "identifier", type = {
1584        Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1585    @Description(shortDefinition = "Identifier for the designation, or procedure number", formalDefinition = "Identifier for the designation, or procedure number.")
1586    protected List<Identifier> identifier;
1587
1588    /**
1589     * The type of special designation, e.g. orphan drug, minor use.
1590     */
1591    @Child(name = "type", type = {
1592        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1593    @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.")
1594    protected CodeableConcept type;
1595
1596    /**
1597     * The intended use of the product, e.g. prevention, treatment.
1598     */
1599    @Child(name = "intendedUse", type = {
1600        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1601    @Description(shortDefinition = "The intended use of the product, e.g. prevention, treatment", formalDefinition = "The intended use of the product, e.g. prevention, treatment.")
1602    protected CodeableConcept intendedUse;
1603
1604    /**
1605     * Condition for which the medicinal use applies.
1606     */
1607    @Child(name = "indication", type = { CodeableConcept.class,
1608        MedicinalProductIndication.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1609    @Description(shortDefinition = "Condition for which the medicinal use applies", formalDefinition = "Condition for which the medicinal use applies.")
1610    protected Type indication;
1611
1612    /**
1613     * For example granted, pending, expired or withdrawn.
1614     */
1615    @Child(name = "status", type = {
1616        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1617    @Description(shortDefinition = "For example granted, pending, expired or withdrawn", formalDefinition = "For example granted, pending, expired or withdrawn.")
1618    protected CodeableConcept status;
1619
1620    /**
1621     * Date when the designation was granted.
1622     */
1623    @Child(name = "date", type = { DateTimeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1624    @Description(shortDefinition = "Date when the designation was granted", formalDefinition = "Date when the designation was granted.")
1625    protected DateTimeType date;
1626
1627    /**
1628     * Animal species for which this applies.
1629     */
1630    @Child(name = "species", type = {
1631        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1632    @Description(shortDefinition = "Animal species for which this applies", formalDefinition = "Animal species for which this applies.")
1633    protected CodeableConcept species;
1634
1635    private static final long serialVersionUID = -1316809207L;
1636
1637    /**
1638     * Constructor
1639     */
1640    public MedicinalProductSpecialDesignationComponent() {
1641      super();
1642    }
1643
1644    /**
1645     * @return {@link #identifier} (Identifier for the designation, or procedure
1646     *         number.)
1647     */
1648    public List<Identifier> getIdentifier() {
1649      if (this.identifier == null)
1650        this.identifier = new ArrayList<Identifier>();
1651      return this.identifier;
1652    }
1653
1654    /**
1655     * @return Returns a reference to <code>this</code> for easy method chaining
1656     */
1657    public MedicinalProductSpecialDesignationComponent setIdentifier(List<Identifier> theIdentifier) {
1658      this.identifier = theIdentifier;
1659      return this;
1660    }
1661
1662    public boolean hasIdentifier() {
1663      if (this.identifier == null)
1664        return false;
1665      for (Identifier item : this.identifier)
1666        if (!item.isEmpty())
1667          return true;
1668      return false;
1669    }
1670
1671    public Identifier addIdentifier() { // 3
1672      Identifier t = new Identifier();
1673      if (this.identifier == null)
1674        this.identifier = new ArrayList<Identifier>();
1675      this.identifier.add(t);
1676      return t;
1677    }
1678
1679    public MedicinalProductSpecialDesignationComponent addIdentifier(Identifier t) { // 3
1680      if (t == null)
1681        return this;
1682      if (this.identifier == null)
1683        this.identifier = new ArrayList<Identifier>();
1684      this.identifier.add(t);
1685      return this;
1686    }
1687
1688    /**
1689     * @return The first repetition of repeating field {@link #identifier}, creating
1690     *         it if it does not already exist
1691     */
1692    public Identifier getIdentifierFirstRep() {
1693      if (getIdentifier().isEmpty()) {
1694        addIdentifier();
1695      }
1696      return getIdentifier().get(0);
1697    }
1698
1699    /**
1700     * @return {@link #type} (The type of special designation, e.g. orphan drug,
1701     *         minor use.)
1702     */
1703    public CodeableConcept getType() {
1704      if (this.type == null)
1705        if (Configuration.errorOnAutoCreate())
1706          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.type");
1707        else if (Configuration.doAutoCreate())
1708          this.type = new CodeableConcept(); // cc
1709      return this.type;
1710    }
1711
1712    public boolean hasType() {
1713      return this.type != null && !this.type.isEmpty();
1714    }
1715
1716    /**
1717     * @param value {@link #type} (The type of special designation, e.g. orphan
1718     *              drug, minor use.)
1719     */
1720    public MedicinalProductSpecialDesignationComponent setType(CodeableConcept value) {
1721      this.type = value;
1722      return this;
1723    }
1724
1725    /**
1726     * @return {@link #intendedUse} (The intended use of the product, e.g.
1727     *         prevention, treatment.)
1728     */
1729    public CodeableConcept getIntendedUse() {
1730      if (this.intendedUse == null)
1731        if (Configuration.errorOnAutoCreate())
1732          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.intendedUse");
1733        else if (Configuration.doAutoCreate())
1734          this.intendedUse = new CodeableConcept(); // cc
1735      return this.intendedUse;
1736    }
1737
1738    public boolean hasIntendedUse() {
1739      return this.intendedUse != null && !this.intendedUse.isEmpty();
1740    }
1741
1742    /**
1743     * @param value {@link #intendedUse} (The intended use of the product, e.g.
1744     *              prevention, treatment.)
1745     */
1746    public MedicinalProductSpecialDesignationComponent setIntendedUse(CodeableConcept value) {
1747      this.intendedUse = value;
1748      return this;
1749    }
1750
1751    /**
1752     * @return {@link #indication} (Condition for which the medicinal use applies.)
1753     */
1754    public Type getIndication() {
1755      return this.indication;
1756    }
1757
1758    /**
1759     * @return {@link #indication} (Condition for which the medicinal use applies.)
1760     */
1761    public CodeableConcept getIndicationCodeableConcept() throws FHIRException {
1762      if (this.indication == null)
1763        this.indication = new CodeableConcept();
1764      if (!(this.indication instanceof CodeableConcept))
1765        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1766            + this.indication.getClass().getName() + " was encountered");
1767      return (CodeableConcept) this.indication;
1768    }
1769
1770    public boolean hasIndicationCodeableConcept() {
1771      return this != null && this.indication instanceof CodeableConcept;
1772    }
1773
1774    /**
1775     * @return {@link #indication} (Condition for which the medicinal use applies.)
1776     */
1777    public Reference getIndicationReference() throws FHIRException {
1778      if (this.indication == null)
1779        this.indication = new Reference();
1780      if (!(this.indication instanceof Reference))
1781        throw new FHIRException("Type mismatch: the type Reference was expected, but "
1782            + this.indication.getClass().getName() + " was encountered");
1783      return (Reference) this.indication;
1784    }
1785
1786    public boolean hasIndicationReference() {
1787      return this != null && this.indication instanceof Reference;
1788    }
1789
1790    public boolean hasIndication() {
1791      return this.indication != null && !this.indication.isEmpty();
1792    }
1793
1794    /**
1795     * @param value {@link #indication} (Condition for which the medicinal use
1796     *              applies.)
1797     */
1798    public MedicinalProductSpecialDesignationComponent setIndication(Type value) {
1799      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1800        throw new Error(
1801            "Not the right type for MedicinalProduct.specialDesignation.indication[x]: " + value.fhirType());
1802      this.indication = value;
1803      return this;
1804    }
1805
1806    /**
1807     * @return {@link #status} (For example granted, pending, expired or withdrawn.)
1808     */
1809    public CodeableConcept getStatus() {
1810      if (this.status == null)
1811        if (Configuration.errorOnAutoCreate())
1812          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.status");
1813        else if (Configuration.doAutoCreate())
1814          this.status = new CodeableConcept(); // cc
1815      return this.status;
1816    }
1817
1818    public boolean hasStatus() {
1819      return this.status != null && !this.status.isEmpty();
1820    }
1821
1822    /**
1823     * @param value {@link #status} (For example granted, pending, expired or
1824     *              withdrawn.)
1825     */
1826    public MedicinalProductSpecialDesignationComponent setStatus(CodeableConcept value) {
1827      this.status = value;
1828      return this;
1829    }
1830
1831    /**
1832     * @return {@link #date} (Date when the designation was granted.). This is the
1833     *         underlying object with id, value and extensions. The accessor
1834     *         "getDate" gives direct access to the value
1835     */
1836    public DateTimeType getDateElement() {
1837      if (this.date == null)
1838        if (Configuration.errorOnAutoCreate())
1839          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.date");
1840        else if (Configuration.doAutoCreate())
1841          this.date = new DateTimeType(); // bb
1842      return this.date;
1843    }
1844
1845    public boolean hasDateElement() {
1846      return this.date != null && !this.date.isEmpty();
1847    }
1848
1849    public boolean hasDate() {
1850      return this.date != null && !this.date.isEmpty();
1851    }
1852
1853    /**
1854     * @param value {@link #date} (Date when the designation was granted.). This is
1855     *              the underlying object with id, value and extensions. The
1856     *              accessor "getDate" gives direct access to the value
1857     */
1858    public MedicinalProductSpecialDesignationComponent setDateElement(DateTimeType value) {
1859      this.date = value;
1860      return this;
1861    }
1862
1863    /**
1864     * @return Date when the designation was granted.
1865     */
1866    public Date getDate() {
1867      return this.date == null ? null : this.date.getValue();
1868    }
1869
1870    /**
1871     * @param value Date when the designation was granted.
1872     */
1873    public MedicinalProductSpecialDesignationComponent setDate(Date value) {
1874      if (value == null)
1875        this.date = null;
1876      else {
1877        if (this.date == null)
1878          this.date = new DateTimeType();
1879        this.date.setValue(value);
1880      }
1881      return this;
1882    }
1883
1884    /**
1885     * @return {@link #species} (Animal species for which this applies.)
1886     */
1887    public CodeableConcept getSpecies() {
1888      if (this.species == null)
1889        if (Configuration.errorOnAutoCreate())
1890          throw new Error("Attempt to auto-create MedicinalProductSpecialDesignationComponent.species");
1891        else if (Configuration.doAutoCreate())
1892          this.species = new CodeableConcept(); // cc
1893      return this.species;
1894    }
1895
1896    public boolean hasSpecies() {
1897      return this.species != null && !this.species.isEmpty();
1898    }
1899
1900    /**
1901     * @param value {@link #species} (Animal species for which this applies.)
1902     */
1903    public MedicinalProductSpecialDesignationComponent setSpecies(CodeableConcept value) {
1904      this.species = value;
1905      return this;
1906    }
1907
1908    protected void listChildren(List<Property> children) {
1909      super.listChildren(children);
1910      children.add(new Property("identifier", "Identifier", "Identifier for the designation, or procedure number.", 0,
1911          java.lang.Integer.MAX_VALUE, identifier));
1912      children.add(new Property("type", "CodeableConcept",
1913          "The type of special designation, e.g. orphan drug, minor use.", 0, 1, type));
1914      children.add(new Property("intendedUse", "CodeableConcept",
1915          "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse));
1916      children.add(new Property("indication[x]", "CodeableConcept|Reference(MedicinalProductIndication)",
1917          "Condition for which the medicinal use applies.", 0, 1, indication));
1918      children.add(new Property("status", "CodeableConcept", "For example granted, pending, expired or withdrawn.", 0,
1919          1, status));
1920      children.add(new Property("date", "dateTime", "Date when the designation was granted.", 0, 1, date));
1921      children.add(new Property("species", "CodeableConcept", "Animal species for which this applies.", 0, 1, species));
1922    }
1923
1924    @Override
1925    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1926      switch (_hash) {
1927      case -1618432855:
1928        /* identifier */ return new Property("identifier", "Identifier",
1929            "Identifier for the designation, or procedure number.", 0, java.lang.Integer.MAX_VALUE, identifier);
1930      case 3575610:
1931        /* type */ return new Property("type", "CodeableConcept",
1932            "The type of special designation, e.g. orphan drug, minor use.", 0, 1, type);
1933      case -1618671268:
1934        /* intendedUse */ return new Property("intendedUse", "CodeableConcept",
1935            "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse);
1936      case -501208668:
1937        /* indication[x] */ return new Property("indication[x]",
1938            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1939            0, 1, indication);
1940      case -597168804:
1941        /* indication */ return new Property("indication[x]", "CodeableConcept|Reference(MedicinalProductIndication)",
1942            "Condition for which the medicinal use applies.", 0, 1, indication);
1943      case -1094003035:
1944        /* indicationCodeableConcept */ return new Property("indication[x]",
1945            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1946            0, 1, indication);
1947      case 803518799:
1948        /* indicationReference */ return new Property("indication[x]",
1949            "CodeableConcept|Reference(MedicinalProductIndication)", "Condition for which the medicinal use applies.",
1950            0, 1, indication);
1951      case -892481550:
1952        /* status */ return new Property("status", "CodeableConcept",
1953            "For example granted, pending, expired or withdrawn.", 0, 1, status);
1954      case 3076014:
1955        /* date */ return new Property("date", "dateTime", "Date when the designation was granted.", 0, 1, date);
1956      case -2008465092:
1957        /* species */ return new Property("species", "CodeableConcept", "Animal species for which this applies.", 0, 1,
1958            species);
1959      default:
1960        return super.getNamedProperty(_hash, _name, _checkValid);
1961      }
1962
1963    }
1964
1965    @Override
1966    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1967      switch (hash) {
1968      case -1618432855:
1969        /* identifier */ return this.identifier == null ? new Base[0]
1970            : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1971      case 3575610:
1972        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1973      case -1618671268:
1974        /* intendedUse */ return this.intendedUse == null ? new Base[0] : new Base[] { this.intendedUse }; // CodeableConcept
1975      case -597168804:
1976        /* indication */ return this.indication == null ? new Base[0] : new Base[] { this.indication }; // Type
1977      case -892481550:
1978        /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // CodeableConcept
1979      case 3076014:
1980        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
1981      case -2008465092:
1982        /* species */ return this.species == null ? new Base[0] : new Base[] { this.species }; // CodeableConcept
1983      default:
1984        return super.getProperty(hash, name, checkValid);
1985      }
1986
1987    }
1988
1989    @Override
1990    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1991      switch (hash) {
1992      case -1618432855: // identifier
1993        this.getIdentifier().add(castToIdentifier(value)); // Identifier
1994        return value;
1995      case 3575610: // type
1996        this.type = castToCodeableConcept(value); // CodeableConcept
1997        return value;
1998      case -1618671268: // intendedUse
1999        this.intendedUse = castToCodeableConcept(value); // CodeableConcept
2000        return value;
2001      case -597168804: // indication
2002        this.indication = castToType(value); // Type
2003        return value;
2004      case -892481550: // status
2005        this.status = castToCodeableConcept(value); // CodeableConcept
2006        return value;
2007      case 3076014: // date
2008        this.date = castToDateTime(value); // DateTimeType
2009        return value;
2010      case -2008465092: // species
2011        this.species = castToCodeableConcept(value); // CodeableConcept
2012        return value;
2013      default:
2014        return super.setProperty(hash, name, value);
2015      }
2016
2017    }
2018
2019    @Override
2020    public Base setProperty(String name, Base value) throws FHIRException {
2021      if (name.equals("identifier")) {
2022        this.getIdentifier().add(castToIdentifier(value));
2023      } else if (name.equals("type")) {
2024        this.type = castToCodeableConcept(value); // CodeableConcept
2025      } else if (name.equals("intendedUse")) {
2026        this.intendedUse = castToCodeableConcept(value); // CodeableConcept
2027      } else if (name.equals("indication[x]")) {
2028        this.indication = castToType(value); // Type
2029      } else if (name.equals("status")) {
2030        this.status = castToCodeableConcept(value); // CodeableConcept
2031      } else if (name.equals("date")) {
2032        this.date = castToDateTime(value); // DateTimeType
2033      } else if (name.equals("species")) {
2034        this.species = castToCodeableConcept(value); // CodeableConcept
2035      } else
2036        return super.setProperty(name, value);
2037      return value;
2038    }
2039
2040  @Override
2041  public void removeChild(String name, Base value) throws FHIRException {
2042      if (name.equals("identifier")) {
2043        this.getIdentifier().remove(castToIdentifier(value));
2044      } else if (name.equals("type")) {
2045        this.type = null;
2046      } else if (name.equals("intendedUse")) {
2047        this.intendedUse = null;
2048      } else if (name.equals("indication[x]")) {
2049        this.indication = null;
2050      } else if (name.equals("status")) {
2051        this.status = null;
2052      } else if (name.equals("date")) {
2053        this.date = null;
2054      } else if (name.equals("species")) {
2055        this.species = null;
2056      } else
2057        super.removeChild(name, value);
2058      
2059    }
2060
2061    @Override
2062    public Base makeProperty(int hash, String name) throws FHIRException {
2063      switch (hash) {
2064      case -1618432855:
2065        return addIdentifier();
2066      case 3575610:
2067        return getType();
2068      case -1618671268:
2069        return getIntendedUse();
2070      case -501208668:
2071        return getIndication();
2072      case -597168804:
2073        return getIndication();
2074      case -892481550:
2075        return getStatus();
2076      case 3076014:
2077        return getDateElement();
2078      case -2008465092:
2079        return getSpecies();
2080      default:
2081        return super.makeProperty(hash, name);
2082      }
2083
2084    }
2085
2086    @Override
2087    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2088      switch (hash) {
2089      case -1618432855:
2090        /* identifier */ return new String[] { "Identifier" };
2091      case 3575610:
2092        /* type */ return new String[] { "CodeableConcept" };
2093      case -1618671268:
2094        /* intendedUse */ return new String[] { "CodeableConcept" };
2095      case -597168804:
2096        /* indication */ return new String[] { "CodeableConcept", "Reference" };
2097      case -892481550:
2098        /* status */ return new String[] { "CodeableConcept" };
2099      case 3076014:
2100        /* date */ return new String[] { "dateTime" };
2101      case -2008465092:
2102        /* species */ return new String[] { "CodeableConcept" };
2103      default:
2104        return super.getTypesForProperty(hash, name);
2105      }
2106
2107    }
2108
2109    @Override
2110    public Base addChild(String name) throws FHIRException {
2111      if (name.equals("identifier")) {
2112        return addIdentifier();
2113      } else if (name.equals("type")) {
2114        this.type = new CodeableConcept();
2115        return this.type;
2116      } else if (name.equals("intendedUse")) {
2117        this.intendedUse = new CodeableConcept();
2118        return this.intendedUse;
2119      } else if (name.equals("indicationCodeableConcept")) {
2120        this.indication = new CodeableConcept();
2121        return this.indication;
2122      } else if (name.equals("indicationReference")) {
2123        this.indication = new Reference();
2124        return this.indication;
2125      } else if (name.equals("status")) {
2126        this.status = new CodeableConcept();
2127        return this.status;
2128      } else if (name.equals("date")) {
2129        throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.date");
2130      } else if (name.equals("species")) {
2131        this.species = new CodeableConcept();
2132        return this.species;
2133      } else
2134        return super.addChild(name);
2135    }
2136
2137    public MedicinalProductSpecialDesignationComponent copy() {
2138      MedicinalProductSpecialDesignationComponent dst = new MedicinalProductSpecialDesignationComponent();
2139      copyValues(dst);
2140      return dst;
2141    }
2142
2143    public void copyValues(MedicinalProductSpecialDesignationComponent dst) {
2144      super.copyValues(dst);
2145      if (identifier != null) {
2146        dst.identifier = new ArrayList<Identifier>();
2147        for (Identifier i : identifier)
2148          dst.identifier.add(i.copy());
2149      }
2150      ;
2151      dst.type = type == null ? null : type.copy();
2152      dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
2153      dst.indication = indication == null ? null : indication.copy();
2154      dst.status = status == null ? null : status.copy();
2155      dst.date = date == null ? null : date.copy();
2156      dst.species = species == null ? null : species.copy();
2157    }
2158
2159    @Override
2160    public boolean equalsDeep(Base other_) {
2161      if (!super.equalsDeep(other_))
2162        return false;
2163      if (!(other_ instanceof MedicinalProductSpecialDesignationComponent))
2164        return false;
2165      MedicinalProductSpecialDesignationComponent o = (MedicinalProductSpecialDesignationComponent) other_;
2166      return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
2167          && compareDeep(intendedUse, o.intendedUse, true) && compareDeep(indication, o.indication, true)
2168          && compareDeep(status, o.status, true) && compareDeep(date, o.date, true)
2169          && compareDeep(species, o.species, true);
2170    }
2171
2172    @Override
2173    public boolean equalsShallow(Base other_) {
2174      if (!super.equalsShallow(other_))
2175        return false;
2176      if (!(other_ instanceof MedicinalProductSpecialDesignationComponent))
2177        return false;
2178      MedicinalProductSpecialDesignationComponent o = (MedicinalProductSpecialDesignationComponent) other_;
2179      return compareValues(date, o.date, true);
2180    }
2181
2182    public boolean isEmpty() {
2183      return super.isEmpty()
2184          && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, intendedUse, indication, status, date, species);
2185    }
2186
2187    public String fhirType() {
2188      return "MedicinalProduct.specialDesignation";
2189
2190    }
2191
2192  }
2193
2194  /**
2195   * Business identifier for this product. Could be an MPID.
2196   */
2197  @Child(name = "identifier", type = {
2198      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2199  @Description(shortDefinition = "Business identifier for this product. Could be an MPID", formalDefinition = "Business identifier for this product. Could be an MPID.")
2200  protected List<Identifier> identifier;
2201
2202  /**
2203   * Regulatory type, e.g. Investigational or Authorized.
2204   */
2205  @Child(name = "type", type = { CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
2206  @Description(shortDefinition = "Regulatory type, e.g. Investigational or Authorized", formalDefinition = "Regulatory type, e.g. Investigational or Authorized.")
2207  protected CodeableConcept type;
2208
2209  /**
2210   * If this medicine applies to human or veterinary uses.
2211   */
2212  @Child(name = "domain", type = { Coding.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
2213  @Description(shortDefinition = "If this medicine applies to human or veterinary uses", formalDefinition = "If this medicine applies to human or veterinary uses.")
2214  protected Coding domain;
2215
2216  /**
2217   * The dose form for a single part product, or combined form of a multiple part
2218   * product.
2219   */
2220  @Child(name = "combinedPharmaceuticalDoseForm", type = {
2221      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
2222  @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.")
2223  protected CodeableConcept combinedPharmaceuticalDoseForm;
2224
2225  /**
2226   * The legal status of supply of the medicinal product as classified by the
2227   * regulator.
2228   */
2229  @Child(name = "legalStatusOfSupply", type = {
2230      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2231  @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.")
2232  protected CodeableConcept legalStatusOfSupply;
2233
2234  /**
2235   * Whether the Medicinal Product is subject to additional monitoring for
2236   * regulatory reasons.
2237   */
2238  @Child(name = "additionalMonitoringIndicator", type = {
2239      CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
2240  @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.")
2241  protected CodeableConcept additionalMonitoringIndicator;
2242
2243  /**
2244   * Whether the Medicinal Product is subject to special measures for regulatory
2245   * reasons.
2246   */
2247  @Child(name = "specialMeasures", type = {
2248      StringType.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2249  @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.")
2250  protected List<StringType> specialMeasures;
2251
2252  /**
2253   * If authorised for use in children.
2254   */
2255  @Child(name = "paediatricUseIndicator", type = {
2256      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
2257  @Description(shortDefinition = "If authorised for use in children", formalDefinition = "If authorised for use in children.")
2258  protected CodeableConcept paediatricUseIndicator;
2259
2260  /**
2261   * Allows the product to be classified by various systems.
2262   */
2263  @Child(name = "productClassification", type = {
2264      CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2265  @Description(shortDefinition = "Allows the product to be classified by various systems", formalDefinition = "Allows the product to be classified by various systems.")
2266  protected List<CodeableConcept> productClassification;
2267
2268  /**
2269   * Marketing status of the medicinal product, in contrast to marketing
2270   * authorizaton.
2271   */
2272  @Child(name = "marketingStatus", type = {
2273      MarketingStatus.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2274  @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.")
2275  protected List<MarketingStatus> marketingStatus;
2276
2277  /**
2278   * Pharmaceutical aspects of product.
2279   */
2280  @Child(name = "pharmaceuticalProduct", type = {
2281      MedicinalProductPharmaceutical.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2282  @Description(shortDefinition = "Pharmaceutical aspects of product", formalDefinition = "Pharmaceutical aspects of product.")
2283  protected List<Reference> pharmaceuticalProduct;
2284  /**
2285   * The actual objects that are the target of the reference (Pharmaceutical
2286   * aspects of product.)
2287   */
2288  protected List<MedicinalProductPharmaceutical> pharmaceuticalProductTarget;
2289
2290  /**
2291   * Package representation for the product.
2292   */
2293  @Child(name = "packagedMedicinalProduct", type = {
2294      MedicinalProductPackaged.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2295  @Description(shortDefinition = "Package representation for the product", formalDefinition = "Package representation for the product.")
2296  protected List<Reference> packagedMedicinalProduct;
2297  /**
2298   * The actual objects that are the target of the reference (Package
2299   * representation for the product.)
2300   */
2301  protected List<MedicinalProductPackaged> packagedMedicinalProductTarget;
2302
2303  /**
2304   * Supporting documentation, typically for regulatory submission.
2305   */
2306  @Child(name = "attachedDocument", type = {
2307      DocumentReference.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2308  @Description(shortDefinition = "Supporting documentation, typically for regulatory submission", formalDefinition = "Supporting documentation, typically for regulatory submission.")
2309  protected List<Reference> attachedDocument;
2310  /**
2311   * The actual objects that are the target of the reference (Supporting
2312   * documentation, typically for regulatory submission.)
2313   */
2314  protected List<DocumentReference> attachedDocumentTarget;
2315
2316  /**
2317   * A master file for to the medicinal product (e.g. Pharmacovigilance System
2318   * Master File).
2319   */
2320  @Child(name = "masterFile", type = {
2321      DocumentReference.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2322  @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).")
2323  protected List<Reference> masterFile;
2324  /**
2325   * The actual objects that are the target of the reference (A master file for to
2326   * the medicinal product (e.g. Pharmacovigilance System Master File).)
2327   */
2328  protected List<DocumentReference> masterFileTarget;
2329
2330  /**
2331   * A product specific contact, person (in a role), or an organization.
2332   */
2333  @Child(name = "contact", type = { Organization.class,
2334      PractitionerRole.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2335  @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.")
2336  protected List<Reference> contact;
2337  /**
2338   * The actual objects that are the target of the reference (A product specific
2339   * contact, person (in a role), or an organization.)
2340   */
2341  protected List<Resource> contactTarget;
2342
2343  /**
2344   * Clinical trials or studies that this product is involved in.
2345   */
2346  @Child(name = "clinicalTrial", type = {
2347      ResearchStudy.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2348  @Description(shortDefinition = "Clinical trials or studies that this product is involved in", formalDefinition = "Clinical trials or studies that this product is involved in.")
2349  protected List<Reference> clinicalTrial;
2350  /**
2351   * The actual objects that are the target of the reference (Clinical trials or
2352   * studies that this product is involved in.)
2353   */
2354  protected List<ResearchStudy> clinicalTrialTarget;
2355
2356  /**
2357   * The product's name, including full name and possibly coded parts.
2358   */
2359  @Child(name = "name", type = {}, order = 16, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2360  @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.")
2361  protected List<MedicinalProductNameComponent> name;
2362
2363  /**
2364   * Reference to another product, e.g. for linking authorised to investigational
2365   * product.
2366   */
2367  @Child(name = "crossReference", type = {
2368      Identifier.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2369  @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.")
2370  protected List<Identifier> crossReference;
2371
2372  /**
2373   * An operation applied to the product, for manufacturing or adminsitrative
2374   * purpose.
2375   */
2376  @Child(name = "manufacturingBusinessOperation", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2377  @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.")
2378  protected List<MedicinalProductManufacturingBusinessOperationComponent> manufacturingBusinessOperation;
2379
2380  /**
2381   * Indicates if the medicinal product has an orphan designation for the
2382   * treatment of a rare disease.
2383   */
2384  @Child(name = "specialDesignation", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2385  @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.")
2386  protected List<MedicinalProductSpecialDesignationComponent> specialDesignation;
2387
2388  private static final long serialVersionUID = -899196111L;
2389
2390  /**
2391   * Constructor
2392   */
2393  public MedicinalProduct() {
2394    super();
2395  }
2396
2397  /**
2398   * @return {@link #identifier} (Business identifier for this product. Could be
2399   *         an MPID.)
2400   */
2401  public List<Identifier> getIdentifier() {
2402    if (this.identifier == null)
2403      this.identifier = new ArrayList<Identifier>();
2404    return this.identifier;
2405  }
2406
2407  /**
2408   * @return Returns a reference to <code>this</code> for easy method chaining
2409   */
2410  public MedicinalProduct setIdentifier(List<Identifier> theIdentifier) {
2411    this.identifier = theIdentifier;
2412    return this;
2413  }
2414
2415  public boolean hasIdentifier() {
2416    if (this.identifier == null)
2417      return false;
2418    for (Identifier item : this.identifier)
2419      if (!item.isEmpty())
2420        return true;
2421    return false;
2422  }
2423
2424  public Identifier addIdentifier() { // 3
2425    Identifier t = new Identifier();
2426    if (this.identifier == null)
2427      this.identifier = new ArrayList<Identifier>();
2428    this.identifier.add(t);
2429    return t;
2430  }
2431
2432  public MedicinalProduct addIdentifier(Identifier t) { // 3
2433    if (t == null)
2434      return this;
2435    if (this.identifier == null)
2436      this.identifier = new ArrayList<Identifier>();
2437    this.identifier.add(t);
2438    return this;
2439  }
2440
2441  /**
2442   * @return The first repetition of repeating field {@link #identifier}, creating
2443   *         it if it does not already exist
2444   */
2445  public Identifier getIdentifierFirstRep() {
2446    if (getIdentifier().isEmpty()) {
2447      addIdentifier();
2448    }
2449    return getIdentifier().get(0);
2450  }
2451
2452  /**
2453   * @return {@link #type} (Regulatory type, e.g. Investigational or Authorized.)
2454   */
2455  public CodeableConcept getType() {
2456    if (this.type == null)
2457      if (Configuration.errorOnAutoCreate())
2458        throw new Error("Attempt to auto-create MedicinalProduct.type");
2459      else if (Configuration.doAutoCreate())
2460        this.type = new CodeableConcept(); // cc
2461    return this.type;
2462  }
2463
2464  public boolean hasType() {
2465    return this.type != null && !this.type.isEmpty();
2466  }
2467
2468  /**
2469   * @param value {@link #type} (Regulatory type, e.g. Investigational or
2470   *              Authorized.)
2471   */
2472  public MedicinalProduct setType(CodeableConcept value) {
2473    this.type = value;
2474    return this;
2475  }
2476
2477  /**
2478   * @return {@link #domain} (If this medicine applies to human or veterinary
2479   *         uses.)
2480   */
2481  public Coding getDomain() {
2482    if (this.domain == null)
2483      if (Configuration.errorOnAutoCreate())
2484        throw new Error("Attempt to auto-create MedicinalProduct.domain");
2485      else if (Configuration.doAutoCreate())
2486        this.domain = new Coding(); // cc
2487    return this.domain;
2488  }
2489
2490  public boolean hasDomain() {
2491    return this.domain != null && !this.domain.isEmpty();
2492  }
2493
2494  /**
2495   * @param value {@link #domain} (If this medicine applies to human or veterinary
2496   *              uses.)
2497   */
2498  public MedicinalProduct setDomain(Coding value) {
2499    this.domain = value;
2500    return this;
2501  }
2502
2503  /**
2504   * @return {@link #combinedPharmaceuticalDoseForm} (The dose form for a single
2505   *         part product, or combined form of a multiple part product.)
2506   */
2507  public CodeableConcept getCombinedPharmaceuticalDoseForm() {
2508    if (this.combinedPharmaceuticalDoseForm == null)
2509      if (Configuration.errorOnAutoCreate())
2510        throw new Error("Attempt to auto-create MedicinalProduct.combinedPharmaceuticalDoseForm");
2511      else if (Configuration.doAutoCreate())
2512        this.combinedPharmaceuticalDoseForm = new CodeableConcept(); // cc
2513    return this.combinedPharmaceuticalDoseForm;
2514  }
2515
2516  public boolean hasCombinedPharmaceuticalDoseForm() {
2517    return this.combinedPharmaceuticalDoseForm != null && !this.combinedPharmaceuticalDoseForm.isEmpty();
2518  }
2519
2520  /**
2521   * @param value {@link #combinedPharmaceuticalDoseForm} (The dose form for a
2522   *              single part product, or combined form of a multiple part
2523   *              product.)
2524   */
2525  public MedicinalProduct setCombinedPharmaceuticalDoseForm(CodeableConcept value) {
2526    this.combinedPharmaceuticalDoseForm = value;
2527    return this;
2528  }
2529
2530  /**
2531   * @return {@link #legalStatusOfSupply} (The legal status of supply of the
2532   *         medicinal product as classified by the regulator.)
2533   */
2534  public CodeableConcept getLegalStatusOfSupply() {
2535    if (this.legalStatusOfSupply == null)
2536      if (Configuration.errorOnAutoCreate())
2537        throw new Error("Attempt to auto-create MedicinalProduct.legalStatusOfSupply");
2538      else if (Configuration.doAutoCreate())
2539        this.legalStatusOfSupply = new CodeableConcept(); // cc
2540    return this.legalStatusOfSupply;
2541  }
2542
2543  public boolean hasLegalStatusOfSupply() {
2544    return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
2545  }
2546
2547  /**
2548   * @param value {@link #legalStatusOfSupply} (The legal status of supply of the
2549   *              medicinal product as classified by the regulator.)
2550   */
2551  public MedicinalProduct setLegalStatusOfSupply(CodeableConcept value) {
2552    this.legalStatusOfSupply = value;
2553    return this;
2554  }
2555
2556  /**
2557   * @return {@link #additionalMonitoringIndicator} (Whether the Medicinal Product
2558   *         is subject to additional monitoring for regulatory reasons.)
2559   */
2560  public CodeableConcept getAdditionalMonitoringIndicator() {
2561    if (this.additionalMonitoringIndicator == null)
2562      if (Configuration.errorOnAutoCreate())
2563        throw new Error("Attempt to auto-create MedicinalProduct.additionalMonitoringIndicator");
2564      else if (Configuration.doAutoCreate())
2565        this.additionalMonitoringIndicator = new CodeableConcept(); // cc
2566    return this.additionalMonitoringIndicator;
2567  }
2568
2569  public boolean hasAdditionalMonitoringIndicator() {
2570    return this.additionalMonitoringIndicator != null && !this.additionalMonitoringIndicator.isEmpty();
2571  }
2572
2573  /**
2574   * @param value {@link #additionalMonitoringIndicator} (Whether the Medicinal
2575   *              Product is subject to additional monitoring for regulatory
2576   *              reasons.)
2577   */
2578  public MedicinalProduct setAdditionalMonitoringIndicator(CodeableConcept value) {
2579    this.additionalMonitoringIndicator = value;
2580    return this;
2581  }
2582
2583  /**
2584   * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to
2585   *         special measures for regulatory reasons.)
2586   */
2587  public List<StringType> getSpecialMeasures() {
2588    if (this.specialMeasures == null)
2589      this.specialMeasures = new ArrayList<StringType>();
2590    return this.specialMeasures;
2591  }
2592
2593  /**
2594   * @return Returns a reference to <code>this</code> for easy method chaining
2595   */
2596  public MedicinalProduct setSpecialMeasures(List<StringType> theSpecialMeasures) {
2597    this.specialMeasures = theSpecialMeasures;
2598    return this;
2599  }
2600
2601  public boolean hasSpecialMeasures() {
2602    if (this.specialMeasures == null)
2603      return false;
2604    for (StringType item : this.specialMeasures)
2605      if (!item.isEmpty())
2606        return true;
2607    return false;
2608  }
2609
2610  /**
2611   * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to
2612   *         special measures for regulatory reasons.)
2613   */
2614  public StringType addSpecialMeasuresElement() {// 2
2615    StringType t = new StringType();
2616    if (this.specialMeasures == null)
2617      this.specialMeasures = new ArrayList<StringType>();
2618    this.specialMeasures.add(t);
2619    return t;
2620  }
2621
2622  /**
2623   * @param value {@link #specialMeasures} (Whether the Medicinal Product is
2624   *              subject to special measures for regulatory reasons.)
2625   */
2626  public MedicinalProduct addSpecialMeasures(String value) { // 1
2627    StringType t = new StringType();
2628    t.setValue(value);
2629    if (this.specialMeasures == null)
2630      this.specialMeasures = new ArrayList<StringType>();
2631    this.specialMeasures.add(t);
2632    return this;
2633  }
2634
2635  /**
2636   * @param value {@link #specialMeasures} (Whether the Medicinal Product is
2637   *              subject to special measures for regulatory reasons.)
2638   */
2639  public boolean hasSpecialMeasures(String value) {
2640    if (this.specialMeasures == null)
2641      return false;
2642    for (StringType v : this.specialMeasures)
2643      if (v.getValue().equals(value)) // string
2644        return true;
2645    return false;
2646  }
2647
2648  /**
2649   * @return {@link #paediatricUseIndicator} (If authorised for use in children.)
2650   */
2651  public CodeableConcept getPaediatricUseIndicator() {
2652    if (this.paediatricUseIndicator == null)
2653      if (Configuration.errorOnAutoCreate())
2654        throw new Error("Attempt to auto-create MedicinalProduct.paediatricUseIndicator");
2655      else if (Configuration.doAutoCreate())
2656        this.paediatricUseIndicator = new CodeableConcept(); // cc
2657    return this.paediatricUseIndicator;
2658  }
2659
2660  public boolean hasPaediatricUseIndicator() {
2661    return this.paediatricUseIndicator != null && !this.paediatricUseIndicator.isEmpty();
2662  }
2663
2664  /**
2665   * @param value {@link #paediatricUseIndicator} (If authorised for use in
2666   *              children.)
2667   */
2668  public MedicinalProduct setPaediatricUseIndicator(CodeableConcept value) {
2669    this.paediatricUseIndicator = value;
2670    return this;
2671  }
2672
2673  /**
2674   * @return {@link #productClassification} (Allows the product to be classified
2675   *         by various systems.)
2676   */
2677  public List<CodeableConcept> getProductClassification() {
2678    if (this.productClassification == null)
2679      this.productClassification = new ArrayList<CodeableConcept>();
2680    return this.productClassification;
2681  }
2682
2683  /**
2684   * @return Returns a reference to <code>this</code> for easy method chaining
2685   */
2686  public MedicinalProduct setProductClassification(List<CodeableConcept> theProductClassification) {
2687    this.productClassification = theProductClassification;
2688    return this;
2689  }
2690
2691  public boolean hasProductClassification() {
2692    if (this.productClassification == null)
2693      return false;
2694    for (CodeableConcept item : this.productClassification)
2695      if (!item.isEmpty())
2696        return true;
2697    return false;
2698  }
2699
2700  public CodeableConcept addProductClassification() { // 3
2701    CodeableConcept t = new CodeableConcept();
2702    if (this.productClassification == null)
2703      this.productClassification = new ArrayList<CodeableConcept>();
2704    this.productClassification.add(t);
2705    return t;
2706  }
2707
2708  public MedicinalProduct addProductClassification(CodeableConcept t) { // 3
2709    if (t == null)
2710      return this;
2711    if (this.productClassification == null)
2712      this.productClassification = new ArrayList<CodeableConcept>();
2713    this.productClassification.add(t);
2714    return this;
2715  }
2716
2717  /**
2718   * @return The first repetition of repeating field
2719   *         {@link #productClassification}, creating it if it does not already
2720   *         exist
2721   */
2722  public CodeableConcept getProductClassificationFirstRep() {
2723    if (getProductClassification().isEmpty()) {
2724      addProductClassification();
2725    }
2726    return getProductClassification().get(0);
2727  }
2728
2729  /**
2730   * @return {@link #marketingStatus} (Marketing status of the medicinal product,
2731   *         in contrast to marketing authorizaton.)
2732   */
2733  public List<MarketingStatus> getMarketingStatus() {
2734    if (this.marketingStatus == null)
2735      this.marketingStatus = new ArrayList<MarketingStatus>();
2736    return this.marketingStatus;
2737  }
2738
2739  /**
2740   * @return Returns a reference to <code>this</code> for easy method chaining
2741   */
2742  public MedicinalProduct setMarketingStatus(List<MarketingStatus> theMarketingStatus) {
2743    this.marketingStatus = theMarketingStatus;
2744    return this;
2745  }
2746
2747  public boolean hasMarketingStatus() {
2748    if (this.marketingStatus == null)
2749      return false;
2750    for (MarketingStatus item : this.marketingStatus)
2751      if (!item.isEmpty())
2752        return true;
2753    return false;
2754  }
2755
2756  public MarketingStatus addMarketingStatus() { // 3
2757    MarketingStatus t = new MarketingStatus();
2758    if (this.marketingStatus == null)
2759      this.marketingStatus = new ArrayList<MarketingStatus>();
2760    this.marketingStatus.add(t);
2761    return t;
2762  }
2763
2764  public MedicinalProduct addMarketingStatus(MarketingStatus t) { // 3
2765    if (t == null)
2766      return this;
2767    if (this.marketingStatus == null)
2768      this.marketingStatus = new ArrayList<MarketingStatus>();
2769    this.marketingStatus.add(t);
2770    return this;
2771  }
2772
2773  /**
2774   * @return The first repetition of repeating field {@link #marketingStatus},
2775   *         creating it if it does not already exist
2776   */
2777  public MarketingStatus getMarketingStatusFirstRep() {
2778    if (getMarketingStatus().isEmpty()) {
2779      addMarketingStatus();
2780    }
2781    return getMarketingStatus().get(0);
2782  }
2783
2784  /**
2785   * @return {@link #pharmaceuticalProduct} (Pharmaceutical aspects of product.)
2786   */
2787  public List<Reference> getPharmaceuticalProduct() {
2788    if (this.pharmaceuticalProduct == null)
2789      this.pharmaceuticalProduct = new ArrayList<Reference>();
2790    return this.pharmaceuticalProduct;
2791  }
2792
2793  /**
2794   * @return Returns a reference to <code>this</code> for easy method chaining
2795   */
2796  public MedicinalProduct setPharmaceuticalProduct(List<Reference> thePharmaceuticalProduct) {
2797    this.pharmaceuticalProduct = thePharmaceuticalProduct;
2798    return this;
2799  }
2800
2801  public boolean hasPharmaceuticalProduct() {
2802    if (this.pharmaceuticalProduct == null)
2803      return false;
2804    for (Reference item : this.pharmaceuticalProduct)
2805      if (!item.isEmpty())
2806        return true;
2807    return false;
2808  }
2809
2810  public Reference addPharmaceuticalProduct() { // 3
2811    Reference t = new Reference();
2812    if (this.pharmaceuticalProduct == null)
2813      this.pharmaceuticalProduct = new ArrayList<Reference>();
2814    this.pharmaceuticalProduct.add(t);
2815    return t;
2816  }
2817
2818  public MedicinalProduct addPharmaceuticalProduct(Reference t) { // 3
2819    if (t == null)
2820      return this;
2821    if (this.pharmaceuticalProduct == null)
2822      this.pharmaceuticalProduct = new ArrayList<Reference>();
2823    this.pharmaceuticalProduct.add(t);
2824    return this;
2825  }
2826
2827  /**
2828   * @return The first repetition of repeating field
2829   *         {@link #pharmaceuticalProduct}, creating it if it does not already
2830   *         exist
2831   */
2832  public Reference getPharmaceuticalProductFirstRep() {
2833    if (getPharmaceuticalProduct().isEmpty()) {
2834      addPharmaceuticalProduct();
2835    }
2836    return getPharmaceuticalProduct().get(0);
2837  }
2838
2839  /**
2840   * @deprecated Use Reference#setResource(IBaseResource) instead
2841   */
2842  @Deprecated
2843  public List<MedicinalProductPharmaceutical> getPharmaceuticalProductTarget() {
2844    if (this.pharmaceuticalProductTarget == null)
2845      this.pharmaceuticalProductTarget = new ArrayList<MedicinalProductPharmaceutical>();
2846    return this.pharmaceuticalProductTarget;
2847  }
2848
2849  /**
2850   * @deprecated Use Reference#setResource(IBaseResource) instead
2851   */
2852  @Deprecated
2853  public MedicinalProductPharmaceutical addPharmaceuticalProductTarget() {
2854    MedicinalProductPharmaceutical r = new MedicinalProductPharmaceutical();
2855    if (this.pharmaceuticalProductTarget == null)
2856      this.pharmaceuticalProductTarget = new ArrayList<MedicinalProductPharmaceutical>();
2857    this.pharmaceuticalProductTarget.add(r);
2858    return r;
2859  }
2860
2861  /**
2862   * @return {@link #packagedMedicinalProduct} (Package representation for the
2863   *         product.)
2864   */
2865  public List<Reference> getPackagedMedicinalProduct() {
2866    if (this.packagedMedicinalProduct == null)
2867      this.packagedMedicinalProduct = new ArrayList<Reference>();
2868    return this.packagedMedicinalProduct;
2869  }
2870
2871  /**
2872   * @return Returns a reference to <code>this</code> for easy method chaining
2873   */
2874  public MedicinalProduct setPackagedMedicinalProduct(List<Reference> thePackagedMedicinalProduct) {
2875    this.packagedMedicinalProduct = thePackagedMedicinalProduct;
2876    return this;
2877  }
2878
2879  public boolean hasPackagedMedicinalProduct() {
2880    if (this.packagedMedicinalProduct == null)
2881      return false;
2882    for (Reference item : this.packagedMedicinalProduct)
2883      if (!item.isEmpty())
2884        return true;
2885    return false;
2886  }
2887
2888  public Reference addPackagedMedicinalProduct() { // 3
2889    Reference t = new Reference();
2890    if (this.packagedMedicinalProduct == null)
2891      this.packagedMedicinalProduct = new ArrayList<Reference>();
2892    this.packagedMedicinalProduct.add(t);
2893    return t;
2894  }
2895
2896  public MedicinalProduct addPackagedMedicinalProduct(Reference t) { // 3
2897    if (t == null)
2898      return this;
2899    if (this.packagedMedicinalProduct == null)
2900      this.packagedMedicinalProduct = new ArrayList<Reference>();
2901    this.packagedMedicinalProduct.add(t);
2902    return this;
2903  }
2904
2905  /**
2906   * @return The first repetition of repeating field
2907   *         {@link #packagedMedicinalProduct}, creating it if it does not already
2908   *         exist
2909   */
2910  public Reference getPackagedMedicinalProductFirstRep() {
2911    if (getPackagedMedicinalProduct().isEmpty()) {
2912      addPackagedMedicinalProduct();
2913    }
2914    return getPackagedMedicinalProduct().get(0);
2915  }
2916
2917  /**
2918   * @deprecated Use Reference#setResource(IBaseResource) instead
2919   */
2920  @Deprecated
2921  public List<MedicinalProductPackaged> getPackagedMedicinalProductTarget() {
2922    if (this.packagedMedicinalProductTarget == null)
2923      this.packagedMedicinalProductTarget = new ArrayList<MedicinalProductPackaged>();
2924    return this.packagedMedicinalProductTarget;
2925  }
2926
2927  /**
2928   * @deprecated Use Reference#setResource(IBaseResource) instead
2929   */
2930  @Deprecated
2931  public MedicinalProductPackaged addPackagedMedicinalProductTarget() {
2932    MedicinalProductPackaged r = new MedicinalProductPackaged();
2933    if (this.packagedMedicinalProductTarget == null)
2934      this.packagedMedicinalProductTarget = new ArrayList<MedicinalProductPackaged>();
2935    this.packagedMedicinalProductTarget.add(r);
2936    return r;
2937  }
2938
2939  /**
2940   * @return {@link #attachedDocument} (Supporting documentation, typically for
2941   *         regulatory submission.)
2942   */
2943  public List<Reference> getAttachedDocument() {
2944    if (this.attachedDocument == null)
2945      this.attachedDocument = new ArrayList<Reference>();
2946    return this.attachedDocument;
2947  }
2948
2949  /**
2950   * @return Returns a reference to <code>this</code> for easy method chaining
2951   */
2952  public MedicinalProduct setAttachedDocument(List<Reference> theAttachedDocument) {
2953    this.attachedDocument = theAttachedDocument;
2954    return this;
2955  }
2956
2957  public boolean hasAttachedDocument() {
2958    if (this.attachedDocument == null)
2959      return false;
2960    for (Reference item : this.attachedDocument)
2961      if (!item.isEmpty())
2962        return true;
2963    return false;
2964  }
2965
2966  public Reference addAttachedDocument() { // 3
2967    Reference t = new Reference();
2968    if (this.attachedDocument == null)
2969      this.attachedDocument = new ArrayList<Reference>();
2970    this.attachedDocument.add(t);
2971    return t;
2972  }
2973
2974  public MedicinalProduct addAttachedDocument(Reference t) { // 3
2975    if (t == null)
2976      return this;
2977    if (this.attachedDocument == null)
2978      this.attachedDocument = new ArrayList<Reference>();
2979    this.attachedDocument.add(t);
2980    return this;
2981  }
2982
2983  /**
2984   * @return The first repetition of repeating field {@link #attachedDocument},
2985   *         creating it if it does not already exist
2986   */
2987  public Reference getAttachedDocumentFirstRep() {
2988    if (getAttachedDocument().isEmpty()) {
2989      addAttachedDocument();
2990    }
2991    return getAttachedDocument().get(0);
2992  }
2993
2994  /**
2995   * @deprecated Use Reference#setResource(IBaseResource) instead
2996   */
2997  @Deprecated
2998  public List<DocumentReference> getAttachedDocumentTarget() {
2999    if (this.attachedDocumentTarget == null)
3000      this.attachedDocumentTarget = new ArrayList<DocumentReference>();
3001    return this.attachedDocumentTarget;
3002  }
3003
3004  /**
3005   * @deprecated Use Reference#setResource(IBaseResource) instead
3006   */
3007  @Deprecated
3008  public DocumentReference addAttachedDocumentTarget() {
3009    DocumentReference r = new DocumentReference();
3010    if (this.attachedDocumentTarget == null)
3011      this.attachedDocumentTarget = new ArrayList<DocumentReference>();
3012    this.attachedDocumentTarget.add(r);
3013    return r;
3014  }
3015
3016  /**
3017   * @return {@link #masterFile} (A master file for to the medicinal product (e.g.
3018   *         Pharmacovigilance System Master File).)
3019   */
3020  public List<Reference> getMasterFile() {
3021    if (this.masterFile == null)
3022      this.masterFile = new ArrayList<Reference>();
3023    return this.masterFile;
3024  }
3025
3026  /**
3027   * @return Returns a reference to <code>this</code> for easy method chaining
3028   */
3029  public MedicinalProduct setMasterFile(List<Reference> theMasterFile) {
3030    this.masterFile = theMasterFile;
3031    return this;
3032  }
3033
3034  public boolean hasMasterFile() {
3035    if (this.masterFile == null)
3036      return false;
3037    for (Reference item : this.masterFile)
3038      if (!item.isEmpty())
3039        return true;
3040    return false;
3041  }
3042
3043  public Reference addMasterFile() { // 3
3044    Reference t = new Reference();
3045    if (this.masterFile == null)
3046      this.masterFile = new ArrayList<Reference>();
3047    this.masterFile.add(t);
3048    return t;
3049  }
3050
3051  public MedicinalProduct addMasterFile(Reference t) { // 3
3052    if (t == null)
3053      return this;
3054    if (this.masterFile == null)
3055      this.masterFile = new ArrayList<Reference>();
3056    this.masterFile.add(t);
3057    return this;
3058  }
3059
3060  /**
3061   * @return The first repetition of repeating field {@link #masterFile}, creating
3062   *         it if it does not already exist
3063   */
3064  public Reference getMasterFileFirstRep() {
3065    if (getMasterFile().isEmpty()) {
3066      addMasterFile();
3067    }
3068    return getMasterFile().get(0);
3069  }
3070
3071  /**
3072   * @deprecated Use Reference#setResource(IBaseResource) instead
3073   */
3074  @Deprecated
3075  public List<DocumentReference> getMasterFileTarget() {
3076    if (this.masterFileTarget == null)
3077      this.masterFileTarget = new ArrayList<DocumentReference>();
3078    return this.masterFileTarget;
3079  }
3080
3081  /**
3082   * @deprecated Use Reference#setResource(IBaseResource) instead
3083   */
3084  @Deprecated
3085  public DocumentReference addMasterFileTarget() {
3086    DocumentReference r = new DocumentReference();
3087    if (this.masterFileTarget == null)
3088      this.masterFileTarget = new ArrayList<DocumentReference>();
3089    this.masterFileTarget.add(r);
3090    return r;
3091  }
3092
3093  /**
3094   * @return {@link #contact} (A product specific contact, person (in a role), or
3095   *         an organization.)
3096   */
3097  public List<Reference> getContact() {
3098    if (this.contact == null)
3099      this.contact = new ArrayList<Reference>();
3100    return this.contact;
3101  }
3102
3103  /**
3104   * @return Returns a reference to <code>this</code> for easy method chaining
3105   */
3106  public MedicinalProduct setContact(List<Reference> theContact) {
3107    this.contact = theContact;
3108    return this;
3109  }
3110
3111  public boolean hasContact() {
3112    if (this.contact == null)
3113      return false;
3114    for (Reference item : this.contact)
3115      if (!item.isEmpty())
3116        return true;
3117    return false;
3118  }
3119
3120  public Reference addContact() { // 3
3121    Reference t = new Reference();
3122    if (this.contact == null)
3123      this.contact = new ArrayList<Reference>();
3124    this.contact.add(t);
3125    return t;
3126  }
3127
3128  public MedicinalProduct addContact(Reference t) { // 3
3129    if (t == null)
3130      return this;
3131    if (this.contact == null)
3132      this.contact = new ArrayList<Reference>();
3133    this.contact.add(t);
3134    return this;
3135  }
3136
3137  /**
3138   * @return The first repetition of repeating field {@link #contact}, creating it
3139   *         if it does not already exist
3140   */
3141  public Reference getContactFirstRep() {
3142    if (getContact().isEmpty()) {
3143      addContact();
3144    }
3145    return getContact().get(0);
3146  }
3147
3148  /**
3149   * @deprecated Use Reference#setResource(IBaseResource) instead
3150   */
3151  @Deprecated
3152  public List<Resource> getContactTarget() {
3153    if (this.contactTarget == null)
3154      this.contactTarget = new ArrayList<Resource>();
3155    return this.contactTarget;
3156  }
3157
3158  /**
3159   * @return {@link #clinicalTrial} (Clinical trials or studies that this product
3160   *         is involved in.)
3161   */
3162  public List<Reference> getClinicalTrial() {
3163    if (this.clinicalTrial == null)
3164      this.clinicalTrial = new ArrayList<Reference>();
3165    return this.clinicalTrial;
3166  }
3167
3168  /**
3169   * @return Returns a reference to <code>this</code> for easy method chaining
3170   */
3171  public MedicinalProduct setClinicalTrial(List<Reference> theClinicalTrial) {
3172    this.clinicalTrial = theClinicalTrial;
3173    return this;
3174  }
3175
3176  public boolean hasClinicalTrial() {
3177    if (this.clinicalTrial == null)
3178      return false;
3179    for (Reference item : this.clinicalTrial)
3180      if (!item.isEmpty())
3181        return true;
3182    return false;
3183  }
3184
3185  public Reference addClinicalTrial() { // 3
3186    Reference t = new Reference();
3187    if (this.clinicalTrial == null)
3188      this.clinicalTrial = new ArrayList<Reference>();
3189    this.clinicalTrial.add(t);
3190    return t;
3191  }
3192
3193  public MedicinalProduct addClinicalTrial(Reference t) { // 3
3194    if (t == null)
3195      return this;
3196    if (this.clinicalTrial == null)
3197      this.clinicalTrial = new ArrayList<Reference>();
3198    this.clinicalTrial.add(t);
3199    return this;
3200  }
3201
3202  /**
3203   * @return The first repetition of repeating field {@link #clinicalTrial},
3204   *         creating it if it does not already exist
3205   */
3206  public Reference getClinicalTrialFirstRep() {
3207    if (getClinicalTrial().isEmpty()) {
3208      addClinicalTrial();
3209    }
3210    return getClinicalTrial().get(0);
3211  }
3212
3213  /**
3214   * @deprecated Use Reference#setResource(IBaseResource) instead
3215   */
3216  @Deprecated
3217  public List<ResearchStudy> getClinicalTrialTarget() {
3218    if (this.clinicalTrialTarget == null)
3219      this.clinicalTrialTarget = new ArrayList<ResearchStudy>();
3220    return this.clinicalTrialTarget;
3221  }
3222
3223  /**
3224   * @deprecated Use Reference#setResource(IBaseResource) instead
3225   */
3226  @Deprecated
3227  public ResearchStudy addClinicalTrialTarget() {
3228    ResearchStudy r = new ResearchStudy();
3229    if (this.clinicalTrialTarget == null)
3230      this.clinicalTrialTarget = new ArrayList<ResearchStudy>();
3231    this.clinicalTrialTarget.add(r);
3232    return r;
3233  }
3234
3235  /**
3236   * @return {@link #name} (The product's name, including full name and possibly
3237   *         coded parts.)
3238   */
3239  public List<MedicinalProductNameComponent> getName() {
3240    if (this.name == null)
3241      this.name = new ArrayList<MedicinalProductNameComponent>();
3242    return this.name;
3243  }
3244
3245  /**
3246   * @return Returns a reference to <code>this</code> for easy method chaining
3247   */
3248  public MedicinalProduct setName(List<MedicinalProductNameComponent> theName) {
3249    this.name = theName;
3250    return this;
3251  }
3252
3253  public boolean hasName() {
3254    if (this.name == null)
3255      return false;
3256    for (MedicinalProductNameComponent item : this.name)
3257      if (!item.isEmpty())
3258        return true;
3259    return false;
3260  }
3261
3262  public MedicinalProductNameComponent addName() { // 3
3263    MedicinalProductNameComponent t = new MedicinalProductNameComponent();
3264    if (this.name == null)
3265      this.name = new ArrayList<MedicinalProductNameComponent>();
3266    this.name.add(t);
3267    return t;
3268  }
3269
3270  public MedicinalProduct addName(MedicinalProductNameComponent t) { // 3
3271    if (t == null)
3272      return this;
3273    if (this.name == null)
3274      this.name = new ArrayList<MedicinalProductNameComponent>();
3275    this.name.add(t);
3276    return this;
3277  }
3278
3279  /**
3280   * @return The first repetition of repeating field {@link #name}, creating it if
3281   *         it does not already exist
3282   */
3283  public MedicinalProductNameComponent getNameFirstRep() {
3284    if (getName().isEmpty()) {
3285      addName();
3286    }
3287    return getName().get(0);
3288  }
3289
3290  /**
3291   * @return {@link #crossReference} (Reference to another product, e.g. for
3292   *         linking authorised to investigational product.)
3293   */
3294  public List<Identifier> getCrossReference() {
3295    if (this.crossReference == null)
3296      this.crossReference = new ArrayList<Identifier>();
3297    return this.crossReference;
3298  }
3299
3300  /**
3301   * @return Returns a reference to <code>this</code> for easy method chaining
3302   */
3303  public MedicinalProduct setCrossReference(List<Identifier> theCrossReference) {
3304    this.crossReference = theCrossReference;
3305    return this;
3306  }
3307
3308  public boolean hasCrossReference() {
3309    if (this.crossReference == null)
3310      return false;
3311    for (Identifier item : this.crossReference)
3312      if (!item.isEmpty())
3313        return true;
3314    return false;
3315  }
3316
3317  public Identifier addCrossReference() { // 3
3318    Identifier t = new Identifier();
3319    if (this.crossReference == null)
3320      this.crossReference = new ArrayList<Identifier>();
3321    this.crossReference.add(t);
3322    return t;
3323  }
3324
3325  public MedicinalProduct addCrossReference(Identifier t) { // 3
3326    if (t == null)
3327      return this;
3328    if (this.crossReference == null)
3329      this.crossReference = new ArrayList<Identifier>();
3330    this.crossReference.add(t);
3331    return this;
3332  }
3333
3334  /**
3335   * @return The first repetition of repeating field {@link #crossReference},
3336   *         creating it if it does not already exist
3337   */
3338  public Identifier getCrossReferenceFirstRep() {
3339    if (getCrossReference().isEmpty()) {
3340      addCrossReference();
3341    }
3342    return getCrossReference().get(0);
3343  }
3344
3345  /**
3346   * @return {@link #manufacturingBusinessOperation} (An operation applied to the
3347   *         product, for manufacturing or adminsitrative purpose.)
3348   */
3349  public List<MedicinalProductManufacturingBusinessOperationComponent> getManufacturingBusinessOperation() {
3350    if (this.manufacturingBusinessOperation == null)
3351      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3352    return this.manufacturingBusinessOperation;
3353  }
3354
3355  /**
3356   * @return Returns a reference to <code>this</code> for easy method chaining
3357   */
3358  public MedicinalProduct setManufacturingBusinessOperation(
3359      List<MedicinalProductManufacturingBusinessOperationComponent> theManufacturingBusinessOperation) {
3360    this.manufacturingBusinessOperation = theManufacturingBusinessOperation;
3361    return this;
3362  }
3363
3364  public boolean hasManufacturingBusinessOperation() {
3365    if (this.manufacturingBusinessOperation == null)
3366      return false;
3367    for (MedicinalProductManufacturingBusinessOperationComponent item : this.manufacturingBusinessOperation)
3368      if (!item.isEmpty())
3369        return true;
3370    return false;
3371  }
3372
3373  public MedicinalProductManufacturingBusinessOperationComponent addManufacturingBusinessOperation() { // 3
3374    MedicinalProductManufacturingBusinessOperationComponent t = new MedicinalProductManufacturingBusinessOperationComponent();
3375    if (this.manufacturingBusinessOperation == null)
3376      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3377    this.manufacturingBusinessOperation.add(t);
3378    return t;
3379  }
3380
3381  public MedicinalProduct addManufacturingBusinessOperation(MedicinalProductManufacturingBusinessOperationComponent t) { // 3
3382    if (t == null)
3383      return this;
3384    if (this.manufacturingBusinessOperation == null)
3385      this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
3386    this.manufacturingBusinessOperation.add(t);
3387    return this;
3388  }
3389
3390  /**
3391   * @return The first repetition of repeating field
3392   *         {@link #manufacturingBusinessOperation}, creating it if it does not
3393   *         already exist
3394   */
3395  public MedicinalProductManufacturingBusinessOperationComponent getManufacturingBusinessOperationFirstRep() {
3396    if (getManufacturingBusinessOperation().isEmpty()) {
3397      addManufacturingBusinessOperation();
3398    }
3399    return getManufacturingBusinessOperation().get(0);
3400  }
3401
3402  /**
3403   * @return {@link #specialDesignation} (Indicates if the medicinal product has
3404   *         an orphan designation for the treatment of a rare disease.)
3405   */
3406  public List<MedicinalProductSpecialDesignationComponent> getSpecialDesignation() {
3407    if (this.specialDesignation == null)
3408      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3409    return this.specialDesignation;
3410  }
3411
3412  /**
3413   * @return Returns a reference to <code>this</code> for easy method chaining
3414   */
3415  public MedicinalProduct setSpecialDesignation(
3416      List<MedicinalProductSpecialDesignationComponent> theSpecialDesignation) {
3417    this.specialDesignation = theSpecialDesignation;
3418    return this;
3419  }
3420
3421  public boolean hasSpecialDesignation() {
3422    if (this.specialDesignation == null)
3423      return false;
3424    for (MedicinalProductSpecialDesignationComponent item : this.specialDesignation)
3425      if (!item.isEmpty())
3426        return true;
3427    return false;
3428  }
3429
3430  public MedicinalProductSpecialDesignationComponent addSpecialDesignation() { // 3
3431    MedicinalProductSpecialDesignationComponent t = new MedicinalProductSpecialDesignationComponent();
3432    if (this.specialDesignation == null)
3433      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3434    this.specialDesignation.add(t);
3435    return t;
3436  }
3437
3438  public MedicinalProduct addSpecialDesignation(MedicinalProductSpecialDesignationComponent t) { // 3
3439    if (t == null)
3440      return this;
3441    if (this.specialDesignation == null)
3442      this.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
3443    this.specialDesignation.add(t);
3444    return this;
3445  }
3446
3447  /**
3448   * @return The first repetition of repeating field {@link #specialDesignation},
3449   *         creating it if it does not already exist
3450   */
3451  public MedicinalProductSpecialDesignationComponent getSpecialDesignationFirstRep() {
3452    if (getSpecialDesignation().isEmpty()) {
3453      addSpecialDesignation();
3454    }
3455    return getSpecialDesignation().get(0);
3456  }
3457
3458  protected void listChildren(List<Property> children) {
3459    super.listChildren(children);
3460    children.add(new Property("identifier", "Identifier", "Business identifier for this product. Could be an MPID.", 0,
3461        java.lang.Integer.MAX_VALUE, identifier));
3462    children.add(
3463        new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.", 0, 1, type));
3464    children
3465        .add(new Property("domain", "Coding", "If this medicine applies to human or veterinary uses.", 0, 1, domain));
3466    children.add(new Property("combinedPharmaceuticalDoseForm", "CodeableConcept",
3467        "The dose form for a single part product, or combined form of a multiple part product.", 0, 1,
3468        combinedPharmaceuticalDoseForm));
3469    children.add(new Property("legalStatusOfSupply", "CodeableConcept",
3470        "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1,
3471        legalStatusOfSupply));
3472    children.add(new Property("additionalMonitoringIndicator", "CodeableConcept",
3473        "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1,
3474        additionalMonitoringIndicator));
3475    children.add(new Property("specialMeasures", "string",
3476        "Whether the Medicinal Product is subject to special measures for regulatory reasons.", 0,
3477        java.lang.Integer.MAX_VALUE, specialMeasures));
3478    children.add(new Property("paediatricUseIndicator", "CodeableConcept", "If authorised for use in children.", 0, 1,
3479        paediatricUseIndicator));
3480    children.add(new Property("productClassification", "CodeableConcept",
3481        "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE,
3482        productClassification));
3483    children.add(new Property("marketingStatus", "MarketingStatus",
3484        "Marketing status of the medicinal product, in contrast to marketing authorizaton.", 0,
3485        java.lang.Integer.MAX_VALUE, marketingStatus));
3486    children.add(new Property("pharmaceuticalProduct", "Reference(MedicinalProductPharmaceutical)",
3487        "Pharmaceutical aspects of product.", 0, java.lang.Integer.MAX_VALUE, pharmaceuticalProduct));
3488    children.add(new Property("packagedMedicinalProduct", "Reference(MedicinalProductPackaged)",
3489        "Package representation for the product.", 0, java.lang.Integer.MAX_VALUE, packagedMedicinalProduct));
3490    children.add(new Property("attachedDocument", "Reference(DocumentReference)",
3491        "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE,
3492        attachedDocument));
3493    children.add(new Property("masterFile", "Reference(DocumentReference)",
3494        "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).", 0,
3495        java.lang.Integer.MAX_VALUE, masterFile));
3496    children.add(new Property("contact", "Reference(Organization|PractitionerRole)",
3497        "A product specific contact, person (in a role), or an organization.", 0, java.lang.Integer.MAX_VALUE,
3498        contact));
3499    children.add(new Property("clinicalTrial", "Reference(ResearchStudy)",
3500        "Clinical trials or studies that this product is involved in.", 0, java.lang.Integer.MAX_VALUE, clinicalTrial));
3501    children.add(new Property("name", "", "The product's name, including full name and possibly coded parts.", 0,
3502        java.lang.Integer.MAX_VALUE, name));
3503    children.add(new Property("crossReference", "Identifier",
3504        "Reference to another product, e.g. for linking authorised to investigational product.", 0,
3505        java.lang.Integer.MAX_VALUE, crossReference));
3506    children.add(new Property("manufacturingBusinessOperation", "",
3507        "An operation applied to the product, for manufacturing or adminsitrative purpose.", 0,
3508        java.lang.Integer.MAX_VALUE, manufacturingBusinessOperation));
3509    children.add(new Property("specialDesignation", "",
3510        "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0,
3511        java.lang.Integer.MAX_VALUE, specialDesignation));
3512  }
3513
3514  @Override
3515  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3516    switch (_hash) {
3517    case -1618432855:
3518      /* identifier */ return new Property("identifier", "Identifier",
3519          "Business identifier for this product. Could be an MPID.", 0, java.lang.Integer.MAX_VALUE, identifier);
3520    case 3575610:
3521      /* type */ return new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.",
3522          0, 1, type);
3523    case -1326197564:
3524      /* domain */ return new Property("domain", "Coding", "If this medicine applies to human or veterinary uses.", 0,
3525          1, domain);
3526    case -1992898487:
3527      /* combinedPharmaceuticalDoseForm */ return new Property("combinedPharmaceuticalDoseForm", "CodeableConcept",
3528          "The dose form for a single part product, or combined form of a multiple part product.", 0, 1,
3529          combinedPharmaceuticalDoseForm);
3530    case -844874031:
3531      /* legalStatusOfSupply */ return new Property("legalStatusOfSupply", "CodeableConcept",
3532          "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1,
3533          legalStatusOfSupply);
3534    case 1935999744:
3535      /* additionalMonitoringIndicator */ return new Property("additionalMonitoringIndicator", "CodeableConcept",
3536          "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1,
3537          additionalMonitoringIndicator);
3538    case 975102638:
3539      /* specialMeasures */ return new Property("specialMeasures", "string",
3540          "Whether the Medicinal Product is subject to special measures for regulatory reasons.", 0,
3541          java.lang.Integer.MAX_VALUE, specialMeasures);
3542    case -1019867160:
3543      /* paediatricUseIndicator */ return new Property("paediatricUseIndicator", "CodeableConcept",
3544          "If authorised for use in children.", 0, 1, paediatricUseIndicator);
3545    case 1247936181:
3546      /* productClassification */ return new Property("productClassification", "CodeableConcept",
3547          "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE,
3548          productClassification);
3549    case 70767032:
3550      /* marketingStatus */ return new Property("marketingStatus", "MarketingStatus",
3551          "Marketing status of the medicinal product, in contrast to marketing authorizaton.", 0,
3552          java.lang.Integer.MAX_VALUE, marketingStatus);
3553    case 443273260:
3554      /* pharmaceuticalProduct */ return new Property("pharmaceuticalProduct",
3555          "Reference(MedicinalProductPharmaceutical)", "Pharmaceutical aspects of product.", 0,
3556          java.lang.Integer.MAX_VALUE, pharmaceuticalProduct);
3557    case -361025513:
3558      /* packagedMedicinalProduct */ return new Property("packagedMedicinalProduct",
3559          "Reference(MedicinalProductPackaged)", "Package representation for the product.", 0,
3560          java.lang.Integer.MAX_VALUE, packagedMedicinalProduct);
3561    case -513945889:
3562      /* attachedDocument */ return new Property("attachedDocument", "Reference(DocumentReference)",
3563          "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE,
3564          attachedDocument);
3565    case -2039573762:
3566      /* masterFile */ return new Property("masterFile", "Reference(DocumentReference)",
3567          "A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).", 0,
3568          java.lang.Integer.MAX_VALUE, masterFile);
3569    case 951526432:
3570      /* contact */ return new Property("contact", "Reference(Organization|PractitionerRole)",
3571          "A product specific contact, person (in a role), or an organization.", 0, java.lang.Integer.MAX_VALUE,
3572          contact);
3573    case 1232866243:
3574      /* clinicalTrial */ return new Property("clinicalTrial", "Reference(ResearchStudy)",
3575          "Clinical trials or studies that this product is involved in.", 0, java.lang.Integer.MAX_VALUE,
3576          clinicalTrial);
3577    case 3373707:
3578      /* name */ return new Property("name", "", "The product's name, including full name and possibly coded parts.", 0,
3579          java.lang.Integer.MAX_VALUE, name);
3580    case -986968341:
3581      /* crossReference */ return new Property("crossReference", "Identifier",
3582          "Reference to another product, e.g. for linking authorised to investigational product.", 0,
3583          java.lang.Integer.MAX_VALUE, crossReference);
3584    case -171103255:
3585      /* manufacturingBusinessOperation */ return new Property("manufacturingBusinessOperation", "",
3586          "An operation applied to the product, for manufacturing or adminsitrative purpose.", 0,
3587          java.lang.Integer.MAX_VALUE, manufacturingBusinessOperation);
3588    case -964310658:
3589      /* specialDesignation */ return new Property("specialDesignation", "",
3590          "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0,
3591          java.lang.Integer.MAX_VALUE, specialDesignation);
3592    default:
3593      return super.getNamedProperty(_hash, _name, _checkValid);
3594    }
3595
3596  }
3597
3598  @Override
3599  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3600    switch (hash) {
3601    case -1618432855:
3602      /* identifier */ return this.identifier == null ? new Base[0]
3603          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3604    case 3575610:
3605      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3606    case -1326197564:
3607      /* domain */ return this.domain == null ? new Base[0] : new Base[] { this.domain }; // Coding
3608    case -1992898487:
3609      /* combinedPharmaceuticalDoseForm */ return this.combinedPharmaceuticalDoseForm == null ? new Base[0]
3610          : new Base[] { this.combinedPharmaceuticalDoseForm }; // CodeableConcept
3611    case -844874031:
3612      /* legalStatusOfSupply */ return this.legalStatusOfSupply == null ? new Base[0]
3613          : new Base[] { this.legalStatusOfSupply }; // CodeableConcept
3614    case 1935999744:
3615      /* additionalMonitoringIndicator */ return this.additionalMonitoringIndicator == null ? new Base[0]
3616          : new Base[] { this.additionalMonitoringIndicator }; // CodeableConcept
3617    case 975102638:
3618      /* specialMeasures */ return this.specialMeasures == null ? new Base[0]
3619          : this.specialMeasures.toArray(new Base[this.specialMeasures.size()]); // StringType
3620    case -1019867160:
3621      /* paediatricUseIndicator */ return this.paediatricUseIndicator == null ? new Base[0]
3622          : new Base[] { this.paediatricUseIndicator }; // CodeableConcept
3623    case 1247936181:
3624      /* productClassification */ return this.productClassification == null ? new Base[0]
3625          : this.productClassification.toArray(new Base[this.productClassification.size()]); // CodeableConcept
3626    case 70767032:
3627      /* marketingStatus */ return this.marketingStatus == null ? new Base[0]
3628          : this.marketingStatus.toArray(new Base[this.marketingStatus.size()]); // MarketingStatus
3629    case 443273260:
3630      /* pharmaceuticalProduct */ return this.pharmaceuticalProduct == null ? new Base[0]
3631          : this.pharmaceuticalProduct.toArray(new Base[this.pharmaceuticalProduct.size()]); // Reference
3632    case -361025513:
3633      /* packagedMedicinalProduct */ return this.packagedMedicinalProduct == null ? new Base[0]
3634          : this.packagedMedicinalProduct.toArray(new Base[this.packagedMedicinalProduct.size()]); // Reference
3635    case -513945889:
3636      /* attachedDocument */ return this.attachedDocument == null ? new Base[0]
3637          : this.attachedDocument.toArray(new Base[this.attachedDocument.size()]); // Reference
3638    case -2039573762:
3639      /* masterFile */ return this.masterFile == null ? new Base[0]
3640          : this.masterFile.toArray(new Base[this.masterFile.size()]); // Reference
3641    case 951526432:
3642      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // Reference
3643    case 1232866243:
3644      /* clinicalTrial */ return this.clinicalTrial == null ? new Base[0]
3645          : this.clinicalTrial.toArray(new Base[this.clinicalTrial.size()]); // Reference
3646    case 3373707:
3647      /* name */ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // MedicinalProductNameComponent
3648    case -986968341:
3649      /* crossReference */ return this.crossReference == null ? new Base[0]
3650          : this.crossReference.toArray(new Base[this.crossReference.size()]); // Identifier
3651    case -171103255:
3652      /* manufacturingBusinessOperation */ return this.manufacturingBusinessOperation == null ? new Base[0]
3653          : this.manufacturingBusinessOperation.toArray(new Base[this.manufacturingBusinessOperation.size()]); // MedicinalProductManufacturingBusinessOperationComponent
3654    case -964310658:
3655      /* specialDesignation */ return this.specialDesignation == null ? new Base[0]
3656          : this.specialDesignation.toArray(new Base[this.specialDesignation.size()]); // MedicinalProductSpecialDesignationComponent
3657    default:
3658      return super.getProperty(hash, name, checkValid);
3659    }
3660
3661  }
3662
3663  @Override
3664  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3665    switch (hash) {
3666    case -1618432855: // identifier
3667      this.getIdentifier().add(castToIdentifier(value)); // Identifier
3668      return value;
3669    case 3575610: // type
3670      this.type = castToCodeableConcept(value); // CodeableConcept
3671      return value;
3672    case -1326197564: // domain
3673      this.domain = castToCoding(value); // Coding
3674      return value;
3675    case -1992898487: // combinedPharmaceuticalDoseForm
3676      this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
3677      return value;
3678    case -844874031: // legalStatusOfSupply
3679      this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
3680      return value;
3681    case 1935999744: // additionalMonitoringIndicator
3682      this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
3683      return value;
3684    case 975102638: // specialMeasures
3685      this.getSpecialMeasures().add(castToString(value)); // StringType
3686      return value;
3687    case -1019867160: // paediatricUseIndicator
3688      this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
3689      return value;
3690    case 1247936181: // productClassification
3691      this.getProductClassification().add(castToCodeableConcept(value)); // CodeableConcept
3692      return value;
3693    case 70767032: // marketingStatus
3694      this.getMarketingStatus().add(castToMarketingStatus(value)); // MarketingStatus
3695      return value;
3696    case 443273260: // pharmaceuticalProduct
3697      this.getPharmaceuticalProduct().add(castToReference(value)); // Reference
3698      return value;
3699    case -361025513: // packagedMedicinalProduct
3700      this.getPackagedMedicinalProduct().add(castToReference(value)); // Reference
3701      return value;
3702    case -513945889: // attachedDocument
3703      this.getAttachedDocument().add(castToReference(value)); // Reference
3704      return value;
3705    case -2039573762: // masterFile
3706      this.getMasterFile().add(castToReference(value)); // Reference
3707      return value;
3708    case 951526432: // contact
3709      this.getContact().add(castToReference(value)); // Reference
3710      return value;
3711    case 1232866243: // clinicalTrial
3712      this.getClinicalTrial().add(castToReference(value)); // Reference
3713      return value;
3714    case 3373707: // name
3715      this.getName().add((MedicinalProductNameComponent) value); // MedicinalProductNameComponent
3716      return value;
3717    case -986968341: // crossReference
3718      this.getCrossReference().add(castToIdentifier(value)); // Identifier
3719      return value;
3720    case -171103255: // manufacturingBusinessOperation
3721      this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value); // MedicinalProductManufacturingBusinessOperationComponent
3722      return value;
3723    case -964310658: // specialDesignation
3724      this.getSpecialDesignation().add((MedicinalProductSpecialDesignationComponent) value); // MedicinalProductSpecialDesignationComponent
3725      return value;
3726    default:
3727      return super.setProperty(hash, name, value);
3728    }
3729
3730  }
3731
3732  @Override
3733  public Base setProperty(String name, Base value) throws FHIRException {
3734    if (name.equals("identifier")) {
3735      this.getIdentifier().add(castToIdentifier(value));
3736    } else if (name.equals("type")) {
3737      this.type = castToCodeableConcept(value); // CodeableConcept
3738    } else if (name.equals("domain")) {
3739      this.domain = castToCoding(value); // Coding
3740    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3741      this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
3742    } else if (name.equals("legalStatusOfSupply")) {
3743      this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
3744    } else if (name.equals("additionalMonitoringIndicator")) {
3745      this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
3746    } else if (name.equals("specialMeasures")) {
3747      this.getSpecialMeasures().add(castToString(value));
3748    } else if (name.equals("paediatricUseIndicator")) {
3749      this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
3750    } else if (name.equals("productClassification")) {
3751      this.getProductClassification().add(castToCodeableConcept(value));
3752    } else if (name.equals("marketingStatus")) {
3753      this.getMarketingStatus().add(castToMarketingStatus(value));
3754    } else if (name.equals("pharmaceuticalProduct")) {
3755      this.getPharmaceuticalProduct().add(castToReference(value));
3756    } else if (name.equals("packagedMedicinalProduct")) {
3757      this.getPackagedMedicinalProduct().add(castToReference(value));
3758    } else if (name.equals("attachedDocument")) {
3759      this.getAttachedDocument().add(castToReference(value));
3760    } else if (name.equals("masterFile")) {
3761      this.getMasterFile().add(castToReference(value));
3762    } else if (name.equals("contact")) {
3763      this.getContact().add(castToReference(value));
3764    } else if (name.equals("clinicalTrial")) {
3765      this.getClinicalTrial().add(castToReference(value));
3766    } else if (name.equals("name")) {
3767      this.getName().add((MedicinalProductNameComponent) value);
3768    } else if (name.equals("crossReference")) {
3769      this.getCrossReference().add(castToIdentifier(value));
3770    } else if (name.equals("manufacturingBusinessOperation")) {
3771      this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value);
3772    } else if (name.equals("specialDesignation")) {
3773      this.getSpecialDesignation().add((MedicinalProductSpecialDesignationComponent) value);
3774    } else
3775      return super.setProperty(name, value);
3776    return value;
3777  }
3778
3779  @Override
3780  public void removeChild(String name, Base value) throws FHIRException {
3781    if (name.equals("identifier")) {
3782      this.getIdentifier().remove(castToIdentifier(value));
3783    } else if (name.equals("type")) {
3784      this.type = null;
3785    } else if (name.equals("domain")) {
3786      this.domain = null;
3787    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3788      this.combinedPharmaceuticalDoseForm = null;
3789    } else if (name.equals("legalStatusOfSupply")) {
3790      this.legalStatusOfSupply = null;
3791    } else if (name.equals("additionalMonitoringIndicator")) {
3792      this.additionalMonitoringIndicator = null;
3793    } else if (name.equals("specialMeasures")) {
3794      this.getSpecialMeasures().remove(castToString(value));
3795    } else if (name.equals("paediatricUseIndicator")) {
3796      this.paediatricUseIndicator = null;
3797    } else if (name.equals("productClassification")) {
3798      this.getProductClassification().remove(castToCodeableConcept(value));
3799    } else if (name.equals("marketingStatus")) {
3800      this.getMarketingStatus().remove(castToMarketingStatus(value));
3801    } else if (name.equals("pharmaceuticalProduct")) {
3802      this.getPharmaceuticalProduct().remove(castToReference(value));
3803    } else if (name.equals("packagedMedicinalProduct")) {
3804      this.getPackagedMedicinalProduct().remove(castToReference(value));
3805    } else if (name.equals("attachedDocument")) {
3806      this.getAttachedDocument().remove(castToReference(value));
3807    } else if (name.equals("masterFile")) {
3808      this.getMasterFile().remove(castToReference(value));
3809    } else if (name.equals("contact")) {
3810      this.getContact().remove(castToReference(value));
3811    } else if (name.equals("clinicalTrial")) {
3812      this.getClinicalTrial().remove(castToReference(value));
3813    } else if (name.equals("name")) {
3814      this.getName().remove((MedicinalProductNameComponent) value);
3815    } else if (name.equals("crossReference")) {
3816      this.getCrossReference().remove(castToIdentifier(value));
3817    } else if (name.equals("manufacturingBusinessOperation")) {
3818      this.getManufacturingBusinessOperation().remove((MedicinalProductManufacturingBusinessOperationComponent) value);
3819    } else if (name.equals("specialDesignation")) {
3820      this.getSpecialDesignation().remove((MedicinalProductSpecialDesignationComponent) value);
3821    } else
3822      super.removeChild(name, value);
3823    
3824  }
3825
3826  @Override
3827  public Base makeProperty(int hash, String name) throws FHIRException {
3828    switch (hash) {
3829    case -1618432855:
3830      return addIdentifier();
3831    case 3575610:
3832      return getType();
3833    case -1326197564:
3834      return getDomain();
3835    case -1992898487:
3836      return getCombinedPharmaceuticalDoseForm();
3837    case -844874031:
3838      return getLegalStatusOfSupply();
3839    case 1935999744:
3840      return getAdditionalMonitoringIndicator();
3841    case 975102638:
3842      return addSpecialMeasuresElement();
3843    case -1019867160:
3844      return getPaediatricUseIndicator();
3845    case 1247936181:
3846      return addProductClassification();
3847    case 70767032:
3848      return addMarketingStatus();
3849    case 443273260:
3850      return addPharmaceuticalProduct();
3851    case -361025513:
3852      return addPackagedMedicinalProduct();
3853    case -513945889:
3854      return addAttachedDocument();
3855    case -2039573762:
3856      return addMasterFile();
3857    case 951526432:
3858      return addContact();
3859    case 1232866243:
3860      return addClinicalTrial();
3861    case 3373707:
3862      return addName();
3863    case -986968341:
3864      return addCrossReference();
3865    case -171103255:
3866      return addManufacturingBusinessOperation();
3867    case -964310658:
3868      return addSpecialDesignation();
3869    default:
3870      return super.makeProperty(hash, name);
3871    }
3872
3873  }
3874
3875  @Override
3876  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3877    switch (hash) {
3878    case -1618432855:
3879      /* identifier */ return new String[] { "Identifier" };
3880    case 3575610:
3881      /* type */ return new String[] { "CodeableConcept" };
3882    case -1326197564:
3883      /* domain */ return new String[] { "Coding" };
3884    case -1992898487:
3885      /* combinedPharmaceuticalDoseForm */ return new String[] { "CodeableConcept" };
3886    case -844874031:
3887      /* legalStatusOfSupply */ return new String[] { "CodeableConcept" };
3888    case 1935999744:
3889      /* additionalMonitoringIndicator */ return new String[] { "CodeableConcept" };
3890    case 975102638:
3891      /* specialMeasures */ return new String[] { "string" };
3892    case -1019867160:
3893      /* paediatricUseIndicator */ return new String[] { "CodeableConcept" };
3894    case 1247936181:
3895      /* productClassification */ return new String[] { "CodeableConcept" };
3896    case 70767032:
3897      /* marketingStatus */ return new String[] { "MarketingStatus" };
3898    case 443273260:
3899      /* pharmaceuticalProduct */ return new String[] { "Reference" };
3900    case -361025513:
3901      /* packagedMedicinalProduct */ return new String[] { "Reference" };
3902    case -513945889:
3903      /* attachedDocument */ return new String[] { "Reference" };
3904    case -2039573762:
3905      /* masterFile */ return new String[] { "Reference" };
3906    case 951526432:
3907      /* contact */ return new String[] { "Reference" };
3908    case 1232866243:
3909      /* clinicalTrial */ return new String[] { "Reference" };
3910    case 3373707:
3911      /* name */ return new String[] {};
3912    case -986968341:
3913      /* crossReference */ return new String[] { "Identifier" };
3914    case -171103255:
3915      /* manufacturingBusinessOperation */ return new String[] {};
3916    case -964310658:
3917      /* specialDesignation */ return new String[] {};
3918    default:
3919      return super.getTypesForProperty(hash, name);
3920    }
3921
3922  }
3923
3924  @Override
3925  public Base addChild(String name) throws FHIRException {
3926    if (name.equals("identifier")) {
3927      return addIdentifier();
3928    } else if (name.equals("type")) {
3929      this.type = new CodeableConcept();
3930      return this.type;
3931    } else if (name.equals("domain")) {
3932      this.domain = new Coding();
3933      return this.domain;
3934    } else if (name.equals("combinedPharmaceuticalDoseForm")) {
3935      this.combinedPharmaceuticalDoseForm = new CodeableConcept();
3936      return this.combinedPharmaceuticalDoseForm;
3937    } else if (name.equals("legalStatusOfSupply")) {
3938      this.legalStatusOfSupply = new CodeableConcept();
3939      return this.legalStatusOfSupply;
3940    } else if (name.equals("additionalMonitoringIndicator")) {
3941      this.additionalMonitoringIndicator = new CodeableConcept();
3942      return this.additionalMonitoringIndicator;
3943    } else if (name.equals("specialMeasures")) {
3944      throw new FHIRException("Cannot call addChild on a singleton property MedicinalProduct.specialMeasures");
3945    } else if (name.equals("paediatricUseIndicator")) {
3946      this.paediatricUseIndicator = new CodeableConcept();
3947      return this.paediatricUseIndicator;
3948    } else if (name.equals("productClassification")) {
3949      return addProductClassification();
3950    } else if (name.equals("marketingStatus")) {
3951      return addMarketingStatus();
3952    } else if (name.equals("pharmaceuticalProduct")) {
3953      return addPharmaceuticalProduct();
3954    } else if (name.equals("packagedMedicinalProduct")) {
3955      return addPackagedMedicinalProduct();
3956    } else if (name.equals("attachedDocument")) {
3957      return addAttachedDocument();
3958    } else if (name.equals("masterFile")) {
3959      return addMasterFile();
3960    } else if (name.equals("contact")) {
3961      return addContact();
3962    } else if (name.equals("clinicalTrial")) {
3963      return addClinicalTrial();
3964    } else if (name.equals("name")) {
3965      return addName();
3966    } else if (name.equals("crossReference")) {
3967      return addCrossReference();
3968    } else if (name.equals("manufacturingBusinessOperation")) {
3969      return addManufacturingBusinessOperation();
3970    } else if (name.equals("specialDesignation")) {
3971      return addSpecialDesignation();
3972    } else
3973      return super.addChild(name);
3974  }
3975
3976  public String fhirType() {
3977    return "MedicinalProduct";
3978
3979  }
3980
3981  public MedicinalProduct copy() {
3982    MedicinalProduct dst = new MedicinalProduct();
3983    copyValues(dst);
3984    return dst;
3985  }
3986
3987  public void copyValues(MedicinalProduct dst) {
3988    super.copyValues(dst);
3989    if (identifier != null) {
3990      dst.identifier = new ArrayList<Identifier>();
3991      for (Identifier i : identifier)
3992        dst.identifier.add(i.copy());
3993    }
3994    ;
3995    dst.type = type == null ? null : type.copy();
3996    dst.domain = domain == null ? null : domain.copy();
3997    dst.combinedPharmaceuticalDoseForm = combinedPharmaceuticalDoseForm == null ? null
3998        : combinedPharmaceuticalDoseForm.copy();
3999    dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
4000    dst.additionalMonitoringIndicator = additionalMonitoringIndicator == null ? null
4001        : additionalMonitoringIndicator.copy();
4002    if (specialMeasures != null) {
4003      dst.specialMeasures = new ArrayList<StringType>();
4004      for (StringType i : specialMeasures)
4005        dst.specialMeasures.add(i.copy());
4006    }
4007    ;
4008    dst.paediatricUseIndicator = paediatricUseIndicator == null ? null : paediatricUseIndicator.copy();
4009    if (productClassification != null) {
4010      dst.productClassification = new ArrayList<CodeableConcept>();
4011      for (CodeableConcept i : productClassification)
4012        dst.productClassification.add(i.copy());
4013    }
4014    ;
4015    if (marketingStatus != null) {
4016      dst.marketingStatus = new ArrayList<MarketingStatus>();
4017      for (MarketingStatus i : marketingStatus)
4018        dst.marketingStatus.add(i.copy());
4019    }
4020    ;
4021    if (pharmaceuticalProduct != null) {
4022      dst.pharmaceuticalProduct = new ArrayList<Reference>();
4023      for (Reference i : pharmaceuticalProduct)
4024        dst.pharmaceuticalProduct.add(i.copy());
4025    }
4026    ;
4027    if (packagedMedicinalProduct != null) {
4028      dst.packagedMedicinalProduct = new ArrayList<Reference>();
4029      for (Reference i : packagedMedicinalProduct)
4030        dst.packagedMedicinalProduct.add(i.copy());
4031    }
4032    ;
4033    if (attachedDocument != null) {
4034      dst.attachedDocument = new ArrayList<Reference>();
4035      for (Reference i : attachedDocument)
4036        dst.attachedDocument.add(i.copy());
4037    }
4038    ;
4039    if (masterFile != null) {
4040      dst.masterFile = new ArrayList<Reference>();
4041      for (Reference i : masterFile)
4042        dst.masterFile.add(i.copy());
4043    }
4044    ;
4045    if (contact != null) {
4046      dst.contact = new ArrayList<Reference>();
4047      for (Reference i : contact)
4048        dst.contact.add(i.copy());
4049    }
4050    ;
4051    if (clinicalTrial != null) {
4052      dst.clinicalTrial = new ArrayList<Reference>();
4053      for (Reference i : clinicalTrial)
4054        dst.clinicalTrial.add(i.copy());
4055    }
4056    ;
4057    if (name != null) {
4058      dst.name = new ArrayList<MedicinalProductNameComponent>();
4059      for (MedicinalProductNameComponent i : name)
4060        dst.name.add(i.copy());
4061    }
4062    ;
4063    if (crossReference != null) {
4064      dst.crossReference = new ArrayList<Identifier>();
4065      for (Identifier i : crossReference)
4066        dst.crossReference.add(i.copy());
4067    }
4068    ;
4069    if (manufacturingBusinessOperation != null) {
4070      dst.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
4071      for (MedicinalProductManufacturingBusinessOperationComponent i : manufacturingBusinessOperation)
4072        dst.manufacturingBusinessOperation.add(i.copy());
4073    }
4074    ;
4075    if (specialDesignation != null) {
4076      dst.specialDesignation = new ArrayList<MedicinalProductSpecialDesignationComponent>();
4077      for (MedicinalProductSpecialDesignationComponent i : specialDesignation)
4078        dst.specialDesignation.add(i.copy());
4079    }
4080    ;
4081  }
4082
4083  protected MedicinalProduct typedCopy() {
4084    return copy();
4085  }
4086
4087  @Override
4088  public boolean equalsDeep(Base other_) {
4089    if (!super.equalsDeep(other_))
4090      return false;
4091    if (!(other_ instanceof MedicinalProduct))
4092      return false;
4093    MedicinalProduct o = (MedicinalProduct) other_;
4094    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
4095        && compareDeep(domain, o.domain, true)
4096        && compareDeep(combinedPharmaceuticalDoseForm, o.combinedPharmaceuticalDoseForm, true)
4097        && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true)
4098        && compareDeep(additionalMonitoringIndicator, o.additionalMonitoringIndicator, true)
4099        && compareDeep(specialMeasures, o.specialMeasures, true)
4100        && compareDeep(paediatricUseIndicator, o.paediatricUseIndicator, true)
4101        && compareDeep(productClassification, o.productClassification, true)
4102        && compareDeep(marketingStatus, o.marketingStatus, true)
4103        && compareDeep(pharmaceuticalProduct, o.pharmaceuticalProduct, true)
4104        && compareDeep(packagedMedicinalProduct, o.packagedMedicinalProduct, true)
4105        && compareDeep(attachedDocument, o.attachedDocument, true) && compareDeep(masterFile, o.masterFile, true)
4106        && compareDeep(contact, o.contact, true) && compareDeep(clinicalTrial, o.clinicalTrial, true)
4107        && compareDeep(name, o.name, true) && compareDeep(crossReference, o.crossReference, true)
4108        && compareDeep(manufacturingBusinessOperation, o.manufacturingBusinessOperation, true)
4109        && compareDeep(specialDesignation, o.specialDesignation, true);
4110  }
4111
4112  @Override
4113  public boolean equalsShallow(Base other_) {
4114    if (!super.equalsShallow(other_))
4115      return false;
4116    if (!(other_ instanceof MedicinalProduct))
4117      return false;
4118    MedicinalProduct o = (MedicinalProduct) other_;
4119    return compareValues(specialMeasures, o.specialMeasures, true);
4120  }
4121
4122  public boolean isEmpty() {
4123    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, domain,
4124        combinedPharmaceuticalDoseForm, legalStatusOfSupply, additionalMonitoringIndicator, specialMeasures,
4125        paediatricUseIndicator, productClassification, marketingStatus, pharmaceuticalProduct, packagedMedicinalProduct,
4126        attachedDocument, masterFile, contact, clinicalTrial, name, crossReference, manufacturingBusinessOperation,
4127        specialDesignation);
4128  }
4129
4130  @Override
4131  public ResourceType getResourceType() {
4132    return ResourceType.MedicinalProduct;
4133  }
4134
4135  /**
4136   * Search parameter: <b>identifier</b>
4137   * <p>
4138   * Description: <b>Business identifier for this product. Could be an
4139   * MPID</b><br>
4140   * Type: <b>token</b><br>
4141   * Path: <b>MedicinalProduct.identifier</b><br>
4142   * </p>
4143   */
4144  @SearchParamDefinition(name = "identifier", path = "MedicinalProduct.identifier", description = "Business identifier for this product. Could be an MPID", type = "token")
4145  public static final String SP_IDENTIFIER = "identifier";
4146  /**
4147   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4148   * <p>
4149   * Description: <b>Business identifier for this product. Could be an
4150   * MPID</b><br>
4151   * Type: <b>token</b><br>
4152   * Path: <b>MedicinalProduct.identifier</b><br>
4153   * </p>
4154   */
4155  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4156      SP_IDENTIFIER);
4157
4158  /**
4159   * Search parameter: <b>name</b>
4160   * <p>
4161   * Description: <b>The full product name</b><br>
4162   * Type: <b>string</b><br>
4163   * Path: <b>MedicinalProduct.name.productName</b><br>
4164   * </p>
4165   */
4166  @SearchParamDefinition(name = "name", path = "MedicinalProduct.name.productName", description = "The full product name", type = "string")
4167  public static final String SP_NAME = "name";
4168  /**
4169   * <b>Fluent Client</b> search parameter constant for <b>name</b>
4170   * <p>
4171   * Description: <b>The full product name</b><br>
4172   * Type: <b>string</b><br>
4173   * Path: <b>MedicinalProduct.name.productName</b><br>
4174   * </p>
4175   */
4176  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
4177      SP_NAME);
4178
4179  /**
4180   * Search parameter: <b>name-language</b>
4181   * <p>
4182   * Description: <b>Language code for this name</b><br>
4183   * Type: <b>token</b><br>
4184   * Path: <b>MedicinalProduct.name.countryLanguage.language</b><br>
4185   * </p>
4186   */
4187  @SearchParamDefinition(name = "name-language", path = "MedicinalProduct.name.countryLanguage.language", description = "Language code for this name", type = "token")
4188  public static final String SP_NAME_LANGUAGE = "name-language";
4189  /**
4190   * <b>Fluent Client</b> search parameter constant for <b>name-language</b>
4191   * <p>
4192   * Description: <b>Language code for this name</b><br>
4193   * Type: <b>token</b><br>
4194   * Path: <b>MedicinalProduct.name.countryLanguage.language</b><br>
4195   * </p>
4196   */
4197  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NAME_LANGUAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4198      SP_NAME_LANGUAGE);
4199
4200}