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