001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * Catalog entries are wrappers that contextualize items included in a catalog.
051 */
052@ResourceDef(name="CatalogEntry", profile="http://hl7.org/fhir/StructureDefinition/CatalogEntry")
053public class CatalogEntry extends DomainResource {
054
055    public enum CatalogEntryRelationType {
056        /**
057         * the related entry represents an activity that may be triggered by the current item.
058         */
059        TRIGGERS, 
060        /**
061         * the related entry represents an item that replaces the current retired item.
062         */
063        ISREPLACEDBY, 
064        /**
065         * added to help the parsers with the generic types
066         */
067        NULL;
068        public static CatalogEntryRelationType fromCode(String codeString) throws FHIRException {
069            if (codeString == null || "".equals(codeString))
070                return null;
071        if ("triggers".equals(codeString))
072          return TRIGGERS;
073        if ("is-replaced-by".equals(codeString))
074          return ISREPLACEDBY;
075        if (Configuration.isAcceptInvalidEnums())
076          return null;
077        else
078          throw new FHIRException("Unknown CatalogEntryRelationType code '"+codeString+"'");
079        }
080        public String toCode() {
081          switch (this) {
082            case TRIGGERS: return "triggers";
083            case ISREPLACEDBY: return "is-replaced-by";
084            default: return "?";
085          }
086        }
087        public String getSystem() {
088          switch (this) {
089            case TRIGGERS: return "http://hl7.org/fhir/relation-type";
090            case ISREPLACEDBY: return "http://hl7.org/fhir/relation-type";
091            default: return "?";
092          }
093        }
094        public String getDefinition() {
095          switch (this) {
096            case TRIGGERS: return "the related entry represents an activity that may be triggered by the current item.";
097            case ISREPLACEDBY: return "the related entry represents an item that replaces the current retired item.";
098            default: return "?";
099          }
100        }
101        public String getDisplay() {
102          switch (this) {
103            case TRIGGERS: return "Triggers";
104            case ISREPLACEDBY: return "Replaced By";
105            default: return "?";
106          }
107        }
108    }
109
110  public static class CatalogEntryRelationTypeEnumFactory implements EnumFactory<CatalogEntryRelationType> {
111    public CatalogEntryRelationType fromCode(String codeString) throws IllegalArgumentException {
112      if (codeString == null || "".equals(codeString))
113            if (codeString == null || "".equals(codeString))
114                return null;
115        if ("triggers".equals(codeString))
116          return CatalogEntryRelationType.TRIGGERS;
117        if ("is-replaced-by".equals(codeString))
118          return CatalogEntryRelationType.ISREPLACEDBY;
119        throw new IllegalArgumentException("Unknown CatalogEntryRelationType code '"+codeString+"'");
120        }
121        public Enumeration<CatalogEntryRelationType> fromType(Base code) throws FHIRException {
122          if (code == null)
123            return null;
124          if (code.isEmpty())
125            return new Enumeration<CatalogEntryRelationType>(this);
126          String codeString = ((PrimitiveType) code).asStringValue();
127          if (codeString == null || "".equals(codeString))
128            return null;
129        if ("triggers".equals(codeString))
130          return new Enumeration<CatalogEntryRelationType>(this, CatalogEntryRelationType.TRIGGERS);
131        if ("is-replaced-by".equals(codeString))
132          return new Enumeration<CatalogEntryRelationType>(this, CatalogEntryRelationType.ISREPLACEDBY);
133        throw new FHIRException("Unknown CatalogEntryRelationType code '"+codeString+"'");
134        }
135    public String toCode(CatalogEntryRelationType code) {
136      if (code == CatalogEntryRelationType.TRIGGERS)
137        return "triggers";
138      if (code == CatalogEntryRelationType.ISREPLACEDBY)
139        return "is-replaced-by";
140      return "?";
141      }
142    public String toSystem(CatalogEntryRelationType code) {
143      return code.getSystem();
144      }
145    }
146
147    @Block()
148    public static class CatalogEntryRelatedEntryComponent extends BackboneElement implements IBaseBackboneElement {
149        /**
150         * The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.
151         */
152        @Child(name = "relationtype", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
153        @Description(shortDefinition="triggers | is-replaced-by", formalDefinition="The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc." )
154        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/relation-type")
155        protected Enumeration<CatalogEntryRelationType> relationtype;
156
157        /**
158         * The reference to the related item.
159         */
160        @Child(name = "item", type = {CatalogEntry.class}, order=2, min=1, max=1, modifier=false, summary=false)
161        @Description(shortDefinition="The reference to the related item", formalDefinition="The reference to the related item." )
162        protected Reference item;
163
164        /**
165         * The actual object that is the target of the reference (The reference to the related item.)
166         */
167        protected CatalogEntry itemTarget;
168
169        private static final long serialVersionUID = -1367020813L;
170
171    /**
172     * Constructor
173     */
174      public CatalogEntryRelatedEntryComponent() {
175        super();
176      }
177
178    /**
179     * Constructor
180     */
181      public CatalogEntryRelatedEntryComponent(Enumeration<CatalogEntryRelationType> relationtype, Reference item) {
182        super();
183        this.relationtype = relationtype;
184        this.item = item;
185      }
186
187        /**
188         * @return {@link #relationtype} (The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.). This is the underlying object with id, value and extensions. The accessor "getRelationtype" gives direct access to the value
189         */
190        public Enumeration<CatalogEntryRelationType> getRelationtypeElement() { 
191          if (this.relationtype == null)
192            if (Configuration.errorOnAutoCreate())
193              throw new Error("Attempt to auto-create CatalogEntryRelatedEntryComponent.relationtype");
194            else if (Configuration.doAutoCreate())
195              this.relationtype = new Enumeration<CatalogEntryRelationType>(new CatalogEntryRelationTypeEnumFactory()); // bb
196          return this.relationtype;
197        }
198
199        public boolean hasRelationtypeElement() { 
200          return this.relationtype != null && !this.relationtype.isEmpty();
201        }
202
203        public boolean hasRelationtype() { 
204          return this.relationtype != null && !this.relationtype.isEmpty();
205        }
206
207        /**
208         * @param value {@link #relationtype} (The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.). This is the underlying object with id, value and extensions. The accessor "getRelationtype" gives direct access to the value
209         */
210        public CatalogEntryRelatedEntryComponent setRelationtypeElement(Enumeration<CatalogEntryRelationType> value) { 
211          this.relationtype = value;
212          return this;
213        }
214
215        /**
216         * @return The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.
217         */
218        public CatalogEntryRelationType getRelationtype() { 
219          return this.relationtype == null ? null : this.relationtype.getValue();
220        }
221
222        /**
223         * @param value The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.
224         */
225        public CatalogEntryRelatedEntryComponent setRelationtype(CatalogEntryRelationType value) { 
226            if (this.relationtype == null)
227              this.relationtype = new Enumeration<CatalogEntryRelationType>(new CatalogEntryRelationTypeEnumFactory());
228            this.relationtype.setValue(value);
229          return this;
230        }
231
232        /**
233         * @return {@link #item} (The reference to the related item.)
234         */
235        public Reference getItem() { 
236          if (this.item == null)
237            if (Configuration.errorOnAutoCreate())
238              throw new Error("Attempt to auto-create CatalogEntryRelatedEntryComponent.item");
239            else if (Configuration.doAutoCreate())
240              this.item = new Reference(); // cc
241          return this.item;
242        }
243
244        public boolean hasItem() { 
245          return this.item != null && !this.item.isEmpty();
246        }
247
248        /**
249         * @param value {@link #item} (The reference to the related item.)
250         */
251        public CatalogEntryRelatedEntryComponent setItem(Reference value) { 
252          this.item = value;
253          return this;
254        }
255
256        /**
257         * @return {@link #item} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The reference to the related item.)
258         */
259        public CatalogEntry getItemTarget() { 
260          if (this.itemTarget == null)
261            if (Configuration.errorOnAutoCreate())
262              throw new Error("Attempt to auto-create CatalogEntryRelatedEntryComponent.item");
263            else if (Configuration.doAutoCreate())
264              this.itemTarget = new CatalogEntry(); // aa
265          return this.itemTarget;
266        }
267
268        /**
269         * @param value {@link #item} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The reference to the related item.)
270         */
271        public CatalogEntryRelatedEntryComponent setItemTarget(CatalogEntry value) { 
272          this.itemTarget = value;
273          return this;
274        }
275
276        protected void listChildren(List<Property> children) {
277          super.listChildren(children);
278          children.add(new Property("relationtype", "code", "The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.", 0, 1, relationtype));
279          children.add(new Property("item", "Reference(CatalogEntry)", "The reference to the related item.", 0, 1, item));
280        }
281
282        @Override
283        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
284          switch (_hash) {
285          case -261805258: /*relationtype*/  return new Property("relationtype", "code", "The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.", 0, 1, relationtype);
286          case 3242771: /*item*/  return new Property("item", "Reference(CatalogEntry)", "The reference to the related item.", 0, 1, item);
287          default: return super.getNamedProperty(_hash, _name, _checkValid);
288          }
289
290        }
291
292      @Override
293      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
294        switch (hash) {
295        case -261805258: /*relationtype*/ return this.relationtype == null ? new Base[0] : new Base[] {this.relationtype}; // Enumeration<CatalogEntryRelationType>
296        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Reference
297        default: return super.getProperty(hash, name, checkValid);
298        }
299
300      }
301
302      @Override
303      public Base setProperty(int hash, String name, Base value) throws FHIRException {
304        switch (hash) {
305        case -261805258: // relationtype
306          value = new CatalogEntryRelationTypeEnumFactory().fromType(castToCode(value));
307          this.relationtype = (Enumeration) value; // Enumeration<CatalogEntryRelationType>
308          return value;
309        case 3242771: // item
310          this.item = castToReference(value); // Reference
311          return value;
312        default: return super.setProperty(hash, name, value);
313        }
314
315      }
316
317      @Override
318      public Base setProperty(String name, Base value) throws FHIRException {
319        if (name.equals("relationtype")) {
320          value = new CatalogEntryRelationTypeEnumFactory().fromType(castToCode(value));
321          this.relationtype = (Enumeration) value; // Enumeration<CatalogEntryRelationType>
322        } else if (name.equals("item")) {
323          this.item = castToReference(value); // Reference
324        } else
325          return super.setProperty(name, value);
326        return value;
327      }
328
329      @Override
330      public Base makeProperty(int hash, String name) throws FHIRException {
331        switch (hash) {
332        case -261805258:  return getRelationtypeElement();
333        case 3242771:  return getItem(); 
334        default: return super.makeProperty(hash, name);
335        }
336
337      }
338
339      @Override
340      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
341        switch (hash) {
342        case -261805258: /*relationtype*/ return new String[] {"code"};
343        case 3242771: /*item*/ return new String[] {"Reference"};
344        default: return super.getTypesForProperty(hash, name);
345        }
346
347      }
348
349      @Override
350      public Base addChild(String name) throws FHIRException {
351        if (name.equals("relationtype")) {
352          throw new FHIRException("Cannot call addChild on a primitive type CatalogEntry.relationtype");
353        }
354        else if (name.equals("item")) {
355          this.item = new Reference();
356          return this.item;
357        }
358        else
359          return super.addChild(name);
360      }
361
362      public CatalogEntryRelatedEntryComponent copy() {
363        CatalogEntryRelatedEntryComponent dst = new CatalogEntryRelatedEntryComponent();
364        copyValues(dst);
365        return dst;
366      }
367
368      public void copyValues(CatalogEntryRelatedEntryComponent dst) {
369        super.copyValues(dst);
370        dst.relationtype = relationtype == null ? null : relationtype.copy();
371        dst.item = item == null ? null : item.copy();
372      }
373
374      @Override
375      public boolean equalsDeep(Base other_) {
376        if (!super.equalsDeep(other_))
377          return false;
378        if (!(other_ instanceof CatalogEntryRelatedEntryComponent))
379          return false;
380        CatalogEntryRelatedEntryComponent o = (CatalogEntryRelatedEntryComponent) other_;
381        return compareDeep(relationtype, o.relationtype, true) && compareDeep(item, o.item, true);
382      }
383
384      @Override
385      public boolean equalsShallow(Base other_) {
386        if (!super.equalsShallow(other_))
387          return false;
388        if (!(other_ instanceof CatalogEntryRelatedEntryComponent))
389          return false;
390        CatalogEntryRelatedEntryComponent o = (CatalogEntryRelatedEntryComponent) other_;
391        return compareValues(relationtype, o.relationtype, true);
392      }
393
394      public boolean isEmpty() {
395        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relationtype, item);
396      }
397
398  public String fhirType() {
399    return "CatalogEntry.relatedEntry";
400
401  }
402
403  }
404
405    /**
406     * Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.
407     */
408    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
409    @Description(shortDefinition="Unique identifier of the catalog item", formalDefinition="Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code." )
410    protected List<Identifier> identifier;
411
412    /**
413     * The type of item - medication, device, service, protocol or other.
414     */
415    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
416    @Description(shortDefinition="The type of item - medication, device, service, protocol or other", formalDefinition="The type of item - medication, device, service, protocol or other." )
417    protected CodeableConcept type;
418
419    /**
420     * Whether the entry represents an orderable item.
421     */
422    @Child(name = "orderable", type = {BooleanType.class}, order=2, min=1, max=1, modifier=false, summary=true)
423    @Description(shortDefinition="Whether the entry represents an orderable item", formalDefinition="Whether the entry represents an orderable item." )
424    protected BooleanType orderable;
425
426    /**
427     * The item in a catalog or definition.
428     */
429    @Child(name = "referencedItem", type = {Medication.class, Device.class, Organization.class, Practitioner.class, PractitionerRole.class, HealthcareService.class, ActivityDefinition.class, PlanDefinition.class, SpecimenDefinition.class, ObservationDefinition.class, Binary.class}, order=3, min=1, max=1, modifier=false, summary=true)
430    @Description(shortDefinition="The item that is being defined", formalDefinition="The item in a catalog or definition." )
431    protected Reference referencedItem;
432
433    /**
434     * The actual object that is the target of the reference (The item in a catalog or definition.)
435     */
436    protected Resource referencedItemTarget;
437
438    /**
439     * Used in supporting related concepts, e.g. NDC to RxNorm.
440     */
441    @Child(name = "additionalIdentifier", type = {Identifier.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
442    @Description(shortDefinition="Any additional identifier(s) for the catalog item, in the same granularity or concept", formalDefinition="Used in supporting related concepts, e.g. NDC to RxNorm." )
443    protected List<Identifier> additionalIdentifier;
444
445    /**
446     * Classes of devices, or ATC for medication.
447     */
448    @Child(name = "classification", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
449    @Description(shortDefinition="Classification (category or class) of the item entry", formalDefinition="Classes of devices, or ATC for medication." )
450    protected List<CodeableConcept> classification;
451
452    /**
453     * Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.
454     */
455    @Child(name = "status", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
456    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable." )
457    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
458    protected Enumeration<PublicationStatus> status;
459
460    /**
461     * The time period in which this catalog entry is expected to be active.
462     */
463    @Child(name = "validityPeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=false)
464    @Description(shortDefinition="The time period in which this catalog entry is expected to be active", formalDefinition="The time period in which this catalog entry is expected to be active." )
465    protected Period validityPeriod;
466
467    /**
468     * The date until which this catalog entry is expected to be active.
469     */
470    @Child(name = "validTo", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
471    @Description(shortDefinition="The date until which this catalog entry is expected to be active", formalDefinition="The date until which this catalog entry is expected to be active." )
472    protected DateTimeType validTo;
473
474    /**
475     * Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.
476     */
477    @Child(name = "lastUpdated", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
478    @Description(shortDefinition="When was this catalog last updated", formalDefinition="Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated." )
479    protected DateTimeType lastUpdated;
480
481    /**
482     * Used for examplefor Out of Formulary, or any specifics.
483     */
484    @Child(name = "additionalCharacteristic", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
485    @Description(shortDefinition="Additional characteristics of the catalog entry", formalDefinition="Used for examplefor Out of Formulary, or any specifics." )
486    protected List<CodeableConcept> additionalCharacteristic;
487
488    /**
489     * User for example for ATC classification, or.
490     */
491    @Child(name = "additionalClassification", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
492    @Description(shortDefinition="Additional classification of the catalog entry", formalDefinition="User for example for ATC classification, or." )
493    protected List<CodeableConcept> additionalClassification;
494
495    /**
496     * Used for example, to point to a substance, or to a device used to administer a medication.
497     */
498    @Child(name = "relatedEntry", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
499    @Description(shortDefinition="An item that this catalog entry is related to", formalDefinition="Used for example, to point to a substance, or to a device used to administer a medication." )
500    protected List<CatalogEntryRelatedEntryComponent> relatedEntry;
501
502    private static final long serialVersionUID = 57448275L;
503
504  /**
505   * Constructor
506   */
507    public CatalogEntry() {
508      super();
509    }
510
511  /**
512   * Constructor
513   */
514    public CatalogEntry(BooleanType orderable, Reference referencedItem) {
515      super();
516      this.orderable = orderable;
517      this.referencedItem = referencedItem;
518    }
519
520    /**
521     * @return {@link #identifier} (Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.)
522     */
523    public List<Identifier> getIdentifier() { 
524      if (this.identifier == null)
525        this.identifier = new ArrayList<Identifier>();
526      return this.identifier;
527    }
528
529    /**
530     * @return Returns a reference to <code>this</code> for easy method chaining
531     */
532    public CatalogEntry setIdentifier(List<Identifier> theIdentifier) { 
533      this.identifier = theIdentifier;
534      return this;
535    }
536
537    public boolean hasIdentifier() { 
538      if (this.identifier == null)
539        return false;
540      for (Identifier item : this.identifier)
541        if (!item.isEmpty())
542          return true;
543      return false;
544    }
545
546    public Identifier addIdentifier() { //3
547      Identifier t = new Identifier();
548      if (this.identifier == null)
549        this.identifier = new ArrayList<Identifier>();
550      this.identifier.add(t);
551      return t;
552    }
553
554    public CatalogEntry addIdentifier(Identifier t) { //3
555      if (t == null)
556        return this;
557      if (this.identifier == null)
558        this.identifier = new ArrayList<Identifier>();
559      this.identifier.add(t);
560      return this;
561    }
562
563    /**
564     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
565     */
566    public Identifier getIdentifierFirstRep() { 
567      if (getIdentifier().isEmpty()) {
568        addIdentifier();
569      }
570      return getIdentifier().get(0);
571    }
572
573    /**
574     * @return {@link #type} (The type of item - medication, device, service, protocol or other.)
575     */
576    public CodeableConcept getType() { 
577      if (this.type == null)
578        if (Configuration.errorOnAutoCreate())
579          throw new Error("Attempt to auto-create CatalogEntry.type");
580        else if (Configuration.doAutoCreate())
581          this.type = new CodeableConcept(); // cc
582      return this.type;
583    }
584
585    public boolean hasType() { 
586      return this.type != null && !this.type.isEmpty();
587    }
588
589    /**
590     * @param value {@link #type} (The type of item - medication, device, service, protocol or other.)
591     */
592    public CatalogEntry setType(CodeableConcept value) { 
593      this.type = value;
594      return this;
595    }
596
597    /**
598     * @return {@link #orderable} (Whether the entry represents an orderable item.). This is the underlying object with id, value and extensions. The accessor "getOrderable" gives direct access to the value
599     */
600    public BooleanType getOrderableElement() { 
601      if (this.orderable == null)
602        if (Configuration.errorOnAutoCreate())
603          throw new Error("Attempt to auto-create CatalogEntry.orderable");
604        else if (Configuration.doAutoCreate())
605          this.orderable = new BooleanType(); // bb
606      return this.orderable;
607    }
608
609    public boolean hasOrderableElement() { 
610      return this.orderable != null && !this.orderable.isEmpty();
611    }
612
613    public boolean hasOrderable() { 
614      return this.orderable != null && !this.orderable.isEmpty();
615    }
616
617    /**
618     * @param value {@link #orderable} (Whether the entry represents an orderable item.). This is the underlying object with id, value and extensions. The accessor "getOrderable" gives direct access to the value
619     */
620    public CatalogEntry setOrderableElement(BooleanType value) { 
621      this.orderable = value;
622      return this;
623    }
624
625    /**
626     * @return Whether the entry represents an orderable item.
627     */
628    public boolean getOrderable() { 
629      return this.orderable == null || this.orderable.isEmpty() ? false : this.orderable.getValue();
630    }
631
632    /**
633     * @param value Whether the entry represents an orderable item.
634     */
635    public CatalogEntry setOrderable(boolean value) { 
636        if (this.orderable == null)
637          this.orderable = new BooleanType();
638        this.orderable.setValue(value);
639      return this;
640    }
641
642    /**
643     * @return {@link #referencedItem} (The item in a catalog or definition.)
644     */
645    public Reference getReferencedItem() { 
646      if (this.referencedItem == null)
647        if (Configuration.errorOnAutoCreate())
648          throw new Error("Attempt to auto-create CatalogEntry.referencedItem");
649        else if (Configuration.doAutoCreate())
650          this.referencedItem = new Reference(); // cc
651      return this.referencedItem;
652    }
653
654    public boolean hasReferencedItem() { 
655      return this.referencedItem != null && !this.referencedItem.isEmpty();
656    }
657
658    /**
659     * @param value {@link #referencedItem} (The item in a catalog or definition.)
660     */
661    public CatalogEntry setReferencedItem(Reference value) { 
662      this.referencedItem = value;
663      return this;
664    }
665
666    /**
667     * @return {@link #referencedItem} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The item in a catalog or definition.)
668     */
669    public Resource getReferencedItemTarget() { 
670      return this.referencedItemTarget;
671    }
672
673    /**
674     * @param value {@link #referencedItem} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The item in a catalog or definition.)
675     */
676    public CatalogEntry setReferencedItemTarget(Resource value) { 
677      this.referencedItemTarget = value;
678      return this;
679    }
680
681    /**
682     * @return {@link #additionalIdentifier} (Used in supporting related concepts, e.g. NDC to RxNorm.)
683     */
684    public List<Identifier> getAdditionalIdentifier() { 
685      if (this.additionalIdentifier == null)
686        this.additionalIdentifier = new ArrayList<Identifier>();
687      return this.additionalIdentifier;
688    }
689
690    /**
691     * @return Returns a reference to <code>this</code> for easy method chaining
692     */
693    public CatalogEntry setAdditionalIdentifier(List<Identifier> theAdditionalIdentifier) { 
694      this.additionalIdentifier = theAdditionalIdentifier;
695      return this;
696    }
697
698    public boolean hasAdditionalIdentifier() { 
699      if (this.additionalIdentifier == null)
700        return false;
701      for (Identifier item : this.additionalIdentifier)
702        if (!item.isEmpty())
703          return true;
704      return false;
705    }
706
707    public Identifier addAdditionalIdentifier() { //3
708      Identifier t = new Identifier();
709      if (this.additionalIdentifier == null)
710        this.additionalIdentifier = new ArrayList<Identifier>();
711      this.additionalIdentifier.add(t);
712      return t;
713    }
714
715    public CatalogEntry addAdditionalIdentifier(Identifier t) { //3
716      if (t == null)
717        return this;
718      if (this.additionalIdentifier == null)
719        this.additionalIdentifier = new ArrayList<Identifier>();
720      this.additionalIdentifier.add(t);
721      return this;
722    }
723
724    /**
725     * @return The first repetition of repeating field {@link #additionalIdentifier}, creating it if it does not already exist
726     */
727    public Identifier getAdditionalIdentifierFirstRep() { 
728      if (getAdditionalIdentifier().isEmpty()) {
729        addAdditionalIdentifier();
730      }
731      return getAdditionalIdentifier().get(0);
732    }
733
734    /**
735     * @return {@link #classification} (Classes of devices, or ATC for medication.)
736     */
737    public List<CodeableConcept> getClassification() { 
738      if (this.classification == null)
739        this.classification = new ArrayList<CodeableConcept>();
740      return this.classification;
741    }
742
743    /**
744     * @return Returns a reference to <code>this</code> for easy method chaining
745     */
746    public CatalogEntry setClassification(List<CodeableConcept> theClassification) { 
747      this.classification = theClassification;
748      return this;
749    }
750
751    public boolean hasClassification() { 
752      if (this.classification == null)
753        return false;
754      for (CodeableConcept item : this.classification)
755        if (!item.isEmpty())
756          return true;
757      return false;
758    }
759
760    public CodeableConcept addClassification() { //3
761      CodeableConcept t = new CodeableConcept();
762      if (this.classification == null)
763        this.classification = new ArrayList<CodeableConcept>();
764      this.classification.add(t);
765      return t;
766    }
767
768    public CatalogEntry addClassification(CodeableConcept t) { //3
769      if (t == null)
770        return this;
771      if (this.classification == null)
772        this.classification = new ArrayList<CodeableConcept>();
773      this.classification.add(t);
774      return this;
775    }
776
777    /**
778     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist
779     */
780    public CodeableConcept getClassificationFirstRep() { 
781      if (getClassification().isEmpty()) {
782        addClassification();
783      }
784      return getClassification().get(0);
785    }
786
787    /**
788     * @return {@link #status} (Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
789     */
790    public Enumeration<PublicationStatus> getStatusElement() { 
791      if (this.status == null)
792        if (Configuration.errorOnAutoCreate())
793          throw new Error("Attempt to auto-create CatalogEntry.status");
794        else if (Configuration.doAutoCreate())
795          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
796      return this.status;
797    }
798
799    public boolean hasStatusElement() { 
800      return this.status != null && !this.status.isEmpty();
801    }
802
803    public boolean hasStatus() { 
804      return this.status != null && !this.status.isEmpty();
805    }
806
807    /**
808     * @param value {@link #status} (Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
809     */
810    public CatalogEntry setStatusElement(Enumeration<PublicationStatus> value) { 
811      this.status = value;
812      return this;
813    }
814
815    /**
816     * @return Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.
817     */
818    public PublicationStatus getStatus() { 
819      return this.status == null ? null : this.status.getValue();
820    }
821
822    /**
823     * @param value Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.
824     */
825    public CatalogEntry setStatus(PublicationStatus value) { 
826      if (value == null)
827        this.status = null;
828      else {
829        if (this.status == null)
830          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
831        this.status.setValue(value);
832      }
833      return this;
834    }
835
836    /**
837     * @return {@link #validityPeriod} (The time period in which this catalog entry is expected to be active.)
838     */
839    public Period getValidityPeriod() { 
840      if (this.validityPeriod == null)
841        if (Configuration.errorOnAutoCreate())
842          throw new Error("Attempt to auto-create CatalogEntry.validityPeriod");
843        else if (Configuration.doAutoCreate())
844          this.validityPeriod = new Period(); // cc
845      return this.validityPeriod;
846    }
847
848    public boolean hasValidityPeriod() { 
849      return this.validityPeriod != null && !this.validityPeriod.isEmpty();
850    }
851
852    /**
853     * @param value {@link #validityPeriod} (The time period in which this catalog entry is expected to be active.)
854     */
855    public CatalogEntry setValidityPeriod(Period value) { 
856      this.validityPeriod = value;
857      return this;
858    }
859
860    /**
861     * @return {@link #validTo} (The date until which this catalog entry is expected to be active.). This is the underlying object with id, value and extensions. The accessor "getValidTo" gives direct access to the value
862     */
863    public DateTimeType getValidToElement() { 
864      if (this.validTo == null)
865        if (Configuration.errorOnAutoCreate())
866          throw new Error("Attempt to auto-create CatalogEntry.validTo");
867        else if (Configuration.doAutoCreate())
868          this.validTo = new DateTimeType(); // bb
869      return this.validTo;
870    }
871
872    public boolean hasValidToElement() { 
873      return this.validTo != null && !this.validTo.isEmpty();
874    }
875
876    public boolean hasValidTo() { 
877      return this.validTo != null && !this.validTo.isEmpty();
878    }
879
880    /**
881     * @param value {@link #validTo} (The date until which this catalog entry is expected to be active.). This is the underlying object with id, value and extensions. The accessor "getValidTo" gives direct access to the value
882     */
883    public CatalogEntry setValidToElement(DateTimeType value) { 
884      this.validTo = value;
885      return this;
886    }
887
888    /**
889     * @return The date until which this catalog entry is expected to be active.
890     */
891    public Date getValidTo() { 
892      return this.validTo == null ? null : this.validTo.getValue();
893    }
894
895    /**
896     * @param value The date until which this catalog entry is expected to be active.
897     */
898    public CatalogEntry setValidTo(Date value) { 
899      if (value == null)
900        this.validTo = null;
901      else {
902        if (this.validTo == null)
903          this.validTo = new DateTimeType();
904        this.validTo.setValue(value);
905      }
906      return this;
907    }
908
909    /**
910     * @return {@link #lastUpdated} (Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
911     */
912    public DateTimeType getLastUpdatedElement() { 
913      if (this.lastUpdated == null)
914        if (Configuration.errorOnAutoCreate())
915          throw new Error("Attempt to auto-create CatalogEntry.lastUpdated");
916        else if (Configuration.doAutoCreate())
917          this.lastUpdated = new DateTimeType(); // bb
918      return this.lastUpdated;
919    }
920
921    public boolean hasLastUpdatedElement() { 
922      return this.lastUpdated != null && !this.lastUpdated.isEmpty();
923    }
924
925    public boolean hasLastUpdated() { 
926      return this.lastUpdated != null && !this.lastUpdated.isEmpty();
927    }
928
929    /**
930     * @param value {@link #lastUpdated} (Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
931     */
932    public CatalogEntry setLastUpdatedElement(DateTimeType value) { 
933      this.lastUpdated = value;
934      return this;
935    }
936
937    /**
938     * @return Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.
939     */
940    public Date getLastUpdated() { 
941      return this.lastUpdated == null ? null : this.lastUpdated.getValue();
942    }
943
944    /**
945     * @param value Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.
946     */
947    public CatalogEntry setLastUpdated(Date value) { 
948      if (value == null)
949        this.lastUpdated = null;
950      else {
951        if (this.lastUpdated == null)
952          this.lastUpdated = new DateTimeType();
953        this.lastUpdated.setValue(value);
954      }
955      return this;
956    }
957
958    /**
959     * @return {@link #additionalCharacteristic} (Used for examplefor Out of Formulary, or any specifics.)
960     */
961    public List<CodeableConcept> getAdditionalCharacteristic() { 
962      if (this.additionalCharacteristic == null)
963        this.additionalCharacteristic = new ArrayList<CodeableConcept>();
964      return this.additionalCharacteristic;
965    }
966
967    /**
968     * @return Returns a reference to <code>this</code> for easy method chaining
969     */
970    public CatalogEntry setAdditionalCharacteristic(List<CodeableConcept> theAdditionalCharacteristic) { 
971      this.additionalCharacteristic = theAdditionalCharacteristic;
972      return this;
973    }
974
975    public boolean hasAdditionalCharacteristic() { 
976      if (this.additionalCharacteristic == null)
977        return false;
978      for (CodeableConcept item : this.additionalCharacteristic)
979        if (!item.isEmpty())
980          return true;
981      return false;
982    }
983
984    public CodeableConcept addAdditionalCharacteristic() { //3
985      CodeableConcept t = new CodeableConcept();
986      if (this.additionalCharacteristic == null)
987        this.additionalCharacteristic = new ArrayList<CodeableConcept>();
988      this.additionalCharacteristic.add(t);
989      return t;
990    }
991
992    public CatalogEntry addAdditionalCharacteristic(CodeableConcept t) { //3
993      if (t == null)
994        return this;
995      if (this.additionalCharacteristic == null)
996        this.additionalCharacteristic = new ArrayList<CodeableConcept>();
997      this.additionalCharacteristic.add(t);
998      return this;
999    }
1000
1001    /**
1002     * @return The first repetition of repeating field {@link #additionalCharacteristic}, creating it if it does not already exist
1003     */
1004    public CodeableConcept getAdditionalCharacteristicFirstRep() { 
1005      if (getAdditionalCharacteristic().isEmpty()) {
1006        addAdditionalCharacteristic();
1007      }
1008      return getAdditionalCharacteristic().get(0);
1009    }
1010
1011    /**
1012     * @return {@link #additionalClassification} (User for example for ATC classification, or.)
1013     */
1014    public List<CodeableConcept> getAdditionalClassification() { 
1015      if (this.additionalClassification == null)
1016        this.additionalClassification = new ArrayList<CodeableConcept>();
1017      return this.additionalClassification;
1018    }
1019
1020    /**
1021     * @return Returns a reference to <code>this</code> for easy method chaining
1022     */
1023    public CatalogEntry setAdditionalClassification(List<CodeableConcept> theAdditionalClassification) { 
1024      this.additionalClassification = theAdditionalClassification;
1025      return this;
1026    }
1027
1028    public boolean hasAdditionalClassification() { 
1029      if (this.additionalClassification == null)
1030        return false;
1031      for (CodeableConcept item : this.additionalClassification)
1032        if (!item.isEmpty())
1033          return true;
1034      return false;
1035    }
1036
1037    public CodeableConcept addAdditionalClassification() { //3
1038      CodeableConcept t = new CodeableConcept();
1039      if (this.additionalClassification == null)
1040        this.additionalClassification = new ArrayList<CodeableConcept>();
1041      this.additionalClassification.add(t);
1042      return t;
1043    }
1044
1045    public CatalogEntry addAdditionalClassification(CodeableConcept t) { //3
1046      if (t == null)
1047        return this;
1048      if (this.additionalClassification == null)
1049        this.additionalClassification = new ArrayList<CodeableConcept>();
1050      this.additionalClassification.add(t);
1051      return this;
1052    }
1053
1054    /**
1055     * @return The first repetition of repeating field {@link #additionalClassification}, creating it if it does not already exist
1056     */
1057    public CodeableConcept getAdditionalClassificationFirstRep() { 
1058      if (getAdditionalClassification().isEmpty()) {
1059        addAdditionalClassification();
1060      }
1061      return getAdditionalClassification().get(0);
1062    }
1063
1064    /**
1065     * @return {@link #relatedEntry} (Used for example, to point to a substance, or to a device used to administer a medication.)
1066     */
1067    public List<CatalogEntryRelatedEntryComponent> getRelatedEntry() { 
1068      if (this.relatedEntry == null)
1069        this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1070      return this.relatedEntry;
1071    }
1072
1073    /**
1074     * @return Returns a reference to <code>this</code> for easy method chaining
1075     */
1076    public CatalogEntry setRelatedEntry(List<CatalogEntryRelatedEntryComponent> theRelatedEntry) { 
1077      this.relatedEntry = theRelatedEntry;
1078      return this;
1079    }
1080
1081    public boolean hasRelatedEntry() { 
1082      if (this.relatedEntry == null)
1083        return false;
1084      for (CatalogEntryRelatedEntryComponent item : this.relatedEntry)
1085        if (!item.isEmpty())
1086          return true;
1087      return false;
1088    }
1089
1090    public CatalogEntryRelatedEntryComponent addRelatedEntry() { //3
1091      CatalogEntryRelatedEntryComponent t = new CatalogEntryRelatedEntryComponent();
1092      if (this.relatedEntry == null)
1093        this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1094      this.relatedEntry.add(t);
1095      return t;
1096    }
1097
1098    public CatalogEntry addRelatedEntry(CatalogEntryRelatedEntryComponent t) { //3
1099      if (t == null)
1100        return this;
1101      if (this.relatedEntry == null)
1102        this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1103      this.relatedEntry.add(t);
1104      return this;
1105    }
1106
1107    /**
1108     * @return The first repetition of repeating field {@link #relatedEntry}, creating it if it does not already exist
1109     */
1110    public CatalogEntryRelatedEntryComponent getRelatedEntryFirstRep() { 
1111      if (getRelatedEntry().isEmpty()) {
1112        addRelatedEntry();
1113      }
1114      return getRelatedEntry().get(0);
1115    }
1116
1117      protected void listChildren(List<Property> children) {
1118        super.listChildren(children);
1119        children.add(new Property("identifier", "Identifier", "Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.", 0, java.lang.Integer.MAX_VALUE, identifier));
1120        children.add(new Property("type", "CodeableConcept", "The type of item - medication, device, service, protocol or other.", 0, 1, type));
1121        children.add(new Property("orderable", "boolean", "Whether the entry represents an orderable item.", 0, 1, orderable));
1122        children.add(new Property("referencedItem", "Reference(Medication|Device|Organization|Practitioner|PractitionerRole|HealthcareService|ActivityDefinition|PlanDefinition|SpecimenDefinition|ObservationDefinition|Binary)", "The item in a catalog or definition.", 0, 1, referencedItem));
1123        children.add(new Property("additionalIdentifier", "Identifier", "Used in supporting related concepts, e.g. NDC to RxNorm.", 0, java.lang.Integer.MAX_VALUE, additionalIdentifier));
1124        children.add(new Property("classification", "CodeableConcept", "Classes of devices, or ATC for medication.", 0, java.lang.Integer.MAX_VALUE, classification));
1125        children.add(new Property("status", "code", "Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.", 0, 1, status));
1126        children.add(new Property("validityPeriod", "Period", "The time period in which this catalog entry is expected to be active.", 0, 1, validityPeriod));
1127        children.add(new Property("validTo", "dateTime", "The date until which this catalog entry is expected to be active.", 0, 1, validTo));
1128        children.add(new Property("lastUpdated", "dateTime", "Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.", 0, 1, lastUpdated));
1129        children.add(new Property("additionalCharacteristic", "CodeableConcept", "Used for examplefor Out of Formulary, or any specifics.", 0, java.lang.Integer.MAX_VALUE, additionalCharacteristic));
1130        children.add(new Property("additionalClassification", "CodeableConcept", "User for example for ATC classification, or.", 0, java.lang.Integer.MAX_VALUE, additionalClassification));
1131        children.add(new Property("relatedEntry", "", "Used for example, to point to a substance, or to a device used to administer a medication.", 0, java.lang.Integer.MAX_VALUE, relatedEntry));
1132      }
1133
1134      @Override
1135      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1136        switch (_hash) {
1137        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.", 0, java.lang.Integer.MAX_VALUE, identifier);
1138        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of item - medication, device, service, protocol or other.", 0, 1, type);
1139        case -391199320: /*orderable*/  return new Property("orderable", "boolean", "Whether the entry represents an orderable item.", 0, 1, orderable);
1140        case -1896630996: /*referencedItem*/  return new Property("referencedItem", "Reference(Medication|Device|Organization|Practitioner|PractitionerRole|HealthcareService|ActivityDefinition|PlanDefinition|SpecimenDefinition|ObservationDefinition|Binary)", "The item in a catalog or definition.", 0, 1, referencedItem);
1141        case 1195162672: /*additionalIdentifier*/  return new Property("additionalIdentifier", "Identifier", "Used in supporting related concepts, e.g. NDC to RxNorm.", 0, java.lang.Integer.MAX_VALUE, additionalIdentifier);
1142        case 382350310: /*classification*/  return new Property("classification", "CodeableConcept", "Classes of devices, or ATC for medication.", 0, java.lang.Integer.MAX_VALUE, classification);
1143        case -892481550: /*status*/  return new Property("status", "code", "Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.", 0, 1, status);
1144        case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The time period in which this catalog entry is expected to be active.", 0, 1, validityPeriod);
1145        case 231246743: /*validTo*/  return new Property("validTo", "dateTime", "The date until which this catalog entry is expected to be active.", 0, 1, validTo);
1146        case 1649733957: /*lastUpdated*/  return new Property("lastUpdated", "dateTime", "Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.", 0, 1, lastUpdated);
1147        case -1638369886: /*additionalCharacteristic*/  return new Property("additionalCharacteristic", "CodeableConcept", "Used for examplefor Out of Formulary, or any specifics.", 0, java.lang.Integer.MAX_VALUE, additionalCharacteristic);
1148        case -1622333459: /*additionalClassification*/  return new Property("additionalClassification", "CodeableConcept", "User for example for ATC classification, or.", 0, java.lang.Integer.MAX_VALUE, additionalClassification);
1149        case 130178823: /*relatedEntry*/  return new Property("relatedEntry", "", "Used for example, to point to a substance, or to a device used to administer a medication.", 0, java.lang.Integer.MAX_VALUE, relatedEntry);
1150        default: return super.getNamedProperty(_hash, _name, _checkValid);
1151        }
1152
1153      }
1154
1155      @Override
1156      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1157        switch (hash) {
1158        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1159        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1160        case -391199320: /*orderable*/ return this.orderable == null ? new Base[0] : new Base[] {this.orderable}; // BooleanType
1161        case -1896630996: /*referencedItem*/ return this.referencedItem == null ? new Base[0] : new Base[] {this.referencedItem}; // Reference
1162        case 1195162672: /*additionalIdentifier*/ return this.additionalIdentifier == null ? new Base[0] : this.additionalIdentifier.toArray(new Base[this.additionalIdentifier.size()]); // Identifier
1163        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // CodeableConcept
1164        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
1165        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1166        case 231246743: /*validTo*/ return this.validTo == null ? new Base[0] : new Base[] {this.validTo}; // DateTimeType
1167        case 1649733957: /*lastUpdated*/ return this.lastUpdated == null ? new Base[0] : new Base[] {this.lastUpdated}; // DateTimeType
1168        case -1638369886: /*additionalCharacteristic*/ return this.additionalCharacteristic == null ? new Base[0] : this.additionalCharacteristic.toArray(new Base[this.additionalCharacteristic.size()]); // CodeableConcept
1169        case -1622333459: /*additionalClassification*/ return this.additionalClassification == null ? new Base[0] : this.additionalClassification.toArray(new Base[this.additionalClassification.size()]); // CodeableConcept
1170        case 130178823: /*relatedEntry*/ return this.relatedEntry == null ? new Base[0] : this.relatedEntry.toArray(new Base[this.relatedEntry.size()]); // CatalogEntryRelatedEntryComponent
1171        default: return super.getProperty(hash, name, checkValid);
1172        }
1173
1174      }
1175
1176      @Override
1177      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1178        switch (hash) {
1179        case -1618432855: // identifier
1180          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1181          return value;
1182        case 3575610: // type
1183          this.type = castToCodeableConcept(value); // CodeableConcept
1184          return value;
1185        case -391199320: // orderable
1186          this.orderable = castToBoolean(value); // BooleanType
1187          return value;
1188        case -1896630996: // referencedItem
1189          this.referencedItem = castToReference(value); // Reference
1190          return value;
1191        case 1195162672: // additionalIdentifier
1192          this.getAdditionalIdentifier().add(castToIdentifier(value)); // Identifier
1193          return value;
1194        case 382350310: // classification
1195          this.getClassification().add(castToCodeableConcept(value)); // CodeableConcept
1196          return value;
1197        case -892481550: // status
1198          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1199          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1200          return value;
1201        case -1434195053: // validityPeriod
1202          this.validityPeriod = castToPeriod(value); // Period
1203          return value;
1204        case 231246743: // validTo
1205          this.validTo = castToDateTime(value); // DateTimeType
1206          return value;
1207        case 1649733957: // lastUpdated
1208          this.lastUpdated = castToDateTime(value); // DateTimeType
1209          return value;
1210        case -1638369886: // additionalCharacteristic
1211          this.getAdditionalCharacteristic().add(castToCodeableConcept(value)); // CodeableConcept
1212          return value;
1213        case -1622333459: // additionalClassification
1214          this.getAdditionalClassification().add(castToCodeableConcept(value)); // CodeableConcept
1215          return value;
1216        case 130178823: // relatedEntry
1217          this.getRelatedEntry().add((CatalogEntryRelatedEntryComponent) value); // CatalogEntryRelatedEntryComponent
1218          return value;
1219        default: return super.setProperty(hash, name, value);
1220        }
1221
1222      }
1223
1224      @Override
1225      public Base setProperty(String name, Base value) throws FHIRException {
1226        if (name.equals("identifier")) {
1227          this.getIdentifier().add(castToIdentifier(value));
1228        } else if (name.equals("type")) {
1229          this.type = castToCodeableConcept(value); // CodeableConcept
1230        } else if (name.equals("orderable")) {
1231          this.orderable = castToBoolean(value); // BooleanType
1232        } else if (name.equals("referencedItem")) {
1233          this.referencedItem = castToReference(value); // Reference
1234        } else if (name.equals("additionalIdentifier")) {
1235          this.getAdditionalIdentifier().add(castToIdentifier(value));
1236        } else if (name.equals("classification")) {
1237          this.getClassification().add(castToCodeableConcept(value));
1238        } else if (name.equals("status")) {
1239          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1240          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1241        } else if (name.equals("validityPeriod")) {
1242          this.validityPeriod = castToPeriod(value); // Period
1243        } else if (name.equals("validTo")) {
1244          this.validTo = castToDateTime(value); // DateTimeType
1245        } else if (name.equals("lastUpdated")) {
1246          this.lastUpdated = castToDateTime(value); // DateTimeType
1247        } else if (name.equals("additionalCharacteristic")) {
1248          this.getAdditionalCharacteristic().add(castToCodeableConcept(value));
1249        } else if (name.equals("additionalClassification")) {
1250          this.getAdditionalClassification().add(castToCodeableConcept(value));
1251        } else if (name.equals("relatedEntry")) {
1252          this.getRelatedEntry().add((CatalogEntryRelatedEntryComponent) value);
1253        } else
1254          return super.setProperty(name, value);
1255        return value;
1256      }
1257
1258      @Override
1259      public Base makeProperty(int hash, String name) throws FHIRException {
1260        switch (hash) {
1261        case -1618432855:  return addIdentifier(); 
1262        case 3575610:  return getType(); 
1263        case -391199320:  return getOrderableElement();
1264        case -1896630996:  return getReferencedItem(); 
1265        case 1195162672:  return addAdditionalIdentifier(); 
1266        case 382350310:  return addClassification(); 
1267        case -892481550:  return getStatusElement();
1268        case -1434195053:  return getValidityPeriod(); 
1269        case 231246743:  return getValidToElement();
1270        case 1649733957:  return getLastUpdatedElement();
1271        case -1638369886:  return addAdditionalCharacteristic(); 
1272        case -1622333459:  return addAdditionalClassification(); 
1273        case 130178823:  return addRelatedEntry(); 
1274        default: return super.makeProperty(hash, name);
1275        }
1276
1277      }
1278
1279      @Override
1280      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1281        switch (hash) {
1282        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1283        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1284        case -391199320: /*orderable*/ return new String[] {"boolean"};
1285        case -1896630996: /*referencedItem*/ return new String[] {"Reference"};
1286        case 1195162672: /*additionalIdentifier*/ return new String[] {"Identifier"};
1287        case 382350310: /*classification*/ return new String[] {"CodeableConcept"};
1288        case -892481550: /*status*/ return new String[] {"code"};
1289        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1290        case 231246743: /*validTo*/ return new String[] {"dateTime"};
1291        case 1649733957: /*lastUpdated*/ return new String[] {"dateTime"};
1292        case -1638369886: /*additionalCharacteristic*/ return new String[] {"CodeableConcept"};
1293        case -1622333459: /*additionalClassification*/ return new String[] {"CodeableConcept"};
1294        case 130178823: /*relatedEntry*/ return new String[] {};
1295        default: return super.getTypesForProperty(hash, name);
1296        }
1297
1298      }
1299
1300      @Override
1301      public Base addChild(String name) throws FHIRException {
1302        if (name.equals("identifier")) {
1303          return addIdentifier();
1304        }
1305        else if (name.equals("type")) {
1306          this.type = new CodeableConcept();
1307          return this.type;
1308        }
1309        else if (name.equals("orderable")) {
1310          throw new FHIRException("Cannot call addChild on a primitive type CatalogEntry.orderable");
1311        }
1312        else if (name.equals("referencedItem")) {
1313          this.referencedItem = new Reference();
1314          return this.referencedItem;
1315        }
1316        else if (name.equals("additionalIdentifier")) {
1317          return addAdditionalIdentifier();
1318        }
1319        else if (name.equals("classification")) {
1320          return addClassification();
1321        }
1322        else if (name.equals("status")) {
1323          throw new FHIRException("Cannot call addChild on a primitive type CatalogEntry.status");
1324        }
1325        else if (name.equals("validityPeriod")) {
1326          this.validityPeriod = new Period();
1327          return this.validityPeriod;
1328        }
1329        else if (name.equals("validTo")) {
1330          throw new FHIRException("Cannot call addChild on a primitive type CatalogEntry.validTo");
1331        }
1332        else if (name.equals("lastUpdated")) {
1333          throw new FHIRException("Cannot call addChild on a primitive type CatalogEntry.lastUpdated");
1334        }
1335        else if (name.equals("additionalCharacteristic")) {
1336          return addAdditionalCharacteristic();
1337        }
1338        else if (name.equals("additionalClassification")) {
1339          return addAdditionalClassification();
1340        }
1341        else if (name.equals("relatedEntry")) {
1342          return addRelatedEntry();
1343        }
1344        else
1345          return super.addChild(name);
1346      }
1347
1348  public String fhirType() {
1349    return "CatalogEntry";
1350
1351  }
1352
1353      public CatalogEntry copy() {
1354        CatalogEntry dst = new CatalogEntry();
1355        copyValues(dst);
1356        return dst;
1357      }
1358
1359      public void copyValues(CatalogEntry dst) {
1360        super.copyValues(dst);
1361        if (identifier != null) {
1362          dst.identifier = new ArrayList<Identifier>();
1363          for (Identifier i : identifier)
1364            dst.identifier.add(i.copy());
1365        };
1366        dst.type = type == null ? null : type.copy();
1367        dst.orderable = orderable == null ? null : orderable.copy();
1368        dst.referencedItem = referencedItem == null ? null : referencedItem.copy();
1369        if (additionalIdentifier != null) {
1370          dst.additionalIdentifier = new ArrayList<Identifier>();
1371          for (Identifier i : additionalIdentifier)
1372            dst.additionalIdentifier.add(i.copy());
1373        };
1374        if (classification != null) {
1375          dst.classification = new ArrayList<CodeableConcept>();
1376          for (CodeableConcept i : classification)
1377            dst.classification.add(i.copy());
1378        };
1379        dst.status = status == null ? null : status.copy();
1380        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1381        dst.validTo = validTo == null ? null : validTo.copy();
1382        dst.lastUpdated = lastUpdated == null ? null : lastUpdated.copy();
1383        if (additionalCharacteristic != null) {
1384          dst.additionalCharacteristic = new ArrayList<CodeableConcept>();
1385          for (CodeableConcept i : additionalCharacteristic)
1386            dst.additionalCharacteristic.add(i.copy());
1387        };
1388        if (additionalClassification != null) {
1389          dst.additionalClassification = new ArrayList<CodeableConcept>();
1390          for (CodeableConcept i : additionalClassification)
1391            dst.additionalClassification.add(i.copy());
1392        };
1393        if (relatedEntry != null) {
1394          dst.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1395          for (CatalogEntryRelatedEntryComponent i : relatedEntry)
1396            dst.relatedEntry.add(i.copy());
1397        };
1398      }
1399
1400      protected CatalogEntry typedCopy() {
1401        return copy();
1402      }
1403
1404      @Override
1405      public boolean equalsDeep(Base other_) {
1406        if (!super.equalsDeep(other_))
1407          return false;
1408        if (!(other_ instanceof CatalogEntry))
1409          return false;
1410        CatalogEntry o = (CatalogEntry) other_;
1411        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(orderable, o.orderable, true)
1412           && compareDeep(referencedItem, o.referencedItem, true) && compareDeep(additionalIdentifier, o.additionalIdentifier, true)
1413           && compareDeep(classification, o.classification, true) && compareDeep(status, o.status, true) && compareDeep(validityPeriod, o.validityPeriod, true)
1414           && compareDeep(validTo, o.validTo, true) && compareDeep(lastUpdated, o.lastUpdated, true) && compareDeep(additionalCharacteristic, o.additionalCharacteristic, true)
1415           && compareDeep(additionalClassification, o.additionalClassification, true) && compareDeep(relatedEntry, o.relatedEntry, true)
1416          ;
1417      }
1418
1419      @Override
1420      public boolean equalsShallow(Base other_) {
1421        if (!super.equalsShallow(other_))
1422          return false;
1423        if (!(other_ instanceof CatalogEntry))
1424          return false;
1425        CatalogEntry o = (CatalogEntry) other_;
1426        return compareValues(orderable, o.orderable, true) && compareValues(status, o.status, true) && compareValues(validTo, o.validTo, true)
1427           && compareValues(lastUpdated, o.lastUpdated, true);
1428      }
1429
1430      public boolean isEmpty() {
1431        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, orderable
1432          , referencedItem, additionalIdentifier, classification, status, validityPeriod, validTo
1433          , lastUpdated, additionalCharacteristic, additionalClassification, relatedEntry);
1434      }
1435
1436  @Override
1437  public ResourceType getResourceType() {
1438    return ResourceType.CatalogEntry;
1439   }
1440
1441
1442}