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