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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.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/Profile/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 = "fullName", 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 fullName;
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 = 993877853L;
075
076    /**
077     * Constructor
078     */
079      public MedicinalProductNameComponent() {
080        super();
081      }
082
083    /**
084     * Constructor
085     */
086      public MedicinalProductNameComponent(StringType fullName) {
087        super();
088        this.fullName = fullName;
089      }
090
091        /**
092         * @return {@link #fullName} (The full product name.). This is the underlying object with id, value and extensions. The accessor "getFullName" gives direct access to the value
093         */
094        public StringType getFullNameElement() { 
095          if (this.fullName == null)
096            if (Configuration.errorOnAutoCreate())
097              throw new Error("Attempt to auto-create MedicinalProductNameComponent.fullName");
098            else if (Configuration.doAutoCreate())
099              this.fullName = new StringType(); // bb
100          return this.fullName;
101        }
102
103        public boolean hasFullNameElement() { 
104          return this.fullName != null && !this.fullName.isEmpty();
105        }
106
107        public boolean hasFullName() { 
108          return this.fullName != null && !this.fullName.isEmpty();
109        }
110
111        /**
112         * @param value {@link #fullName} (The full product name.). This is the underlying object with id, value and extensions. The accessor "getFullName" gives direct access to the value
113         */
114        public MedicinalProductNameComponent setFullNameElement(StringType value) { 
115          this.fullName = value;
116          return this;
117        }
118
119        /**
120         * @return The full product name.
121         */
122        public String getFullName() { 
123          return this.fullName == null ? null : this.fullName.getValue();
124        }
125
126        /**
127         * @param value The full product name.
128         */
129        public MedicinalProductNameComponent setFullName(String value) { 
130            if (this.fullName == null)
131              this.fullName = new StringType();
132            this.fullName.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("fullName", "string", "The full product name.", 0, 1, fullName));
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 1330852282: /*fullName*/  return new Property("fullName", "string", "The full product name.", 0, 1, fullName);
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 1330852282: /*fullName*/ return this.fullName == null ? new Base[0] : new Base[] {this.fullName}; // 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 1330852282: // fullName
275          this.fullName = 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("fullName")) {
291          this.fullName = 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 1330852282:  return getFullNameElement();
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 1330852282: /*fullName*/ 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("fullName")) {
326          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProduct.fullName");
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.fullName = fullName == null ? null : fullName.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(fullName, o.fullName, true) && compareDeep(namePart, o.namePart, true) && compareDeep(countryLanguage, o.countryLanguage, true)
363          ;
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(fullName, o.fullName, true);
374      }
375
376      public boolean isEmpty() {
377        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(fullName, 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    /**
1362     * Business idenfifier for this product. Could be an MPID.
1363     */
1364    @Child(name = "identifier", type = {Identifier.class}, order=0, min=1, max=1, modifier=false, summary=true)
1365    @Description(shortDefinition="Business idenfifier for this product. Could be an MPID", formalDefinition="Business idenfifier for this product. Could be an MPID." )
1366    protected Identifier identifier;
1367
1368    /**
1369     * Regulatory type, e.g. Investigational or Authorized.
1370     */
1371    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1372    @Description(shortDefinition="Regulatory type, e.g. Investigational or Authorized", formalDefinition="Regulatory type, e.g. Investigational or Authorized." )
1373    protected CodeableConcept type;
1374
1375    /**
1376     * The dose form for a single part product, or combined form of a multiple part product.
1377     */
1378    @Child(name = "combinedPharmaceuticalDoseForm", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1379    @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." )
1380    protected CodeableConcept combinedPharmaceuticalDoseForm;
1381
1382    /**
1383     * Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.
1384     */
1385    @Child(name = "additionalMonitoringIndicator", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1386    @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." )
1387    protected CodeableConcept additionalMonitoringIndicator;
1388
1389    /**
1390     * Whether the Medicinal Product is subject to special measures for regulatory reasons.
1391     */
1392    @Child(name = "specialMeasures", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1393    @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." )
1394    protected List<StringType> specialMeasures;
1395
1396    /**
1397     * If authorised for use in children.
1398     */
1399    @Child(name = "paediatricUseIndicator", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1400    @Description(shortDefinition="If authorised for use in children", formalDefinition="If authorised for use in children." )
1401    protected CodeableConcept paediatricUseIndicator;
1402
1403    /**
1404     * Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.
1405     */
1406    @Child(name = "orphanDesignationStatus", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
1407    @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." )
1408    protected CodeableConcept orphanDesignationStatus;
1409
1410    /**
1411     * Allows the product to be classified by various systems.
1412     */
1413    @Child(name = "productClassification", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1414    @Description(shortDefinition="Allows the product to be classified by various systems", formalDefinition="Allows the product to be classified by various systems." )
1415    protected List<CodeableConcept> productClassification;
1416
1417    /**
1418     * Product regulatory authorization.
1419     */
1420    @Child(name = "marketingAuthorization", type = {MedicinalProductAuthorization.class}, order=8, min=0, max=1, modifier=false, summary=true)
1421    @Description(shortDefinition="Product regulatory authorization", formalDefinition="Product regulatory authorization." )
1422    protected Reference marketingAuthorization;
1423
1424    /**
1425     * The actual object that is the target of the reference (Product regulatory authorization.)
1426     */
1427    protected MedicinalProductAuthorization marketingAuthorizationTarget;
1428
1429    /**
1430     * Package representation for the product.
1431     */
1432    @Child(name = "packagedMedicinalProduct", type = {MedicinalProductPackaged.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1433    @Description(shortDefinition="Package representation for the product", formalDefinition="Package representation for the product." )
1434    protected List<Reference> packagedMedicinalProduct;
1435    /**
1436     * The actual objects that are the target of the reference (Package representation for the product.)
1437     */
1438    protected List<MedicinalProductPackaged> packagedMedicinalProductTarget;
1439
1440
1441    /**
1442     * Pharmaceutical aspects of product.
1443     */
1444    @Child(name = "pharmaceuticalProduct", type = {MedicinalProductPharmaceutical.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1445    @Description(shortDefinition="Pharmaceutical aspects of product", formalDefinition="Pharmaceutical aspects of product." )
1446    protected List<Reference> pharmaceuticalProduct;
1447    /**
1448     * The actual objects that are the target of the reference (Pharmaceutical aspects of product.)
1449     */
1450    protected List<MedicinalProductPharmaceutical> pharmaceuticalProductTarget;
1451
1452
1453    /**
1454     * Clinical particulars, indications etc.
1455     */
1456    @Child(name = "clinicalParticulars", type = {MedicinalProductClinicals.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1457    @Description(shortDefinition="Clinical particulars, indications etc.", formalDefinition="Clinical particulars, indications etc." )
1458    protected List<Reference> clinicalParticulars;
1459    /**
1460     * The actual objects that are the target of the reference (Clinical particulars, indications etc.)
1461     */
1462    protected List<MedicinalProductClinicals> clinicalParticularsTarget;
1463
1464
1465    /**
1466     * Supporting documentation, typically for regulatory submission.
1467     */
1468    @Child(name = "attachedDocument", type = {DocumentReference.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1469    @Description(shortDefinition="Supporting documentation, typically for regulatory submission", formalDefinition="Supporting documentation, typically for regulatory submission." )
1470    protected List<Reference> attachedDocument;
1471    /**
1472     * The actual objects that are the target of the reference (Supporting documentation, typically for regulatory submission.)
1473     */
1474    protected List<DocumentReference> attachedDocumentTarget;
1475
1476
1477    /**
1478     * A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).
1479     */
1480    @Child(name = "masterFile", type = {DocumentReference.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1481    @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)." )
1482    protected List<Reference> masterFile;
1483    /**
1484     * The actual objects that are the target of the reference (A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).)
1485     */
1486    protected List<DocumentReference> masterFileTarget;
1487
1488
1489    /**
1490     * The product's name, including full name and possibly coded parts.
1491     */
1492    @Child(name = "name", type = {}, order=14, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1493    @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." )
1494    protected List<MedicinalProductNameComponent> name;
1495
1496    /**
1497     * Reference to another product, e.g. for linking authorised to investigational product.
1498     */
1499    @Child(name = "crossReference", type = {Identifier.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1500    @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." )
1501    protected List<Identifier> crossReference;
1502
1503    /**
1504     * An operation applied to the product, for manufacturing or adminsitrative purpose.
1505     */
1506    @Child(name = "manufacturingBusinessOperation", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1507    @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." )
1508    protected List<MedicinalProductManufacturingBusinessOperationComponent> manufacturingBusinessOperation;
1509
1510    private static final long serialVersionUID = -1694141448L;
1511
1512  /**
1513   * Constructor
1514   */
1515    public MedicinalProduct() {
1516      super();
1517    }
1518
1519  /**
1520   * Constructor
1521   */
1522    public MedicinalProduct(Identifier identifier) {
1523      super();
1524      this.identifier = identifier;
1525    }
1526
1527    /**
1528     * @return {@link #identifier} (Business idenfifier for this product. Could be an MPID.)
1529     */
1530    public Identifier getIdentifier() { 
1531      if (this.identifier == null)
1532        if (Configuration.errorOnAutoCreate())
1533          throw new Error("Attempt to auto-create MedicinalProduct.identifier");
1534        else if (Configuration.doAutoCreate())
1535          this.identifier = new Identifier(); // cc
1536      return this.identifier;
1537    }
1538
1539    public boolean hasIdentifier() { 
1540      return this.identifier != null && !this.identifier.isEmpty();
1541    }
1542
1543    /**
1544     * @param value {@link #identifier} (Business idenfifier for this product. Could be an MPID.)
1545     */
1546    public MedicinalProduct setIdentifier(Identifier value) { 
1547      this.identifier = value;
1548      return this;
1549    }
1550
1551    /**
1552     * @return {@link #type} (Regulatory type, e.g. Investigational or Authorized.)
1553     */
1554    public CodeableConcept getType() { 
1555      if (this.type == null)
1556        if (Configuration.errorOnAutoCreate())
1557          throw new Error("Attempt to auto-create MedicinalProduct.type");
1558        else if (Configuration.doAutoCreate())
1559          this.type = new CodeableConcept(); // cc
1560      return this.type;
1561    }
1562
1563    public boolean hasType() { 
1564      return this.type != null && !this.type.isEmpty();
1565    }
1566
1567    /**
1568     * @param value {@link #type} (Regulatory type, e.g. Investigational or Authorized.)
1569     */
1570    public MedicinalProduct setType(CodeableConcept value) { 
1571      this.type = value;
1572      return this;
1573    }
1574
1575    /**
1576     * @return {@link #combinedPharmaceuticalDoseForm} (The dose form for a single part product, or combined form of a multiple part product.)
1577     */
1578    public CodeableConcept getCombinedPharmaceuticalDoseForm() { 
1579      if (this.combinedPharmaceuticalDoseForm == null)
1580        if (Configuration.errorOnAutoCreate())
1581          throw new Error("Attempt to auto-create MedicinalProduct.combinedPharmaceuticalDoseForm");
1582        else if (Configuration.doAutoCreate())
1583          this.combinedPharmaceuticalDoseForm = new CodeableConcept(); // cc
1584      return this.combinedPharmaceuticalDoseForm;
1585    }
1586
1587    public boolean hasCombinedPharmaceuticalDoseForm() { 
1588      return this.combinedPharmaceuticalDoseForm != null && !this.combinedPharmaceuticalDoseForm.isEmpty();
1589    }
1590
1591    /**
1592     * @param value {@link #combinedPharmaceuticalDoseForm} (The dose form for a single part product, or combined form of a multiple part product.)
1593     */
1594    public MedicinalProduct setCombinedPharmaceuticalDoseForm(CodeableConcept value) { 
1595      this.combinedPharmaceuticalDoseForm = value;
1596      return this;
1597    }
1598
1599    /**
1600     * @return {@link #additionalMonitoringIndicator} (Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.)
1601     */
1602    public CodeableConcept getAdditionalMonitoringIndicator() { 
1603      if (this.additionalMonitoringIndicator == null)
1604        if (Configuration.errorOnAutoCreate())
1605          throw new Error("Attempt to auto-create MedicinalProduct.additionalMonitoringIndicator");
1606        else if (Configuration.doAutoCreate())
1607          this.additionalMonitoringIndicator = new CodeableConcept(); // cc
1608      return this.additionalMonitoringIndicator;
1609    }
1610
1611    public boolean hasAdditionalMonitoringIndicator() { 
1612      return this.additionalMonitoringIndicator != null && !this.additionalMonitoringIndicator.isEmpty();
1613    }
1614
1615    /**
1616     * @param value {@link #additionalMonitoringIndicator} (Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.)
1617     */
1618    public MedicinalProduct setAdditionalMonitoringIndicator(CodeableConcept value) { 
1619      this.additionalMonitoringIndicator = value;
1620      return this;
1621    }
1622
1623    /**
1624     * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to special measures for regulatory reasons.)
1625     */
1626    public List<StringType> getSpecialMeasures() { 
1627      if (this.specialMeasures == null)
1628        this.specialMeasures = new ArrayList<StringType>();
1629      return this.specialMeasures;
1630    }
1631
1632    /**
1633     * @return Returns a reference to <code>this</code> for easy method chaining
1634     */
1635    public MedicinalProduct setSpecialMeasures(List<StringType> theSpecialMeasures) { 
1636      this.specialMeasures = theSpecialMeasures;
1637      return this;
1638    }
1639
1640    public boolean hasSpecialMeasures() { 
1641      if (this.specialMeasures == null)
1642        return false;
1643      for (StringType item : this.specialMeasures)
1644        if (!item.isEmpty())
1645          return true;
1646      return false;
1647    }
1648
1649    /**
1650     * @return {@link #specialMeasures} (Whether the Medicinal Product is subject to special measures for regulatory reasons.)
1651     */
1652    public StringType addSpecialMeasuresElement() {//2 
1653      StringType t = new StringType();
1654      if (this.specialMeasures == null)
1655        this.specialMeasures = new ArrayList<StringType>();
1656      this.specialMeasures.add(t);
1657      return t;
1658    }
1659
1660    /**
1661     * @param value {@link #specialMeasures} (Whether the Medicinal Product is subject to special measures for regulatory reasons.)
1662     */
1663    public MedicinalProduct addSpecialMeasures(String value) { //1
1664      StringType t = new StringType();
1665      t.setValue(value);
1666      if (this.specialMeasures == null)
1667        this.specialMeasures = new ArrayList<StringType>();
1668      this.specialMeasures.add(t);
1669      return this;
1670    }
1671
1672    /**
1673     * @param value {@link #specialMeasures} (Whether the Medicinal Product is subject to special measures for regulatory reasons.)
1674     */
1675    public boolean hasSpecialMeasures(String value) { 
1676      if (this.specialMeasures == null)
1677        return false;
1678      for (StringType v : this.specialMeasures)
1679        if (v.getValue().equals(value)) // string
1680          return true;
1681      return false;
1682    }
1683
1684    /**
1685     * @return {@link #paediatricUseIndicator} (If authorised for use in children.)
1686     */
1687    public CodeableConcept getPaediatricUseIndicator() { 
1688      if (this.paediatricUseIndicator == null)
1689        if (Configuration.errorOnAutoCreate())
1690          throw new Error("Attempt to auto-create MedicinalProduct.paediatricUseIndicator");
1691        else if (Configuration.doAutoCreate())
1692          this.paediatricUseIndicator = new CodeableConcept(); // cc
1693      return this.paediatricUseIndicator;
1694    }
1695
1696    public boolean hasPaediatricUseIndicator() { 
1697      return this.paediatricUseIndicator != null && !this.paediatricUseIndicator.isEmpty();
1698    }
1699
1700    /**
1701     * @param value {@link #paediatricUseIndicator} (If authorised for use in children.)
1702     */
1703    public MedicinalProduct setPaediatricUseIndicator(CodeableConcept value) { 
1704      this.paediatricUseIndicator = value;
1705      return this;
1706    }
1707
1708    /**
1709     * @return {@link #orphanDesignationStatus} (Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.)
1710     */
1711    public CodeableConcept getOrphanDesignationStatus() { 
1712      if (this.orphanDesignationStatus == null)
1713        if (Configuration.errorOnAutoCreate())
1714          throw new Error("Attempt to auto-create MedicinalProduct.orphanDesignationStatus");
1715        else if (Configuration.doAutoCreate())
1716          this.orphanDesignationStatus = new CodeableConcept(); // cc
1717      return this.orphanDesignationStatus;
1718    }
1719
1720    public boolean hasOrphanDesignationStatus() { 
1721      return this.orphanDesignationStatus != null && !this.orphanDesignationStatus.isEmpty();
1722    }
1723
1724    /**
1725     * @param value {@link #orphanDesignationStatus} (Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.)
1726     */
1727    public MedicinalProduct setOrphanDesignationStatus(CodeableConcept value) { 
1728      this.orphanDesignationStatus = value;
1729      return this;
1730    }
1731
1732    /**
1733     * @return {@link #productClassification} (Allows the product to be classified by various systems.)
1734     */
1735    public List<CodeableConcept> getProductClassification() { 
1736      if (this.productClassification == null)
1737        this.productClassification = new ArrayList<CodeableConcept>();
1738      return this.productClassification;
1739    }
1740
1741    /**
1742     * @return Returns a reference to <code>this</code> for easy method chaining
1743     */
1744    public MedicinalProduct setProductClassification(List<CodeableConcept> theProductClassification) { 
1745      this.productClassification = theProductClassification;
1746      return this;
1747    }
1748
1749    public boolean hasProductClassification() { 
1750      if (this.productClassification == null)
1751        return false;
1752      for (CodeableConcept item : this.productClassification)
1753        if (!item.isEmpty())
1754          return true;
1755      return false;
1756    }
1757
1758    public CodeableConcept addProductClassification() { //3
1759      CodeableConcept t = new CodeableConcept();
1760      if (this.productClassification == null)
1761        this.productClassification = new ArrayList<CodeableConcept>();
1762      this.productClassification.add(t);
1763      return t;
1764    }
1765
1766    public MedicinalProduct addProductClassification(CodeableConcept t) { //3
1767      if (t == null)
1768        return this;
1769      if (this.productClassification == null)
1770        this.productClassification = new ArrayList<CodeableConcept>();
1771      this.productClassification.add(t);
1772      return this;
1773    }
1774
1775    /**
1776     * @return The first repetition of repeating field {@link #productClassification}, creating it if it does not already exist
1777     */
1778    public CodeableConcept getProductClassificationFirstRep() { 
1779      if (getProductClassification().isEmpty()) {
1780        addProductClassification();
1781      }
1782      return getProductClassification().get(0);
1783    }
1784
1785    /**
1786     * @return {@link #marketingAuthorization} (Product regulatory authorization.)
1787     */
1788    public Reference getMarketingAuthorization() { 
1789      if (this.marketingAuthorization == null)
1790        if (Configuration.errorOnAutoCreate())
1791          throw new Error("Attempt to auto-create MedicinalProduct.marketingAuthorization");
1792        else if (Configuration.doAutoCreate())
1793          this.marketingAuthorization = new Reference(); // cc
1794      return this.marketingAuthorization;
1795    }
1796
1797    public boolean hasMarketingAuthorization() { 
1798      return this.marketingAuthorization != null && !this.marketingAuthorization.isEmpty();
1799    }
1800
1801    /**
1802     * @param value {@link #marketingAuthorization} (Product regulatory authorization.)
1803     */
1804    public MedicinalProduct setMarketingAuthorization(Reference value) { 
1805      this.marketingAuthorization = value;
1806      return this;
1807    }
1808
1809    /**
1810     * @return {@link #marketingAuthorization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Product regulatory authorization.)
1811     */
1812    public MedicinalProductAuthorization getMarketingAuthorizationTarget() { 
1813      if (this.marketingAuthorizationTarget == null)
1814        if (Configuration.errorOnAutoCreate())
1815          throw new Error("Attempt to auto-create MedicinalProduct.marketingAuthorization");
1816        else if (Configuration.doAutoCreate())
1817          this.marketingAuthorizationTarget = new MedicinalProductAuthorization(); // aa
1818      return this.marketingAuthorizationTarget;
1819    }
1820
1821    /**
1822     * @param value {@link #marketingAuthorization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Product regulatory authorization.)
1823     */
1824    public MedicinalProduct setMarketingAuthorizationTarget(MedicinalProductAuthorization value) { 
1825      this.marketingAuthorizationTarget = value;
1826      return this;
1827    }
1828
1829    /**
1830     * @return {@link #packagedMedicinalProduct} (Package representation for the product.)
1831     */
1832    public List<Reference> getPackagedMedicinalProduct() { 
1833      if (this.packagedMedicinalProduct == null)
1834        this.packagedMedicinalProduct = new ArrayList<Reference>();
1835      return this.packagedMedicinalProduct;
1836    }
1837
1838    /**
1839     * @return Returns a reference to <code>this</code> for easy method chaining
1840     */
1841    public MedicinalProduct setPackagedMedicinalProduct(List<Reference> thePackagedMedicinalProduct) { 
1842      this.packagedMedicinalProduct = thePackagedMedicinalProduct;
1843      return this;
1844    }
1845
1846    public boolean hasPackagedMedicinalProduct() { 
1847      if (this.packagedMedicinalProduct == null)
1848        return false;
1849      for (Reference item : this.packagedMedicinalProduct)
1850        if (!item.isEmpty())
1851          return true;
1852      return false;
1853    }
1854
1855    public Reference addPackagedMedicinalProduct() { //3
1856      Reference t = new Reference();
1857      if (this.packagedMedicinalProduct == null)
1858        this.packagedMedicinalProduct = new ArrayList<Reference>();
1859      this.packagedMedicinalProduct.add(t);
1860      return t;
1861    }
1862
1863    public MedicinalProduct addPackagedMedicinalProduct(Reference t) { //3
1864      if (t == null)
1865        return this;
1866      if (this.packagedMedicinalProduct == null)
1867        this.packagedMedicinalProduct = new ArrayList<Reference>();
1868      this.packagedMedicinalProduct.add(t);
1869      return this;
1870    }
1871
1872    /**
1873     * @return The first repetition of repeating field {@link #packagedMedicinalProduct}, creating it if it does not already exist
1874     */
1875    public Reference getPackagedMedicinalProductFirstRep() { 
1876      if (getPackagedMedicinalProduct().isEmpty()) {
1877        addPackagedMedicinalProduct();
1878      }
1879      return getPackagedMedicinalProduct().get(0);
1880    }
1881
1882    /**
1883     * @deprecated Use Reference#setResource(IBaseResource) instead
1884     */
1885    @Deprecated
1886    public List<MedicinalProductPackaged> getPackagedMedicinalProductTarget() { 
1887      if (this.packagedMedicinalProductTarget == null)
1888        this.packagedMedicinalProductTarget = new ArrayList<MedicinalProductPackaged>();
1889      return this.packagedMedicinalProductTarget;
1890    }
1891
1892    /**
1893     * @deprecated Use Reference#setResource(IBaseResource) instead
1894     */
1895    @Deprecated
1896    public MedicinalProductPackaged addPackagedMedicinalProductTarget() { 
1897      MedicinalProductPackaged r = new MedicinalProductPackaged();
1898      if (this.packagedMedicinalProductTarget == null)
1899        this.packagedMedicinalProductTarget = new ArrayList<MedicinalProductPackaged>();
1900      this.packagedMedicinalProductTarget.add(r);
1901      return r;
1902    }
1903
1904    /**
1905     * @return {@link #pharmaceuticalProduct} (Pharmaceutical aspects of product.)
1906     */
1907    public List<Reference> getPharmaceuticalProduct() { 
1908      if (this.pharmaceuticalProduct == null)
1909        this.pharmaceuticalProduct = new ArrayList<Reference>();
1910      return this.pharmaceuticalProduct;
1911    }
1912
1913    /**
1914     * @return Returns a reference to <code>this</code> for easy method chaining
1915     */
1916    public MedicinalProduct setPharmaceuticalProduct(List<Reference> thePharmaceuticalProduct) { 
1917      this.pharmaceuticalProduct = thePharmaceuticalProduct;
1918      return this;
1919    }
1920
1921    public boolean hasPharmaceuticalProduct() { 
1922      if (this.pharmaceuticalProduct == null)
1923        return false;
1924      for (Reference item : this.pharmaceuticalProduct)
1925        if (!item.isEmpty())
1926          return true;
1927      return false;
1928    }
1929
1930    public Reference addPharmaceuticalProduct() { //3
1931      Reference t = new Reference();
1932      if (this.pharmaceuticalProduct == null)
1933        this.pharmaceuticalProduct = new ArrayList<Reference>();
1934      this.pharmaceuticalProduct.add(t);
1935      return t;
1936    }
1937
1938    public MedicinalProduct addPharmaceuticalProduct(Reference t) { //3
1939      if (t == null)
1940        return this;
1941      if (this.pharmaceuticalProduct == null)
1942        this.pharmaceuticalProduct = new ArrayList<Reference>();
1943      this.pharmaceuticalProduct.add(t);
1944      return this;
1945    }
1946
1947    /**
1948     * @return The first repetition of repeating field {@link #pharmaceuticalProduct}, creating it if it does not already exist
1949     */
1950    public Reference getPharmaceuticalProductFirstRep() { 
1951      if (getPharmaceuticalProduct().isEmpty()) {
1952        addPharmaceuticalProduct();
1953      }
1954      return getPharmaceuticalProduct().get(0);
1955    }
1956
1957    /**
1958     * @deprecated Use Reference#setResource(IBaseResource) instead
1959     */
1960    @Deprecated
1961    public List<MedicinalProductPharmaceutical> getPharmaceuticalProductTarget() { 
1962      if (this.pharmaceuticalProductTarget == null)
1963        this.pharmaceuticalProductTarget = new ArrayList<MedicinalProductPharmaceutical>();
1964      return this.pharmaceuticalProductTarget;
1965    }
1966
1967    /**
1968     * @deprecated Use Reference#setResource(IBaseResource) instead
1969     */
1970    @Deprecated
1971    public MedicinalProductPharmaceutical addPharmaceuticalProductTarget() { 
1972      MedicinalProductPharmaceutical r = new MedicinalProductPharmaceutical();
1973      if (this.pharmaceuticalProductTarget == null)
1974        this.pharmaceuticalProductTarget = new ArrayList<MedicinalProductPharmaceutical>();
1975      this.pharmaceuticalProductTarget.add(r);
1976      return r;
1977    }
1978
1979    /**
1980     * @return {@link #clinicalParticulars} (Clinical particulars, indications etc.)
1981     */
1982    public List<Reference> getClinicalParticulars() { 
1983      if (this.clinicalParticulars == null)
1984        this.clinicalParticulars = new ArrayList<Reference>();
1985      return this.clinicalParticulars;
1986    }
1987
1988    /**
1989     * @return Returns a reference to <code>this</code> for easy method chaining
1990     */
1991    public MedicinalProduct setClinicalParticulars(List<Reference> theClinicalParticulars) { 
1992      this.clinicalParticulars = theClinicalParticulars;
1993      return this;
1994    }
1995
1996    public boolean hasClinicalParticulars() { 
1997      if (this.clinicalParticulars == null)
1998        return false;
1999      for (Reference item : this.clinicalParticulars)
2000        if (!item.isEmpty())
2001          return true;
2002      return false;
2003    }
2004
2005    public Reference addClinicalParticulars() { //3
2006      Reference t = new Reference();
2007      if (this.clinicalParticulars == null)
2008        this.clinicalParticulars = new ArrayList<Reference>();
2009      this.clinicalParticulars.add(t);
2010      return t;
2011    }
2012
2013    public MedicinalProduct addClinicalParticulars(Reference t) { //3
2014      if (t == null)
2015        return this;
2016      if (this.clinicalParticulars == null)
2017        this.clinicalParticulars = new ArrayList<Reference>();
2018      this.clinicalParticulars.add(t);
2019      return this;
2020    }
2021
2022    /**
2023     * @return The first repetition of repeating field {@link #clinicalParticulars}, creating it if it does not already exist
2024     */
2025    public Reference getClinicalParticularsFirstRep() { 
2026      if (getClinicalParticulars().isEmpty()) {
2027        addClinicalParticulars();
2028      }
2029      return getClinicalParticulars().get(0);
2030    }
2031
2032    /**
2033     * @deprecated Use Reference#setResource(IBaseResource) instead
2034     */
2035    @Deprecated
2036    public List<MedicinalProductClinicals> getClinicalParticularsTarget() { 
2037      if (this.clinicalParticularsTarget == null)
2038        this.clinicalParticularsTarget = new ArrayList<MedicinalProductClinicals>();
2039      return this.clinicalParticularsTarget;
2040    }
2041
2042    /**
2043     * @deprecated Use Reference#setResource(IBaseResource) instead
2044     */
2045    @Deprecated
2046    public MedicinalProductClinicals addClinicalParticularsTarget() { 
2047      MedicinalProductClinicals r = new MedicinalProductClinicals();
2048      if (this.clinicalParticularsTarget == null)
2049        this.clinicalParticularsTarget = new ArrayList<MedicinalProductClinicals>();
2050      this.clinicalParticularsTarget.add(r);
2051      return r;
2052    }
2053
2054    /**
2055     * @return {@link #attachedDocument} (Supporting documentation, typically for regulatory submission.)
2056     */
2057    public List<Reference> getAttachedDocument() { 
2058      if (this.attachedDocument == null)
2059        this.attachedDocument = new ArrayList<Reference>();
2060      return this.attachedDocument;
2061    }
2062
2063    /**
2064     * @return Returns a reference to <code>this</code> for easy method chaining
2065     */
2066    public MedicinalProduct setAttachedDocument(List<Reference> theAttachedDocument) { 
2067      this.attachedDocument = theAttachedDocument;
2068      return this;
2069    }
2070
2071    public boolean hasAttachedDocument() { 
2072      if (this.attachedDocument == null)
2073        return false;
2074      for (Reference item : this.attachedDocument)
2075        if (!item.isEmpty())
2076          return true;
2077      return false;
2078    }
2079
2080    public Reference addAttachedDocument() { //3
2081      Reference t = new Reference();
2082      if (this.attachedDocument == null)
2083        this.attachedDocument = new ArrayList<Reference>();
2084      this.attachedDocument.add(t);
2085      return t;
2086    }
2087
2088    public MedicinalProduct addAttachedDocument(Reference t) { //3
2089      if (t == null)
2090        return this;
2091      if (this.attachedDocument == null)
2092        this.attachedDocument = new ArrayList<Reference>();
2093      this.attachedDocument.add(t);
2094      return this;
2095    }
2096
2097    /**
2098     * @return The first repetition of repeating field {@link #attachedDocument}, creating it if it does not already exist
2099     */
2100    public Reference getAttachedDocumentFirstRep() { 
2101      if (getAttachedDocument().isEmpty()) {
2102        addAttachedDocument();
2103      }
2104      return getAttachedDocument().get(0);
2105    }
2106
2107    /**
2108     * @deprecated Use Reference#setResource(IBaseResource) instead
2109     */
2110    @Deprecated
2111    public List<DocumentReference> getAttachedDocumentTarget() { 
2112      if (this.attachedDocumentTarget == null)
2113        this.attachedDocumentTarget = new ArrayList<DocumentReference>();
2114      return this.attachedDocumentTarget;
2115    }
2116
2117    /**
2118     * @deprecated Use Reference#setResource(IBaseResource) instead
2119     */
2120    @Deprecated
2121    public DocumentReference addAttachedDocumentTarget() { 
2122      DocumentReference r = new DocumentReference();
2123      if (this.attachedDocumentTarget == null)
2124        this.attachedDocumentTarget = new ArrayList<DocumentReference>();
2125      this.attachedDocumentTarget.add(r);
2126      return r;
2127    }
2128
2129    /**
2130     * @return {@link #masterFile} (A master file for to the medicinal product (e.g. Pharmacovigilance System Master File).)
2131     */
2132    public List<Reference> getMasterFile() { 
2133      if (this.masterFile == null)
2134        this.masterFile = new ArrayList<Reference>();
2135      return this.masterFile;
2136    }
2137
2138    /**
2139     * @return Returns a reference to <code>this</code> for easy method chaining
2140     */
2141    public MedicinalProduct setMasterFile(List<Reference> theMasterFile) { 
2142      this.masterFile = theMasterFile;
2143      return this;
2144    }
2145
2146    public boolean hasMasterFile() { 
2147      if (this.masterFile == null)
2148        return false;
2149      for (Reference item : this.masterFile)
2150        if (!item.isEmpty())
2151          return true;
2152      return false;
2153    }
2154
2155    public Reference addMasterFile() { //3
2156      Reference t = new Reference();
2157      if (this.masterFile == null)
2158        this.masterFile = new ArrayList<Reference>();
2159      this.masterFile.add(t);
2160      return t;
2161    }
2162
2163    public MedicinalProduct addMasterFile(Reference t) { //3
2164      if (t == null)
2165        return this;
2166      if (this.masterFile == null)
2167        this.masterFile = new ArrayList<Reference>();
2168      this.masterFile.add(t);
2169      return this;
2170    }
2171
2172    /**
2173     * @return The first repetition of repeating field {@link #masterFile}, creating it if it does not already exist
2174     */
2175    public Reference getMasterFileFirstRep() { 
2176      if (getMasterFile().isEmpty()) {
2177        addMasterFile();
2178      }
2179      return getMasterFile().get(0);
2180    }
2181
2182    /**
2183     * @deprecated Use Reference#setResource(IBaseResource) instead
2184     */
2185    @Deprecated
2186    public List<DocumentReference> getMasterFileTarget() { 
2187      if (this.masterFileTarget == null)
2188        this.masterFileTarget = new ArrayList<DocumentReference>();
2189      return this.masterFileTarget;
2190    }
2191
2192    /**
2193     * @deprecated Use Reference#setResource(IBaseResource) instead
2194     */
2195    @Deprecated
2196    public DocumentReference addMasterFileTarget() { 
2197      DocumentReference r = new DocumentReference();
2198      if (this.masterFileTarget == null)
2199        this.masterFileTarget = new ArrayList<DocumentReference>();
2200      this.masterFileTarget.add(r);
2201      return r;
2202    }
2203
2204    /**
2205     * @return {@link #name} (The product's name, including full name and possibly coded parts.)
2206     */
2207    public List<MedicinalProductNameComponent> getName() { 
2208      if (this.name == null)
2209        this.name = new ArrayList<MedicinalProductNameComponent>();
2210      return this.name;
2211    }
2212
2213    /**
2214     * @return Returns a reference to <code>this</code> for easy method chaining
2215     */
2216    public MedicinalProduct setName(List<MedicinalProductNameComponent> theName) { 
2217      this.name = theName;
2218      return this;
2219    }
2220
2221    public boolean hasName() { 
2222      if (this.name == null)
2223        return false;
2224      for (MedicinalProductNameComponent item : this.name)
2225        if (!item.isEmpty())
2226          return true;
2227      return false;
2228    }
2229
2230    public MedicinalProductNameComponent addName() { //3
2231      MedicinalProductNameComponent t = new MedicinalProductNameComponent();
2232      if (this.name == null)
2233        this.name = new ArrayList<MedicinalProductNameComponent>();
2234      this.name.add(t);
2235      return t;
2236    }
2237
2238    public MedicinalProduct addName(MedicinalProductNameComponent t) { //3
2239      if (t == null)
2240        return this;
2241      if (this.name == null)
2242        this.name = new ArrayList<MedicinalProductNameComponent>();
2243      this.name.add(t);
2244      return this;
2245    }
2246
2247    /**
2248     * @return The first repetition of repeating field {@link #name}, creating it if it does not already exist
2249     */
2250    public MedicinalProductNameComponent getNameFirstRep() { 
2251      if (getName().isEmpty()) {
2252        addName();
2253      }
2254      return getName().get(0);
2255    }
2256
2257    /**
2258     * @return {@link #crossReference} (Reference to another product, e.g. for linking authorised to investigational product.)
2259     */
2260    public List<Identifier> getCrossReference() { 
2261      if (this.crossReference == null)
2262        this.crossReference = new ArrayList<Identifier>();
2263      return this.crossReference;
2264    }
2265
2266    /**
2267     * @return Returns a reference to <code>this</code> for easy method chaining
2268     */
2269    public MedicinalProduct setCrossReference(List<Identifier> theCrossReference) { 
2270      this.crossReference = theCrossReference;
2271      return this;
2272    }
2273
2274    public boolean hasCrossReference() { 
2275      if (this.crossReference == null)
2276        return false;
2277      for (Identifier item : this.crossReference)
2278        if (!item.isEmpty())
2279          return true;
2280      return false;
2281    }
2282
2283    public Identifier addCrossReference() { //3
2284      Identifier t = new Identifier();
2285      if (this.crossReference == null)
2286        this.crossReference = new ArrayList<Identifier>();
2287      this.crossReference.add(t);
2288      return t;
2289    }
2290
2291    public MedicinalProduct addCrossReference(Identifier t) { //3
2292      if (t == null)
2293        return this;
2294      if (this.crossReference == null)
2295        this.crossReference = new ArrayList<Identifier>();
2296      this.crossReference.add(t);
2297      return this;
2298    }
2299
2300    /**
2301     * @return The first repetition of repeating field {@link #crossReference}, creating it if it does not already exist
2302     */
2303    public Identifier getCrossReferenceFirstRep() { 
2304      if (getCrossReference().isEmpty()) {
2305        addCrossReference();
2306      }
2307      return getCrossReference().get(0);
2308    }
2309
2310    /**
2311     * @return {@link #manufacturingBusinessOperation} (An operation applied to the product, for manufacturing or adminsitrative purpose.)
2312     */
2313    public List<MedicinalProductManufacturingBusinessOperationComponent> getManufacturingBusinessOperation() { 
2314      if (this.manufacturingBusinessOperation == null)
2315        this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
2316      return this.manufacturingBusinessOperation;
2317    }
2318
2319    /**
2320     * @return Returns a reference to <code>this</code> for easy method chaining
2321     */
2322    public MedicinalProduct setManufacturingBusinessOperation(List<MedicinalProductManufacturingBusinessOperationComponent> theManufacturingBusinessOperation) { 
2323      this.manufacturingBusinessOperation = theManufacturingBusinessOperation;
2324      return this;
2325    }
2326
2327    public boolean hasManufacturingBusinessOperation() { 
2328      if (this.manufacturingBusinessOperation == null)
2329        return false;
2330      for (MedicinalProductManufacturingBusinessOperationComponent item : this.manufacturingBusinessOperation)
2331        if (!item.isEmpty())
2332          return true;
2333      return false;
2334    }
2335
2336    public MedicinalProductManufacturingBusinessOperationComponent addManufacturingBusinessOperation() { //3
2337      MedicinalProductManufacturingBusinessOperationComponent t = new MedicinalProductManufacturingBusinessOperationComponent();
2338      if (this.manufacturingBusinessOperation == null)
2339        this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
2340      this.manufacturingBusinessOperation.add(t);
2341      return t;
2342    }
2343
2344    public MedicinalProduct addManufacturingBusinessOperation(MedicinalProductManufacturingBusinessOperationComponent t) { //3
2345      if (t == null)
2346        return this;
2347      if (this.manufacturingBusinessOperation == null)
2348        this.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
2349      this.manufacturingBusinessOperation.add(t);
2350      return this;
2351    }
2352
2353    /**
2354     * @return The first repetition of repeating field {@link #manufacturingBusinessOperation}, creating it if it does not already exist
2355     */
2356    public MedicinalProductManufacturingBusinessOperationComponent getManufacturingBusinessOperationFirstRep() { 
2357      if (getManufacturingBusinessOperation().isEmpty()) {
2358        addManufacturingBusinessOperation();
2359      }
2360      return getManufacturingBusinessOperation().get(0);
2361    }
2362
2363      protected void listChildren(List<Property> children) {
2364        super.listChildren(children);
2365        children.add(new Property("identifier", "Identifier", "Business idenfifier for this product. Could be an MPID.", 0, 1, identifier));
2366        children.add(new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.", 0, 1, type));
2367        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));
2368        children.add(new Property("additionalMonitoringIndicator", "CodeableConcept", "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1, additionalMonitoringIndicator));
2369        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));
2370        children.add(new Property("paediatricUseIndicator", "CodeableConcept", "If authorised for use in children.", 0, 1, paediatricUseIndicator));
2371        children.add(new Property("orphanDesignationStatus", "CodeableConcept", "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0, 1, orphanDesignationStatus));
2372        children.add(new Property("productClassification", "CodeableConcept", "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE, productClassification));
2373        children.add(new Property("marketingAuthorization", "Reference(MedicinalProductAuthorization)", "Product regulatory authorization.", 0, 1, marketingAuthorization));
2374        children.add(new Property("packagedMedicinalProduct", "Reference(MedicinalProductPackaged)", "Package representation for the product.", 0, java.lang.Integer.MAX_VALUE, packagedMedicinalProduct));
2375        children.add(new Property("pharmaceuticalProduct", "Reference(MedicinalProductPharmaceutical)", "Pharmaceutical aspects of product.", 0, java.lang.Integer.MAX_VALUE, pharmaceuticalProduct));
2376        children.add(new Property("clinicalParticulars", "Reference(MedicinalProductClinicals)", "Clinical particulars, indications etc.", 0, java.lang.Integer.MAX_VALUE, clinicalParticulars));
2377        children.add(new Property("attachedDocument", "Reference(DocumentReference)", "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE, attachedDocument));
2378        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));
2379        children.add(new Property("name", "", "The product's name, including full name and possibly coded parts.", 0, java.lang.Integer.MAX_VALUE, name));
2380        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));
2381        children.add(new Property("manufacturingBusinessOperation", "", "An operation applied to the product, for manufacturing or adminsitrative purpose.", 0, java.lang.Integer.MAX_VALUE, manufacturingBusinessOperation));
2382      }
2383
2384      @Override
2385      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2386        switch (_hash) {
2387        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business idenfifier for this product. Could be an MPID.", 0, 1, identifier);
2388        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Regulatory type, e.g. Investigational or Authorized.", 0, 1, type);
2389        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);
2390        case 1935999744: /*additionalMonitoringIndicator*/  return new Property("additionalMonitoringIndicator", "CodeableConcept", "Whether the Medicinal Product is subject to additional monitoring for regulatory reasons.", 0, 1, additionalMonitoringIndicator);
2391        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);
2392        case -1019867160: /*paediatricUseIndicator*/  return new Property("paediatricUseIndicator", "CodeableConcept", "If authorised for use in children.", 0, 1, paediatricUseIndicator);
2393        case 201000737: /*orphanDesignationStatus*/  return new Property("orphanDesignationStatus", "CodeableConcept", "Indicates if the medicinal product has an orphan designation for the treatment of a rare disease.", 0, 1, orphanDesignationStatus);
2394        case 1247936181: /*productClassification*/  return new Property("productClassification", "CodeableConcept", "Allows the product to be classified by various systems.", 0, java.lang.Integer.MAX_VALUE, productClassification);
2395        case 571831283: /*marketingAuthorization*/  return new Property("marketingAuthorization", "Reference(MedicinalProductAuthorization)", "Product regulatory authorization.", 0, 1, marketingAuthorization);
2396        case -361025513: /*packagedMedicinalProduct*/  return new Property("packagedMedicinalProduct", "Reference(MedicinalProductPackaged)", "Package representation for the product.", 0, java.lang.Integer.MAX_VALUE, packagedMedicinalProduct);
2397        case 443273260: /*pharmaceuticalProduct*/  return new Property("pharmaceuticalProduct", "Reference(MedicinalProductPharmaceutical)", "Pharmaceutical aspects of product.", 0, java.lang.Integer.MAX_VALUE, pharmaceuticalProduct);
2398        case -588103893: /*clinicalParticulars*/  return new Property("clinicalParticulars", "Reference(MedicinalProductClinicals)", "Clinical particulars, indications etc.", 0, java.lang.Integer.MAX_VALUE, clinicalParticulars);
2399        case -513945889: /*attachedDocument*/  return new Property("attachedDocument", "Reference(DocumentReference)", "Supporting documentation, typically for regulatory submission.", 0, java.lang.Integer.MAX_VALUE, attachedDocument);
2400        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);
2401        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);
2402        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);
2403        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);
2404        default: return super.getNamedProperty(_hash, _name, _checkValid);
2405        }
2406
2407      }
2408
2409      @Override
2410      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2411        switch (hash) {
2412        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2413        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2414        case -1992898487: /*combinedPharmaceuticalDoseForm*/ return this.combinedPharmaceuticalDoseForm == null ? new Base[0] : new Base[] {this.combinedPharmaceuticalDoseForm}; // CodeableConcept
2415        case 1935999744: /*additionalMonitoringIndicator*/ return this.additionalMonitoringIndicator == null ? new Base[0] : new Base[] {this.additionalMonitoringIndicator}; // CodeableConcept
2416        case 975102638: /*specialMeasures*/ return this.specialMeasures == null ? new Base[0] : this.specialMeasures.toArray(new Base[this.specialMeasures.size()]); // StringType
2417        case -1019867160: /*paediatricUseIndicator*/ return this.paediatricUseIndicator == null ? new Base[0] : new Base[] {this.paediatricUseIndicator}; // CodeableConcept
2418        case 201000737: /*orphanDesignationStatus*/ return this.orphanDesignationStatus == null ? new Base[0] : new Base[] {this.orphanDesignationStatus}; // CodeableConcept
2419        case 1247936181: /*productClassification*/ return this.productClassification == null ? new Base[0] : this.productClassification.toArray(new Base[this.productClassification.size()]); // CodeableConcept
2420        case 571831283: /*marketingAuthorization*/ return this.marketingAuthorization == null ? new Base[0] : new Base[] {this.marketingAuthorization}; // Reference
2421        case -361025513: /*packagedMedicinalProduct*/ return this.packagedMedicinalProduct == null ? new Base[0] : this.packagedMedicinalProduct.toArray(new Base[this.packagedMedicinalProduct.size()]); // Reference
2422        case 443273260: /*pharmaceuticalProduct*/ return this.pharmaceuticalProduct == null ? new Base[0] : this.pharmaceuticalProduct.toArray(new Base[this.pharmaceuticalProduct.size()]); // Reference
2423        case -588103893: /*clinicalParticulars*/ return this.clinicalParticulars == null ? new Base[0] : this.clinicalParticulars.toArray(new Base[this.clinicalParticulars.size()]); // Reference
2424        case -513945889: /*attachedDocument*/ return this.attachedDocument == null ? new Base[0] : this.attachedDocument.toArray(new Base[this.attachedDocument.size()]); // Reference
2425        case -2039573762: /*masterFile*/ return this.masterFile == null ? new Base[0] : this.masterFile.toArray(new Base[this.masterFile.size()]); // Reference
2426        case 3373707: /*name*/ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // MedicinalProductNameComponent
2427        case -986968341: /*crossReference*/ return this.crossReference == null ? new Base[0] : this.crossReference.toArray(new Base[this.crossReference.size()]); // Identifier
2428        case -171103255: /*manufacturingBusinessOperation*/ return this.manufacturingBusinessOperation == null ? new Base[0] : this.manufacturingBusinessOperation.toArray(new Base[this.manufacturingBusinessOperation.size()]); // MedicinalProductManufacturingBusinessOperationComponent
2429        default: return super.getProperty(hash, name, checkValid);
2430        }
2431
2432      }
2433
2434      @Override
2435      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2436        switch (hash) {
2437        case -1618432855: // identifier
2438          this.identifier = castToIdentifier(value); // Identifier
2439          return value;
2440        case 3575610: // type
2441          this.type = castToCodeableConcept(value); // CodeableConcept
2442          return value;
2443        case -1992898487: // combinedPharmaceuticalDoseForm
2444          this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
2445          return value;
2446        case 1935999744: // additionalMonitoringIndicator
2447          this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
2448          return value;
2449        case 975102638: // specialMeasures
2450          this.getSpecialMeasures().add(castToString(value)); // StringType
2451          return value;
2452        case -1019867160: // paediatricUseIndicator
2453          this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
2454          return value;
2455        case 201000737: // orphanDesignationStatus
2456          this.orphanDesignationStatus = castToCodeableConcept(value); // CodeableConcept
2457          return value;
2458        case 1247936181: // productClassification
2459          this.getProductClassification().add(castToCodeableConcept(value)); // CodeableConcept
2460          return value;
2461        case 571831283: // marketingAuthorization
2462          this.marketingAuthorization = castToReference(value); // Reference
2463          return value;
2464        case -361025513: // packagedMedicinalProduct
2465          this.getPackagedMedicinalProduct().add(castToReference(value)); // Reference
2466          return value;
2467        case 443273260: // pharmaceuticalProduct
2468          this.getPharmaceuticalProduct().add(castToReference(value)); // Reference
2469          return value;
2470        case -588103893: // clinicalParticulars
2471          this.getClinicalParticulars().add(castToReference(value)); // Reference
2472          return value;
2473        case -513945889: // attachedDocument
2474          this.getAttachedDocument().add(castToReference(value)); // Reference
2475          return value;
2476        case -2039573762: // masterFile
2477          this.getMasterFile().add(castToReference(value)); // Reference
2478          return value;
2479        case 3373707: // name
2480          this.getName().add((MedicinalProductNameComponent) value); // MedicinalProductNameComponent
2481          return value;
2482        case -986968341: // crossReference
2483          this.getCrossReference().add(castToIdentifier(value)); // Identifier
2484          return value;
2485        case -171103255: // manufacturingBusinessOperation
2486          this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value); // MedicinalProductManufacturingBusinessOperationComponent
2487          return value;
2488        default: return super.setProperty(hash, name, value);
2489        }
2490
2491      }
2492
2493      @Override
2494      public Base setProperty(String name, Base value) throws FHIRException {
2495        if (name.equals("identifier")) {
2496          this.identifier = castToIdentifier(value); // Identifier
2497        } else if (name.equals("type")) {
2498          this.type = castToCodeableConcept(value); // CodeableConcept
2499        } else if (name.equals("combinedPharmaceuticalDoseForm")) {
2500          this.combinedPharmaceuticalDoseForm = castToCodeableConcept(value); // CodeableConcept
2501        } else if (name.equals("additionalMonitoringIndicator")) {
2502          this.additionalMonitoringIndicator = castToCodeableConcept(value); // CodeableConcept
2503        } else if (name.equals("specialMeasures")) {
2504          this.getSpecialMeasures().add(castToString(value));
2505        } else if (name.equals("paediatricUseIndicator")) {
2506          this.paediatricUseIndicator = castToCodeableConcept(value); // CodeableConcept
2507        } else if (name.equals("orphanDesignationStatus")) {
2508          this.orphanDesignationStatus = castToCodeableConcept(value); // CodeableConcept
2509        } else if (name.equals("productClassification")) {
2510          this.getProductClassification().add(castToCodeableConcept(value));
2511        } else if (name.equals("marketingAuthorization")) {
2512          this.marketingAuthorization = castToReference(value); // Reference
2513        } else if (name.equals("packagedMedicinalProduct")) {
2514          this.getPackagedMedicinalProduct().add(castToReference(value));
2515        } else if (name.equals("pharmaceuticalProduct")) {
2516          this.getPharmaceuticalProduct().add(castToReference(value));
2517        } else if (name.equals("clinicalParticulars")) {
2518          this.getClinicalParticulars().add(castToReference(value));
2519        } else if (name.equals("attachedDocument")) {
2520          this.getAttachedDocument().add(castToReference(value));
2521        } else if (name.equals("masterFile")) {
2522          this.getMasterFile().add(castToReference(value));
2523        } else if (name.equals("name")) {
2524          this.getName().add((MedicinalProductNameComponent) value);
2525        } else if (name.equals("crossReference")) {
2526          this.getCrossReference().add(castToIdentifier(value));
2527        } else if (name.equals("manufacturingBusinessOperation")) {
2528          this.getManufacturingBusinessOperation().add((MedicinalProductManufacturingBusinessOperationComponent) value);
2529        } else
2530          return super.setProperty(name, value);
2531        return value;
2532      }
2533
2534      @Override
2535      public Base makeProperty(int hash, String name) throws FHIRException {
2536        switch (hash) {
2537        case -1618432855:  return getIdentifier(); 
2538        case 3575610:  return getType(); 
2539        case -1992898487:  return getCombinedPharmaceuticalDoseForm(); 
2540        case 1935999744:  return getAdditionalMonitoringIndicator(); 
2541        case 975102638:  return addSpecialMeasuresElement();
2542        case -1019867160:  return getPaediatricUseIndicator(); 
2543        case 201000737:  return getOrphanDesignationStatus(); 
2544        case 1247936181:  return addProductClassification(); 
2545        case 571831283:  return getMarketingAuthorization(); 
2546        case -361025513:  return addPackagedMedicinalProduct(); 
2547        case 443273260:  return addPharmaceuticalProduct(); 
2548        case -588103893:  return addClinicalParticulars(); 
2549        case -513945889:  return addAttachedDocument(); 
2550        case -2039573762:  return addMasterFile(); 
2551        case 3373707:  return addName(); 
2552        case -986968341:  return addCrossReference(); 
2553        case -171103255:  return addManufacturingBusinessOperation(); 
2554        default: return super.makeProperty(hash, name);
2555        }
2556
2557      }
2558
2559      @Override
2560      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2561        switch (hash) {
2562        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2563        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2564        case -1992898487: /*combinedPharmaceuticalDoseForm*/ return new String[] {"CodeableConcept"};
2565        case 1935999744: /*additionalMonitoringIndicator*/ return new String[] {"CodeableConcept"};
2566        case 975102638: /*specialMeasures*/ return new String[] {"string"};
2567        case -1019867160: /*paediatricUseIndicator*/ return new String[] {"CodeableConcept"};
2568        case 201000737: /*orphanDesignationStatus*/ return new String[] {"CodeableConcept"};
2569        case 1247936181: /*productClassification*/ return new String[] {"CodeableConcept"};
2570        case 571831283: /*marketingAuthorization*/ return new String[] {"Reference"};
2571        case -361025513: /*packagedMedicinalProduct*/ return new String[] {"Reference"};
2572        case 443273260: /*pharmaceuticalProduct*/ return new String[] {"Reference"};
2573        case -588103893: /*clinicalParticulars*/ return new String[] {"Reference"};
2574        case -513945889: /*attachedDocument*/ return new String[] {"Reference"};
2575        case -2039573762: /*masterFile*/ return new String[] {"Reference"};
2576        case 3373707: /*name*/ return new String[] {};
2577        case -986968341: /*crossReference*/ return new String[] {"Identifier"};
2578        case -171103255: /*manufacturingBusinessOperation*/ return new String[] {};
2579        default: return super.getTypesForProperty(hash, name);
2580        }
2581
2582      }
2583
2584      @Override
2585      public Base addChild(String name) throws FHIRException {
2586        if (name.equals("identifier")) {
2587          this.identifier = new Identifier();
2588          return this.identifier;
2589        }
2590        else if (name.equals("type")) {
2591          this.type = new CodeableConcept();
2592          return this.type;
2593        }
2594        else if (name.equals("combinedPharmaceuticalDoseForm")) {
2595          this.combinedPharmaceuticalDoseForm = new CodeableConcept();
2596          return this.combinedPharmaceuticalDoseForm;
2597        }
2598        else if (name.equals("additionalMonitoringIndicator")) {
2599          this.additionalMonitoringIndicator = new CodeableConcept();
2600          return this.additionalMonitoringIndicator;
2601        }
2602        else if (name.equals("specialMeasures")) {
2603          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProduct.specialMeasures");
2604        }
2605        else if (name.equals("paediatricUseIndicator")) {
2606          this.paediatricUseIndicator = new CodeableConcept();
2607          return this.paediatricUseIndicator;
2608        }
2609        else if (name.equals("orphanDesignationStatus")) {
2610          this.orphanDesignationStatus = new CodeableConcept();
2611          return this.orphanDesignationStatus;
2612        }
2613        else if (name.equals("productClassification")) {
2614          return addProductClassification();
2615        }
2616        else if (name.equals("marketingAuthorization")) {
2617          this.marketingAuthorization = new Reference();
2618          return this.marketingAuthorization;
2619        }
2620        else if (name.equals("packagedMedicinalProduct")) {
2621          return addPackagedMedicinalProduct();
2622        }
2623        else if (name.equals("pharmaceuticalProduct")) {
2624          return addPharmaceuticalProduct();
2625        }
2626        else if (name.equals("clinicalParticulars")) {
2627          return addClinicalParticulars();
2628        }
2629        else if (name.equals("attachedDocument")) {
2630          return addAttachedDocument();
2631        }
2632        else if (name.equals("masterFile")) {
2633          return addMasterFile();
2634        }
2635        else if (name.equals("name")) {
2636          return addName();
2637        }
2638        else if (name.equals("crossReference")) {
2639          return addCrossReference();
2640        }
2641        else if (name.equals("manufacturingBusinessOperation")) {
2642          return addManufacturingBusinessOperation();
2643        }
2644        else
2645          return super.addChild(name);
2646      }
2647
2648  public String fhirType() {
2649    return "MedicinalProduct";
2650
2651  }
2652
2653      public MedicinalProduct copy() {
2654        MedicinalProduct dst = new MedicinalProduct();
2655        copyValues(dst);
2656        dst.identifier = identifier == null ? null : identifier.copy();
2657        dst.type = type == null ? null : type.copy();
2658        dst.combinedPharmaceuticalDoseForm = combinedPharmaceuticalDoseForm == null ? null : combinedPharmaceuticalDoseForm.copy();
2659        dst.additionalMonitoringIndicator = additionalMonitoringIndicator == null ? null : additionalMonitoringIndicator.copy();
2660        if (specialMeasures != null) {
2661          dst.specialMeasures = new ArrayList<StringType>();
2662          for (StringType i : specialMeasures)
2663            dst.specialMeasures.add(i.copy());
2664        };
2665        dst.paediatricUseIndicator = paediatricUseIndicator == null ? null : paediatricUseIndicator.copy();
2666        dst.orphanDesignationStatus = orphanDesignationStatus == null ? null : orphanDesignationStatus.copy();
2667        if (productClassification != null) {
2668          dst.productClassification = new ArrayList<CodeableConcept>();
2669          for (CodeableConcept i : productClassification)
2670            dst.productClassification.add(i.copy());
2671        };
2672        dst.marketingAuthorization = marketingAuthorization == null ? null : marketingAuthorization.copy();
2673        if (packagedMedicinalProduct != null) {
2674          dst.packagedMedicinalProduct = new ArrayList<Reference>();
2675          for (Reference i : packagedMedicinalProduct)
2676            dst.packagedMedicinalProduct.add(i.copy());
2677        };
2678        if (pharmaceuticalProduct != null) {
2679          dst.pharmaceuticalProduct = new ArrayList<Reference>();
2680          for (Reference i : pharmaceuticalProduct)
2681            dst.pharmaceuticalProduct.add(i.copy());
2682        };
2683        if (clinicalParticulars != null) {
2684          dst.clinicalParticulars = new ArrayList<Reference>();
2685          for (Reference i : clinicalParticulars)
2686            dst.clinicalParticulars.add(i.copy());
2687        };
2688        if (attachedDocument != null) {
2689          dst.attachedDocument = new ArrayList<Reference>();
2690          for (Reference i : attachedDocument)
2691            dst.attachedDocument.add(i.copy());
2692        };
2693        if (masterFile != null) {
2694          dst.masterFile = new ArrayList<Reference>();
2695          for (Reference i : masterFile)
2696            dst.masterFile.add(i.copy());
2697        };
2698        if (name != null) {
2699          dst.name = new ArrayList<MedicinalProductNameComponent>();
2700          for (MedicinalProductNameComponent i : name)
2701            dst.name.add(i.copy());
2702        };
2703        if (crossReference != null) {
2704          dst.crossReference = new ArrayList<Identifier>();
2705          for (Identifier i : crossReference)
2706            dst.crossReference.add(i.copy());
2707        };
2708        if (manufacturingBusinessOperation != null) {
2709          dst.manufacturingBusinessOperation = new ArrayList<MedicinalProductManufacturingBusinessOperationComponent>();
2710          for (MedicinalProductManufacturingBusinessOperationComponent i : manufacturingBusinessOperation)
2711            dst.manufacturingBusinessOperation.add(i.copy());
2712        };
2713        return dst;
2714      }
2715
2716      protected MedicinalProduct typedCopy() {
2717        return copy();
2718      }
2719
2720      @Override
2721      public boolean equalsDeep(Base other_) {
2722        if (!super.equalsDeep(other_))
2723          return false;
2724        if (!(other_ instanceof MedicinalProduct))
2725          return false;
2726        MedicinalProduct o = (MedicinalProduct) other_;
2727        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(combinedPharmaceuticalDoseForm, o.combinedPharmaceuticalDoseForm, true)
2728           && compareDeep(additionalMonitoringIndicator, o.additionalMonitoringIndicator, true) && compareDeep(specialMeasures, o.specialMeasures, true)
2729           && compareDeep(paediatricUseIndicator, o.paediatricUseIndicator, true) && compareDeep(orphanDesignationStatus, o.orphanDesignationStatus, true)
2730           && compareDeep(productClassification, o.productClassification, true) && compareDeep(marketingAuthorization, o.marketingAuthorization, true)
2731           && compareDeep(packagedMedicinalProduct, o.packagedMedicinalProduct, true) && compareDeep(pharmaceuticalProduct, o.pharmaceuticalProduct, true)
2732           && compareDeep(clinicalParticulars, o.clinicalParticulars, true) && compareDeep(attachedDocument, o.attachedDocument, true)
2733           && compareDeep(masterFile, o.masterFile, true) && compareDeep(name, o.name, true) && compareDeep(crossReference, o.crossReference, true)
2734           && compareDeep(manufacturingBusinessOperation, o.manufacturingBusinessOperation, true);
2735      }
2736
2737      @Override
2738      public boolean equalsShallow(Base other_) {
2739        if (!super.equalsShallow(other_))
2740          return false;
2741        if (!(other_ instanceof MedicinalProduct))
2742          return false;
2743        MedicinalProduct o = (MedicinalProduct) other_;
2744        return compareValues(specialMeasures, o.specialMeasures, true);
2745      }
2746
2747      public boolean isEmpty() {
2748        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, combinedPharmaceuticalDoseForm
2749          , additionalMonitoringIndicator, specialMeasures, paediatricUseIndicator, orphanDesignationStatus
2750          , productClassification, marketingAuthorization, packagedMedicinalProduct, pharmaceuticalProduct
2751          , clinicalParticulars, attachedDocument, masterFile, name, crossReference, manufacturingBusinessOperation
2752          );
2753      }
2754
2755  @Override
2756  public ResourceType getResourceType() {
2757    return ResourceType.MedicinalProduct;
2758   }
2759
2760
2761}
2762