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