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