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