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