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