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