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