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