001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Identifies two or more records (resource instances) that refer to the same real-world "occurrence".
052 */
053@ResourceDef(name="Linkage", profile="http://hl7.org/fhir/StructureDefinition/Linkage")
054public class Linkage extends DomainResource {
055
056    public enum LinkageType {
057        /**
058         * The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc.
059         */
060        SOURCE, 
061        /**
062         * The resource represents an alternative view of the underlying event/condition/etc.  The resource may still be actively maintained, even though it is not considered to be the source of truth.
063         */
064        ALTERNATE, 
065        /**
066         * The resource represents an obsolete record of the underlying event/condition/etc.  It is not expected to be actively maintained.
067         */
068        HISTORICAL, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static LinkageType fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("source".equals(codeString))
077          return SOURCE;
078        if ("alternate".equals(codeString))
079          return ALTERNATE;
080        if ("historical".equals(codeString))
081          return HISTORICAL;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown LinkageType code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case SOURCE: return "source";
090            case ALTERNATE: return "alternate";
091            case HISTORICAL: return "historical";
092            default: return "?";
093          }
094        }
095        public String getSystem() {
096          switch (this) {
097            case SOURCE: return "http://hl7.org/fhir/linkage-type";
098            case ALTERNATE: return "http://hl7.org/fhir/linkage-type";
099            case HISTORICAL: return "http://hl7.org/fhir/linkage-type";
100            default: return "?";
101          }
102        }
103        public String getDefinition() {
104          switch (this) {
105            case SOURCE: return "The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc.";
106            case ALTERNATE: return "The resource represents an alternative view of the underlying event/condition/etc.  The resource may still be actively maintained, even though it is not considered to be the source of truth.";
107            case HISTORICAL: return "The resource represents an obsolete record of the underlying event/condition/etc.  It is not expected to be actively maintained.";
108            default: return "?";
109          }
110        }
111        public String getDisplay() {
112          switch (this) {
113            case SOURCE: return "Source of Truth";
114            case ALTERNATE: return "Alternate Record";
115            case HISTORICAL: return "Historical/Obsolete Record";
116            default: return "?";
117          }
118        }
119    }
120
121  public static class LinkageTypeEnumFactory implements EnumFactory<LinkageType> {
122    public LinkageType fromCode(String codeString) throws IllegalArgumentException {
123      if (codeString == null || "".equals(codeString))
124            if (codeString == null || "".equals(codeString))
125                return null;
126        if ("source".equals(codeString))
127          return LinkageType.SOURCE;
128        if ("alternate".equals(codeString))
129          return LinkageType.ALTERNATE;
130        if ("historical".equals(codeString))
131          return LinkageType.HISTORICAL;
132        throw new IllegalArgumentException("Unknown LinkageType code '"+codeString+"'");
133        }
134        public Enumeration<LinkageType> fromType(Base code) throws FHIRException {
135          if (code == null)
136            return null;
137          if (code.isEmpty())
138            return new Enumeration<LinkageType>(this);
139          String codeString = ((PrimitiveType) code).asStringValue();
140          if (codeString == null || "".equals(codeString))
141            return null;
142        if ("source".equals(codeString))
143          return new Enumeration<LinkageType>(this, LinkageType.SOURCE);
144        if ("alternate".equals(codeString))
145          return new Enumeration<LinkageType>(this, LinkageType.ALTERNATE);
146        if ("historical".equals(codeString))
147          return new Enumeration<LinkageType>(this, LinkageType.HISTORICAL);
148        throw new FHIRException("Unknown LinkageType code '"+codeString+"'");
149        }
150    public String toCode(LinkageType code) {
151      if (code == LinkageType.SOURCE)
152        return "source";
153      if (code == LinkageType.ALTERNATE)
154        return "alternate";
155      if (code == LinkageType.HISTORICAL)
156        return "historical";
157      return "?";
158      }
159    public String toSystem(LinkageType code) {
160      return code.getSystem();
161      }
162    }
163
164    @Block()
165    public static class LinkageItemComponent extends BackboneElement implements IBaseBackboneElement {
166        /**
167         * Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.
168         */
169        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
170        @Description(shortDefinition="source | alternate | historical", formalDefinition="Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations." )
171        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/linkage-type")
172        protected Enumeration<LinkageType> type;
173
174        /**
175         * The resource instance being linked as part of the group.
176         */
177        @Child(name = "resource", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true)
178        @Description(shortDefinition="Resource being linked", formalDefinition="The resource instance being linked as part of the group." )
179        protected Reference resource;
180
181        private static final long serialVersionUID = 527428511L;
182
183    /**
184     * Constructor
185     */
186      public LinkageItemComponent() {
187        super();
188      }
189
190    /**
191     * Constructor
192     */
193      public LinkageItemComponent(LinkageType type, Reference resource) {
194        super();
195        this.setType(type);
196        this.setResource(resource);
197      }
198
199        /**
200         * @return {@link #type} (Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
201         */
202        public Enumeration<LinkageType> getTypeElement() { 
203          if (this.type == null)
204            if (Configuration.errorOnAutoCreate())
205              throw new Error("Attempt to auto-create LinkageItemComponent.type");
206            else if (Configuration.doAutoCreate())
207              this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); // bb
208          return this.type;
209        }
210
211        public boolean hasTypeElement() { 
212          return this.type != null && !this.type.isEmpty();
213        }
214
215        public boolean hasType() { 
216          return this.type != null && !this.type.isEmpty();
217        }
218
219        /**
220         * @param value {@link #type} (Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
221         */
222        public LinkageItemComponent setTypeElement(Enumeration<LinkageType> value) { 
223          this.type = value;
224          return this;
225        }
226
227        /**
228         * @return Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.
229         */
230        public LinkageType getType() { 
231          return this.type == null ? null : this.type.getValue();
232        }
233
234        /**
235         * @param value Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.
236         */
237        public LinkageItemComponent setType(LinkageType value) { 
238            if (this.type == null)
239              this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory());
240            this.type.setValue(value);
241          return this;
242        }
243
244        /**
245         * @return {@link #resource} (The resource instance being linked as part of the group.)
246         */
247        public Reference getResource() { 
248          if (this.resource == null)
249            if (Configuration.errorOnAutoCreate())
250              throw new Error("Attempt to auto-create LinkageItemComponent.resource");
251            else if (Configuration.doAutoCreate())
252              this.resource = new Reference(); // cc
253          return this.resource;
254        }
255
256        public boolean hasResource() { 
257          return this.resource != null && !this.resource.isEmpty();
258        }
259
260        /**
261         * @param value {@link #resource} (The resource instance being linked as part of the group.)
262         */
263        public LinkageItemComponent setResource(Reference value) { 
264          this.resource = value;
265          return this;
266        }
267
268        protected void listChildren(List<Property> children) {
269          super.listChildren(children);
270          children.add(new Property("type", "code", "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 0, 1, type));
271          children.add(new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource));
272        }
273
274        @Override
275        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
276          switch (_hash) {
277          case 3575610: /*type*/  return new Property("type", "code", "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 0, 1, type);
278          case -341064690: /*resource*/  return new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource);
279          default: return super.getNamedProperty(_hash, _name, _checkValid);
280          }
281
282        }
283
284      @Override
285      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
286        switch (hash) {
287        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<LinkageType>
288        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference
289        default: return super.getProperty(hash, name, checkValid);
290        }
291
292      }
293
294      @Override
295      public Base setProperty(int hash, String name, Base value) throws FHIRException {
296        switch (hash) {
297        case 3575610: // type
298          value = new LinkageTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
299          this.type = (Enumeration) value; // Enumeration<LinkageType>
300          return value;
301        case -341064690: // resource
302          this.resource = TypeConvertor.castToReference(value); // Reference
303          return value;
304        default: return super.setProperty(hash, name, value);
305        }
306
307      }
308
309      @Override
310      public Base setProperty(String name, Base value) throws FHIRException {
311        if (name.equals("type")) {
312          value = new LinkageTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
313          this.type = (Enumeration) value; // Enumeration<LinkageType>
314        } else if (name.equals("resource")) {
315          this.resource = TypeConvertor.castToReference(value); // Reference
316        } else
317          return super.setProperty(name, value);
318        return value;
319      }
320
321      @Override
322      public Base makeProperty(int hash, String name) throws FHIRException {
323        switch (hash) {
324        case 3575610:  return getTypeElement();
325        case -341064690:  return getResource();
326        default: return super.makeProperty(hash, name);
327        }
328
329      }
330
331      @Override
332      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
333        switch (hash) {
334        case 3575610: /*type*/ return new String[] {"code"};
335        case -341064690: /*resource*/ return new String[] {"Reference"};
336        default: return super.getTypesForProperty(hash, name);
337        }
338
339      }
340
341      @Override
342      public Base addChild(String name) throws FHIRException {
343        if (name.equals("type")) {
344          throw new FHIRException("Cannot call addChild on a primitive type Linkage.item.type");
345        }
346        else if (name.equals("resource")) {
347          this.resource = new Reference();
348          return this.resource;
349        }
350        else
351          return super.addChild(name);
352      }
353
354      public LinkageItemComponent copy() {
355        LinkageItemComponent dst = new LinkageItemComponent();
356        copyValues(dst);
357        return dst;
358      }
359
360      public void copyValues(LinkageItemComponent dst) {
361        super.copyValues(dst);
362        dst.type = type == null ? null : type.copy();
363        dst.resource = resource == null ? null : resource.copy();
364      }
365
366      @Override
367      public boolean equalsDeep(Base other_) {
368        if (!super.equalsDeep(other_))
369          return false;
370        if (!(other_ instanceof LinkageItemComponent))
371          return false;
372        LinkageItemComponent o = (LinkageItemComponent) other_;
373        return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true);
374      }
375
376      @Override
377      public boolean equalsShallow(Base other_) {
378        if (!super.equalsShallow(other_))
379          return false;
380        if (!(other_ instanceof LinkageItemComponent))
381          return false;
382        LinkageItemComponent o = (LinkageItemComponent) other_;
383        return compareValues(type, o.type, true);
384      }
385
386      public boolean isEmpty() {
387        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource);
388      }
389
390  public String fhirType() {
391    return "Linkage.item";
392
393  }
394
395  }
396
397    /**
398     * Indicates whether the asserted set of linkages are considered to be "in effect".
399     */
400    @Child(name = "active", type = {BooleanType.class}, order=0, min=0, max=1, modifier=false, summary=true)
401    @Description(shortDefinition="Whether this linkage assertion is active or not", formalDefinition="Indicates whether the asserted set of linkages are considered to be \"in effect\"." )
402    protected BooleanType active;
403
404    /**
405     * Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.
406     */
407    @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=1, min=0, max=1, modifier=false, summary=true)
408    @Description(shortDefinition="Who is responsible for linkages", formalDefinition="Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated." )
409    protected Reference author;
410
411    /**
412     * Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.
413     */
414    @Child(name = "item", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
415    @Description(shortDefinition="Item to be linked", formalDefinition="Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items." )
416    protected List<LinkageItemComponent> item;
417
418    private static final long serialVersionUID = 810520886L;
419
420  /**
421   * Constructor
422   */
423    public Linkage() {
424      super();
425    }
426
427  /**
428   * Constructor
429   */
430    public Linkage(LinkageItemComponent item) {
431      super();
432      this.addItem(item);
433    }
434
435    /**
436     * @return {@link #active} (Indicates whether the asserted set of linkages are considered to be "in effect".). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
437     */
438    public BooleanType getActiveElement() { 
439      if (this.active == null)
440        if (Configuration.errorOnAutoCreate())
441          throw new Error("Attempt to auto-create Linkage.active");
442        else if (Configuration.doAutoCreate())
443          this.active = new BooleanType(); // bb
444      return this.active;
445    }
446
447    public boolean hasActiveElement() { 
448      return this.active != null && !this.active.isEmpty();
449    }
450
451    public boolean hasActive() { 
452      return this.active != null && !this.active.isEmpty();
453    }
454
455    /**
456     * @param value {@link #active} (Indicates whether the asserted set of linkages are considered to be "in effect".). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
457     */
458    public Linkage setActiveElement(BooleanType value) { 
459      this.active = value;
460      return this;
461    }
462
463    /**
464     * @return Indicates whether the asserted set of linkages are considered to be "in effect".
465     */
466    public boolean getActive() { 
467      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
468    }
469
470    /**
471     * @param value Indicates whether the asserted set of linkages are considered to be "in effect".
472     */
473    public Linkage setActive(boolean value) { 
474        if (this.active == null)
475          this.active = new BooleanType();
476        this.active.setValue(value);
477      return this;
478    }
479
480    /**
481     * @return {@link #author} (Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.)
482     */
483    public Reference getAuthor() { 
484      if (this.author == null)
485        if (Configuration.errorOnAutoCreate())
486          throw new Error("Attempt to auto-create Linkage.author");
487        else if (Configuration.doAutoCreate())
488          this.author = new Reference(); // cc
489      return this.author;
490    }
491
492    public boolean hasAuthor() { 
493      return this.author != null && !this.author.isEmpty();
494    }
495
496    /**
497     * @param value {@link #author} (Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.)
498     */
499    public Linkage setAuthor(Reference value) { 
500      this.author = value;
501      return this;
502    }
503
504    /**
505     * @return {@link #item} (Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.)
506     */
507    public List<LinkageItemComponent> getItem() { 
508      if (this.item == null)
509        this.item = new ArrayList<LinkageItemComponent>();
510      return this.item;
511    }
512
513    /**
514     * @return Returns a reference to <code>this</code> for easy method chaining
515     */
516    public Linkage setItem(List<LinkageItemComponent> theItem) { 
517      this.item = theItem;
518      return this;
519    }
520
521    public boolean hasItem() { 
522      if (this.item == null)
523        return false;
524      for (LinkageItemComponent item : this.item)
525        if (!item.isEmpty())
526          return true;
527      return false;
528    }
529
530    public LinkageItemComponent addItem() { //3
531      LinkageItemComponent t = new LinkageItemComponent();
532      if (this.item == null)
533        this.item = new ArrayList<LinkageItemComponent>();
534      this.item.add(t);
535      return t;
536    }
537
538    public Linkage addItem(LinkageItemComponent t) { //3
539      if (t == null)
540        return this;
541      if (this.item == null)
542        this.item = new ArrayList<LinkageItemComponent>();
543      this.item.add(t);
544      return this;
545    }
546
547    /**
548     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
549     */
550    public LinkageItemComponent getItemFirstRep() { 
551      if (getItem().isEmpty()) {
552        addItem();
553      }
554      return getItem().get(0);
555    }
556
557      protected void listChildren(List<Property> children) {
558        super.listChildren(children);
559        children.add(new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active));
560        children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", "Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.", 0, 1, author));
561        children.add(new Property("item", "", "Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.", 0, java.lang.Integer.MAX_VALUE, item));
562      }
563
564      @Override
565      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
566        switch (_hash) {
567        case -1422950650: /*active*/  return new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active);
568        case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", "Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.", 0, 1, author);
569        case 3242771: /*item*/  return new Property("item", "", "Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.", 0, java.lang.Integer.MAX_VALUE, item);
570        default: return super.getNamedProperty(_hash, _name, _checkValid);
571        }
572
573      }
574
575      @Override
576      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
577        switch (hash) {
578        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
579        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
580        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // LinkageItemComponent
581        default: return super.getProperty(hash, name, checkValid);
582        }
583
584      }
585
586      @Override
587      public Base setProperty(int hash, String name, Base value) throws FHIRException {
588        switch (hash) {
589        case -1422950650: // active
590          this.active = TypeConvertor.castToBoolean(value); // BooleanType
591          return value;
592        case -1406328437: // author
593          this.author = TypeConvertor.castToReference(value); // Reference
594          return value;
595        case 3242771: // item
596          this.getItem().add((LinkageItemComponent) value); // LinkageItemComponent
597          return value;
598        default: return super.setProperty(hash, name, value);
599        }
600
601      }
602
603      @Override
604      public Base setProperty(String name, Base value) throws FHIRException {
605        if (name.equals("active")) {
606          this.active = TypeConvertor.castToBoolean(value); // BooleanType
607        } else if (name.equals("author")) {
608          this.author = TypeConvertor.castToReference(value); // Reference
609        } else if (name.equals("item")) {
610          this.getItem().add((LinkageItemComponent) value);
611        } else
612          return super.setProperty(name, value);
613        return value;
614      }
615
616      @Override
617      public Base makeProperty(int hash, String name) throws FHIRException {
618        switch (hash) {
619        case -1422950650:  return getActiveElement();
620        case -1406328437:  return getAuthor();
621        case 3242771:  return addItem(); 
622        default: return super.makeProperty(hash, name);
623        }
624
625      }
626
627      @Override
628      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
629        switch (hash) {
630        case -1422950650: /*active*/ return new String[] {"boolean"};
631        case -1406328437: /*author*/ return new String[] {"Reference"};
632        case 3242771: /*item*/ return new String[] {};
633        default: return super.getTypesForProperty(hash, name);
634        }
635
636      }
637
638      @Override
639      public Base addChild(String name) throws FHIRException {
640        if (name.equals("active")) {
641          throw new FHIRException("Cannot call addChild on a primitive type Linkage.active");
642        }
643        else if (name.equals("author")) {
644          this.author = new Reference();
645          return this.author;
646        }
647        else if (name.equals("item")) {
648          return addItem();
649        }
650        else
651          return super.addChild(name);
652      }
653
654  public String fhirType() {
655    return "Linkage";
656
657  }
658
659      public Linkage copy() {
660        Linkage dst = new Linkage();
661        copyValues(dst);
662        return dst;
663      }
664
665      public void copyValues(Linkage dst) {
666        super.copyValues(dst);
667        dst.active = active == null ? null : active.copy();
668        dst.author = author == null ? null : author.copy();
669        if (item != null) {
670          dst.item = new ArrayList<LinkageItemComponent>();
671          for (LinkageItemComponent i : item)
672            dst.item.add(i.copy());
673        };
674      }
675
676      protected Linkage typedCopy() {
677        return copy();
678      }
679
680      @Override
681      public boolean equalsDeep(Base other_) {
682        if (!super.equalsDeep(other_))
683          return false;
684        if (!(other_ instanceof Linkage))
685          return false;
686        Linkage o = (Linkage) other_;
687        return compareDeep(active, o.active, true) && compareDeep(author, o.author, true) && compareDeep(item, o.item, true)
688          ;
689      }
690
691      @Override
692      public boolean equalsShallow(Base other_) {
693        if (!super.equalsShallow(other_))
694          return false;
695        if (!(other_ instanceof Linkage))
696          return false;
697        Linkage o = (Linkage) other_;
698        return compareValues(active, o.active, true);
699      }
700
701      public boolean isEmpty() {
702        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(active, author, item);
703      }
704
705  @Override
706  public ResourceType getResourceType() {
707    return ResourceType.Linkage;
708   }
709
710 /**
711   * Search parameter: <b>author</b>
712   * <p>
713   * Description: <b>Author of the Linkage</b><br>
714   * Type: <b>reference</b><br>
715   * Path: <b>Linkage.author</b><br>
716   * </p>
717   */
718  @SearchParamDefinition(name="author", path="Linkage.author", description="Author of the Linkage", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
719  public static final String SP_AUTHOR = "author";
720 /**
721   * <b>Fluent Client</b> search parameter constant for <b>author</b>
722   * <p>
723   * Description: <b>Author of the Linkage</b><br>
724   * Type: <b>reference</b><br>
725   * Path: <b>Linkage.author</b><br>
726   * </p>
727   */
728  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
729
730/**
731   * Constant for fluent queries to be used to add include statements. Specifies
732   * the path value of "<b>Linkage:author</b>".
733   */
734  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Linkage:author").toLocked();
735
736 /**
737   * Search parameter: <b>item</b>
738   * <p>
739   * Description: <b>Matches on any item in the Linkage</b><br>
740   * Type: <b>reference</b><br>
741   * Path: <b>Linkage.item.resource</b><br>
742   * </p>
743   */
744  @SearchParamDefinition(name="item", path="Linkage.item.resource", description="Matches on any item in the Linkage", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
745  public static final String SP_ITEM = "item";
746 /**
747   * <b>Fluent Client</b> search parameter constant for <b>item</b>
748   * <p>
749   * Description: <b>Matches on any item in the Linkage</b><br>
750   * Type: <b>reference</b><br>
751   * Path: <b>Linkage.item.resource</b><br>
752   * </p>
753   */
754  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM);
755
756/**
757   * Constant for fluent queries to be used to add include statements. Specifies
758   * the path value of "<b>Linkage:item</b>".
759   */
760  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("Linkage:item").toLocked();
761
762 /**
763   * Search parameter: <b>source</b>
764   * <p>
765   * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br>
766   * Type: <b>reference</b><br>
767   * Path: <b>Linkage.item.resource</b><br>
768   * </p>
769   */
770  @SearchParamDefinition(name="source", path="Linkage.item.resource", description="Matches on any item in the Linkage with a type of 'source'", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, ConceptMap2.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
771  public static final String SP_SOURCE = "source";
772 /**
773   * <b>Fluent Client</b> search parameter constant for <b>source</b>
774   * <p>
775   * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br>
776   * Type: <b>reference</b><br>
777   * Path: <b>Linkage.item.resource</b><br>
778   * </p>
779   */
780  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
781
782/**
783   * Constant for fluent queries to be used to add include statements. Specifies
784   * the path value of "<b>Linkage:source</b>".
785   */
786  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("Linkage:source").toLocked();
787
788
789}
790