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