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