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