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