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