001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import ca.uhn.fhir.model.api.annotation.ResourceDef;
037import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.ChildOrder;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.Block;
042import org.hl7.fhir.instance.model.api.*;
043import org.hl7.fhir.exceptions.FHIRException;
044/**
045 * The regulatory authorization of a medicinal product.
046 */
047@ResourceDef(name="MedicinalProductAuthorization", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductAuthorization")
048public class MedicinalProductAuthorization extends DomainResource {
049
050    @Block()
051    public static class MedicinalProductAuthorizationJurisdictionalAuthorizationComponent extends BackboneElement implements IBaseBackboneElement {
052        /**
053         * The assigned number for the marketing authorization.
054         */
055        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
056        @Description(shortDefinition="The assigned number for the marketing authorization", formalDefinition="The assigned number for the marketing authorization." )
057        protected List<Identifier> identifier;
058
059        /**
060         * Country of authorization.
061         */
062        @Child(name = "country", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
063        @Description(shortDefinition="Country of authorization", formalDefinition="Country of authorization." )
064        protected CodeableConcept country;
065
066        /**
067         * Jurisdiction within a country.
068         */
069        @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
070        @Description(shortDefinition="Jurisdiction within a country", formalDefinition="Jurisdiction within a country." )
071        protected List<CodeableConcept> jurisdiction;
072
073        /**
074         * The legal status of supply in a jurisdiction or region.
075         */
076        @Child(name = "legalStatusOfSupply", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
077        @Description(shortDefinition="The legal status of supply in a jurisdiction or region", formalDefinition="The legal status of supply in a jurisdiction or region." )
078        protected CodeableConcept legalStatusOfSupply;
079
080        /**
081         * The start and expected end date of the authorization.
082         */
083        @Child(name = "validityPeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
084        @Description(shortDefinition="The start and expected end date of the authorization", formalDefinition="The start and expected end date of the authorization." )
085        protected Period validityPeriod;
086
087        private static final long serialVersionUID = -1893307291L;
088
089    /**
090     * Constructor
091     */
092      public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent() {
093        super();
094      }
095
096        /**
097         * @return {@link #identifier} (The assigned number for the marketing authorization.)
098         */
099        public List<Identifier> getIdentifier() { 
100          if (this.identifier == null)
101            this.identifier = new ArrayList<Identifier>();
102          return this.identifier;
103        }
104
105        /**
106         * @return Returns a reference to <code>this</code> for easy method chaining
107         */
108        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setIdentifier(List<Identifier> theIdentifier) { 
109          this.identifier = theIdentifier;
110          return this;
111        }
112
113        public boolean hasIdentifier() { 
114          if (this.identifier == null)
115            return false;
116          for (Identifier item : this.identifier)
117            if (!item.isEmpty())
118              return true;
119          return false;
120        }
121
122        public Identifier addIdentifier() { //3
123          Identifier t = new Identifier();
124          if (this.identifier == null)
125            this.identifier = new ArrayList<Identifier>();
126          this.identifier.add(t);
127          return t;
128        }
129
130        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addIdentifier(Identifier t) { //3
131          if (t == null)
132            return this;
133          if (this.identifier == null)
134            this.identifier = new ArrayList<Identifier>();
135          this.identifier.add(t);
136          return this;
137        }
138
139        /**
140         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
141         */
142        public Identifier getIdentifierFirstRep() { 
143          if (getIdentifier().isEmpty()) {
144            addIdentifier();
145          }
146          return getIdentifier().get(0);
147        }
148
149        /**
150         * @return {@link #country} (Country of authorization.)
151         */
152        public CodeableConcept getCountry() { 
153          if (this.country == null)
154            if (Configuration.errorOnAutoCreate())
155              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.country");
156            else if (Configuration.doAutoCreate())
157              this.country = new CodeableConcept(); // cc
158          return this.country;
159        }
160
161        public boolean hasCountry() { 
162          return this.country != null && !this.country.isEmpty();
163        }
164
165        /**
166         * @param value {@link #country} (Country of authorization.)
167         */
168        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setCountry(CodeableConcept value) { 
169          this.country = value;
170          return this;
171        }
172
173        /**
174         * @return {@link #jurisdiction} (Jurisdiction within a country.)
175         */
176        public List<CodeableConcept> getJurisdiction() { 
177          if (this.jurisdiction == null)
178            this.jurisdiction = new ArrayList<CodeableConcept>();
179          return this.jurisdiction;
180        }
181
182        /**
183         * @return Returns a reference to <code>this</code> for easy method chaining
184         */
185        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setJurisdiction(List<CodeableConcept> theJurisdiction) { 
186          this.jurisdiction = theJurisdiction;
187          return this;
188        }
189
190        public boolean hasJurisdiction() { 
191          if (this.jurisdiction == null)
192            return false;
193          for (CodeableConcept item : this.jurisdiction)
194            if (!item.isEmpty())
195              return true;
196          return false;
197        }
198
199        public CodeableConcept addJurisdiction() { //3
200          CodeableConcept t = new CodeableConcept();
201          if (this.jurisdiction == null)
202            this.jurisdiction = new ArrayList<CodeableConcept>();
203          this.jurisdiction.add(t);
204          return t;
205        }
206
207        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addJurisdiction(CodeableConcept t) { //3
208          if (t == null)
209            return this;
210          if (this.jurisdiction == null)
211            this.jurisdiction = new ArrayList<CodeableConcept>();
212          this.jurisdiction.add(t);
213          return this;
214        }
215
216        /**
217         * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
218         */
219        public CodeableConcept getJurisdictionFirstRep() { 
220          if (getJurisdiction().isEmpty()) {
221            addJurisdiction();
222          }
223          return getJurisdiction().get(0);
224        }
225
226        /**
227         * @return {@link #legalStatusOfSupply} (The legal status of supply in a jurisdiction or region.)
228         */
229        public CodeableConcept getLegalStatusOfSupply() { 
230          if (this.legalStatusOfSupply == null)
231            if (Configuration.errorOnAutoCreate())
232              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.legalStatusOfSupply");
233            else if (Configuration.doAutoCreate())
234              this.legalStatusOfSupply = new CodeableConcept(); // cc
235          return this.legalStatusOfSupply;
236        }
237
238        public boolean hasLegalStatusOfSupply() { 
239          return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
240        }
241
242        /**
243         * @param value {@link #legalStatusOfSupply} (The legal status of supply in a jurisdiction or region.)
244         */
245        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setLegalStatusOfSupply(CodeableConcept value) { 
246          this.legalStatusOfSupply = value;
247          return this;
248        }
249
250        /**
251         * @return {@link #validityPeriod} (The start and expected end date of the authorization.)
252         */
253        public Period getValidityPeriod() { 
254          if (this.validityPeriod == null)
255            if (Configuration.errorOnAutoCreate())
256              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.validityPeriod");
257            else if (Configuration.doAutoCreate())
258              this.validityPeriod = new Period(); // cc
259          return this.validityPeriod;
260        }
261
262        public boolean hasValidityPeriod() { 
263          return this.validityPeriod != null && !this.validityPeriod.isEmpty();
264        }
265
266        /**
267         * @param value {@link #validityPeriod} (The start and expected end date of the authorization.)
268         */
269        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setValidityPeriod(Period value) { 
270          this.validityPeriod = value;
271          return this;
272        }
273
274        protected void listChildren(List<Property> children) {
275          super.listChildren(children);
276          children.add(new Property("identifier", "Identifier", "The assigned number for the marketing authorization.", 0, java.lang.Integer.MAX_VALUE, identifier));
277          children.add(new Property("country", "CodeableConcept", "Country of authorization.", 0, 1, country));
278          children.add(new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
279          children.add(new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply in a jurisdiction or region.", 0, 1, legalStatusOfSupply));
280          children.add(new Property("validityPeriod", "Period", "The start and expected end date of the authorization.", 0, 1, validityPeriod));
281        }
282
283        @Override
284        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
285          switch (_hash) {
286          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The assigned number for the marketing authorization.", 0, java.lang.Integer.MAX_VALUE, identifier);
287          case 957831062: /*country*/  return new Property("country", "CodeableConcept", "Country of authorization.", 0, 1, country);
288          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
289          case -844874031: /*legalStatusOfSupply*/  return new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply in a jurisdiction or region.", 0, 1, legalStatusOfSupply);
290          case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The start and expected end date of the authorization.", 0, 1, validityPeriod);
291          default: return super.getNamedProperty(_hash, _name, _checkValid);
292          }
293
294        }
295
296      @Override
297      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
298        switch (hash) {
299        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
300        case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // CodeableConcept
301        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
302        case -844874031: /*legalStatusOfSupply*/ return this.legalStatusOfSupply == null ? new Base[0] : new Base[] {this.legalStatusOfSupply}; // CodeableConcept
303        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
304        default: return super.getProperty(hash, name, checkValid);
305        }
306
307      }
308
309      @Override
310      public Base setProperty(int hash, String name, Base value) throws FHIRException {
311        switch (hash) {
312        case -1618432855: // identifier
313          this.getIdentifier().add(castToIdentifier(value)); // Identifier
314          return value;
315        case 957831062: // country
316          this.country = castToCodeableConcept(value); // CodeableConcept
317          return value;
318        case -507075711: // jurisdiction
319          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
320          return value;
321        case -844874031: // legalStatusOfSupply
322          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
323          return value;
324        case -1434195053: // validityPeriod
325          this.validityPeriod = castToPeriod(value); // Period
326          return value;
327        default: return super.setProperty(hash, name, value);
328        }
329
330      }
331
332      @Override
333      public Base setProperty(String name, Base value) throws FHIRException {
334        if (name.equals("identifier")) {
335          this.getIdentifier().add(castToIdentifier(value));
336        } else if (name.equals("country")) {
337          this.country = castToCodeableConcept(value); // CodeableConcept
338        } else if (name.equals("jurisdiction")) {
339          this.getJurisdiction().add(castToCodeableConcept(value));
340        } else if (name.equals("legalStatusOfSupply")) {
341          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
342        } else if (name.equals("validityPeriod")) {
343          this.validityPeriod = castToPeriod(value); // Period
344        } else
345          return super.setProperty(name, value);
346        return value;
347      }
348
349      @Override
350      public Base makeProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case -1618432855:  return addIdentifier(); 
353        case 957831062:  return getCountry(); 
354        case -507075711:  return addJurisdiction(); 
355        case -844874031:  return getLegalStatusOfSupply(); 
356        case -1434195053:  return getValidityPeriod(); 
357        default: return super.makeProperty(hash, name);
358        }
359
360      }
361
362      @Override
363      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
364        switch (hash) {
365        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
366        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
367        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
368        case -844874031: /*legalStatusOfSupply*/ return new String[] {"CodeableConcept"};
369        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
370        default: return super.getTypesForProperty(hash, name);
371        }
372
373      }
374
375      @Override
376      public Base addChild(String name) throws FHIRException {
377        if (name.equals("identifier")) {
378          return addIdentifier();
379        }
380        else if (name.equals("country")) {
381          this.country = new CodeableConcept();
382          return this.country;
383        }
384        else if (name.equals("jurisdiction")) {
385          return addJurisdiction();
386        }
387        else if (name.equals("legalStatusOfSupply")) {
388          this.legalStatusOfSupply = new CodeableConcept();
389          return this.legalStatusOfSupply;
390        }
391        else if (name.equals("validityPeriod")) {
392          this.validityPeriod = new Period();
393          return this.validityPeriod;
394        }
395        else
396          return super.addChild(name);
397      }
398
399      public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent copy() {
400        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent dst = new MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
401        copyValues(dst);
402        if (identifier != null) {
403          dst.identifier = new ArrayList<Identifier>();
404          for (Identifier i : identifier)
405            dst.identifier.add(i.copy());
406        };
407        dst.country = country == null ? null : country.copy();
408        if (jurisdiction != null) {
409          dst.jurisdiction = new ArrayList<CodeableConcept>();
410          for (CodeableConcept i : jurisdiction)
411            dst.jurisdiction.add(i.copy());
412        };
413        dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
414        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
415        return dst;
416      }
417
418      @Override
419      public boolean equalsDeep(Base other_) {
420        if (!super.equalsDeep(other_))
421          return false;
422        if (!(other_ instanceof MedicinalProductAuthorizationJurisdictionalAuthorizationComponent))
423          return false;
424        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent o = (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) other_;
425        return compareDeep(identifier, o.identifier, true) && compareDeep(country, o.country, true) && compareDeep(jurisdiction, o.jurisdiction, true)
426           && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true) && compareDeep(validityPeriod, o.validityPeriod, true)
427          ;
428      }
429
430      @Override
431      public boolean equalsShallow(Base other_) {
432        if (!super.equalsShallow(other_))
433          return false;
434        if (!(other_ instanceof MedicinalProductAuthorizationJurisdictionalAuthorizationComponent))
435          return false;
436        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent o = (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) other_;
437        return true;
438      }
439
440      public boolean isEmpty() {
441        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, country, jurisdiction
442          , legalStatusOfSupply, validityPeriod);
443      }
444
445  public String fhirType() {
446    return "MedicinalProductAuthorization.jurisdictionalAuthorization";
447
448  }
449
450  }
451
452    @Block()
453    public static class MedicinalProductAuthorizationProcedureComponent extends BackboneElement implements IBaseBackboneElement {
454        /**
455         * Identifier for this procedure.
456         */
457        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
458        @Description(shortDefinition="Identifier for this procedure", formalDefinition="Identifier for this procedure." )
459        protected Identifier identifier;
460
461        /**
462         * Type of procedure.
463         */
464        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
465        @Description(shortDefinition="Type of procedure", formalDefinition="Type of procedure." )
466        protected CodeableConcept type;
467
468        /**
469         * Date of procedure.
470         */
471        @Child(name = "date", type = {Period.class, DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
472        @Description(shortDefinition="Date of procedure", formalDefinition="Date of procedure." )
473        protected Type date;
474
475        /**
476         * Applcations submitted to obtain a marketing authorization.
477         */
478        @Child(name = "application", type = {MedicinalProductAuthorizationProcedureComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
479        @Description(shortDefinition="Applcations submitted to obtain a marketing authorization", formalDefinition="Applcations submitted to obtain a marketing authorization." )
480        protected List<MedicinalProductAuthorizationProcedureComponent> application;
481
482        private static final long serialVersionUID = 930236001L;
483
484    /**
485     * Constructor
486     */
487      public MedicinalProductAuthorizationProcedureComponent() {
488        super();
489      }
490
491    /**
492     * Constructor
493     */
494      public MedicinalProductAuthorizationProcedureComponent(CodeableConcept type) {
495        super();
496        this.type = type;
497      }
498
499        /**
500         * @return {@link #identifier} (Identifier for this procedure.)
501         */
502        public Identifier getIdentifier() { 
503          if (this.identifier == null)
504            if (Configuration.errorOnAutoCreate())
505              throw new Error("Attempt to auto-create MedicinalProductAuthorizationProcedureComponent.identifier");
506            else if (Configuration.doAutoCreate())
507              this.identifier = new Identifier(); // cc
508          return this.identifier;
509        }
510
511        public boolean hasIdentifier() { 
512          return this.identifier != null && !this.identifier.isEmpty();
513        }
514
515        /**
516         * @param value {@link #identifier} (Identifier for this procedure.)
517         */
518        public MedicinalProductAuthorizationProcedureComponent setIdentifier(Identifier value) { 
519          this.identifier = value;
520          return this;
521        }
522
523        /**
524         * @return {@link #type} (Type of procedure.)
525         */
526        public CodeableConcept getType() { 
527          if (this.type == null)
528            if (Configuration.errorOnAutoCreate())
529              throw new Error("Attempt to auto-create MedicinalProductAuthorizationProcedureComponent.type");
530            else if (Configuration.doAutoCreate())
531              this.type = new CodeableConcept(); // cc
532          return this.type;
533        }
534
535        public boolean hasType() { 
536          return this.type != null && !this.type.isEmpty();
537        }
538
539        /**
540         * @param value {@link #type} (Type of procedure.)
541         */
542        public MedicinalProductAuthorizationProcedureComponent setType(CodeableConcept value) { 
543          this.type = value;
544          return this;
545        }
546
547        /**
548         * @return {@link #date} (Date of procedure.)
549         */
550        public Type getDate() { 
551          return this.date;
552        }
553
554        /**
555         * @return {@link #date} (Date of procedure.)
556         */
557        public Period getDatePeriod() throws FHIRException { 
558          if (this.date == null)
559            this.date = new Period();
560          if (!(this.date instanceof Period))
561            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.date.getClass().getName()+" was encountered");
562          return (Period) this.date;
563        }
564
565        public boolean hasDatePeriod() { 
566          return this != null && this.date instanceof Period;
567        }
568
569        /**
570         * @return {@link #date} (Date of procedure.)
571         */
572        public DateTimeType getDateDateTimeType() throws FHIRException { 
573          if (this.date == null)
574            this.date = new DateTimeType();
575          if (!(this.date instanceof DateTimeType))
576            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.date.getClass().getName()+" was encountered");
577          return (DateTimeType) this.date;
578        }
579
580        public boolean hasDateDateTimeType() { 
581          return this != null && this.date instanceof DateTimeType;
582        }
583
584        public boolean hasDate() { 
585          return this.date != null && !this.date.isEmpty();
586        }
587
588        /**
589         * @param value {@link #date} (Date of procedure.)
590         */
591        public MedicinalProductAuthorizationProcedureComponent setDate(Type value) { 
592          if (value != null && !(value instanceof Period || value instanceof DateTimeType))
593            throw new Error("Not the right type for MedicinalProductAuthorization.procedure.date[x]: "+value.fhirType());
594          this.date = value;
595          return this;
596        }
597
598        /**
599         * @return {@link #application} (Applcations submitted to obtain a marketing authorization.)
600         */
601        public List<MedicinalProductAuthorizationProcedureComponent> getApplication() { 
602          if (this.application == null)
603            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
604          return this.application;
605        }
606
607        /**
608         * @return Returns a reference to <code>this</code> for easy method chaining
609         */
610        public MedicinalProductAuthorizationProcedureComponent setApplication(List<MedicinalProductAuthorizationProcedureComponent> theApplication) { 
611          this.application = theApplication;
612          return this;
613        }
614
615        public boolean hasApplication() { 
616          if (this.application == null)
617            return false;
618          for (MedicinalProductAuthorizationProcedureComponent item : this.application)
619            if (!item.isEmpty())
620              return true;
621          return false;
622        }
623
624        public MedicinalProductAuthorizationProcedureComponent addApplication() { //3
625          MedicinalProductAuthorizationProcedureComponent t = new MedicinalProductAuthorizationProcedureComponent();
626          if (this.application == null)
627            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
628          this.application.add(t);
629          return t;
630        }
631
632        public MedicinalProductAuthorizationProcedureComponent addApplication(MedicinalProductAuthorizationProcedureComponent t) { //3
633          if (t == null)
634            return this;
635          if (this.application == null)
636            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
637          this.application.add(t);
638          return this;
639        }
640
641        /**
642         * @return The first repetition of repeating field {@link #application}, creating it if it does not already exist
643         */
644        public MedicinalProductAuthorizationProcedureComponent getApplicationFirstRep() { 
645          if (getApplication().isEmpty()) {
646            addApplication();
647          }
648          return getApplication().get(0);
649        }
650
651        protected void listChildren(List<Property> children) {
652          super.listChildren(children);
653          children.add(new Property("identifier", "Identifier", "Identifier for this procedure.", 0, 1, identifier));
654          children.add(new Property("type", "CodeableConcept", "Type of procedure.", 0, 1, type));
655          children.add(new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date));
656          children.add(new Property("application", "@MedicinalProductAuthorization.procedure", "Applcations submitted to obtain a marketing authorization.", 0, java.lang.Integer.MAX_VALUE, application));
657        }
658
659        @Override
660        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
661          switch (_hash) {
662          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this procedure.", 0, 1, identifier);
663          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of procedure.", 0, 1, type);
664          case 1443311122: /*date[x]*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
665          case 3076014: /*date*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
666          case 432297743: /*datePeriod*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
667          case 185136489: /*dateDateTime*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
668          case 1554253136: /*application*/  return new Property("application", "@MedicinalProductAuthorization.procedure", "Applcations submitted to obtain a marketing authorization.", 0, java.lang.Integer.MAX_VALUE, application);
669          default: return super.getNamedProperty(_hash, _name, _checkValid);
670          }
671
672        }
673
674      @Override
675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
676        switch (hash) {
677        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
678        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
679        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // Type
680        case 1554253136: /*application*/ return this.application == null ? new Base[0] : this.application.toArray(new Base[this.application.size()]); // MedicinalProductAuthorizationProcedureComponent
681        default: return super.getProperty(hash, name, checkValid);
682        }
683
684      }
685
686      @Override
687      public Base setProperty(int hash, String name, Base value) throws FHIRException {
688        switch (hash) {
689        case -1618432855: // identifier
690          this.identifier = castToIdentifier(value); // Identifier
691          return value;
692        case 3575610: // type
693          this.type = castToCodeableConcept(value); // CodeableConcept
694          return value;
695        case 3076014: // date
696          this.date = castToType(value); // Type
697          return value;
698        case 1554253136: // application
699          this.getApplication().add((MedicinalProductAuthorizationProcedureComponent) value); // MedicinalProductAuthorizationProcedureComponent
700          return value;
701        default: return super.setProperty(hash, name, value);
702        }
703
704      }
705
706      @Override
707      public Base setProperty(String name, Base value) throws FHIRException {
708        if (name.equals("identifier")) {
709          this.identifier = castToIdentifier(value); // Identifier
710        } else if (name.equals("type")) {
711          this.type = castToCodeableConcept(value); // CodeableConcept
712        } else if (name.equals("date[x]")) {
713          this.date = castToType(value); // Type
714        } else if (name.equals("application")) {
715          this.getApplication().add((MedicinalProductAuthorizationProcedureComponent) value);
716        } else
717          return super.setProperty(name, value);
718        return value;
719      }
720
721      @Override
722      public Base makeProperty(int hash, String name) throws FHIRException {
723        switch (hash) {
724        case -1618432855:  return getIdentifier(); 
725        case 3575610:  return getType(); 
726        case 1443311122:  return getDate(); 
727        case 3076014:  return getDate(); 
728        case 1554253136:  return addApplication(); 
729        default: return super.makeProperty(hash, name);
730        }
731
732      }
733
734      @Override
735      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
736        switch (hash) {
737        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
738        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
739        case 3076014: /*date*/ return new String[] {"Period", "dateTime"};
740        case 1554253136: /*application*/ return new String[] {"@MedicinalProductAuthorization.procedure"};
741        default: return super.getTypesForProperty(hash, name);
742        }
743
744      }
745
746      @Override
747      public Base addChild(String name) throws FHIRException {
748        if (name.equals("identifier")) {
749          this.identifier = new Identifier();
750          return this.identifier;
751        }
752        else if (name.equals("type")) {
753          this.type = new CodeableConcept();
754          return this.type;
755        }
756        else if (name.equals("datePeriod")) {
757          this.date = new Period();
758          return this.date;
759        }
760        else if (name.equals("dateDateTime")) {
761          this.date = new DateTimeType();
762          return this.date;
763        }
764        else if (name.equals("application")) {
765          return addApplication();
766        }
767        else
768          return super.addChild(name);
769      }
770
771      public MedicinalProductAuthorizationProcedureComponent copy() {
772        MedicinalProductAuthorizationProcedureComponent dst = new MedicinalProductAuthorizationProcedureComponent();
773        copyValues(dst);
774        dst.identifier = identifier == null ? null : identifier.copy();
775        dst.type = type == null ? null : type.copy();
776        dst.date = date == null ? null : date.copy();
777        if (application != null) {
778          dst.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
779          for (MedicinalProductAuthorizationProcedureComponent i : application)
780            dst.application.add(i.copy());
781        };
782        return dst;
783      }
784
785      @Override
786      public boolean equalsDeep(Base other_) {
787        if (!super.equalsDeep(other_))
788          return false;
789        if (!(other_ instanceof MedicinalProductAuthorizationProcedureComponent))
790          return false;
791        MedicinalProductAuthorizationProcedureComponent o = (MedicinalProductAuthorizationProcedureComponent) other_;
792        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
793           && compareDeep(application, o.application, true);
794      }
795
796      @Override
797      public boolean equalsShallow(Base other_) {
798        if (!super.equalsShallow(other_))
799          return false;
800        if (!(other_ instanceof MedicinalProductAuthorizationProcedureComponent))
801          return false;
802        MedicinalProductAuthorizationProcedureComponent o = (MedicinalProductAuthorizationProcedureComponent) other_;
803        return true;
804      }
805
806      public boolean isEmpty() {
807        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, date, application
808          );
809      }
810
811  public String fhirType() {
812    return "MedicinalProductAuthorization.procedure";
813
814  }
815
816  }
817
818    /**
819     * Business identifier for the marketing authorization, as assigned by a regulator.
820     */
821    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
822    @Description(shortDefinition="Business identifier for the marketing authorization, as assigned by a regulator", formalDefinition="Business identifier for the marketing authorization, as assigned by a regulator." )
823    protected List<Identifier> identifier;
824
825    /**
826     * The medicinal product that is being authorized.
827     */
828    @Child(name = "subject", type = {MedicinalProduct.class, MedicinalProductPackaged.class}, order=1, min=0, max=1, modifier=false, summary=true)
829    @Description(shortDefinition="The medicinal product that is being authorized", formalDefinition="The medicinal product that is being authorized." )
830    protected Reference subject;
831
832    /**
833     * The actual object that is the target of the reference (The medicinal product that is being authorized.)
834     */
835    protected Resource subjectTarget;
836
837    /**
838     * The country in which the marketing authorization has been granted.
839     */
840    @Child(name = "country", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
841    @Description(shortDefinition="The country in which the marketing authorization has been granted", formalDefinition="The country in which the marketing authorization has been granted." )
842    protected List<CodeableConcept> country;
843
844    /**
845     * Jurisdiction within a country.
846     */
847    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
848    @Description(shortDefinition="Jurisdiction within a country", formalDefinition="Jurisdiction within a country." )
849    protected List<CodeableConcept> jurisdiction;
850
851    /**
852     * The status of the marketing authorization.
853     */
854    @Child(name = "status", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
855    @Description(shortDefinition="The status of the marketing authorization", formalDefinition="The status of the marketing authorization." )
856    protected CodeableConcept status;
857
858    /**
859     * The date at which the given status has become applicable.
860     */
861    @Child(name = "statusDate", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
862    @Description(shortDefinition="The date at which the given status has become applicable", formalDefinition="The date at which the given status has become applicable." )
863    protected DateTimeType statusDate;
864
865    /**
866     * The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
867     */
868    @Child(name = "restoreDate", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
869    @Description(shortDefinition="The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored", formalDefinition="The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored." )
870    protected DateTimeType restoreDate;
871
872    /**
873     * The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.
874     */
875    @Child(name = "validityPeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
876    @Description(shortDefinition="The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format", formalDefinition="The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format." )
877    protected Period validityPeriod;
878
879    /**
880     * A period of time after authorization before generic product applicatiosn can be submitted.
881     */
882    @Child(name = "dataExclusivityPeriod", type = {Period.class}, order=8, min=0, max=1, modifier=false, summary=true)
883    @Description(shortDefinition="A period of time after authorization before generic product applicatiosn can be submitted", formalDefinition="A period of time after authorization before generic product applicatiosn can be submitted." )
884    protected Period dataExclusivityPeriod;
885
886    /**
887     * The date when the first authorization was granted by a Medicines Regulatory Agency.
888     */
889    @Child(name = "dateOfFirstAuthorization", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
890    @Description(shortDefinition="The date when the first authorization was granted by a Medicines Regulatory Agency", formalDefinition="The date when the first authorization was granted by a Medicines Regulatory Agency." )
891    protected DateTimeType dateOfFirstAuthorization;
892
893    /**
894     * Date of first marketing authorization for a company's new medicinal product in any country in the World.
895     */
896    @Child(name = "internationalBirthDate", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
897    @Description(shortDefinition="Date of first marketing authorization for a company's new medicinal product in any country in the World", formalDefinition="Date of first marketing authorization for a company's new medicinal product in any country in the World." )
898    protected DateTimeType internationalBirthDate;
899
900    /**
901     * The legal framework against which this authorization is granted.
902     */
903    @Child(name = "legalBasis", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true)
904    @Description(shortDefinition="The legal framework against which this authorization is granted", formalDefinition="The legal framework against which this authorization is granted." )
905    protected CodeableConcept legalBasis;
906
907    /**
908     * Authorization in areas within a country.
909     */
910    @Child(name = "jurisdictionalAuthorization", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
911    @Description(shortDefinition="Authorization in areas within a country", formalDefinition="Authorization in areas within a country." )
912    protected List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> jurisdictionalAuthorization;
913
914    /**
915     * Marketing Authorization Holder.
916     */
917    @Child(name = "holder", type = {Organization.class}, order=13, min=0, max=1, modifier=false, summary=true)
918    @Description(shortDefinition="Marketing Authorization Holder", formalDefinition="Marketing Authorization Holder." )
919    protected Reference holder;
920
921    /**
922     * The actual object that is the target of the reference (Marketing Authorization Holder.)
923     */
924    protected Organization holderTarget;
925
926    /**
927     * Medicines Regulatory Agency.
928     */
929    @Child(name = "regulator", type = {Organization.class}, order=14, min=0, max=1, modifier=false, summary=true)
930    @Description(shortDefinition="Medicines Regulatory Agency", formalDefinition="Medicines Regulatory Agency." )
931    protected Reference regulator;
932
933    /**
934     * The actual object that is the target of the reference (Medicines Regulatory Agency.)
935     */
936    protected Organization regulatorTarget;
937
938    /**
939     * The regulatory procedure for granting or amending a marketing authorization.
940     */
941    @Child(name = "procedure", type = {}, order=15, min=0, max=1, modifier=false, summary=true)
942    @Description(shortDefinition="The regulatory procedure for granting or amending a marketing authorization", formalDefinition="The regulatory procedure for granting or amending a marketing authorization." )
943    protected MedicinalProductAuthorizationProcedureComponent procedure;
944
945    private static final long serialVersionUID = 16249078L;
946
947  /**
948   * Constructor
949   */
950    public MedicinalProductAuthorization() {
951      super();
952    }
953
954    /**
955     * @return {@link #identifier} (Business identifier for the marketing authorization, as assigned by a regulator.)
956     */
957    public List<Identifier> getIdentifier() { 
958      if (this.identifier == null)
959        this.identifier = new ArrayList<Identifier>();
960      return this.identifier;
961    }
962
963    /**
964     * @return Returns a reference to <code>this</code> for easy method chaining
965     */
966    public MedicinalProductAuthorization setIdentifier(List<Identifier> theIdentifier) { 
967      this.identifier = theIdentifier;
968      return this;
969    }
970
971    public boolean hasIdentifier() { 
972      if (this.identifier == null)
973        return false;
974      for (Identifier item : this.identifier)
975        if (!item.isEmpty())
976          return true;
977      return false;
978    }
979
980    public Identifier addIdentifier() { //3
981      Identifier t = new Identifier();
982      if (this.identifier == null)
983        this.identifier = new ArrayList<Identifier>();
984      this.identifier.add(t);
985      return t;
986    }
987
988    public MedicinalProductAuthorization addIdentifier(Identifier t) { //3
989      if (t == null)
990        return this;
991      if (this.identifier == null)
992        this.identifier = new ArrayList<Identifier>();
993      this.identifier.add(t);
994      return this;
995    }
996
997    /**
998     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
999     */
1000    public Identifier getIdentifierFirstRep() { 
1001      if (getIdentifier().isEmpty()) {
1002        addIdentifier();
1003      }
1004      return getIdentifier().get(0);
1005    }
1006
1007    /**
1008     * @return {@link #subject} (The medicinal product that is being authorized.)
1009     */
1010    public Reference getSubject() { 
1011      if (this.subject == null)
1012        if (Configuration.errorOnAutoCreate())
1013          throw new Error("Attempt to auto-create MedicinalProductAuthorization.subject");
1014        else if (Configuration.doAutoCreate())
1015          this.subject = new Reference(); // cc
1016      return this.subject;
1017    }
1018
1019    public boolean hasSubject() { 
1020      return this.subject != null && !this.subject.isEmpty();
1021    }
1022
1023    /**
1024     * @param value {@link #subject} (The medicinal product that is being authorized.)
1025     */
1026    public MedicinalProductAuthorization setSubject(Reference value) { 
1027      this.subject = value;
1028      return this;
1029    }
1030
1031    /**
1032     * @return {@link #subject} 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. (The medicinal product that is being authorized.)
1033     */
1034    public Resource getSubjectTarget() { 
1035      return this.subjectTarget;
1036    }
1037
1038    /**
1039     * @param value {@link #subject} 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. (The medicinal product that is being authorized.)
1040     */
1041    public MedicinalProductAuthorization setSubjectTarget(Resource value) { 
1042      this.subjectTarget = value;
1043      return this;
1044    }
1045
1046    /**
1047     * @return {@link #country} (The country in which the marketing authorization has been granted.)
1048     */
1049    public List<CodeableConcept> getCountry() { 
1050      if (this.country == null)
1051        this.country = new ArrayList<CodeableConcept>();
1052      return this.country;
1053    }
1054
1055    /**
1056     * @return Returns a reference to <code>this</code> for easy method chaining
1057     */
1058    public MedicinalProductAuthorization setCountry(List<CodeableConcept> theCountry) { 
1059      this.country = theCountry;
1060      return this;
1061    }
1062
1063    public boolean hasCountry() { 
1064      if (this.country == null)
1065        return false;
1066      for (CodeableConcept item : this.country)
1067        if (!item.isEmpty())
1068          return true;
1069      return false;
1070    }
1071
1072    public CodeableConcept addCountry() { //3
1073      CodeableConcept t = new CodeableConcept();
1074      if (this.country == null)
1075        this.country = new ArrayList<CodeableConcept>();
1076      this.country.add(t);
1077      return t;
1078    }
1079
1080    public MedicinalProductAuthorization addCountry(CodeableConcept t) { //3
1081      if (t == null)
1082        return this;
1083      if (this.country == null)
1084        this.country = new ArrayList<CodeableConcept>();
1085      this.country.add(t);
1086      return this;
1087    }
1088
1089    /**
1090     * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist
1091     */
1092    public CodeableConcept getCountryFirstRep() { 
1093      if (getCountry().isEmpty()) {
1094        addCountry();
1095      }
1096      return getCountry().get(0);
1097    }
1098
1099    /**
1100     * @return {@link #jurisdiction} (Jurisdiction within a country.)
1101     */
1102    public List<CodeableConcept> getJurisdiction() { 
1103      if (this.jurisdiction == null)
1104        this.jurisdiction = new ArrayList<CodeableConcept>();
1105      return this.jurisdiction;
1106    }
1107
1108    /**
1109     * @return Returns a reference to <code>this</code> for easy method chaining
1110     */
1111    public MedicinalProductAuthorization setJurisdiction(List<CodeableConcept> theJurisdiction) { 
1112      this.jurisdiction = theJurisdiction;
1113      return this;
1114    }
1115
1116    public boolean hasJurisdiction() { 
1117      if (this.jurisdiction == null)
1118        return false;
1119      for (CodeableConcept item : this.jurisdiction)
1120        if (!item.isEmpty())
1121          return true;
1122      return false;
1123    }
1124
1125    public CodeableConcept addJurisdiction() { //3
1126      CodeableConcept t = new CodeableConcept();
1127      if (this.jurisdiction == null)
1128        this.jurisdiction = new ArrayList<CodeableConcept>();
1129      this.jurisdiction.add(t);
1130      return t;
1131    }
1132
1133    public MedicinalProductAuthorization addJurisdiction(CodeableConcept t) { //3
1134      if (t == null)
1135        return this;
1136      if (this.jurisdiction == null)
1137        this.jurisdiction = new ArrayList<CodeableConcept>();
1138      this.jurisdiction.add(t);
1139      return this;
1140    }
1141
1142    /**
1143     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
1144     */
1145    public CodeableConcept getJurisdictionFirstRep() { 
1146      if (getJurisdiction().isEmpty()) {
1147        addJurisdiction();
1148      }
1149      return getJurisdiction().get(0);
1150    }
1151
1152    /**
1153     * @return {@link #status} (The status of the marketing authorization.)
1154     */
1155    public CodeableConcept getStatus() { 
1156      if (this.status == null)
1157        if (Configuration.errorOnAutoCreate())
1158          throw new Error("Attempt to auto-create MedicinalProductAuthorization.status");
1159        else if (Configuration.doAutoCreate())
1160          this.status = new CodeableConcept(); // cc
1161      return this.status;
1162    }
1163
1164    public boolean hasStatus() { 
1165      return this.status != null && !this.status.isEmpty();
1166    }
1167
1168    /**
1169     * @param value {@link #status} (The status of the marketing authorization.)
1170     */
1171    public MedicinalProductAuthorization setStatus(CodeableConcept value) { 
1172      this.status = value;
1173      return this;
1174    }
1175
1176    /**
1177     * @return {@link #statusDate} (The date at which the given status has become applicable.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1178     */
1179    public DateTimeType getStatusDateElement() { 
1180      if (this.statusDate == null)
1181        if (Configuration.errorOnAutoCreate())
1182          throw new Error("Attempt to auto-create MedicinalProductAuthorization.statusDate");
1183        else if (Configuration.doAutoCreate())
1184          this.statusDate = new DateTimeType(); // bb
1185      return this.statusDate;
1186    }
1187
1188    public boolean hasStatusDateElement() { 
1189      return this.statusDate != null && !this.statusDate.isEmpty();
1190    }
1191
1192    public boolean hasStatusDate() { 
1193      return this.statusDate != null && !this.statusDate.isEmpty();
1194    }
1195
1196    /**
1197     * @param value {@link #statusDate} (The date at which the given status has become applicable.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1198     */
1199    public MedicinalProductAuthorization setStatusDateElement(DateTimeType value) { 
1200      this.statusDate = value;
1201      return this;
1202    }
1203
1204    /**
1205     * @return The date at which the given status has become applicable.
1206     */
1207    public Date getStatusDate() { 
1208      return this.statusDate == null ? null : this.statusDate.getValue();
1209    }
1210
1211    /**
1212     * @param value The date at which the given status has become applicable.
1213     */
1214    public MedicinalProductAuthorization setStatusDate(Date value) { 
1215      if (value == null)
1216        this.statusDate = null;
1217      else {
1218        if (this.statusDate == null)
1219          this.statusDate = new DateTimeType();
1220        this.statusDate.setValue(value);
1221      }
1222      return this;
1223    }
1224
1225    /**
1226     * @return {@link #restoreDate} (The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
1227     */
1228    public DateTimeType getRestoreDateElement() { 
1229      if (this.restoreDate == null)
1230        if (Configuration.errorOnAutoCreate())
1231          throw new Error("Attempt to auto-create MedicinalProductAuthorization.restoreDate");
1232        else if (Configuration.doAutoCreate())
1233          this.restoreDate = new DateTimeType(); // bb
1234      return this.restoreDate;
1235    }
1236
1237    public boolean hasRestoreDateElement() { 
1238      return this.restoreDate != null && !this.restoreDate.isEmpty();
1239    }
1240
1241    public boolean hasRestoreDate() { 
1242      return this.restoreDate != null && !this.restoreDate.isEmpty();
1243    }
1244
1245    /**
1246     * @param value {@link #restoreDate} (The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
1247     */
1248    public MedicinalProductAuthorization setRestoreDateElement(DateTimeType value) { 
1249      this.restoreDate = value;
1250      return this;
1251    }
1252
1253    /**
1254     * @return The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
1255     */
1256    public Date getRestoreDate() { 
1257      return this.restoreDate == null ? null : this.restoreDate.getValue();
1258    }
1259
1260    /**
1261     * @param value The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
1262     */
1263    public MedicinalProductAuthorization setRestoreDate(Date value) { 
1264      if (value == null)
1265        this.restoreDate = null;
1266      else {
1267        if (this.restoreDate == null)
1268          this.restoreDate = new DateTimeType();
1269        this.restoreDate.setValue(value);
1270      }
1271      return this;
1272    }
1273
1274    /**
1275     * @return {@link #validityPeriod} (The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.)
1276     */
1277    public Period getValidityPeriod() { 
1278      if (this.validityPeriod == null)
1279        if (Configuration.errorOnAutoCreate())
1280          throw new Error("Attempt to auto-create MedicinalProductAuthorization.validityPeriod");
1281        else if (Configuration.doAutoCreate())
1282          this.validityPeriod = new Period(); // cc
1283      return this.validityPeriod;
1284    }
1285
1286    public boolean hasValidityPeriod() { 
1287      return this.validityPeriod != null && !this.validityPeriod.isEmpty();
1288    }
1289
1290    /**
1291     * @param value {@link #validityPeriod} (The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.)
1292     */
1293    public MedicinalProductAuthorization setValidityPeriod(Period value) { 
1294      this.validityPeriod = value;
1295      return this;
1296    }
1297
1298    /**
1299     * @return {@link #dataExclusivityPeriod} (A period of time after authorization before generic product applicatiosn can be submitted.)
1300     */
1301    public Period getDataExclusivityPeriod() { 
1302      if (this.dataExclusivityPeriod == null)
1303        if (Configuration.errorOnAutoCreate())
1304          throw new Error("Attempt to auto-create MedicinalProductAuthorization.dataExclusivityPeriod");
1305        else if (Configuration.doAutoCreate())
1306          this.dataExclusivityPeriod = new Period(); // cc
1307      return this.dataExclusivityPeriod;
1308    }
1309
1310    public boolean hasDataExclusivityPeriod() { 
1311      return this.dataExclusivityPeriod != null && !this.dataExclusivityPeriod.isEmpty();
1312    }
1313
1314    /**
1315     * @param value {@link #dataExclusivityPeriod} (A period of time after authorization before generic product applicatiosn can be submitted.)
1316     */
1317    public MedicinalProductAuthorization setDataExclusivityPeriod(Period value) { 
1318      this.dataExclusivityPeriod = value;
1319      return this;
1320    }
1321
1322    /**
1323     * @return {@link #dateOfFirstAuthorization} (The date when the first authorization was granted by a Medicines Regulatory Agency.). This is the underlying object with id, value and extensions. The accessor "getDateOfFirstAuthorization" gives direct access to the value
1324     */
1325    public DateTimeType getDateOfFirstAuthorizationElement() { 
1326      if (this.dateOfFirstAuthorization == null)
1327        if (Configuration.errorOnAutoCreate())
1328          throw new Error("Attempt to auto-create MedicinalProductAuthorization.dateOfFirstAuthorization");
1329        else if (Configuration.doAutoCreate())
1330          this.dateOfFirstAuthorization = new DateTimeType(); // bb
1331      return this.dateOfFirstAuthorization;
1332    }
1333
1334    public boolean hasDateOfFirstAuthorizationElement() { 
1335      return this.dateOfFirstAuthorization != null && !this.dateOfFirstAuthorization.isEmpty();
1336    }
1337
1338    public boolean hasDateOfFirstAuthorization() { 
1339      return this.dateOfFirstAuthorization != null && !this.dateOfFirstAuthorization.isEmpty();
1340    }
1341
1342    /**
1343     * @param value {@link #dateOfFirstAuthorization} (The date when the first authorization was granted by a Medicines Regulatory Agency.). This is the underlying object with id, value and extensions. The accessor "getDateOfFirstAuthorization" gives direct access to the value
1344     */
1345    public MedicinalProductAuthorization setDateOfFirstAuthorizationElement(DateTimeType value) { 
1346      this.dateOfFirstAuthorization = value;
1347      return this;
1348    }
1349
1350    /**
1351     * @return The date when the first authorization was granted by a Medicines Regulatory Agency.
1352     */
1353    public Date getDateOfFirstAuthorization() { 
1354      return this.dateOfFirstAuthorization == null ? null : this.dateOfFirstAuthorization.getValue();
1355    }
1356
1357    /**
1358     * @param value The date when the first authorization was granted by a Medicines Regulatory Agency.
1359     */
1360    public MedicinalProductAuthorization setDateOfFirstAuthorization(Date value) { 
1361      if (value == null)
1362        this.dateOfFirstAuthorization = null;
1363      else {
1364        if (this.dateOfFirstAuthorization == null)
1365          this.dateOfFirstAuthorization = new DateTimeType();
1366        this.dateOfFirstAuthorization.setValue(value);
1367      }
1368      return this;
1369    }
1370
1371    /**
1372     * @return {@link #internationalBirthDate} (Date of first marketing authorization for a company's new medicinal product in any country in the World.). This is the underlying object with id, value and extensions. The accessor "getInternationalBirthDate" gives direct access to the value
1373     */
1374    public DateTimeType getInternationalBirthDateElement() { 
1375      if (this.internationalBirthDate == null)
1376        if (Configuration.errorOnAutoCreate())
1377          throw new Error("Attempt to auto-create MedicinalProductAuthorization.internationalBirthDate");
1378        else if (Configuration.doAutoCreate())
1379          this.internationalBirthDate = new DateTimeType(); // bb
1380      return this.internationalBirthDate;
1381    }
1382
1383    public boolean hasInternationalBirthDateElement() { 
1384      return this.internationalBirthDate != null && !this.internationalBirthDate.isEmpty();
1385    }
1386
1387    public boolean hasInternationalBirthDate() { 
1388      return this.internationalBirthDate != null && !this.internationalBirthDate.isEmpty();
1389    }
1390
1391    /**
1392     * @param value {@link #internationalBirthDate} (Date of first marketing authorization for a company's new medicinal product in any country in the World.). This is the underlying object with id, value and extensions. The accessor "getInternationalBirthDate" gives direct access to the value
1393     */
1394    public MedicinalProductAuthorization setInternationalBirthDateElement(DateTimeType value) { 
1395      this.internationalBirthDate = value;
1396      return this;
1397    }
1398
1399    /**
1400     * @return Date of first marketing authorization for a company's new medicinal product in any country in the World.
1401     */
1402    public Date getInternationalBirthDate() { 
1403      return this.internationalBirthDate == null ? null : this.internationalBirthDate.getValue();
1404    }
1405
1406    /**
1407     * @param value Date of first marketing authorization for a company's new medicinal product in any country in the World.
1408     */
1409    public MedicinalProductAuthorization setInternationalBirthDate(Date value) { 
1410      if (value == null)
1411        this.internationalBirthDate = null;
1412      else {
1413        if (this.internationalBirthDate == null)
1414          this.internationalBirthDate = new DateTimeType();
1415        this.internationalBirthDate.setValue(value);
1416      }
1417      return this;
1418    }
1419
1420    /**
1421     * @return {@link #legalBasis} (The legal framework against which this authorization is granted.)
1422     */
1423    public CodeableConcept getLegalBasis() { 
1424      if (this.legalBasis == null)
1425        if (Configuration.errorOnAutoCreate())
1426          throw new Error("Attempt to auto-create MedicinalProductAuthorization.legalBasis");
1427        else if (Configuration.doAutoCreate())
1428          this.legalBasis = new CodeableConcept(); // cc
1429      return this.legalBasis;
1430    }
1431
1432    public boolean hasLegalBasis() { 
1433      return this.legalBasis != null && !this.legalBasis.isEmpty();
1434    }
1435
1436    /**
1437     * @param value {@link #legalBasis} (The legal framework against which this authorization is granted.)
1438     */
1439    public MedicinalProductAuthorization setLegalBasis(CodeableConcept value) { 
1440      this.legalBasis = value;
1441      return this;
1442    }
1443
1444    /**
1445     * @return {@link #jurisdictionalAuthorization} (Authorization in areas within a country.)
1446     */
1447    public List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> getJurisdictionalAuthorization() { 
1448      if (this.jurisdictionalAuthorization == null)
1449        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1450      return this.jurisdictionalAuthorization;
1451    }
1452
1453    /**
1454     * @return Returns a reference to <code>this</code> for easy method chaining
1455     */
1456    public MedicinalProductAuthorization setJurisdictionalAuthorization(List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> theJurisdictionalAuthorization) { 
1457      this.jurisdictionalAuthorization = theJurisdictionalAuthorization;
1458      return this;
1459    }
1460
1461    public boolean hasJurisdictionalAuthorization() { 
1462      if (this.jurisdictionalAuthorization == null)
1463        return false;
1464      for (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent item : this.jurisdictionalAuthorization)
1465        if (!item.isEmpty())
1466          return true;
1467      return false;
1468    }
1469
1470    public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addJurisdictionalAuthorization() { //3
1471      MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t = new MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
1472      if (this.jurisdictionalAuthorization == null)
1473        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1474      this.jurisdictionalAuthorization.add(t);
1475      return t;
1476    }
1477
1478    public MedicinalProductAuthorization addJurisdictionalAuthorization(MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t) { //3
1479      if (t == null)
1480        return this;
1481      if (this.jurisdictionalAuthorization == null)
1482        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1483      this.jurisdictionalAuthorization.add(t);
1484      return this;
1485    }
1486
1487    /**
1488     * @return The first repetition of repeating field {@link #jurisdictionalAuthorization}, creating it if it does not already exist
1489     */
1490    public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent getJurisdictionalAuthorizationFirstRep() { 
1491      if (getJurisdictionalAuthorization().isEmpty()) {
1492        addJurisdictionalAuthorization();
1493      }
1494      return getJurisdictionalAuthorization().get(0);
1495    }
1496
1497    /**
1498     * @return {@link #holder} (Marketing Authorization Holder.)
1499     */
1500    public Reference getHolder() { 
1501      if (this.holder == null)
1502        if (Configuration.errorOnAutoCreate())
1503          throw new Error("Attempt to auto-create MedicinalProductAuthorization.holder");
1504        else if (Configuration.doAutoCreate())
1505          this.holder = new Reference(); // cc
1506      return this.holder;
1507    }
1508
1509    public boolean hasHolder() { 
1510      return this.holder != null && !this.holder.isEmpty();
1511    }
1512
1513    /**
1514     * @param value {@link #holder} (Marketing Authorization Holder.)
1515     */
1516    public MedicinalProductAuthorization setHolder(Reference value) { 
1517      this.holder = value;
1518      return this;
1519    }
1520
1521    /**
1522     * @return {@link #holder} 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. (Marketing Authorization Holder.)
1523     */
1524    public Organization getHolderTarget() { 
1525      if (this.holderTarget == null)
1526        if (Configuration.errorOnAutoCreate())
1527          throw new Error("Attempt to auto-create MedicinalProductAuthorization.holder");
1528        else if (Configuration.doAutoCreate())
1529          this.holderTarget = new Organization(); // aa
1530      return this.holderTarget;
1531    }
1532
1533    /**
1534     * @param value {@link #holder} 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. (Marketing Authorization Holder.)
1535     */
1536    public MedicinalProductAuthorization setHolderTarget(Organization value) { 
1537      this.holderTarget = value;
1538      return this;
1539    }
1540
1541    /**
1542     * @return {@link #regulator} (Medicines Regulatory Agency.)
1543     */
1544    public Reference getRegulator() { 
1545      if (this.regulator == null)
1546        if (Configuration.errorOnAutoCreate())
1547          throw new Error("Attempt to auto-create MedicinalProductAuthorization.regulator");
1548        else if (Configuration.doAutoCreate())
1549          this.regulator = new Reference(); // cc
1550      return this.regulator;
1551    }
1552
1553    public boolean hasRegulator() { 
1554      return this.regulator != null && !this.regulator.isEmpty();
1555    }
1556
1557    /**
1558     * @param value {@link #regulator} (Medicines Regulatory Agency.)
1559     */
1560    public MedicinalProductAuthorization setRegulator(Reference value) { 
1561      this.regulator = value;
1562      return this;
1563    }
1564
1565    /**
1566     * @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. (Medicines Regulatory Agency.)
1567     */
1568    public Organization getRegulatorTarget() { 
1569      if (this.regulatorTarget == null)
1570        if (Configuration.errorOnAutoCreate())
1571          throw new Error("Attempt to auto-create MedicinalProductAuthorization.regulator");
1572        else if (Configuration.doAutoCreate())
1573          this.regulatorTarget = new Organization(); // aa
1574      return this.regulatorTarget;
1575    }
1576
1577    /**
1578     * @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. (Medicines Regulatory Agency.)
1579     */
1580    public MedicinalProductAuthorization setRegulatorTarget(Organization value) { 
1581      this.regulatorTarget = value;
1582      return this;
1583    }
1584
1585    /**
1586     * @return {@link #procedure} (The regulatory procedure for granting or amending a marketing authorization.)
1587     */
1588    public MedicinalProductAuthorizationProcedureComponent getProcedure() { 
1589      if (this.procedure == null)
1590        if (Configuration.errorOnAutoCreate())
1591          throw new Error("Attempt to auto-create MedicinalProductAuthorization.procedure");
1592        else if (Configuration.doAutoCreate())
1593          this.procedure = new MedicinalProductAuthorizationProcedureComponent(); // cc
1594      return this.procedure;
1595    }
1596
1597    public boolean hasProcedure() { 
1598      return this.procedure != null && !this.procedure.isEmpty();
1599    }
1600
1601    /**
1602     * @param value {@link #procedure} (The regulatory procedure for granting or amending a marketing authorization.)
1603     */
1604    public MedicinalProductAuthorization setProcedure(MedicinalProductAuthorizationProcedureComponent value) { 
1605      this.procedure = value;
1606      return this;
1607    }
1608
1609      protected void listChildren(List<Property> children) {
1610        super.listChildren(children);
1611        children.add(new Property("identifier", "Identifier", "Business identifier for the marketing authorization, as assigned by a regulator.", 0, java.lang.Integer.MAX_VALUE, identifier));
1612        children.add(new Property("subject", "Reference(MedicinalProduct|MedicinalProductPackaged)", "The medicinal product that is being authorized.", 0, 1, subject));
1613        children.add(new Property("country", "CodeableConcept", "The country in which the marketing authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, country));
1614        children.add(new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
1615        children.add(new Property("status", "CodeableConcept", "The status of the marketing authorization.", 0, 1, status));
1616        children.add(new Property("statusDate", "dateTime", "The date at which the given status has become applicable.", 0, 1, statusDate));
1617        children.add(new Property("restoreDate", "dateTime", "The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.", 0, 1, restoreDate));
1618        children.add(new Property("validityPeriod", "Period", "The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.", 0, 1, validityPeriod));
1619        children.add(new Property("dataExclusivityPeriod", "Period", "A period of time after authorization before generic product applicatiosn can be submitted.", 0, 1, dataExclusivityPeriod));
1620        children.add(new Property("dateOfFirstAuthorization", "dateTime", "The date when the first authorization was granted by a Medicines Regulatory Agency.", 0, 1, dateOfFirstAuthorization));
1621        children.add(new Property("internationalBirthDate", "dateTime", "Date of first marketing authorization for a company's new medicinal product in any country in the World.", 0, 1, internationalBirthDate));
1622        children.add(new Property("legalBasis", "CodeableConcept", "The legal framework against which this authorization is granted.", 0, 1, legalBasis));
1623        children.add(new Property("jurisdictionalAuthorization", "", "Authorization in areas within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdictionalAuthorization));
1624        children.add(new Property("holder", "Reference(Organization)", "Marketing Authorization Holder.", 0, 1, holder));
1625        children.add(new Property("regulator", "Reference(Organization)", "Medicines Regulatory Agency.", 0, 1, regulator));
1626        children.add(new Property("procedure", "", "The regulatory procedure for granting or amending a marketing authorization.", 0, 1, procedure));
1627      }
1628
1629      @Override
1630      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1631        switch (_hash) {
1632        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier for the marketing authorization, as assigned by a regulator.", 0, java.lang.Integer.MAX_VALUE, identifier);
1633        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProduct|MedicinalProductPackaged)", "The medicinal product that is being authorized.", 0, 1, subject);
1634        case 957831062: /*country*/  return new Property("country", "CodeableConcept", "The country in which the marketing authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, country);
1635        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
1636        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of the marketing authorization.", 0, 1, status);
1637        case 247524032: /*statusDate*/  return new Property("statusDate", "dateTime", "The date at which the given status has become applicable.", 0, 1, statusDate);
1638        case 329465692: /*restoreDate*/  return new Property("restoreDate", "dateTime", "The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.", 0, 1, restoreDate);
1639        case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.", 0, 1, validityPeriod);
1640        case 1940655806: /*dataExclusivityPeriod*/  return new Property("dataExclusivityPeriod", "Period", "A period of time after authorization before generic product applicatiosn can be submitted.", 0, 1, dataExclusivityPeriod);
1641        case -1026933074: /*dateOfFirstAuthorization*/  return new Property("dateOfFirstAuthorization", "dateTime", "The date when the first authorization was granted by a Medicines Regulatory Agency.", 0, 1, dateOfFirstAuthorization);
1642        case 400069151: /*internationalBirthDate*/  return new Property("internationalBirthDate", "dateTime", "Date of first marketing authorization for a company's new medicinal product in any country in the World.", 0, 1, internationalBirthDate);
1643        case 552357125: /*legalBasis*/  return new Property("legalBasis", "CodeableConcept", "The legal framework against which this authorization is granted.", 0, 1, legalBasis);
1644        case 1459432557: /*jurisdictionalAuthorization*/  return new Property("jurisdictionalAuthorization", "", "Authorization in areas within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdictionalAuthorization);
1645        case -1211707988: /*holder*/  return new Property("holder", "Reference(Organization)", "Marketing Authorization Holder.", 0, 1, holder);
1646        case 414760449: /*regulator*/  return new Property("regulator", "Reference(Organization)", "Medicines Regulatory Agency.", 0, 1, regulator);
1647        case -1095204141: /*procedure*/  return new Property("procedure", "", "The regulatory procedure for granting or amending a marketing authorization.", 0, 1, procedure);
1648        default: return super.getNamedProperty(_hash, _name, _checkValid);
1649        }
1650
1651      }
1652
1653      @Override
1654      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1655        switch (hash) {
1656        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1657        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1658        case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept
1659        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
1660        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
1661        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateTimeType
1662        case 329465692: /*restoreDate*/ return this.restoreDate == null ? new Base[0] : new Base[] {this.restoreDate}; // DateTimeType
1663        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1664        case 1940655806: /*dataExclusivityPeriod*/ return this.dataExclusivityPeriod == null ? new Base[0] : new Base[] {this.dataExclusivityPeriod}; // Period
1665        case -1026933074: /*dateOfFirstAuthorization*/ return this.dateOfFirstAuthorization == null ? new Base[0] : new Base[] {this.dateOfFirstAuthorization}; // DateTimeType
1666        case 400069151: /*internationalBirthDate*/ return this.internationalBirthDate == null ? new Base[0] : new Base[] {this.internationalBirthDate}; // DateTimeType
1667        case 552357125: /*legalBasis*/ return this.legalBasis == null ? new Base[0] : new Base[] {this.legalBasis}; // CodeableConcept
1668        case 1459432557: /*jurisdictionalAuthorization*/ return this.jurisdictionalAuthorization == null ? new Base[0] : this.jurisdictionalAuthorization.toArray(new Base[this.jurisdictionalAuthorization.size()]); // MedicinalProductAuthorizationJurisdictionalAuthorizationComponent
1669        case -1211707988: /*holder*/ return this.holder == null ? new Base[0] : new Base[] {this.holder}; // Reference
1670        case 414760449: /*regulator*/ return this.regulator == null ? new Base[0] : new Base[] {this.regulator}; // Reference
1671        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // MedicinalProductAuthorizationProcedureComponent
1672        default: return super.getProperty(hash, name, checkValid);
1673        }
1674
1675      }
1676
1677      @Override
1678      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1679        switch (hash) {
1680        case -1618432855: // identifier
1681          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1682          return value;
1683        case -1867885268: // subject
1684          this.subject = castToReference(value); // Reference
1685          return value;
1686        case 957831062: // country
1687          this.getCountry().add(castToCodeableConcept(value)); // CodeableConcept
1688          return value;
1689        case -507075711: // jurisdiction
1690          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
1691          return value;
1692        case -892481550: // status
1693          this.status = castToCodeableConcept(value); // CodeableConcept
1694          return value;
1695        case 247524032: // statusDate
1696          this.statusDate = castToDateTime(value); // DateTimeType
1697          return value;
1698        case 329465692: // restoreDate
1699          this.restoreDate = castToDateTime(value); // DateTimeType
1700          return value;
1701        case -1434195053: // validityPeriod
1702          this.validityPeriod = castToPeriod(value); // Period
1703          return value;
1704        case 1940655806: // dataExclusivityPeriod
1705          this.dataExclusivityPeriod = castToPeriod(value); // Period
1706          return value;
1707        case -1026933074: // dateOfFirstAuthorization
1708          this.dateOfFirstAuthorization = castToDateTime(value); // DateTimeType
1709          return value;
1710        case 400069151: // internationalBirthDate
1711          this.internationalBirthDate = castToDateTime(value); // DateTimeType
1712          return value;
1713        case 552357125: // legalBasis
1714          this.legalBasis = castToCodeableConcept(value); // CodeableConcept
1715          return value;
1716        case 1459432557: // jurisdictionalAuthorization
1717          this.getJurisdictionalAuthorization().add((MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) value); // MedicinalProductAuthorizationJurisdictionalAuthorizationComponent
1718          return value;
1719        case -1211707988: // holder
1720          this.holder = castToReference(value); // Reference
1721          return value;
1722        case 414760449: // regulator
1723          this.regulator = castToReference(value); // Reference
1724          return value;
1725        case -1095204141: // procedure
1726          this.procedure = (MedicinalProductAuthorizationProcedureComponent) value; // MedicinalProductAuthorizationProcedureComponent
1727          return value;
1728        default: return super.setProperty(hash, name, value);
1729        }
1730
1731      }
1732
1733      @Override
1734      public Base setProperty(String name, Base value) throws FHIRException {
1735        if (name.equals("identifier")) {
1736          this.getIdentifier().add(castToIdentifier(value));
1737        } else if (name.equals("subject")) {
1738          this.subject = castToReference(value); // Reference
1739        } else if (name.equals("country")) {
1740          this.getCountry().add(castToCodeableConcept(value));
1741        } else if (name.equals("jurisdiction")) {
1742          this.getJurisdiction().add(castToCodeableConcept(value));
1743        } else if (name.equals("status")) {
1744          this.status = castToCodeableConcept(value); // CodeableConcept
1745        } else if (name.equals("statusDate")) {
1746          this.statusDate = castToDateTime(value); // DateTimeType
1747        } else if (name.equals("restoreDate")) {
1748          this.restoreDate = castToDateTime(value); // DateTimeType
1749        } else if (name.equals("validityPeriod")) {
1750          this.validityPeriod = castToPeriod(value); // Period
1751        } else if (name.equals("dataExclusivityPeriod")) {
1752          this.dataExclusivityPeriod = castToPeriod(value); // Period
1753        } else if (name.equals("dateOfFirstAuthorization")) {
1754          this.dateOfFirstAuthorization = castToDateTime(value); // DateTimeType
1755        } else if (name.equals("internationalBirthDate")) {
1756          this.internationalBirthDate = castToDateTime(value); // DateTimeType
1757        } else if (name.equals("legalBasis")) {
1758          this.legalBasis = castToCodeableConcept(value); // CodeableConcept
1759        } else if (name.equals("jurisdictionalAuthorization")) {
1760          this.getJurisdictionalAuthorization().add((MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) value);
1761        } else if (name.equals("holder")) {
1762          this.holder = castToReference(value); // Reference
1763        } else if (name.equals("regulator")) {
1764          this.regulator = castToReference(value); // Reference
1765        } else if (name.equals("procedure")) {
1766          this.procedure = (MedicinalProductAuthorizationProcedureComponent) value; // MedicinalProductAuthorizationProcedureComponent
1767        } else
1768          return super.setProperty(name, value);
1769        return value;
1770      }
1771
1772      @Override
1773      public Base makeProperty(int hash, String name) throws FHIRException {
1774        switch (hash) {
1775        case -1618432855:  return addIdentifier(); 
1776        case -1867885268:  return getSubject(); 
1777        case 957831062:  return addCountry(); 
1778        case -507075711:  return addJurisdiction(); 
1779        case -892481550:  return getStatus(); 
1780        case 247524032:  return getStatusDateElement();
1781        case 329465692:  return getRestoreDateElement();
1782        case -1434195053:  return getValidityPeriod(); 
1783        case 1940655806:  return getDataExclusivityPeriod(); 
1784        case -1026933074:  return getDateOfFirstAuthorizationElement();
1785        case 400069151:  return getInternationalBirthDateElement();
1786        case 552357125:  return getLegalBasis(); 
1787        case 1459432557:  return addJurisdictionalAuthorization(); 
1788        case -1211707988:  return getHolder(); 
1789        case 414760449:  return getRegulator(); 
1790        case -1095204141:  return getProcedure(); 
1791        default: return super.makeProperty(hash, name);
1792        }
1793
1794      }
1795
1796      @Override
1797      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1798        switch (hash) {
1799        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1800        case -1867885268: /*subject*/ return new String[] {"Reference"};
1801        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
1802        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
1803        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
1804        case 247524032: /*statusDate*/ return new String[] {"dateTime"};
1805        case 329465692: /*restoreDate*/ return new String[] {"dateTime"};
1806        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1807        case 1940655806: /*dataExclusivityPeriod*/ return new String[] {"Period"};
1808        case -1026933074: /*dateOfFirstAuthorization*/ return new String[] {"dateTime"};
1809        case 400069151: /*internationalBirthDate*/ return new String[] {"dateTime"};
1810        case 552357125: /*legalBasis*/ return new String[] {"CodeableConcept"};
1811        case 1459432557: /*jurisdictionalAuthorization*/ return new String[] {};
1812        case -1211707988: /*holder*/ return new String[] {"Reference"};
1813        case 414760449: /*regulator*/ return new String[] {"Reference"};
1814        case -1095204141: /*procedure*/ return new String[] {};
1815        default: return super.getTypesForProperty(hash, name);
1816        }
1817
1818      }
1819
1820      @Override
1821      public Base addChild(String name) throws FHIRException {
1822        if (name.equals("identifier")) {
1823          return addIdentifier();
1824        }
1825        else if (name.equals("subject")) {
1826          this.subject = new Reference();
1827          return this.subject;
1828        }
1829        else if (name.equals("country")) {
1830          return addCountry();
1831        }
1832        else if (name.equals("jurisdiction")) {
1833          return addJurisdiction();
1834        }
1835        else if (name.equals("status")) {
1836          this.status = new CodeableConcept();
1837          return this.status;
1838        }
1839        else if (name.equals("statusDate")) {
1840          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.statusDate");
1841        }
1842        else if (name.equals("restoreDate")) {
1843          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.restoreDate");
1844        }
1845        else if (name.equals("validityPeriod")) {
1846          this.validityPeriod = new Period();
1847          return this.validityPeriod;
1848        }
1849        else if (name.equals("dataExclusivityPeriod")) {
1850          this.dataExclusivityPeriod = new Period();
1851          return this.dataExclusivityPeriod;
1852        }
1853        else if (name.equals("dateOfFirstAuthorization")) {
1854          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.dateOfFirstAuthorization");
1855        }
1856        else if (name.equals("internationalBirthDate")) {
1857          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.internationalBirthDate");
1858        }
1859        else if (name.equals("legalBasis")) {
1860          this.legalBasis = new CodeableConcept();
1861          return this.legalBasis;
1862        }
1863        else if (name.equals("jurisdictionalAuthorization")) {
1864          return addJurisdictionalAuthorization();
1865        }
1866        else if (name.equals("holder")) {
1867          this.holder = new Reference();
1868          return this.holder;
1869        }
1870        else if (name.equals("regulator")) {
1871          this.regulator = new Reference();
1872          return this.regulator;
1873        }
1874        else if (name.equals("procedure")) {
1875          this.procedure = new MedicinalProductAuthorizationProcedureComponent();
1876          return this.procedure;
1877        }
1878        else
1879          return super.addChild(name);
1880      }
1881
1882  public String fhirType() {
1883    return "MedicinalProductAuthorization";
1884
1885  }
1886
1887      public MedicinalProductAuthorization copy() {
1888        MedicinalProductAuthorization dst = new MedicinalProductAuthorization();
1889        copyValues(dst);
1890        if (identifier != null) {
1891          dst.identifier = new ArrayList<Identifier>();
1892          for (Identifier i : identifier)
1893            dst.identifier.add(i.copy());
1894        };
1895        dst.subject = subject == null ? null : subject.copy();
1896        if (country != null) {
1897          dst.country = new ArrayList<CodeableConcept>();
1898          for (CodeableConcept i : country)
1899            dst.country.add(i.copy());
1900        };
1901        if (jurisdiction != null) {
1902          dst.jurisdiction = new ArrayList<CodeableConcept>();
1903          for (CodeableConcept i : jurisdiction)
1904            dst.jurisdiction.add(i.copy());
1905        };
1906        dst.status = status == null ? null : status.copy();
1907        dst.statusDate = statusDate == null ? null : statusDate.copy();
1908        dst.restoreDate = restoreDate == null ? null : restoreDate.copy();
1909        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1910        dst.dataExclusivityPeriod = dataExclusivityPeriod == null ? null : dataExclusivityPeriod.copy();
1911        dst.dateOfFirstAuthorization = dateOfFirstAuthorization == null ? null : dateOfFirstAuthorization.copy();
1912        dst.internationalBirthDate = internationalBirthDate == null ? null : internationalBirthDate.copy();
1913        dst.legalBasis = legalBasis == null ? null : legalBasis.copy();
1914        if (jurisdictionalAuthorization != null) {
1915          dst.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1916          for (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent i : jurisdictionalAuthorization)
1917            dst.jurisdictionalAuthorization.add(i.copy());
1918        };
1919        dst.holder = holder == null ? null : holder.copy();
1920        dst.regulator = regulator == null ? null : regulator.copy();
1921        dst.procedure = procedure == null ? null : procedure.copy();
1922        return dst;
1923      }
1924
1925      protected MedicinalProductAuthorization typedCopy() {
1926        return copy();
1927      }
1928
1929      @Override
1930      public boolean equalsDeep(Base other_) {
1931        if (!super.equalsDeep(other_))
1932          return false;
1933        if (!(other_ instanceof MedicinalProductAuthorization))
1934          return false;
1935        MedicinalProductAuthorization o = (MedicinalProductAuthorization) other_;
1936        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(country, o.country, true)
1937           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(status, o.status, true) && compareDeep(statusDate, o.statusDate, true)
1938           && compareDeep(restoreDate, o.restoreDate, true) && compareDeep(validityPeriod, o.validityPeriod, true)
1939           && compareDeep(dataExclusivityPeriod, o.dataExclusivityPeriod, true) && compareDeep(dateOfFirstAuthorization, o.dateOfFirstAuthorization, true)
1940           && compareDeep(internationalBirthDate, o.internationalBirthDate, true) && compareDeep(legalBasis, o.legalBasis, true)
1941           && compareDeep(jurisdictionalAuthorization, o.jurisdictionalAuthorization, true) && compareDeep(holder, o.holder, true)
1942           && compareDeep(regulator, o.regulator, true) && compareDeep(procedure, o.procedure, true);
1943      }
1944
1945      @Override
1946      public boolean equalsShallow(Base other_) {
1947        if (!super.equalsShallow(other_))
1948          return false;
1949        if (!(other_ instanceof MedicinalProductAuthorization))
1950          return false;
1951        MedicinalProductAuthorization o = (MedicinalProductAuthorization) other_;
1952        return compareValues(statusDate, o.statusDate, true) && compareValues(restoreDate, o.restoreDate, true)
1953           && compareValues(dateOfFirstAuthorization, o.dateOfFirstAuthorization, true) && compareValues(internationalBirthDate, o.internationalBirthDate, true)
1954          ;
1955      }
1956
1957      public boolean isEmpty() {
1958        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, country
1959          , jurisdiction, status, statusDate, restoreDate, validityPeriod, dataExclusivityPeriod
1960          , dateOfFirstAuthorization, internationalBirthDate, legalBasis, jurisdictionalAuthorization
1961          , holder, regulator, procedure);
1962      }
1963
1964  @Override
1965  public ResourceType getResourceType() {
1966    return ResourceType.MedicinalProductAuthorization;
1967   }
1968
1969 /**
1970   * Search parameter: <b>identifier</b>
1971   * <p>
1972   * Description: <b>Business identifier for the marketing authorization, as assigned by a regulator</b><br>
1973   * Type: <b>token</b><br>
1974   * Path: <b>MedicinalProductAuthorization.identifier</b><br>
1975   * </p>
1976   */
1977  @SearchParamDefinition(name="identifier", path="MedicinalProductAuthorization.identifier", description="Business identifier for the marketing authorization, as assigned by a regulator", type="token" )
1978  public static final String SP_IDENTIFIER = "identifier";
1979 /**
1980   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1981   * <p>
1982   * Description: <b>Business identifier for the marketing authorization, as assigned by a regulator</b><br>
1983   * Type: <b>token</b><br>
1984   * Path: <b>MedicinalProductAuthorization.identifier</b><br>
1985   * </p>
1986   */
1987  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1988
1989 /**
1990   * Search parameter: <b>country</b>
1991   * <p>
1992   * Description: <b>The country in which the marketing authorization has been granted</b><br>
1993   * Type: <b>token</b><br>
1994   * Path: <b>MedicinalProductAuthorization.country</b><br>
1995   * </p>
1996   */
1997  @SearchParamDefinition(name="country", path="MedicinalProductAuthorization.country", description="The country in which the marketing authorization has been granted", type="token" )
1998  public static final String SP_COUNTRY = "country";
1999 /**
2000   * <b>Fluent Client</b> search parameter constant for <b>country</b>
2001   * <p>
2002   * Description: <b>The country in which the marketing authorization has been granted</b><br>
2003   * Type: <b>token</b><br>
2004   * Path: <b>MedicinalProductAuthorization.country</b><br>
2005   * </p>
2006   */
2007  public static final ca.uhn.fhir.rest.gclient.TokenClientParam COUNTRY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_COUNTRY);
2008
2009 /**
2010   * Search parameter: <b>subject</b>
2011   * <p>
2012   * Description: <b>The medicinal product that is being authorized</b><br>
2013   * Type: <b>reference</b><br>
2014   * Path: <b>MedicinalProductAuthorization.subject</b><br>
2015   * </p>
2016   */
2017  @SearchParamDefinition(name="subject", path="MedicinalProductAuthorization.subject", description="The medicinal product that is being authorized", type="reference", target={MedicinalProduct.class, MedicinalProductPackaged.class } )
2018  public static final String SP_SUBJECT = "subject";
2019 /**
2020   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2021   * <p>
2022   * Description: <b>The medicinal product that is being authorized</b><br>
2023   * Type: <b>reference</b><br>
2024   * Path: <b>MedicinalProductAuthorization.subject</b><br>
2025   * </p>
2026   */
2027  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2028
2029/**
2030   * Constant for fluent queries to be used to add include statements. Specifies
2031   * the path value of "<b>MedicinalProductAuthorization:subject</b>".
2032   */
2033  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductAuthorization:subject").toLocked();
2034
2035 /**
2036   * Search parameter: <b>holder</b>
2037   * <p>
2038   * Description: <b>Marketing Authorization Holder</b><br>
2039   * Type: <b>reference</b><br>
2040   * Path: <b>MedicinalProductAuthorization.holder</b><br>
2041   * </p>
2042   */
2043  @SearchParamDefinition(name="holder", path="MedicinalProductAuthorization.holder", description="Marketing Authorization Holder", type="reference", target={Organization.class } )
2044  public static final String SP_HOLDER = "holder";
2045 /**
2046   * <b>Fluent Client</b> search parameter constant for <b>holder</b>
2047   * <p>
2048   * Description: <b>Marketing Authorization Holder</b><br>
2049   * Type: <b>reference</b><br>
2050   * Path: <b>MedicinalProductAuthorization.holder</b><br>
2051   * </p>
2052   */
2053  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam HOLDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_HOLDER);
2054
2055/**
2056   * Constant for fluent queries to be used to add include statements. Specifies
2057   * the path value of "<b>MedicinalProductAuthorization:holder</b>".
2058   */
2059  public static final ca.uhn.fhir.model.api.Include INCLUDE_HOLDER = new ca.uhn.fhir.model.api.Include("MedicinalProductAuthorization:holder").toLocked();
2060
2061 /**
2062   * Search parameter: <b>status</b>
2063   * <p>
2064   * Description: <b>The status of the marketing authorization</b><br>
2065   * Type: <b>token</b><br>
2066   * Path: <b>MedicinalProductAuthorization.status</b><br>
2067   * </p>
2068   */
2069  @SearchParamDefinition(name="status", path="MedicinalProductAuthorization.status", description="The status of the marketing authorization", type="token" )
2070  public static final String SP_STATUS = "status";
2071 /**
2072   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2073   * <p>
2074   * Description: <b>The status of the marketing authorization</b><br>
2075   * Type: <b>token</b><br>
2076   * Path: <b>MedicinalProductAuthorization.status</b><br>
2077   * </p>
2078   */
2079  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2080
2081
2082}
2083