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 void removeChild(String name, Base value) throws FHIRException {
389      if (name.equals("relationtype")) {
390        this.relationtype = null;
391      } else if (name.equals("item")) {
392        this.item = null;
393      } else
394        super.removeChild(name, value);
395      
396    }
397
398    @Override
399    public Base makeProperty(int hash, String name) throws FHIRException {
400      switch (hash) {
401      case -261805258:
402        return getRelationtypeElement();
403      case 3242771:
404        return getItem();
405      default:
406        return super.makeProperty(hash, name);
407      }
408
409    }
410
411    @Override
412    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
413      switch (hash) {
414      case -261805258:
415        /* relationtype */ return new String[] { "code" };
416      case 3242771:
417        /* item */ return new String[] { "Reference" };
418      default:
419        return super.getTypesForProperty(hash, name);
420      }
421
422    }
423
424    @Override
425    public Base addChild(String name) throws FHIRException {
426      if (name.equals("relationtype")) {
427        throw new FHIRException("Cannot call addChild on a singleton property CatalogEntry.relationtype");
428      } else if (name.equals("item")) {
429        this.item = new Reference();
430        return this.item;
431      } else
432        return super.addChild(name);
433    }
434
435    public CatalogEntryRelatedEntryComponent copy() {
436      CatalogEntryRelatedEntryComponent dst = new CatalogEntryRelatedEntryComponent();
437      copyValues(dst);
438      return dst;
439    }
440
441    public void copyValues(CatalogEntryRelatedEntryComponent dst) {
442      super.copyValues(dst);
443      dst.relationtype = relationtype == null ? null : relationtype.copy();
444      dst.item = item == null ? null : item.copy();
445    }
446
447    @Override
448    public boolean equalsDeep(Base other_) {
449      if (!super.equalsDeep(other_))
450        return false;
451      if (!(other_ instanceof CatalogEntryRelatedEntryComponent))
452        return false;
453      CatalogEntryRelatedEntryComponent o = (CatalogEntryRelatedEntryComponent) other_;
454      return compareDeep(relationtype, o.relationtype, true) && compareDeep(item, o.item, true);
455    }
456
457    @Override
458    public boolean equalsShallow(Base other_) {
459      if (!super.equalsShallow(other_))
460        return false;
461      if (!(other_ instanceof CatalogEntryRelatedEntryComponent))
462        return false;
463      CatalogEntryRelatedEntryComponent o = (CatalogEntryRelatedEntryComponent) other_;
464      return compareValues(relationtype, o.relationtype, true);
465    }
466
467    public boolean isEmpty() {
468      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relationtype, item);
469    }
470
471    public String fhirType() {
472      return "CatalogEntry.relatedEntry";
473
474    }
475
476  }
477
478  /**
479   * Used in supporting different identifiers for the same product, e.g.
480   * manufacturer code and retailer code.
481   */
482  @Child(name = "identifier", type = {
483      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
484  @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.")
485  protected List<Identifier> identifier;
486
487  /**
488   * The type of item - medication, device, service, protocol or other.
489   */
490  @Child(name = "type", type = {
491      CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
492  @Description(shortDefinition = "The type of item - medication, device, service, protocol or other", formalDefinition = "The type of item - medication, device, service, protocol or other.")
493  protected CodeableConcept type;
494
495  /**
496   * Whether the entry represents an orderable item.
497   */
498  @Child(name = "orderable", type = {
499      BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
500  @Description(shortDefinition = "Whether the entry represents an orderable item", formalDefinition = "Whether the entry represents an orderable item.")
501  protected BooleanType orderable;
502
503  /**
504   * The item in a catalog or definition.
505   */
506  @Child(name = "referencedItem", type = { Medication.class, Device.class, Organization.class, Practitioner.class,
507      PractitionerRole.class, HealthcareService.class, ActivityDefinition.class, PlanDefinition.class,
508      SpecimenDefinition.class, ObservationDefinition.class,
509      Binary.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
510  @Description(shortDefinition = "The item that is being defined", formalDefinition = "The item in a catalog or definition.")
511  protected Reference referencedItem;
512
513  /**
514   * The actual object that is the target of the reference (The item in a catalog
515   * or definition.)
516   */
517  protected Resource referencedItemTarget;
518
519  /**
520   * Used in supporting related concepts, e.g. NDC to RxNorm.
521   */
522  @Child(name = "additionalIdentifier", type = {
523      Identifier.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
524  @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.")
525  protected List<Identifier> additionalIdentifier;
526
527  /**
528   * Classes of devices, or ATC for medication.
529   */
530  @Child(name = "classification", type = {
531      CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
532  @Description(shortDefinition = "Classification (category or class) of the item entry", formalDefinition = "Classes of devices, or ATC for medication.")
533  protected List<CodeableConcept> classification;
534
535  /**
536   * Used to support catalog exchange even for unsupported products, e.g. getting
537   * list of medications even if not prescribable.
538   */
539  @Child(name = "status", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
540  @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.")
541  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/publication-status")
542  protected Enumeration<PublicationStatus> status;
543
544  /**
545   * The time period in which this catalog entry is expected to be active.
546   */
547  @Child(name = "validityPeriod", type = {
548      Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
549  @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.")
550  protected Period validityPeriod;
551
552  /**
553   * The date until which this catalog entry is expected to be active.
554   */
555  @Child(name = "validTo", type = {
556      DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
557  @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.")
558  protected DateTimeType validTo;
559
560  /**
561   * Typically date of issue is different from the beginning of the validity. This
562   * can be used to see when an item was last updated.
563   */
564  @Child(name = "lastUpdated", type = {
565      DateTimeType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
566  @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.")
567  protected DateTimeType lastUpdated;
568
569  /**
570   * Used for examplefor Out of Formulary, or any specifics.
571   */
572  @Child(name = "additionalCharacteristic", type = {
573      CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
574  @Description(shortDefinition = "Additional characteristics of the catalog entry", formalDefinition = "Used for examplefor Out of Formulary, or any specifics.")
575  protected List<CodeableConcept> additionalCharacteristic;
576
577  /**
578   * User for example for ATC classification, or.
579   */
580  @Child(name = "additionalClassification", type = {
581      CodeableConcept.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
582  @Description(shortDefinition = "Additional classification of the catalog entry", formalDefinition = "User for example for ATC classification, or.")
583  protected List<CodeableConcept> additionalClassification;
584
585  /**
586   * Used for example, to point to a substance, or to a device used to administer
587   * a medication.
588   */
589  @Child(name = "relatedEntry", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
590  @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.")
591  protected List<CatalogEntryRelatedEntryComponent> relatedEntry;
592
593  private static final long serialVersionUID = 57448275L;
594
595  /**
596   * Constructor
597   */
598  public CatalogEntry() {
599    super();
600  }
601
602  /**
603   * Constructor
604   */
605  public CatalogEntry(BooleanType orderable, Reference referencedItem) {
606    super();
607    this.orderable = orderable;
608    this.referencedItem = referencedItem;
609  }
610
611  /**
612   * @return {@link #identifier} (Used in supporting different identifiers for the
613   *         same product, e.g. manufacturer code and retailer code.)
614   */
615  public List<Identifier> getIdentifier() {
616    if (this.identifier == null)
617      this.identifier = new ArrayList<Identifier>();
618    return this.identifier;
619  }
620
621  /**
622   * @return Returns a reference to <code>this</code> for easy method chaining
623   */
624  public CatalogEntry setIdentifier(List<Identifier> theIdentifier) {
625    this.identifier = theIdentifier;
626    return this;
627  }
628
629  public boolean hasIdentifier() {
630    if (this.identifier == null)
631      return false;
632    for (Identifier item : this.identifier)
633      if (!item.isEmpty())
634        return true;
635    return false;
636  }
637
638  public Identifier addIdentifier() { // 3
639    Identifier t = new Identifier();
640    if (this.identifier == null)
641      this.identifier = new ArrayList<Identifier>();
642    this.identifier.add(t);
643    return t;
644  }
645
646  public CatalogEntry addIdentifier(Identifier t) { // 3
647    if (t == null)
648      return this;
649    if (this.identifier == null)
650      this.identifier = new ArrayList<Identifier>();
651    this.identifier.add(t);
652    return this;
653  }
654
655  /**
656   * @return The first repetition of repeating field {@link #identifier}, creating
657   *         it if it does not already exist
658   */
659  public Identifier getIdentifierFirstRep() {
660    if (getIdentifier().isEmpty()) {
661      addIdentifier();
662    }
663    return getIdentifier().get(0);
664  }
665
666  /**
667   * @return {@link #type} (The type of item - medication, device, service,
668   *         protocol or other.)
669   */
670  public CodeableConcept getType() {
671    if (this.type == null)
672      if (Configuration.errorOnAutoCreate())
673        throw new Error("Attempt to auto-create CatalogEntry.type");
674      else if (Configuration.doAutoCreate())
675        this.type = new CodeableConcept(); // cc
676    return this.type;
677  }
678
679  public boolean hasType() {
680    return this.type != null && !this.type.isEmpty();
681  }
682
683  /**
684   * @param value {@link #type} (The type of item - medication, device, service,
685   *              protocol or other.)
686   */
687  public CatalogEntry setType(CodeableConcept value) {
688    this.type = value;
689    return this;
690  }
691
692  /**
693   * @return {@link #orderable} (Whether the entry represents an orderable item.).
694   *         This is the underlying object with id, value and extensions. The
695   *         accessor "getOrderable" gives direct access to the value
696   */
697  public BooleanType getOrderableElement() {
698    if (this.orderable == null)
699      if (Configuration.errorOnAutoCreate())
700        throw new Error("Attempt to auto-create CatalogEntry.orderable");
701      else if (Configuration.doAutoCreate())
702        this.orderable = new BooleanType(); // bb
703    return this.orderable;
704  }
705
706  public boolean hasOrderableElement() {
707    return this.orderable != null && !this.orderable.isEmpty();
708  }
709
710  public boolean hasOrderable() {
711    return this.orderable != null && !this.orderable.isEmpty();
712  }
713
714  /**
715   * @param value {@link #orderable} (Whether the entry represents an orderable
716   *              item.). This is the underlying object with id, value and
717   *              extensions. The accessor "getOrderable" gives direct access to
718   *              the value
719   */
720  public CatalogEntry setOrderableElement(BooleanType value) {
721    this.orderable = value;
722    return this;
723  }
724
725  /**
726   * @return Whether the entry represents an orderable item.
727   */
728  public boolean getOrderable() {
729    return this.orderable == null || this.orderable.isEmpty() ? false : this.orderable.getValue();
730  }
731
732  /**
733   * @param value Whether the entry represents an orderable item.
734   */
735  public CatalogEntry setOrderable(boolean value) {
736    if (this.orderable == null)
737      this.orderable = new BooleanType();
738    this.orderable.setValue(value);
739    return this;
740  }
741
742  /**
743   * @return {@link #referencedItem} (The item in a catalog or definition.)
744   */
745  public Reference getReferencedItem() {
746    if (this.referencedItem == null)
747      if (Configuration.errorOnAutoCreate())
748        throw new Error("Attempt to auto-create CatalogEntry.referencedItem");
749      else if (Configuration.doAutoCreate())
750        this.referencedItem = new Reference(); // cc
751    return this.referencedItem;
752  }
753
754  public boolean hasReferencedItem() {
755    return this.referencedItem != null && !this.referencedItem.isEmpty();
756  }
757
758  /**
759   * @param value {@link #referencedItem} (The item in a catalog or definition.)
760   */
761  public CatalogEntry setReferencedItem(Reference value) {
762    this.referencedItem = value;
763    return this;
764  }
765
766  /**
767   * @return {@link #referencedItem} The actual object that is the target of the
768   *         reference. The reference library doesn't populate this, but you can
769   *         use it to hold the resource if you resolve it. (The item in a catalog
770   *         or definition.)
771   */
772  public Resource getReferencedItemTarget() {
773    return this.referencedItemTarget;
774  }
775
776  /**
777   * @param value {@link #referencedItem} The actual object that is the target of
778   *              the reference. The reference library doesn't use these, but you
779   *              can use it to hold the resource if you resolve it. (The item in
780   *              a catalog or definition.)
781   */
782  public CatalogEntry setReferencedItemTarget(Resource value) {
783    this.referencedItemTarget = value;
784    return this;
785  }
786
787  /**
788   * @return {@link #additionalIdentifier} (Used in supporting related concepts,
789   *         e.g. NDC to RxNorm.)
790   */
791  public List<Identifier> getAdditionalIdentifier() {
792    if (this.additionalIdentifier == null)
793      this.additionalIdentifier = new ArrayList<Identifier>();
794    return this.additionalIdentifier;
795  }
796
797  /**
798   * @return Returns a reference to <code>this</code> for easy method chaining
799   */
800  public CatalogEntry setAdditionalIdentifier(List<Identifier> theAdditionalIdentifier) {
801    this.additionalIdentifier = theAdditionalIdentifier;
802    return this;
803  }
804
805  public boolean hasAdditionalIdentifier() {
806    if (this.additionalIdentifier == null)
807      return false;
808    for (Identifier item : this.additionalIdentifier)
809      if (!item.isEmpty())
810        return true;
811    return false;
812  }
813
814  public Identifier addAdditionalIdentifier() { // 3
815    Identifier t = new Identifier();
816    if (this.additionalIdentifier == null)
817      this.additionalIdentifier = new ArrayList<Identifier>();
818    this.additionalIdentifier.add(t);
819    return t;
820  }
821
822  public CatalogEntry addAdditionalIdentifier(Identifier t) { // 3
823    if (t == null)
824      return this;
825    if (this.additionalIdentifier == null)
826      this.additionalIdentifier = new ArrayList<Identifier>();
827    this.additionalIdentifier.add(t);
828    return this;
829  }
830
831  /**
832   * @return The first repetition of repeating field
833   *         {@link #additionalIdentifier}, creating it if it does not already
834   *         exist
835   */
836  public Identifier getAdditionalIdentifierFirstRep() {
837    if (getAdditionalIdentifier().isEmpty()) {
838      addAdditionalIdentifier();
839    }
840    return getAdditionalIdentifier().get(0);
841  }
842
843  /**
844   * @return {@link #classification} (Classes of devices, or ATC for medication.)
845   */
846  public List<CodeableConcept> getClassification() {
847    if (this.classification == null)
848      this.classification = new ArrayList<CodeableConcept>();
849    return this.classification;
850  }
851
852  /**
853   * @return Returns a reference to <code>this</code> for easy method chaining
854   */
855  public CatalogEntry setClassification(List<CodeableConcept> theClassification) {
856    this.classification = theClassification;
857    return this;
858  }
859
860  public boolean hasClassification() {
861    if (this.classification == null)
862      return false;
863    for (CodeableConcept item : this.classification)
864      if (!item.isEmpty())
865        return true;
866    return false;
867  }
868
869  public CodeableConcept addClassification() { // 3
870    CodeableConcept t = new CodeableConcept();
871    if (this.classification == null)
872      this.classification = new ArrayList<CodeableConcept>();
873    this.classification.add(t);
874    return t;
875  }
876
877  public CatalogEntry addClassification(CodeableConcept t) { // 3
878    if (t == null)
879      return this;
880    if (this.classification == null)
881      this.classification = new ArrayList<CodeableConcept>();
882    this.classification.add(t);
883    return this;
884  }
885
886  /**
887   * @return The first repetition of repeating field {@link #classification},
888   *         creating it if it does not already exist
889   */
890  public CodeableConcept getClassificationFirstRep() {
891    if (getClassification().isEmpty()) {
892      addClassification();
893    }
894    return getClassification().get(0);
895  }
896
897  /**
898   * @return {@link #status} (Used to support catalog exchange even for
899   *         unsupported products, e.g. getting list of medications even if not
900   *         prescribable.). This is the underlying object with id, value and
901   *         extensions. The accessor "getStatus" gives direct access to the value
902   */
903  public Enumeration<PublicationStatus> getStatusElement() {
904    if (this.status == null)
905      if (Configuration.errorOnAutoCreate())
906        throw new Error("Attempt to auto-create CatalogEntry.status");
907      else if (Configuration.doAutoCreate())
908        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
909    return this.status;
910  }
911
912  public boolean hasStatusElement() {
913    return this.status != null && !this.status.isEmpty();
914  }
915
916  public boolean hasStatus() {
917    return this.status != null && !this.status.isEmpty();
918  }
919
920  /**
921   * @param value {@link #status} (Used to support catalog exchange even for
922   *              unsupported products, e.g. getting list of medications even if
923   *              not prescribable.). This is the underlying object with id, value
924   *              and extensions. The accessor "getStatus" gives direct access to
925   *              the value
926   */
927  public CatalogEntry setStatusElement(Enumeration<PublicationStatus> value) {
928    this.status = value;
929    return this;
930  }
931
932  /**
933   * @return Used to support catalog exchange even for unsupported products, e.g.
934   *         getting list of medications even if not prescribable.
935   */
936  public PublicationStatus getStatus() {
937    return this.status == null ? null : this.status.getValue();
938  }
939
940  /**
941   * @param value Used to support catalog exchange even for unsupported products,
942   *              e.g. getting list of medications even if not prescribable.
943   */
944  public CatalogEntry setStatus(PublicationStatus value) {
945    if (value == null)
946      this.status = null;
947    else {
948      if (this.status == null)
949        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
950      this.status.setValue(value);
951    }
952    return this;
953  }
954
955  /**
956   * @return {@link #validityPeriod} (The time period in which this catalog entry
957   *         is expected to be active.)
958   */
959  public Period getValidityPeriod() {
960    if (this.validityPeriod == null)
961      if (Configuration.errorOnAutoCreate())
962        throw new Error("Attempt to auto-create CatalogEntry.validityPeriod");
963      else if (Configuration.doAutoCreate())
964        this.validityPeriod = new Period(); // cc
965    return this.validityPeriod;
966  }
967
968  public boolean hasValidityPeriod() {
969    return this.validityPeriod != null && !this.validityPeriod.isEmpty();
970  }
971
972  /**
973   * @param value {@link #validityPeriod} (The time period in which this catalog
974   *              entry is expected to be active.)
975   */
976  public CatalogEntry setValidityPeriod(Period value) {
977    this.validityPeriod = value;
978    return this;
979  }
980
981  /**
982   * @return {@link #validTo} (The date until which this catalog entry is expected
983   *         to be active.). This is the underlying object with id, value and
984   *         extensions. The accessor "getValidTo" gives direct access to the
985   *         value
986   */
987  public DateTimeType getValidToElement() {
988    if (this.validTo == null)
989      if (Configuration.errorOnAutoCreate())
990        throw new Error("Attempt to auto-create CatalogEntry.validTo");
991      else if (Configuration.doAutoCreate())
992        this.validTo = new DateTimeType(); // bb
993    return this.validTo;
994  }
995
996  public boolean hasValidToElement() {
997    return this.validTo != null && !this.validTo.isEmpty();
998  }
999
1000  public boolean hasValidTo() {
1001    return this.validTo != null && !this.validTo.isEmpty();
1002  }
1003
1004  /**
1005   * @param value {@link #validTo} (The date until which this catalog entry is
1006   *              expected to be active.). This is the underlying object with id,
1007   *              value and extensions. The accessor "getValidTo" gives direct
1008   *              access to the value
1009   */
1010  public CatalogEntry setValidToElement(DateTimeType value) {
1011    this.validTo = value;
1012    return this;
1013  }
1014
1015  /**
1016   * @return The date until which this catalog entry is expected to be active.
1017   */
1018  public Date getValidTo() {
1019    return this.validTo == null ? null : this.validTo.getValue();
1020  }
1021
1022  /**
1023   * @param value The date until which this catalog entry is expected to be
1024   *              active.
1025   */
1026  public CatalogEntry setValidTo(Date value) {
1027    if (value == null)
1028      this.validTo = null;
1029    else {
1030      if (this.validTo == null)
1031        this.validTo = new DateTimeType();
1032      this.validTo.setValue(value);
1033    }
1034    return this;
1035  }
1036
1037  /**
1038   * @return {@link #lastUpdated} (Typically date of issue is different from the
1039   *         beginning of the validity. This can be used to see when an item was
1040   *         last updated.). This is the underlying object with id, value and
1041   *         extensions. The accessor "getLastUpdated" gives direct access to the
1042   *         value
1043   */
1044  public DateTimeType getLastUpdatedElement() {
1045    if (this.lastUpdated == null)
1046      if (Configuration.errorOnAutoCreate())
1047        throw new Error("Attempt to auto-create CatalogEntry.lastUpdated");
1048      else if (Configuration.doAutoCreate())
1049        this.lastUpdated = new DateTimeType(); // bb
1050    return this.lastUpdated;
1051  }
1052
1053  public boolean hasLastUpdatedElement() {
1054    return this.lastUpdated != null && !this.lastUpdated.isEmpty();
1055  }
1056
1057  public boolean hasLastUpdated() {
1058    return this.lastUpdated != null && !this.lastUpdated.isEmpty();
1059  }
1060
1061  /**
1062   * @param value {@link #lastUpdated} (Typically date of issue is different from
1063   *              the beginning of the validity. This can be used to see when an
1064   *              item was last updated.). This is the underlying object with id,
1065   *              value and extensions. The accessor "getLastUpdated" gives direct
1066   *              access to the value
1067   */
1068  public CatalogEntry setLastUpdatedElement(DateTimeType value) {
1069    this.lastUpdated = value;
1070    return this;
1071  }
1072
1073  /**
1074   * @return Typically date of issue is different from the beginning of the
1075   *         validity. This can be used to see when an item was last updated.
1076   */
1077  public Date getLastUpdated() {
1078    return this.lastUpdated == null ? null : this.lastUpdated.getValue();
1079  }
1080
1081  /**
1082   * @param value Typically date of issue is different from the beginning of the
1083   *              validity. This can be used to see when an item was last updated.
1084   */
1085  public CatalogEntry setLastUpdated(Date value) {
1086    if (value == null)
1087      this.lastUpdated = null;
1088    else {
1089      if (this.lastUpdated == null)
1090        this.lastUpdated = new DateTimeType();
1091      this.lastUpdated.setValue(value);
1092    }
1093    return this;
1094  }
1095
1096  /**
1097   * @return {@link #additionalCharacteristic} (Used for examplefor Out of
1098   *         Formulary, or any specifics.)
1099   */
1100  public List<CodeableConcept> getAdditionalCharacteristic() {
1101    if (this.additionalCharacteristic == null)
1102      this.additionalCharacteristic = new ArrayList<CodeableConcept>();
1103    return this.additionalCharacteristic;
1104  }
1105
1106  /**
1107   * @return Returns a reference to <code>this</code> for easy method chaining
1108   */
1109  public CatalogEntry setAdditionalCharacteristic(List<CodeableConcept> theAdditionalCharacteristic) {
1110    this.additionalCharacteristic = theAdditionalCharacteristic;
1111    return this;
1112  }
1113
1114  public boolean hasAdditionalCharacteristic() {
1115    if (this.additionalCharacteristic == null)
1116      return false;
1117    for (CodeableConcept item : this.additionalCharacteristic)
1118      if (!item.isEmpty())
1119        return true;
1120    return false;
1121  }
1122
1123  public CodeableConcept addAdditionalCharacteristic() { // 3
1124    CodeableConcept t = new CodeableConcept();
1125    if (this.additionalCharacteristic == null)
1126      this.additionalCharacteristic = new ArrayList<CodeableConcept>();
1127    this.additionalCharacteristic.add(t);
1128    return t;
1129  }
1130
1131  public CatalogEntry addAdditionalCharacteristic(CodeableConcept t) { // 3
1132    if (t == null)
1133      return this;
1134    if (this.additionalCharacteristic == null)
1135      this.additionalCharacteristic = new ArrayList<CodeableConcept>();
1136    this.additionalCharacteristic.add(t);
1137    return this;
1138  }
1139
1140  /**
1141   * @return The first repetition of repeating field
1142   *         {@link #additionalCharacteristic}, creating it if it does not already
1143   *         exist
1144   */
1145  public CodeableConcept getAdditionalCharacteristicFirstRep() {
1146    if (getAdditionalCharacteristic().isEmpty()) {
1147      addAdditionalCharacteristic();
1148    }
1149    return getAdditionalCharacteristic().get(0);
1150  }
1151
1152  /**
1153   * @return {@link #additionalClassification} (User for example for ATC
1154   *         classification, or.)
1155   */
1156  public List<CodeableConcept> getAdditionalClassification() {
1157    if (this.additionalClassification == null)
1158      this.additionalClassification = new ArrayList<CodeableConcept>();
1159    return this.additionalClassification;
1160  }
1161
1162  /**
1163   * @return Returns a reference to <code>this</code> for easy method chaining
1164   */
1165  public CatalogEntry setAdditionalClassification(List<CodeableConcept> theAdditionalClassification) {
1166    this.additionalClassification = theAdditionalClassification;
1167    return this;
1168  }
1169
1170  public boolean hasAdditionalClassification() {
1171    if (this.additionalClassification == null)
1172      return false;
1173    for (CodeableConcept item : this.additionalClassification)
1174      if (!item.isEmpty())
1175        return true;
1176    return false;
1177  }
1178
1179  public CodeableConcept addAdditionalClassification() { // 3
1180    CodeableConcept t = new CodeableConcept();
1181    if (this.additionalClassification == null)
1182      this.additionalClassification = new ArrayList<CodeableConcept>();
1183    this.additionalClassification.add(t);
1184    return t;
1185  }
1186
1187  public CatalogEntry addAdditionalClassification(CodeableConcept t) { // 3
1188    if (t == null)
1189      return this;
1190    if (this.additionalClassification == null)
1191      this.additionalClassification = new ArrayList<CodeableConcept>();
1192    this.additionalClassification.add(t);
1193    return this;
1194  }
1195
1196  /**
1197   * @return The first repetition of repeating field
1198   *         {@link #additionalClassification}, creating it if it does not already
1199   *         exist
1200   */
1201  public CodeableConcept getAdditionalClassificationFirstRep() {
1202    if (getAdditionalClassification().isEmpty()) {
1203      addAdditionalClassification();
1204    }
1205    return getAdditionalClassification().get(0);
1206  }
1207
1208  /**
1209   * @return {@link #relatedEntry} (Used for example, to point to a substance, or
1210   *         to a device used to administer a medication.)
1211   */
1212  public List<CatalogEntryRelatedEntryComponent> getRelatedEntry() {
1213    if (this.relatedEntry == null)
1214      this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1215    return this.relatedEntry;
1216  }
1217
1218  /**
1219   * @return Returns a reference to <code>this</code> for easy method chaining
1220   */
1221  public CatalogEntry setRelatedEntry(List<CatalogEntryRelatedEntryComponent> theRelatedEntry) {
1222    this.relatedEntry = theRelatedEntry;
1223    return this;
1224  }
1225
1226  public boolean hasRelatedEntry() {
1227    if (this.relatedEntry == null)
1228      return false;
1229    for (CatalogEntryRelatedEntryComponent item : this.relatedEntry)
1230      if (!item.isEmpty())
1231        return true;
1232    return false;
1233  }
1234
1235  public CatalogEntryRelatedEntryComponent addRelatedEntry() { // 3
1236    CatalogEntryRelatedEntryComponent t = new CatalogEntryRelatedEntryComponent();
1237    if (this.relatedEntry == null)
1238      this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1239    this.relatedEntry.add(t);
1240    return t;
1241  }
1242
1243  public CatalogEntry addRelatedEntry(CatalogEntryRelatedEntryComponent t) { // 3
1244    if (t == null)
1245      return this;
1246    if (this.relatedEntry == null)
1247      this.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1248    this.relatedEntry.add(t);
1249    return this;
1250  }
1251
1252  /**
1253   * @return The first repetition of repeating field {@link #relatedEntry},
1254   *         creating it if it does not already exist
1255   */
1256  public CatalogEntryRelatedEntryComponent getRelatedEntryFirstRep() {
1257    if (getRelatedEntry().isEmpty()) {
1258      addRelatedEntry();
1259    }
1260    return getRelatedEntry().get(0);
1261  }
1262
1263  protected void listChildren(List<Property> children) {
1264    super.listChildren(children);
1265    children.add(new Property("identifier", "Identifier",
1266        "Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.", 0,
1267        java.lang.Integer.MAX_VALUE, identifier));
1268    children.add(new Property("type", "CodeableConcept",
1269        "The type of item - medication, device, service, protocol or other.", 0, 1, type));
1270    children
1271        .add(new Property("orderable", "boolean", "Whether the entry represents an orderable item.", 0, 1, orderable));
1272    children.add(new Property("referencedItem",
1273        "Reference(Medication|Device|Organization|Practitioner|PractitionerRole|HealthcareService|ActivityDefinition|PlanDefinition|SpecimenDefinition|ObservationDefinition|Binary)",
1274        "The item in a catalog or definition.", 0, 1, referencedItem));
1275    children.add(
1276        new Property("additionalIdentifier", "Identifier", "Used in supporting related concepts, e.g. NDC to RxNorm.",
1277            0, java.lang.Integer.MAX_VALUE, additionalIdentifier));
1278    children.add(new Property("classification", "CodeableConcept", "Classes of devices, or ATC for medication.", 0,
1279        java.lang.Integer.MAX_VALUE, classification));
1280    children.add(new Property("status", "code",
1281        "Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.",
1282        0, 1, status));
1283    children.add(new Property("validityPeriod", "Period",
1284        "The time period in which this catalog entry is expected to be active.", 0, 1, validityPeriod));
1285    children.add(new Property("validTo", "dateTime",
1286        "The date until which this catalog entry is expected to be active.", 0, 1, validTo));
1287    children.add(new Property("lastUpdated", "dateTime",
1288        "Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.",
1289        0, 1, lastUpdated));
1290    children.add(new Property("additionalCharacteristic", "CodeableConcept",
1291        "Used for examplefor Out of Formulary, or any specifics.", 0, java.lang.Integer.MAX_VALUE,
1292        additionalCharacteristic));
1293    children.add(new Property("additionalClassification", "CodeableConcept",
1294        "User for example for ATC classification, or.", 0, java.lang.Integer.MAX_VALUE, additionalClassification));
1295    children.add(new Property("relatedEntry", "",
1296        "Used for example, to point to a substance, or to a device used to administer a medication.", 0,
1297        java.lang.Integer.MAX_VALUE, relatedEntry));
1298  }
1299
1300  @Override
1301  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1302    switch (_hash) {
1303    case -1618432855:
1304      /* identifier */ return new Property("identifier", "Identifier",
1305          "Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.", 0,
1306          java.lang.Integer.MAX_VALUE, identifier);
1307    case 3575610:
1308      /* type */ return new Property("type", "CodeableConcept",
1309          "The type of item - medication, device, service, protocol or other.", 0, 1, type);
1310    case -391199320:
1311      /* orderable */ return new Property("orderable", "boolean", "Whether the entry represents an orderable item.", 0,
1312          1, orderable);
1313    case -1896630996:
1314      /* referencedItem */ return new Property("referencedItem",
1315          "Reference(Medication|Device|Organization|Practitioner|PractitionerRole|HealthcareService|ActivityDefinition|PlanDefinition|SpecimenDefinition|ObservationDefinition|Binary)",
1316          "The item in a catalog or definition.", 0, 1, referencedItem);
1317    case 1195162672:
1318      /* additionalIdentifier */ return new Property("additionalIdentifier", "Identifier",
1319          "Used in supporting related concepts, e.g. NDC to RxNorm.", 0, java.lang.Integer.MAX_VALUE,
1320          additionalIdentifier);
1321    case 382350310:
1322      /* classification */ return new Property("classification", "CodeableConcept",
1323          "Classes of devices, or ATC for medication.", 0, java.lang.Integer.MAX_VALUE, classification);
1324    case -892481550:
1325      /* status */ return new Property("status", "code",
1326          "Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not prescribable.",
1327          0, 1, status);
1328    case -1434195053:
1329      /* validityPeriod */ return new Property("validityPeriod", "Period",
1330          "The time period in which this catalog entry is expected to be active.", 0, 1, validityPeriod);
1331    case 231246743:
1332      /* validTo */ return new Property("validTo", "dateTime",
1333          "The date until which this catalog entry is expected to be active.", 0, 1, validTo);
1334    case 1649733957:
1335      /* lastUpdated */ return new Property("lastUpdated", "dateTime",
1336          "Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last updated.",
1337          0, 1, lastUpdated);
1338    case -1638369886:
1339      /* additionalCharacteristic */ return new Property("additionalCharacteristic", "CodeableConcept",
1340          "Used for examplefor Out of Formulary, or any specifics.", 0, java.lang.Integer.MAX_VALUE,
1341          additionalCharacteristic);
1342    case -1622333459:
1343      /* additionalClassification */ return new Property("additionalClassification", "CodeableConcept",
1344          "User for example for ATC classification, or.", 0, java.lang.Integer.MAX_VALUE, additionalClassification);
1345    case 130178823:
1346      /* relatedEntry */ return new Property("relatedEntry", "",
1347          "Used for example, to point to a substance, or to a device used to administer a medication.", 0,
1348          java.lang.Integer.MAX_VALUE, relatedEntry);
1349    default:
1350      return super.getNamedProperty(_hash, _name, _checkValid);
1351    }
1352
1353  }
1354
1355  @Override
1356  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1357    switch (hash) {
1358    case -1618432855:
1359      /* identifier */ return this.identifier == null ? new Base[0]
1360          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1361    case 3575610:
1362      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1363    case -391199320:
1364      /* orderable */ return this.orderable == null ? new Base[0] : new Base[] { this.orderable }; // BooleanType
1365    case -1896630996:
1366      /* referencedItem */ return this.referencedItem == null ? new Base[0] : new Base[] { this.referencedItem }; // Reference
1367    case 1195162672:
1368      /* additionalIdentifier */ return this.additionalIdentifier == null ? new Base[0]
1369          : this.additionalIdentifier.toArray(new Base[this.additionalIdentifier.size()]); // Identifier
1370    case 382350310:
1371      /* classification */ return this.classification == null ? new Base[0]
1372          : this.classification.toArray(new Base[this.classification.size()]); // CodeableConcept
1373    case -892481550:
1374      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<PublicationStatus>
1375    case -1434195053:
1376      /* validityPeriod */ return this.validityPeriod == null ? new Base[0] : new Base[] { this.validityPeriod }; // Period
1377    case 231246743:
1378      /* validTo */ return this.validTo == null ? new Base[0] : new Base[] { this.validTo }; // DateTimeType
1379    case 1649733957:
1380      /* lastUpdated */ return this.lastUpdated == null ? new Base[0] : new Base[] { this.lastUpdated }; // DateTimeType
1381    case -1638369886:
1382      /* additionalCharacteristic */ return this.additionalCharacteristic == null ? new Base[0]
1383          : this.additionalCharacteristic.toArray(new Base[this.additionalCharacteristic.size()]); // CodeableConcept
1384    case -1622333459:
1385      /* additionalClassification */ return this.additionalClassification == null ? new Base[0]
1386          : this.additionalClassification.toArray(new Base[this.additionalClassification.size()]); // CodeableConcept
1387    case 130178823:
1388      /* relatedEntry */ return this.relatedEntry == null ? new Base[0]
1389          : this.relatedEntry.toArray(new Base[this.relatedEntry.size()]); // CatalogEntryRelatedEntryComponent
1390    default:
1391      return super.getProperty(hash, name, checkValid);
1392    }
1393
1394  }
1395
1396  @Override
1397  public Base setProperty(int hash, String name, Base value) throws FHIRException {
1398    switch (hash) {
1399    case -1618432855: // identifier
1400      this.getIdentifier().add(castToIdentifier(value)); // Identifier
1401      return value;
1402    case 3575610: // type
1403      this.type = castToCodeableConcept(value); // CodeableConcept
1404      return value;
1405    case -391199320: // orderable
1406      this.orderable = castToBoolean(value); // BooleanType
1407      return value;
1408    case -1896630996: // referencedItem
1409      this.referencedItem = castToReference(value); // Reference
1410      return value;
1411    case 1195162672: // additionalIdentifier
1412      this.getAdditionalIdentifier().add(castToIdentifier(value)); // Identifier
1413      return value;
1414    case 382350310: // classification
1415      this.getClassification().add(castToCodeableConcept(value)); // CodeableConcept
1416      return value;
1417    case -892481550: // status
1418      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1419      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1420      return value;
1421    case -1434195053: // validityPeriod
1422      this.validityPeriod = castToPeriod(value); // Period
1423      return value;
1424    case 231246743: // validTo
1425      this.validTo = castToDateTime(value); // DateTimeType
1426      return value;
1427    case 1649733957: // lastUpdated
1428      this.lastUpdated = castToDateTime(value); // DateTimeType
1429      return value;
1430    case -1638369886: // additionalCharacteristic
1431      this.getAdditionalCharacteristic().add(castToCodeableConcept(value)); // CodeableConcept
1432      return value;
1433    case -1622333459: // additionalClassification
1434      this.getAdditionalClassification().add(castToCodeableConcept(value)); // CodeableConcept
1435      return value;
1436    case 130178823: // relatedEntry
1437      this.getRelatedEntry().add((CatalogEntryRelatedEntryComponent) value); // CatalogEntryRelatedEntryComponent
1438      return value;
1439    default:
1440      return super.setProperty(hash, name, value);
1441    }
1442
1443  }
1444
1445  @Override
1446  public Base setProperty(String name, Base value) throws FHIRException {
1447    if (name.equals("identifier")) {
1448      this.getIdentifier().add(castToIdentifier(value));
1449    } else if (name.equals("type")) {
1450      this.type = castToCodeableConcept(value); // CodeableConcept
1451    } else if (name.equals("orderable")) {
1452      this.orderable = castToBoolean(value); // BooleanType
1453    } else if (name.equals("referencedItem")) {
1454      this.referencedItem = castToReference(value); // Reference
1455    } else if (name.equals("additionalIdentifier")) {
1456      this.getAdditionalIdentifier().add(castToIdentifier(value));
1457    } else if (name.equals("classification")) {
1458      this.getClassification().add(castToCodeableConcept(value));
1459    } else if (name.equals("status")) {
1460      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1461      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1462    } else if (name.equals("validityPeriod")) {
1463      this.validityPeriod = castToPeriod(value); // Period
1464    } else if (name.equals("validTo")) {
1465      this.validTo = castToDateTime(value); // DateTimeType
1466    } else if (name.equals("lastUpdated")) {
1467      this.lastUpdated = castToDateTime(value); // DateTimeType
1468    } else if (name.equals("additionalCharacteristic")) {
1469      this.getAdditionalCharacteristic().add(castToCodeableConcept(value));
1470    } else if (name.equals("additionalClassification")) {
1471      this.getAdditionalClassification().add(castToCodeableConcept(value));
1472    } else if (name.equals("relatedEntry")) {
1473      this.getRelatedEntry().add((CatalogEntryRelatedEntryComponent) value);
1474    } else
1475      return super.setProperty(name, value);
1476    return value;
1477  }
1478
1479  @Override
1480  public void removeChild(String name, Base value) throws FHIRException {
1481    if (name.equals("identifier")) {
1482      this.getIdentifier().remove(castToIdentifier(value));
1483    } else if (name.equals("type")) {
1484      this.type = null;
1485    } else if (name.equals("orderable")) {
1486      this.orderable = null;
1487    } else if (name.equals("referencedItem")) {
1488      this.referencedItem = null;
1489    } else if (name.equals("additionalIdentifier")) {
1490      this.getAdditionalIdentifier().remove(castToIdentifier(value));
1491    } else if (name.equals("classification")) {
1492      this.getClassification().remove(castToCodeableConcept(value));
1493    } else if (name.equals("status")) {
1494      this.status = null;
1495    } else if (name.equals("validityPeriod")) {
1496      this.validityPeriod = null;
1497    } else if (name.equals("validTo")) {
1498      this.validTo = null;
1499    } else if (name.equals("lastUpdated")) {
1500      this.lastUpdated = null;
1501    } else if (name.equals("additionalCharacteristic")) {
1502      this.getAdditionalCharacteristic().remove(castToCodeableConcept(value));
1503    } else if (name.equals("additionalClassification")) {
1504      this.getAdditionalClassification().remove(castToCodeableConcept(value));
1505    } else if (name.equals("relatedEntry")) {
1506      this.getRelatedEntry().remove((CatalogEntryRelatedEntryComponent) value);
1507    } else
1508      super.removeChild(name, value);
1509    
1510  }
1511
1512  @Override
1513  public Base makeProperty(int hash, String name) throws FHIRException {
1514    switch (hash) {
1515    case -1618432855:
1516      return addIdentifier();
1517    case 3575610:
1518      return getType();
1519    case -391199320:
1520      return getOrderableElement();
1521    case -1896630996:
1522      return getReferencedItem();
1523    case 1195162672:
1524      return addAdditionalIdentifier();
1525    case 382350310:
1526      return addClassification();
1527    case -892481550:
1528      return getStatusElement();
1529    case -1434195053:
1530      return getValidityPeriod();
1531    case 231246743:
1532      return getValidToElement();
1533    case 1649733957:
1534      return getLastUpdatedElement();
1535    case -1638369886:
1536      return addAdditionalCharacteristic();
1537    case -1622333459:
1538      return addAdditionalClassification();
1539    case 130178823:
1540      return addRelatedEntry();
1541    default:
1542      return super.makeProperty(hash, name);
1543    }
1544
1545  }
1546
1547  @Override
1548  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1549    switch (hash) {
1550    case -1618432855:
1551      /* identifier */ return new String[] { "Identifier" };
1552    case 3575610:
1553      /* type */ return new String[] { "CodeableConcept" };
1554    case -391199320:
1555      /* orderable */ return new String[] { "boolean" };
1556    case -1896630996:
1557      /* referencedItem */ return new String[] { "Reference" };
1558    case 1195162672:
1559      /* additionalIdentifier */ return new String[] { "Identifier" };
1560    case 382350310:
1561      /* classification */ return new String[] { "CodeableConcept" };
1562    case -892481550:
1563      /* status */ return new String[] { "code" };
1564    case -1434195053:
1565      /* validityPeriod */ return new String[] { "Period" };
1566    case 231246743:
1567      /* validTo */ return new String[] { "dateTime" };
1568    case 1649733957:
1569      /* lastUpdated */ return new String[] { "dateTime" };
1570    case -1638369886:
1571      /* additionalCharacteristic */ return new String[] { "CodeableConcept" };
1572    case -1622333459:
1573      /* additionalClassification */ return new String[] { "CodeableConcept" };
1574    case 130178823:
1575      /* relatedEntry */ return new String[] {};
1576    default:
1577      return super.getTypesForProperty(hash, name);
1578    }
1579
1580  }
1581
1582  @Override
1583  public Base addChild(String name) throws FHIRException {
1584    if (name.equals("identifier")) {
1585      return addIdentifier();
1586    } else if (name.equals("type")) {
1587      this.type = new CodeableConcept();
1588      return this.type;
1589    } else if (name.equals("orderable")) {
1590      throw new FHIRException("Cannot call addChild on a singleton property CatalogEntry.orderable");
1591    } else if (name.equals("referencedItem")) {
1592      this.referencedItem = new Reference();
1593      return this.referencedItem;
1594    } else if (name.equals("additionalIdentifier")) {
1595      return addAdditionalIdentifier();
1596    } else if (name.equals("classification")) {
1597      return addClassification();
1598    } else if (name.equals("status")) {
1599      throw new FHIRException("Cannot call addChild on a singleton property CatalogEntry.status");
1600    } else if (name.equals("validityPeriod")) {
1601      this.validityPeriod = new Period();
1602      return this.validityPeriod;
1603    } else if (name.equals("validTo")) {
1604      throw new FHIRException("Cannot call addChild on a singleton property CatalogEntry.validTo");
1605    } else if (name.equals("lastUpdated")) {
1606      throw new FHIRException("Cannot call addChild on a singleton property CatalogEntry.lastUpdated");
1607    } else if (name.equals("additionalCharacteristic")) {
1608      return addAdditionalCharacteristic();
1609    } else if (name.equals("additionalClassification")) {
1610      return addAdditionalClassification();
1611    } else if (name.equals("relatedEntry")) {
1612      return addRelatedEntry();
1613    } else
1614      return super.addChild(name);
1615  }
1616
1617  public String fhirType() {
1618    return "CatalogEntry";
1619
1620  }
1621
1622  public CatalogEntry copy() {
1623    CatalogEntry dst = new CatalogEntry();
1624    copyValues(dst);
1625    return dst;
1626  }
1627
1628  public void copyValues(CatalogEntry dst) {
1629    super.copyValues(dst);
1630    if (identifier != null) {
1631      dst.identifier = new ArrayList<Identifier>();
1632      for (Identifier i : identifier)
1633        dst.identifier.add(i.copy());
1634    }
1635    ;
1636    dst.type = type == null ? null : type.copy();
1637    dst.orderable = orderable == null ? null : orderable.copy();
1638    dst.referencedItem = referencedItem == null ? null : referencedItem.copy();
1639    if (additionalIdentifier != null) {
1640      dst.additionalIdentifier = new ArrayList<Identifier>();
1641      for (Identifier i : additionalIdentifier)
1642        dst.additionalIdentifier.add(i.copy());
1643    }
1644    ;
1645    if (classification != null) {
1646      dst.classification = new ArrayList<CodeableConcept>();
1647      for (CodeableConcept i : classification)
1648        dst.classification.add(i.copy());
1649    }
1650    ;
1651    dst.status = status == null ? null : status.copy();
1652    dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1653    dst.validTo = validTo == null ? null : validTo.copy();
1654    dst.lastUpdated = lastUpdated == null ? null : lastUpdated.copy();
1655    if (additionalCharacteristic != null) {
1656      dst.additionalCharacteristic = new ArrayList<CodeableConcept>();
1657      for (CodeableConcept i : additionalCharacteristic)
1658        dst.additionalCharacteristic.add(i.copy());
1659    }
1660    ;
1661    if (additionalClassification != null) {
1662      dst.additionalClassification = new ArrayList<CodeableConcept>();
1663      for (CodeableConcept i : additionalClassification)
1664        dst.additionalClassification.add(i.copy());
1665    }
1666    ;
1667    if (relatedEntry != null) {
1668      dst.relatedEntry = new ArrayList<CatalogEntryRelatedEntryComponent>();
1669      for (CatalogEntryRelatedEntryComponent i : relatedEntry)
1670        dst.relatedEntry.add(i.copy());
1671    }
1672    ;
1673  }
1674
1675  protected CatalogEntry typedCopy() {
1676    return copy();
1677  }
1678
1679  @Override
1680  public boolean equalsDeep(Base other_) {
1681    if (!super.equalsDeep(other_))
1682      return false;
1683    if (!(other_ instanceof CatalogEntry))
1684      return false;
1685    CatalogEntry o = (CatalogEntry) other_;
1686    return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
1687        && compareDeep(orderable, o.orderable, true) && compareDeep(referencedItem, o.referencedItem, true)
1688        && compareDeep(additionalIdentifier, o.additionalIdentifier, true)
1689        && compareDeep(classification, o.classification, true) && compareDeep(status, o.status, true)
1690        && compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(validTo, o.validTo, true)
1691        && compareDeep(lastUpdated, o.lastUpdated, true)
1692        && compareDeep(additionalCharacteristic, o.additionalCharacteristic, true)
1693        && compareDeep(additionalClassification, o.additionalClassification, true)
1694        && compareDeep(relatedEntry, o.relatedEntry, true);
1695  }
1696
1697  @Override
1698  public boolean equalsShallow(Base other_) {
1699    if (!super.equalsShallow(other_))
1700      return false;
1701    if (!(other_ instanceof CatalogEntry))
1702      return false;
1703    CatalogEntry o = (CatalogEntry) other_;
1704    return compareValues(orderable, o.orderable, true) && compareValues(status, o.status, true)
1705        && compareValues(validTo, o.validTo, true) && compareValues(lastUpdated, o.lastUpdated, true);
1706  }
1707
1708  public boolean isEmpty() {
1709    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, orderable, referencedItem,
1710        additionalIdentifier, classification, status, validityPeriod, validTo, lastUpdated, additionalCharacteristic,
1711        additionalClassification, relatedEntry);
1712  }
1713
1714  @Override
1715  public ResourceType getResourceType() {
1716    return ResourceType.CatalogEntry;
1717  }
1718
1719}