001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.
051 */
052@ResourceDef(name="GraphDefinition", profile="http://hl7.org/fhir/StructureDefinition/GraphDefinition")
053@ChildOrder(names={"url", "version", "name", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "start", "profile", "link"})
054public class GraphDefinition extends MetadataResource {
055
056    public enum GraphCompartmentUse {
057        /**
058         * This compartment rule is a condition for whether the rule applies.
059         */
060        CONDITION, 
061        /**
062         * This compartment rule is enforced on any relationships that meet the conditions.
063         */
064        REQUIREMENT, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static GraphCompartmentUse fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("condition".equals(codeString))
073          return CONDITION;
074        if ("requirement".equals(codeString))
075          return REQUIREMENT;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown GraphCompartmentUse code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case CONDITION: return "condition";
084            case REQUIREMENT: return "requirement";
085            case NULL: return null;
086            default: return "?";
087          }
088        }
089        public String getSystem() {
090          switch (this) {
091            case CONDITION: return "http://hl7.org/fhir/graph-compartment-use";
092            case REQUIREMENT: return "http://hl7.org/fhir/graph-compartment-use";
093            case NULL: return null;
094            default: return "?";
095          }
096        }
097        public String getDefinition() {
098          switch (this) {
099            case CONDITION: return "This compartment rule is a condition for whether the rule applies.";
100            case REQUIREMENT: return "This compartment rule is enforced on any relationships that meet the conditions.";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDisplay() {
106          switch (this) {
107            case CONDITION: return "Condition";
108            case REQUIREMENT: return "Requirement";
109            case NULL: return null;
110            default: return "?";
111          }
112        }
113    }
114
115  public static class GraphCompartmentUseEnumFactory implements EnumFactory<GraphCompartmentUse> {
116    public GraphCompartmentUse fromCode(String codeString) throws IllegalArgumentException {
117      if (codeString == null || "".equals(codeString))
118            if (codeString == null || "".equals(codeString))
119                return null;
120        if ("condition".equals(codeString))
121          return GraphCompartmentUse.CONDITION;
122        if ("requirement".equals(codeString))
123          return GraphCompartmentUse.REQUIREMENT;
124        throw new IllegalArgumentException("Unknown GraphCompartmentUse code '"+codeString+"'");
125        }
126        public Enumeration<GraphCompartmentUse> fromType(Base code) throws FHIRException {
127          if (code == null)
128            return null;
129          if (code.isEmpty())
130            return new Enumeration<GraphCompartmentUse>(this);
131          String codeString = ((PrimitiveType) code).asStringValue();
132          if (codeString == null || "".equals(codeString))
133            return null;
134        if ("condition".equals(codeString))
135          return new Enumeration<GraphCompartmentUse>(this, GraphCompartmentUse.CONDITION);
136        if ("requirement".equals(codeString))
137          return new Enumeration<GraphCompartmentUse>(this, GraphCompartmentUse.REQUIREMENT);
138        throw new FHIRException("Unknown GraphCompartmentUse code '"+codeString+"'");
139        }
140    public String toCode(GraphCompartmentUse code) {
141      if (code == GraphCompartmentUse.CONDITION)
142        return "condition";
143      if (code == GraphCompartmentUse.REQUIREMENT)
144        return "requirement";
145      return "?";
146      }
147    public String toSystem(GraphCompartmentUse code) {
148      return code.getSystem();
149      }
150    }
151
152    public enum CompartmentCode {
153        /**
154         * The compartment definition is for the patient compartment.
155         */
156        PATIENT, 
157        /**
158         * The compartment definition is for the encounter compartment.
159         */
160        ENCOUNTER, 
161        /**
162         * The compartment definition is for the related-person compartment.
163         */
164        RELATEDPERSON, 
165        /**
166         * The compartment definition is for the practitioner compartment.
167         */
168        PRACTITIONER, 
169        /**
170         * The compartment definition is for the device compartment.
171         */
172        DEVICE, 
173        /**
174         * added to help the parsers with the generic types
175         */
176        NULL;
177        public static CompartmentCode fromCode(String codeString) throws FHIRException {
178            if (codeString == null || "".equals(codeString))
179                return null;
180        if ("Patient".equals(codeString))
181          return PATIENT;
182        if ("Encounter".equals(codeString))
183          return ENCOUNTER;
184        if ("RelatedPerson".equals(codeString))
185          return RELATEDPERSON;
186        if ("Practitioner".equals(codeString))
187          return PRACTITIONER;
188        if ("Device".equals(codeString))
189          return DEVICE;
190        if (Configuration.isAcceptInvalidEnums())
191          return null;
192        else
193          throw new FHIRException("Unknown CompartmentCode code '"+codeString+"'");
194        }
195        public String toCode() {
196          switch (this) {
197            case PATIENT: return "Patient";
198            case ENCOUNTER: return "Encounter";
199            case RELATEDPERSON: return "RelatedPerson";
200            case PRACTITIONER: return "Practitioner";
201            case DEVICE: return "Device";
202            case NULL: return null;
203            default: return "?";
204          }
205        }
206        public String getSystem() {
207          switch (this) {
208            case PATIENT: return "http://hl7.org/fhir/compartment-type";
209            case ENCOUNTER: return "http://hl7.org/fhir/compartment-type";
210            case RELATEDPERSON: return "http://hl7.org/fhir/compartment-type";
211            case PRACTITIONER: return "http://hl7.org/fhir/compartment-type";
212            case DEVICE: return "http://hl7.org/fhir/compartment-type";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDefinition() {
218          switch (this) {
219            case PATIENT: return "The compartment definition is for the patient compartment.";
220            case ENCOUNTER: return "The compartment definition is for the encounter compartment.";
221            case RELATEDPERSON: return "The compartment definition is for the related-person compartment.";
222            case PRACTITIONER: return "The compartment definition is for the practitioner compartment.";
223            case DEVICE: return "The compartment definition is for the device compartment.";
224            case NULL: return null;
225            default: return "?";
226          }
227        }
228        public String getDisplay() {
229          switch (this) {
230            case PATIENT: return "Patient";
231            case ENCOUNTER: return "Encounter";
232            case RELATEDPERSON: return "RelatedPerson";
233            case PRACTITIONER: return "Practitioner";
234            case DEVICE: return "Device";
235            case NULL: return null;
236            default: return "?";
237          }
238        }
239    }
240
241  public static class CompartmentCodeEnumFactory implements EnumFactory<CompartmentCode> {
242    public CompartmentCode fromCode(String codeString) throws IllegalArgumentException {
243      if (codeString == null || "".equals(codeString))
244            if (codeString == null || "".equals(codeString))
245                return null;
246        if ("Patient".equals(codeString))
247          return CompartmentCode.PATIENT;
248        if ("Encounter".equals(codeString))
249          return CompartmentCode.ENCOUNTER;
250        if ("RelatedPerson".equals(codeString))
251          return CompartmentCode.RELATEDPERSON;
252        if ("Practitioner".equals(codeString))
253          return CompartmentCode.PRACTITIONER;
254        if ("Device".equals(codeString))
255          return CompartmentCode.DEVICE;
256        throw new IllegalArgumentException("Unknown CompartmentCode code '"+codeString+"'");
257        }
258        public Enumeration<CompartmentCode> fromType(Base code) throws FHIRException {
259          if (code == null)
260            return null;
261          if (code.isEmpty())
262            return new Enumeration<CompartmentCode>(this);
263          String codeString = ((PrimitiveType) code).asStringValue();
264          if (codeString == null || "".equals(codeString))
265            return null;
266        if ("Patient".equals(codeString))
267          return new Enumeration<CompartmentCode>(this, CompartmentCode.PATIENT);
268        if ("Encounter".equals(codeString))
269          return new Enumeration<CompartmentCode>(this, CompartmentCode.ENCOUNTER);
270        if ("RelatedPerson".equals(codeString))
271          return new Enumeration<CompartmentCode>(this, CompartmentCode.RELATEDPERSON);
272        if ("Practitioner".equals(codeString))
273          return new Enumeration<CompartmentCode>(this, CompartmentCode.PRACTITIONER);
274        if ("Device".equals(codeString))
275          return new Enumeration<CompartmentCode>(this, CompartmentCode.DEVICE);
276        throw new FHIRException("Unknown CompartmentCode code '"+codeString+"'");
277        }
278    public String toCode(CompartmentCode code) {
279      if (code == CompartmentCode.PATIENT)
280        return "Patient";
281      if (code == CompartmentCode.ENCOUNTER)
282        return "Encounter";
283      if (code == CompartmentCode.RELATEDPERSON)
284        return "RelatedPerson";
285      if (code == CompartmentCode.PRACTITIONER)
286        return "Practitioner";
287      if (code == CompartmentCode.DEVICE)
288        return "Device";
289      return "?";
290      }
291    public String toSystem(CompartmentCode code) {
292      return code.getSystem();
293      }
294    }
295
296    public enum GraphCompartmentRule {
297        /**
298         * The compartment must be identical (the same literal reference).
299         */
300        IDENTICAL, 
301        /**
302         * The compartment must be the same - the record must be about the same patient, but the reference may be different.
303         */
304        MATCHING, 
305        /**
306         * The compartment must be different.
307         */
308        DIFFERENT, 
309        /**
310         * The compartment rule is defined in the accompanying FHIRPath expression.
311         */
312        CUSTOM, 
313        /**
314         * added to help the parsers with the generic types
315         */
316        NULL;
317        public static GraphCompartmentRule fromCode(String codeString) throws FHIRException {
318            if (codeString == null || "".equals(codeString))
319                return null;
320        if ("identical".equals(codeString))
321          return IDENTICAL;
322        if ("matching".equals(codeString))
323          return MATCHING;
324        if ("different".equals(codeString))
325          return DIFFERENT;
326        if ("custom".equals(codeString))
327          return CUSTOM;
328        if (Configuration.isAcceptInvalidEnums())
329          return null;
330        else
331          throw new FHIRException("Unknown GraphCompartmentRule code '"+codeString+"'");
332        }
333        public String toCode() {
334          switch (this) {
335            case IDENTICAL: return "identical";
336            case MATCHING: return "matching";
337            case DIFFERENT: return "different";
338            case CUSTOM: return "custom";
339            case NULL: return null;
340            default: return "?";
341          }
342        }
343        public String getSystem() {
344          switch (this) {
345            case IDENTICAL: return "http://hl7.org/fhir/graph-compartment-rule";
346            case MATCHING: return "http://hl7.org/fhir/graph-compartment-rule";
347            case DIFFERENT: return "http://hl7.org/fhir/graph-compartment-rule";
348            case CUSTOM: return "http://hl7.org/fhir/graph-compartment-rule";
349            case NULL: return null;
350            default: return "?";
351          }
352        }
353        public String getDefinition() {
354          switch (this) {
355            case IDENTICAL: return "The compartment must be identical (the same literal reference).";
356            case MATCHING: return "The compartment must be the same - the record must be about the same patient, but the reference may be different.";
357            case DIFFERENT: return "The compartment must be different.";
358            case CUSTOM: return "The compartment rule is defined in the accompanying FHIRPath expression.";
359            case NULL: return null;
360            default: return "?";
361          }
362        }
363        public String getDisplay() {
364          switch (this) {
365            case IDENTICAL: return "Identical";
366            case MATCHING: return "Matching";
367            case DIFFERENT: return "Different";
368            case CUSTOM: return "Custom";
369            case NULL: return null;
370            default: return "?";
371          }
372        }
373    }
374
375  public static class GraphCompartmentRuleEnumFactory implements EnumFactory<GraphCompartmentRule> {
376    public GraphCompartmentRule fromCode(String codeString) throws IllegalArgumentException {
377      if (codeString == null || "".equals(codeString))
378            if (codeString == null || "".equals(codeString))
379                return null;
380        if ("identical".equals(codeString))
381          return GraphCompartmentRule.IDENTICAL;
382        if ("matching".equals(codeString))
383          return GraphCompartmentRule.MATCHING;
384        if ("different".equals(codeString))
385          return GraphCompartmentRule.DIFFERENT;
386        if ("custom".equals(codeString))
387          return GraphCompartmentRule.CUSTOM;
388        throw new IllegalArgumentException("Unknown GraphCompartmentRule code '"+codeString+"'");
389        }
390        public Enumeration<GraphCompartmentRule> fromType(Base code) throws FHIRException {
391          if (code == null)
392            return null;
393          if (code.isEmpty())
394            return new Enumeration<GraphCompartmentRule>(this);
395          String codeString = ((PrimitiveType) code).asStringValue();
396          if (codeString == null || "".equals(codeString))
397            return null;
398        if ("identical".equals(codeString))
399          return new Enumeration<GraphCompartmentRule>(this, GraphCompartmentRule.IDENTICAL);
400        if ("matching".equals(codeString))
401          return new Enumeration<GraphCompartmentRule>(this, GraphCompartmentRule.MATCHING);
402        if ("different".equals(codeString))
403          return new Enumeration<GraphCompartmentRule>(this, GraphCompartmentRule.DIFFERENT);
404        if ("custom".equals(codeString))
405          return new Enumeration<GraphCompartmentRule>(this, GraphCompartmentRule.CUSTOM);
406        throw new FHIRException("Unknown GraphCompartmentRule code '"+codeString+"'");
407        }
408    public String toCode(GraphCompartmentRule code) {
409      if (code == GraphCompartmentRule.IDENTICAL)
410        return "identical";
411      if (code == GraphCompartmentRule.MATCHING)
412        return "matching";
413      if (code == GraphCompartmentRule.DIFFERENT)
414        return "different";
415      if (code == GraphCompartmentRule.CUSTOM)
416        return "custom";
417      return "?";
418      }
419    public String toSystem(GraphCompartmentRule code) {
420      return code.getSystem();
421      }
422    }
423
424    @Block()
425    public static class GraphDefinitionLinkComponent extends BackboneElement implements IBaseBackboneElement {
426        /**
427         * A FHIR expression that identifies one of FHIR References to other resources.
428         */
429        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
430        @Description(shortDefinition="Path in the resource that contains the link", formalDefinition="A FHIR expression that identifies one of FHIR References to other resources." )
431        protected StringType path;
432
433        /**
434         * Which slice (if profiled).
435         */
436        @Child(name = "sliceName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
437        @Description(shortDefinition="Which slice (if profiled)", formalDefinition="Which slice (if profiled)." )
438        protected StringType sliceName;
439
440        /**
441         * Minimum occurrences for this link.
442         */
443        @Child(name = "min", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
444        @Description(shortDefinition="Minimum occurrences for this link", formalDefinition="Minimum occurrences for this link." )
445        protected IntegerType min;
446
447        /**
448         * Maximum occurrences for this link.
449         */
450        @Child(name = "max", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
451        @Description(shortDefinition="Maximum occurrences for this link", formalDefinition="Maximum occurrences for this link." )
452        protected StringType max;
453
454        /**
455         * Information about why this link is of interest in this graph definition.
456         */
457        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
458        @Description(shortDefinition="Why this link is specified", formalDefinition="Information about why this link is of interest in this graph definition." )
459        protected StringType description;
460
461        /**
462         * Potential target for the link.
463         */
464        @Child(name = "target", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
465        @Description(shortDefinition="Potential target for the link", formalDefinition="Potential target for the link." )
466        protected List<GraphDefinitionLinkTargetComponent> target;
467
468        private static final long serialVersionUID = -593733346L;
469
470    /**
471     * Constructor
472     */
473      public GraphDefinitionLinkComponent() {
474        super();
475      }
476
477        /**
478         * @return {@link #path} (A FHIR expression that identifies one of FHIR References to other resources.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
479         */
480        public StringType getPathElement() { 
481          if (this.path == null)
482            if (Configuration.errorOnAutoCreate())
483              throw new Error("Attempt to auto-create GraphDefinitionLinkComponent.path");
484            else if (Configuration.doAutoCreate())
485              this.path = new StringType(); // bb
486          return this.path;
487        }
488
489        public boolean hasPathElement() { 
490          return this.path != null && !this.path.isEmpty();
491        }
492
493        public boolean hasPath() { 
494          return this.path != null && !this.path.isEmpty();
495        }
496
497        /**
498         * @param value {@link #path} (A FHIR expression that identifies one of FHIR References to other resources.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
499         */
500        public GraphDefinitionLinkComponent setPathElement(StringType value) { 
501          this.path = value;
502          return this;
503        }
504
505        /**
506         * @return A FHIR expression that identifies one of FHIR References to other resources.
507         */
508        public String getPath() { 
509          return this.path == null ? null : this.path.getValue();
510        }
511
512        /**
513         * @param value A FHIR expression that identifies one of FHIR References to other resources.
514         */
515        public GraphDefinitionLinkComponent setPath(String value) { 
516          if (Utilities.noString(value))
517            this.path = null;
518          else {
519            if (this.path == null)
520              this.path = new StringType();
521            this.path.setValue(value);
522          }
523          return this;
524        }
525
526        /**
527         * @return {@link #sliceName} (Which slice (if profiled).). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
528         */
529        public StringType getSliceNameElement() { 
530          if (this.sliceName == null)
531            if (Configuration.errorOnAutoCreate())
532              throw new Error("Attempt to auto-create GraphDefinitionLinkComponent.sliceName");
533            else if (Configuration.doAutoCreate())
534              this.sliceName = new StringType(); // bb
535          return this.sliceName;
536        }
537
538        public boolean hasSliceNameElement() { 
539          return this.sliceName != null && !this.sliceName.isEmpty();
540        }
541
542        public boolean hasSliceName() { 
543          return this.sliceName != null && !this.sliceName.isEmpty();
544        }
545
546        /**
547         * @param value {@link #sliceName} (Which slice (if profiled).). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
548         */
549        public GraphDefinitionLinkComponent setSliceNameElement(StringType value) { 
550          this.sliceName = value;
551          return this;
552        }
553
554        /**
555         * @return Which slice (if profiled).
556         */
557        public String getSliceName() { 
558          return this.sliceName == null ? null : this.sliceName.getValue();
559        }
560
561        /**
562         * @param value Which slice (if profiled).
563         */
564        public GraphDefinitionLinkComponent setSliceName(String value) { 
565          if (Utilities.noString(value))
566            this.sliceName = null;
567          else {
568            if (this.sliceName == null)
569              this.sliceName = new StringType();
570            this.sliceName.setValue(value);
571          }
572          return this;
573        }
574
575        /**
576         * @return {@link #min} (Minimum occurrences for this link.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
577         */
578        public IntegerType getMinElement() { 
579          if (this.min == null)
580            if (Configuration.errorOnAutoCreate())
581              throw new Error("Attempt to auto-create GraphDefinitionLinkComponent.min");
582            else if (Configuration.doAutoCreate())
583              this.min = new IntegerType(); // bb
584          return this.min;
585        }
586
587        public boolean hasMinElement() { 
588          return this.min != null && !this.min.isEmpty();
589        }
590
591        public boolean hasMin() { 
592          return this.min != null && !this.min.isEmpty();
593        }
594
595        /**
596         * @param value {@link #min} (Minimum occurrences for this link.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
597         */
598        public GraphDefinitionLinkComponent setMinElement(IntegerType value) { 
599          this.min = value;
600          return this;
601        }
602
603        /**
604         * @return Minimum occurrences for this link.
605         */
606        public int getMin() { 
607          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
608        }
609
610        /**
611         * @param value Minimum occurrences for this link.
612         */
613        public GraphDefinitionLinkComponent setMin(int value) { 
614            if (this.min == null)
615              this.min = new IntegerType();
616            this.min.setValue(value);
617          return this;
618        }
619
620        /**
621         * @return {@link #max} (Maximum occurrences for this link.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
622         */
623        public StringType getMaxElement() { 
624          if (this.max == null)
625            if (Configuration.errorOnAutoCreate())
626              throw new Error("Attempt to auto-create GraphDefinitionLinkComponent.max");
627            else if (Configuration.doAutoCreate())
628              this.max = new StringType(); // bb
629          return this.max;
630        }
631
632        public boolean hasMaxElement() { 
633          return this.max != null && !this.max.isEmpty();
634        }
635
636        public boolean hasMax() { 
637          return this.max != null && !this.max.isEmpty();
638        }
639
640        /**
641         * @param value {@link #max} (Maximum occurrences for this link.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
642         */
643        public GraphDefinitionLinkComponent setMaxElement(StringType value) { 
644          this.max = value;
645          return this;
646        }
647
648        /**
649         * @return Maximum occurrences for this link.
650         */
651        public String getMax() { 
652          return this.max == null ? null : this.max.getValue();
653        }
654
655        /**
656         * @param value Maximum occurrences for this link.
657         */
658        public GraphDefinitionLinkComponent setMax(String value) { 
659          if (Utilities.noString(value))
660            this.max = null;
661          else {
662            if (this.max == null)
663              this.max = new StringType();
664            this.max.setValue(value);
665          }
666          return this;
667        }
668
669        /**
670         * @return {@link #description} (Information about why this link is of interest in this graph definition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
671         */
672        public StringType getDescriptionElement() { 
673          if (this.description == null)
674            if (Configuration.errorOnAutoCreate())
675              throw new Error("Attempt to auto-create GraphDefinitionLinkComponent.description");
676            else if (Configuration.doAutoCreate())
677              this.description = new StringType(); // bb
678          return this.description;
679        }
680
681        public boolean hasDescriptionElement() { 
682          return this.description != null && !this.description.isEmpty();
683        }
684
685        public boolean hasDescription() { 
686          return this.description != null && !this.description.isEmpty();
687        }
688
689        /**
690         * @param value {@link #description} (Information about why this link is of interest in this graph definition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
691         */
692        public GraphDefinitionLinkComponent setDescriptionElement(StringType value) { 
693          this.description = value;
694          return this;
695        }
696
697        /**
698         * @return Information about why this link is of interest in this graph definition.
699         */
700        public String getDescription() { 
701          return this.description == null ? null : this.description.getValue();
702        }
703
704        /**
705         * @param value Information about why this link is of interest in this graph definition.
706         */
707        public GraphDefinitionLinkComponent setDescription(String value) { 
708          if (Utilities.noString(value))
709            this.description = null;
710          else {
711            if (this.description == null)
712              this.description = new StringType();
713            this.description.setValue(value);
714          }
715          return this;
716        }
717
718        /**
719         * @return {@link #target} (Potential target for the link.)
720         */
721        public List<GraphDefinitionLinkTargetComponent> getTarget() { 
722          if (this.target == null)
723            this.target = new ArrayList<GraphDefinitionLinkTargetComponent>();
724          return this.target;
725        }
726
727        /**
728         * @return Returns a reference to <code>this</code> for easy method chaining
729         */
730        public GraphDefinitionLinkComponent setTarget(List<GraphDefinitionLinkTargetComponent> theTarget) { 
731          this.target = theTarget;
732          return this;
733        }
734
735        public boolean hasTarget() { 
736          if (this.target == null)
737            return false;
738          for (GraphDefinitionLinkTargetComponent item : this.target)
739            if (!item.isEmpty())
740              return true;
741          return false;
742        }
743
744        public GraphDefinitionLinkTargetComponent addTarget() { //3
745          GraphDefinitionLinkTargetComponent t = new GraphDefinitionLinkTargetComponent();
746          if (this.target == null)
747            this.target = new ArrayList<GraphDefinitionLinkTargetComponent>();
748          this.target.add(t);
749          return t;
750        }
751
752        public GraphDefinitionLinkComponent addTarget(GraphDefinitionLinkTargetComponent t) { //3
753          if (t == null)
754            return this;
755          if (this.target == null)
756            this.target = new ArrayList<GraphDefinitionLinkTargetComponent>();
757          this.target.add(t);
758          return this;
759        }
760
761        /**
762         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
763         */
764        public GraphDefinitionLinkTargetComponent getTargetFirstRep() { 
765          if (getTarget().isEmpty()) {
766            addTarget();
767          }
768          return getTarget().get(0);
769        }
770
771        protected void listChildren(List<Property> children) {
772          super.listChildren(children);
773          children.add(new Property("path", "string", "A FHIR expression that identifies one of FHIR References to other resources.", 0, 1, path));
774          children.add(new Property("sliceName", "string", "Which slice (if profiled).", 0, 1, sliceName));
775          children.add(new Property("min", "integer", "Minimum occurrences for this link.", 0, 1, min));
776          children.add(new Property("max", "string", "Maximum occurrences for this link.", 0, 1, max));
777          children.add(new Property("description", "string", "Information about why this link is of interest in this graph definition.", 0, 1, description));
778          children.add(new Property("target", "", "Potential target for the link.", 0, java.lang.Integer.MAX_VALUE, target));
779        }
780
781        @Override
782        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
783          switch (_hash) {
784          case 3433509: /*path*/  return new Property("path", "string", "A FHIR expression that identifies one of FHIR References to other resources.", 0, 1, path);
785          case -825289923: /*sliceName*/  return new Property("sliceName", "string", "Which slice (if profiled).", 0, 1, sliceName);
786          case 108114: /*min*/  return new Property("min", "integer", "Minimum occurrences for this link.", 0, 1, min);
787          case 107876: /*max*/  return new Property("max", "string", "Maximum occurrences for this link.", 0, 1, max);
788          case -1724546052: /*description*/  return new Property("description", "string", "Information about why this link is of interest in this graph definition.", 0, 1, description);
789          case -880905839: /*target*/  return new Property("target", "", "Potential target for the link.", 0, java.lang.Integer.MAX_VALUE, target);
790          default: return super.getNamedProperty(_hash, _name, _checkValid);
791          }
792
793        }
794
795      @Override
796      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
797        switch (hash) {
798        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
799        case -825289923: /*sliceName*/ return this.sliceName == null ? new Base[0] : new Base[] {this.sliceName}; // StringType
800        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
801        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
802        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
803        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // GraphDefinitionLinkTargetComponent
804        default: return super.getProperty(hash, name, checkValid);
805        }
806
807      }
808
809      @Override
810      public Base setProperty(int hash, String name, Base value) throws FHIRException {
811        switch (hash) {
812        case 3433509: // path
813          this.path = castToString(value); // StringType
814          return value;
815        case -825289923: // sliceName
816          this.sliceName = castToString(value); // StringType
817          return value;
818        case 108114: // min
819          this.min = castToInteger(value); // IntegerType
820          return value;
821        case 107876: // max
822          this.max = castToString(value); // StringType
823          return value;
824        case -1724546052: // description
825          this.description = castToString(value); // StringType
826          return value;
827        case -880905839: // target
828          this.getTarget().add((GraphDefinitionLinkTargetComponent) value); // GraphDefinitionLinkTargetComponent
829          return value;
830        default: return super.setProperty(hash, name, value);
831        }
832
833      }
834
835      @Override
836      public Base setProperty(String name, Base value) throws FHIRException {
837        if (name.equals("path")) {
838          this.path = castToString(value); // StringType
839        } else if (name.equals("sliceName")) {
840          this.sliceName = castToString(value); // StringType
841        } else if (name.equals("min")) {
842          this.min = castToInteger(value); // IntegerType
843        } else if (name.equals("max")) {
844          this.max = castToString(value); // StringType
845        } else if (name.equals("description")) {
846          this.description = castToString(value); // StringType
847        } else if (name.equals("target")) {
848          this.getTarget().add((GraphDefinitionLinkTargetComponent) value);
849        } else
850          return super.setProperty(name, value);
851        return value;
852      }
853
854      @Override
855      public Base makeProperty(int hash, String name) throws FHIRException {
856        switch (hash) {
857        case 3433509:  return getPathElement();
858        case -825289923:  return getSliceNameElement();
859        case 108114:  return getMinElement();
860        case 107876:  return getMaxElement();
861        case -1724546052:  return getDescriptionElement();
862        case -880905839:  return addTarget(); 
863        default: return super.makeProperty(hash, name);
864        }
865
866      }
867
868      @Override
869      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
870        switch (hash) {
871        case 3433509: /*path*/ return new String[] {"string"};
872        case -825289923: /*sliceName*/ return new String[] {"string"};
873        case 108114: /*min*/ return new String[] {"integer"};
874        case 107876: /*max*/ return new String[] {"string"};
875        case -1724546052: /*description*/ return new String[] {"string"};
876        case -880905839: /*target*/ return new String[] {};
877        default: return super.getTypesForProperty(hash, name);
878        }
879
880      }
881
882      @Override
883      public Base addChild(String name) throws FHIRException {
884        if (name.equals("path")) {
885          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.path");
886        }
887        else if (name.equals("sliceName")) {
888          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.sliceName");
889        }
890        else if (name.equals("min")) {
891          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.min");
892        }
893        else if (name.equals("max")) {
894          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.max");
895        }
896        else if (name.equals("description")) {
897          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.description");
898        }
899        else if (name.equals("target")) {
900          return addTarget();
901        }
902        else
903          return super.addChild(name);
904      }
905
906      public GraphDefinitionLinkComponent copy() {
907        GraphDefinitionLinkComponent dst = new GraphDefinitionLinkComponent();
908        copyValues(dst);
909        return dst;
910      }
911
912      public void copyValues(GraphDefinitionLinkComponent dst) {
913        super.copyValues(dst);
914        dst.path = path == null ? null : path.copy();
915        dst.sliceName = sliceName == null ? null : sliceName.copy();
916        dst.min = min == null ? null : min.copy();
917        dst.max = max == null ? null : max.copy();
918        dst.description = description == null ? null : description.copy();
919        if (target != null) {
920          dst.target = new ArrayList<GraphDefinitionLinkTargetComponent>();
921          for (GraphDefinitionLinkTargetComponent i : target)
922            dst.target.add(i.copy());
923        };
924      }
925
926      @Override
927      public boolean equalsDeep(Base other_) {
928        if (!super.equalsDeep(other_))
929          return false;
930        if (!(other_ instanceof GraphDefinitionLinkComponent))
931          return false;
932        GraphDefinitionLinkComponent o = (GraphDefinitionLinkComponent) other_;
933        return compareDeep(path, o.path, true) && compareDeep(sliceName, o.sliceName, true) && compareDeep(min, o.min, true)
934           && compareDeep(max, o.max, true) && compareDeep(description, o.description, true) && compareDeep(target, o.target, true)
935          ;
936      }
937
938      @Override
939      public boolean equalsShallow(Base other_) {
940        if (!super.equalsShallow(other_))
941          return false;
942        if (!(other_ instanceof GraphDefinitionLinkComponent))
943          return false;
944        GraphDefinitionLinkComponent o = (GraphDefinitionLinkComponent) other_;
945        return compareValues(path, o.path, true) && compareValues(sliceName, o.sliceName, true) && compareValues(min, o.min, true)
946           && compareValues(max, o.max, true) && compareValues(description, o.description, true);
947      }
948
949      public boolean isEmpty() {
950        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, sliceName, min, max
951          , description, target);
952      }
953
954  public String fhirType() {
955    return "GraphDefinition.link";
956
957  }
958
959  }
960
961    @Block()
962    public static class GraphDefinitionLinkTargetComponent extends BackboneElement implements IBaseBackboneElement {
963        /**
964         * Type of resource this link refers to.
965         */
966        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
967        @Description(shortDefinition="Type of resource this link refers to", formalDefinition="Type of resource this link refers to." )
968        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
969        protected CodeType type;
970
971        /**
972         * A set of parameters to look up.
973         */
974        @Child(name = "params", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
975        @Description(shortDefinition="Criteria for reverse lookup", formalDefinition="A set of parameters to look up." )
976        protected StringType params;
977
978        /**
979         * Profile for the target resource.
980         */
981        @Child(name = "profile", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
982        @Description(shortDefinition="Profile for the target resource", formalDefinition="Profile for the target resource." )
983        protected CanonicalType profile;
984
985        /**
986         * Compartment Consistency Rules.
987         */
988        @Child(name = "compartment", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
989        @Description(shortDefinition="Compartment Consistency Rules", formalDefinition="Compartment Consistency Rules." )
990        protected List<GraphDefinitionLinkTargetCompartmentComponent> compartment;
991
992        /**
993         * Additional links from target resource.
994         */
995        @Child(name = "link", type = {GraphDefinitionLinkComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
996        @Description(shortDefinition="Additional links from target resource", formalDefinition="Additional links from target resource." )
997        protected List<GraphDefinitionLinkComponent> link;
998
999        private static final long serialVersionUID = -35248998L;
1000
1001    /**
1002     * Constructor
1003     */
1004      public GraphDefinitionLinkTargetComponent() {
1005        super();
1006      }
1007
1008    /**
1009     * Constructor
1010     */
1011      public GraphDefinitionLinkTargetComponent(CodeType type) {
1012        super();
1013        this.type = type;
1014      }
1015
1016        /**
1017         * @return {@link #type} (Type of resource this link refers to.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1018         */
1019        public CodeType getTypeElement() { 
1020          if (this.type == null)
1021            if (Configuration.errorOnAutoCreate())
1022              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.type");
1023            else if (Configuration.doAutoCreate())
1024              this.type = new CodeType(); // bb
1025          return this.type;
1026        }
1027
1028        public boolean hasTypeElement() { 
1029          return this.type != null && !this.type.isEmpty();
1030        }
1031
1032        public boolean hasType() { 
1033          return this.type != null && !this.type.isEmpty();
1034        }
1035
1036        /**
1037         * @param value {@link #type} (Type of resource this link refers to.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1038         */
1039        public GraphDefinitionLinkTargetComponent setTypeElement(CodeType value) { 
1040          this.type = value;
1041          return this;
1042        }
1043
1044        /**
1045         * @return Type of resource this link refers to.
1046         */
1047        public String getType() { 
1048          return this.type == null ? null : this.type.getValue();
1049        }
1050
1051        /**
1052         * @param value Type of resource this link refers to.
1053         */
1054        public GraphDefinitionLinkTargetComponent setType(String value) { 
1055            if (this.type == null)
1056              this.type = new CodeType();
1057            this.type.setValue(value);
1058          return this;
1059        }
1060
1061        /**
1062         * @return {@link #params} (A set of parameters to look up.). This is the underlying object with id, value and extensions. The accessor "getParams" gives direct access to the value
1063         */
1064        public StringType getParamsElement() { 
1065          if (this.params == null)
1066            if (Configuration.errorOnAutoCreate())
1067              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.params");
1068            else if (Configuration.doAutoCreate())
1069              this.params = new StringType(); // bb
1070          return this.params;
1071        }
1072
1073        public boolean hasParamsElement() { 
1074          return this.params != null && !this.params.isEmpty();
1075        }
1076
1077        public boolean hasParams() { 
1078          return this.params != null && !this.params.isEmpty();
1079        }
1080
1081        /**
1082         * @param value {@link #params} (A set of parameters to look up.). This is the underlying object with id, value and extensions. The accessor "getParams" gives direct access to the value
1083         */
1084        public GraphDefinitionLinkTargetComponent setParamsElement(StringType value) { 
1085          this.params = value;
1086          return this;
1087        }
1088
1089        /**
1090         * @return A set of parameters to look up.
1091         */
1092        public String getParams() { 
1093          return this.params == null ? null : this.params.getValue();
1094        }
1095
1096        /**
1097         * @param value A set of parameters to look up.
1098         */
1099        public GraphDefinitionLinkTargetComponent setParams(String value) { 
1100          if (Utilities.noString(value))
1101            this.params = null;
1102          else {
1103            if (this.params == null)
1104              this.params = new StringType();
1105            this.params.setValue(value);
1106          }
1107          return this;
1108        }
1109
1110        /**
1111         * @return {@link #profile} (Profile for the target resource.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
1112         */
1113        public CanonicalType getProfileElement() { 
1114          if (this.profile == null)
1115            if (Configuration.errorOnAutoCreate())
1116              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.profile");
1117            else if (Configuration.doAutoCreate())
1118              this.profile = new CanonicalType(); // bb
1119          return this.profile;
1120        }
1121
1122        public boolean hasProfileElement() { 
1123          return this.profile != null && !this.profile.isEmpty();
1124        }
1125
1126        public boolean hasProfile() { 
1127          return this.profile != null && !this.profile.isEmpty();
1128        }
1129
1130        /**
1131         * @param value {@link #profile} (Profile for the target resource.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
1132         */
1133        public GraphDefinitionLinkTargetComponent setProfileElement(CanonicalType value) { 
1134          this.profile = value;
1135          return this;
1136        }
1137
1138        /**
1139         * @return Profile for the target resource.
1140         */
1141        public String getProfile() { 
1142          return this.profile == null ? null : this.profile.getValue();
1143        }
1144
1145        /**
1146         * @param value Profile for the target resource.
1147         */
1148        public GraphDefinitionLinkTargetComponent setProfile(String value) { 
1149          if (Utilities.noString(value))
1150            this.profile = null;
1151          else {
1152            if (this.profile == null)
1153              this.profile = new CanonicalType();
1154            this.profile.setValue(value);
1155          }
1156          return this;
1157        }
1158
1159        /**
1160         * @return {@link #compartment} (Compartment Consistency Rules.)
1161         */
1162        public List<GraphDefinitionLinkTargetCompartmentComponent> getCompartment() { 
1163          if (this.compartment == null)
1164            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1165          return this.compartment;
1166        }
1167
1168        /**
1169         * @return Returns a reference to <code>this</code> for easy method chaining
1170         */
1171        public GraphDefinitionLinkTargetComponent setCompartment(List<GraphDefinitionLinkTargetCompartmentComponent> theCompartment) { 
1172          this.compartment = theCompartment;
1173          return this;
1174        }
1175
1176        public boolean hasCompartment() { 
1177          if (this.compartment == null)
1178            return false;
1179          for (GraphDefinitionLinkTargetCompartmentComponent item : this.compartment)
1180            if (!item.isEmpty())
1181              return true;
1182          return false;
1183        }
1184
1185        public GraphDefinitionLinkTargetCompartmentComponent addCompartment() { //3
1186          GraphDefinitionLinkTargetCompartmentComponent t = new GraphDefinitionLinkTargetCompartmentComponent();
1187          if (this.compartment == null)
1188            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1189          this.compartment.add(t);
1190          return t;
1191        }
1192
1193        public GraphDefinitionLinkTargetComponent addCompartment(GraphDefinitionLinkTargetCompartmentComponent t) { //3
1194          if (t == null)
1195            return this;
1196          if (this.compartment == null)
1197            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1198          this.compartment.add(t);
1199          return this;
1200        }
1201
1202        /**
1203         * @return The first repetition of repeating field {@link #compartment}, creating it if it does not already exist
1204         */
1205        public GraphDefinitionLinkTargetCompartmentComponent getCompartmentFirstRep() { 
1206          if (getCompartment().isEmpty()) {
1207            addCompartment();
1208          }
1209          return getCompartment().get(0);
1210        }
1211
1212        /**
1213         * @return {@link #link} (Additional links from target resource.)
1214         */
1215        public List<GraphDefinitionLinkComponent> getLink() { 
1216          if (this.link == null)
1217            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1218          return this.link;
1219        }
1220
1221        /**
1222         * @return Returns a reference to <code>this</code> for easy method chaining
1223         */
1224        public GraphDefinitionLinkTargetComponent setLink(List<GraphDefinitionLinkComponent> theLink) { 
1225          this.link = theLink;
1226          return this;
1227        }
1228
1229        public boolean hasLink() { 
1230          if (this.link == null)
1231            return false;
1232          for (GraphDefinitionLinkComponent item : this.link)
1233            if (!item.isEmpty())
1234              return true;
1235          return false;
1236        }
1237
1238        public GraphDefinitionLinkComponent addLink() { //3
1239          GraphDefinitionLinkComponent t = new GraphDefinitionLinkComponent();
1240          if (this.link == null)
1241            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1242          this.link.add(t);
1243          return t;
1244        }
1245
1246        public GraphDefinitionLinkTargetComponent addLink(GraphDefinitionLinkComponent t) { //3
1247          if (t == null)
1248            return this;
1249          if (this.link == null)
1250            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1251          this.link.add(t);
1252          return this;
1253        }
1254
1255        /**
1256         * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist
1257         */
1258        public GraphDefinitionLinkComponent getLinkFirstRep() { 
1259          if (getLink().isEmpty()) {
1260            addLink();
1261          }
1262          return getLink().get(0);
1263        }
1264
1265        protected void listChildren(List<Property> children) {
1266          super.listChildren(children);
1267          children.add(new Property("type", "code", "Type of resource this link refers to.", 0, 1, type));
1268          children.add(new Property("params", "string", "A set of parameters to look up.", 0, 1, params));
1269          children.add(new Property("profile", "canonical(StructureDefinition)", "Profile for the target resource.", 0, 1, profile));
1270          children.add(new Property("compartment", "", "Compartment Consistency Rules.", 0, java.lang.Integer.MAX_VALUE, compartment));
1271          children.add(new Property("link", "@GraphDefinition.link", "Additional links from target resource.", 0, java.lang.Integer.MAX_VALUE, link));
1272        }
1273
1274        @Override
1275        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1276          switch (_hash) {
1277          case 3575610: /*type*/  return new Property("type", "code", "Type of resource this link refers to.", 0, 1, type);
1278          case -995427962: /*params*/  return new Property("params", "string", "A set of parameters to look up.", 0, 1, params);
1279          case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "Profile for the target resource.", 0, 1, profile);
1280          case -397756334: /*compartment*/  return new Property("compartment", "", "Compartment Consistency Rules.", 0, java.lang.Integer.MAX_VALUE, compartment);
1281          case 3321850: /*link*/  return new Property("link", "@GraphDefinition.link", "Additional links from target resource.", 0, java.lang.Integer.MAX_VALUE, link);
1282          default: return super.getNamedProperty(_hash, _name, _checkValid);
1283          }
1284
1285        }
1286
1287      @Override
1288      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1289        switch (hash) {
1290        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1291        case -995427962: /*params*/ return this.params == null ? new Base[0] : new Base[] {this.params}; // StringType
1292        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType
1293        case -397756334: /*compartment*/ return this.compartment == null ? new Base[0] : this.compartment.toArray(new Base[this.compartment.size()]); // GraphDefinitionLinkTargetCompartmentComponent
1294        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // GraphDefinitionLinkComponent
1295        default: return super.getProperty(hash, name, checkValid);
1296        }
1297
1298      }
1299
1300      @Override
1301      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1302        switch (hash) {
1303        case 3575610: // type
1304          this.type = castToCode(value); // CodeType
1305          return value;
1306        case -995427962: // params
1307          this.params = castToString(value); // StringType
1308          return value;
1309        case -309425751: // profile
1310          this.profile = castToCanonical(value); // CanonicalType
1311          return value;
1312        case -397756334: // compartment
1313          this.getCompartment().add((GraphDefinitionLinkTargetCompartmentComponent) value); // GraphDefinitionLinkTargetCompartmentComponent
1314          return value;
1315        case 3321850: // link
1316          this.getLink().add((GraphDefinitionLinkComponent) value); // GraphDefinitionLinkComponent
1317          return value;
1318        default: return super.setProperty(hash, name, value);
1319        }
1320
1321      }
1322
1323      @Override
1324      public Base setProperty(String name, Base value) throws FHIRException {
1325        if (name.equals("type")) {
1326          this.type = castToCode(value); // CodeType
1327        } else if (name.equals("params")) {
1328          this.params = castToString(value); // StringType
1329        } else if (name.equals("profile")) {
1330          this.profile = castToCanonical(value); // CanonicalType
1331        } else if (name.equals("compartment")) {
1332          this.getCompartment().add((GraphDefinitionLinkTargetCompartmentComponent) value);
1333        } else if (name.equals("link")) {
1334          this.getLink().add((GraphDefinitionLinkComponent) value);
1335        } else
1336          return super.setProperty(name, value);
1337        return value;
1338      }
1339
1340      @Override
1341      public Base makeProperty(int hash, String name) throws FHIRException {
1342        switch (hash) {
1343        case 3575610:  return getTypeElement();
1344        case -995427962:  return getParamsElement();
1345        case -309425751:  return getProfileElement();
1346        case -397756334:  return addCompartment(); 
1347        case 3321850:  return addLink(); 
1348        default: return super.makeProperty(hash, name);
1349        }
1350
1351      }
1352
1353      @Override
1354      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1355        switch (hash) {
1356        case 3575610: /*type*/ return new String[] {"code"};
1357        case -995427962: /*params*/ return new String[] {"string"};
1358        case -309425751: /*profile*/ return new String[] {"canonical"};
1359        case -397756334: /*compartment*/ return new String[] {};
1360        case 3321850: /*link*/ return new String[] {"@GraphDefinition.link"};
1361        default: return super.getTypesForProperty(hash, name);
1362        }
1363
1364      }
1365
1366      @Override
1367      public Base addChild(String name) throws FHIRException {
1368        if (name.equals("type")) {
1369          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.type");
1370        }
1371        else if (name.equals("params")) {
1372          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.params");
1373        }
1374        else if (name.equals("profile")) {
1375          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.profile");
1376        }
1377        else if (name.equals("compartment")) {
1378          return addCompartment();
1379        }
1380        else if (name.equals("link")) {
1381          return addLink();
1382        }
1383        else
1384          return super.addChild(name);
1385      }
1386
1387      public GraphDefinitionLinkTargetComponent copy() {
1388        GraphDefinitionLinkTargetComponent dst = new GraphDefinitionLinkTargetComponent();
1389        copyValues(dst);
1390        return dst;
1391      }
1392
1393      public void copyValues(GraphDefinitionLinkTargetComponent dst) {
1394        super.copyValues(dst);
1395        dst.type = type == null ? null : type.copy();
1396        dst.params = params == null ? null : params.copy();
1397        dst.profile = profile == null ? null : profile.copy();
1398        if (compartment != null) {
1399          dst.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1400          for (GraphDefinitionLinkTargetCompartmentComponent i : compartment)
1401            dst.compartment.add(i.copy());
1402        };
1403        if (link != null) {
1404          dst.link = new ArrayList<GraphDefinitionLinkComponent>();
1405          for (GraphDefinitionLinkComponent i : link)
1406            dst.link.add(i.copy());
1407        };
1408      }
1409
1410      @Override
1411      public boolean equalsDeep(Base other_) {
1412        if (!super.equalsDeep(other_))
1413          return false;
1414        if (!(other_ instanceof GraphDefinitionLinkTargetComponent))
1415          return false;
1416        GraphDefinitionLinkTargetComponent o = (GraphDefinitionLinkTargetComponent) other_;
1417        return compareDeep(type, o.type, true) && compareDeep(params, o.params, true) && compareDeep(profile, o.profile, true)
1418           && compareDeep(compartment, o.compartment, true) && compareDeep(link, o.link, true);
1419      }
1420
1421      @Override
1422      public boolean equalsShallow(Base other_) {
1423        if (!super.equalsShallow(other_))
1424          return false;
1425        if (!(other_ instanceof GraphDefinitionLinkTargetComponent))
1426          return false;
1427        GraphDefinitionLinkTargetComponent o = (GraphDefinitionLinkTargetComponent) other_;
1428        return compareValues(type, o.type, true) && compareValues(params, o.params, true);
1429      }
1430
1431      public boolean isEmpty() {
1432        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, params, profile, compartment
1433          , link);
1434      }
1435
1436  public String fhirType() {
1437    return "GraphDefinition.link.target";
1438
1439  }
1440
1441  }
1442
1443    @Block()
1444    public static class GraphDefinitionLinkTargetCompartmentComponent extends BackboneElement implements IBaseBackboneElement {
1445        /**
1446         * Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.
1447         */
1448        @Child(name = "use", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1449        @Description(shortDefinition="condition | requirement", formalDefinition="Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed." )
1450        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/graph-compartment-use")
1451        protected Enumeration<GraphCompartmentUse> use;
1452
1453        /**
1454         * Identifies the compartment.
1455         */
1456        @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1457        @Description(shortDefinition="Patient | Encounter | RelatedPerson | Practitioner | Device", formalDefinition="Identifies the compartment." )
1458        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/compartment-type")
1459        protected Enumeration<CompartmentCode> code;
1460
1461        /**
1462         * identical | matching | different | no-rule | custom.
1463         */
1464        @Child(name = "rule", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1465        @Description(shortDefinition="identical | matching | different | custom", formalDefinition="identical | matching | different | no-rule | custom." )
1466        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/graph-compartment-rule")
1467        protected Enumeration<GraphCompartmentRule> rule;
1468
1469        /**
1470         * Custom rule, as a FHIRPath expression.
1471         */
1472        @Child(name = "expression", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1473        @Description(shortDefinition="Custom rule, as a FHIRPath expression", formalDefinition="Custom rule, as a FHIRPath expression." )
1474        protected StringType expression;
1475
1476        /**
1477         * Documentation for FHIRPath expression.
1478         */
1479        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1480        @Description(shortDefinition="Documentation for FHIRPath expression", formalDefinition="Documentation for FHIRPath expression." )
1481        protected StringType description;
1482
1483        private static final long serialVersionUID = 1023364175L;
1484
1485    /**
1486     * Constructor
1487     */
1488      public GraphDefinitionLinkTargetCompartmentComponent() {
1489        super();
1490      }
1491
1492    /**
1493     * Constructor
1494     */
1495      public GraphDefinitionLinkTargetCompartmentComponent(Enumeration<GraphCompartmentUse> use, Enumeration<CompartmentCode> code, Enumeration<GraphCompartmentRule> rule) {
1496        super();
1497        this.use = use;
1498        this.code = code;
1499        this.rule = rule;
1500      }
1501
1502        /**
1503         * @return {@link #use} (Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
1504         */
1505        public Enumeration<GraphCompartmentUse> getUseElement() { 
1506          if (this.use == null)
1507            if (Configuration.errorOnAutoCreate())
1508              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.use");
1509            else if (Configuration.doAutoCreate())
1510              this.use = new Enumeration<GraphCompartmentUse>(new GraphCompartmentUseEnumFactory()); // bb
1511          return this.use;
1512        }
1513
1514        public boolean hasUseElement() { 
1515          return this.use != null && !this.use.isEmpty();
1516        }
1517
1518        public boolean hasUse() { 
1519          return this.use != null && !this.use.isEmpty();
1520        }
1521
1522        /**
1523         * @param value {@link #use} (Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
1524         */
1525        public GraphDefinitionLinkTargetCompartmentComponent setUseElement(Enumeration<GraphCompartmentUse> value) { 
1526          this.use = value;
1527          return this;
1528        }
1529
1530        /**
1531         * @return Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.
1532         */
1533        public GraphCompartmentUse getUse() { 
1534          return this.use == null ? null : this.use.getValue();
1535        }
1536
1537        /**
1538         * @param value Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.
1539         */
1540        public GraphDefinitionLinkTargetCompartmentComponent setUse(GraphCompartmentUse value) { 
1541            if (this.use == null)
1542              this.use = new Enumeration<GraphCompartmentUse>(new GraphCompartmentUseEnumFactory());
1543            this.use.setValue(value);
1544          return this;
1545        }
1546
1547        /**
1548         * @return {@link #code} (Identifies the compartment.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1549         */
1550        public Enumeration<CompartmentCode> getCodeElement() { 
1551          if (this.code == null)
1552            if (Configuration.errorOnAutoCreate())
1553              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.code");
1554            else if (Configuration.doAutoCreate())
1555              this.code = new Enumeration<CompartmentCode>(new CompartmentCodeEnumFactory()); // bb
1556          return this.code;
1557        }
1558
1559        public boolean hasCodeElement() { 
1560          return this.code != null && !this.code.isEmpty();
1561        }
1562
1563        public boolean hasCode() { 
1564          return this.code != null && !this.code.isEmpty();
1565        }
1566
1567        /**
1568         * @param value {@link #code} (Identifies the compartment.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1569         */
1570        public GraphDefinitionLinkTargetCompartmentComponent setCodeElement(Enumeration<CompartmentCode> value) { 
1571          this.code = value;
1572          return this;
1573        }
1574
1575        /**
1576         * @return Identifies the compartment.
1577         */
1578        public CompartmentCode getCode() { 
1579          return this.code == null ? null : this.code.getValue();
1580        }
1581
1582        /**
1583         * @param value Identifies the compartment.
1584         */
1585        public GraphDefinitionLinkTargetCompartmentComponent setCode(CompartmentCode value) { 
1586            if (this.code == null)
1587              this.code = new Enumeration<CompartmentCode>(new CompartmentCodeEnumFactory());
1588            this.code.setValue(value);
1589          return this;
1590        }
1591
1592        /**
1593         * @return {@link #rule} (identical | matching | different | no-rule | custom.). This is the underlying object with id, value and extensions. The accessor "getRule" gives direct access to the value
1594         */
1595        public Enumeration<GraphCompartmentRule> getRuleElement() { 
1596          if (this.rule == null)
1597            if (Configuration.errorOnAutoCreate())
1598              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.rule");
1599            else if (Configuration.doAutoCreate())
1600              this.rule = new Enumeration<GraphCompartmentRule>(new GraphCompartmentRuleEnumFactory()); // bb
1601          return this.rule;
1602        }
1603
1604        public boolean hasRuleElement() { 
1605          return this.rule != null && !this.rule.isEmpty();
1606        }
1607
1608        public boolean hasRule() { 
1609          return this.rule != null && !this.rule.isEmpty();
1610        }
1611
1612        /**
1613         * @param value {@link #rule} (identical | matching | different | no-rule | custom.). This is the underlying object with id, value and extensions. The accessor "getRule" gives direct access to the value
1614         */
1615        public GraphDefinitionLinkTargetCompartmentComponent setRuleElement(Enumeration<GraphCompartmentRule> value) { 
1616          this.rule = value;
1617          return this;
1618        }
1619
1620        /**
1621         * @return identical | matching | different | no-rule | custom.
1622         */
1623        public GraphCompartmentRule getRule() { 
1624          return this.rule == null ? null : this.rule.getValue();
1625        }
1626
1627        /**
1628         * @param value identical | matching | different | no-rule | custom.
1629         */
1630        public GraphDefinitionLinkTargetCompartmentComponent setRule(GraphCompartmentRule value) { 
1631            if (this.rule == null)
1632              this.rule = new Enumeration<GraphCompartmentRule>(new GraphCompartmentRuleEnumFactory());
1633            this.rule.setValue(value);
1634          return this;
1635        }
1636
1637        /**
1638         * @return {@link #expression} (Custom rule, as a FHIRPath expression.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
1639         */
1640        public StringType getExpressionElement() { 
1641          if (this.expression == null)
1642            if (Configuration.errorOnAutoCreate())
1643              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.expression");
1644            else if (Configuration.doAutoCreate())
1645              this.expression = new StringType(); // bb
1646          return this.expression;
1647        }
1648
1649        public boolean hasExpressionElement() { 
1650          return this.expression != null && !this.expression.isEmpty();
1651        }
1652
1653        public boolean hasExpression() { 
1654          return this.expression != null && !this.expression.isEmpty();
1655        }
1656
1657        /**
1658         * @param value {@link #expression} (Custom rule, as a FHIRPath expression.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
1659         */
1660        public GraphDefinitionLinkTargetCompartmentComponent setExpressionElement(StringType value) { 
1661          this.expression = value;
1662          return this;
1663        }
1664
1665        /**
1666         * @return Custom rule, as a FHIRPath expression.
1667         */
1668        public String getExpression() { 
1669          return this.expression == null ? null : this.expression.getValue();
1670        }
1671
1672        /**
1673         * @param value Custom rule, as a FHIRPath expression.
1674         */
1675        public GraphDefinitionLinkTargetCompartmentComponent setExpression(String value) { 
1676          if (Utilities.noString(value))
1677            this.expression = null;
1678          else {
1679            if (this.expression == null)
1680              this.expression = new StringType();
1681            this.expression.setValue(value);
1682          }
1683          return this;
1684        }
1685
1686        /**
1687         * @return {@link #description} (Documentation for FHIRPath expression.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1688         */
1689        public StringType getDescriptionElement() { 
1690          if (this.description == null)
1691            if (Configuration.errorOnAutoCreate())
1692              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.description");
1693            else if (Configuration.doAutoCreate())
1694              this.description = new StringType(); // bb
1695          return this.description;
1696        }
1697
1698        public boolean hasDescriptionElement() { 
1699          return this.description != null && !this.description.isEmpty();
1700        }
1701
1702        public boolean hasDescription() { 
1703          return this.description != null && !this.description.isEmpty();
1704        }
1705
1706        /**
1707         * @param value {@link #description} (Documentation for FHIRPath expression.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1708         */
1709        public GraphDefinitionLinkTargetCompartmentComponent setDescriptionElement(StringType value) { 
1710          this.description = value;
1711          return this;
1712        }
1713
1714        /**
1715         * @return Documentation for FHIRPath expression.
1716         */
1717        public String getDescription() { 
1718          return this.description == null ? null : this.description.getValue();
1719        }
1720
1721        /**
1722         * @param value Documentation for FHIRPath expression.
1723         */
1724        public GraphDefinitionLinkTargetCompartmentComponent setDescription(String value) { 
1725          if (Utilities.noString(value))
1726            this.description = null;
1727          else {
1728            if (this.description == null)
1729              this.description = new StringType();
1730            this.description.setValue(value);
1731          }
1732          return this;
1733        }
1734
1735        protected void listChildren(List<Property> children) {
1736          super.listChildren(children);
1737          children.add(new Property("use", "code", "Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.", 0, 1, use));
1738          children.add(new Property("code", "code", "Identifies the compartment.", 0, 1, code));
1739          children.add(new Property("rule", "code", "identical | matching | different | no-rule | custom.", 0, 1, rule));
1740          children.add(new Property("expression", "string", "Custom rule, as a FHIRPath expression.", 0, 1, expression));
1741          children.add(new Property("description", "string", "Documentation for FHIRPath expression.", 0, 1, description));
1742        }
1743
1744        @Override
1745        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1746          switch (_hash) {
1747          case 116103: /*use*/  return new Property("use", "code", "Defines how the compartment rule is used - whether it it is used to test whether resources are subject to the rule, or whether it is a rule that must be followed.", 0, 1, use);
1748          case 3059181: /*code*/  return new Property("code", "code", "Identifies the compartment.", 0, 1, code);
1749          case 3512060: /*rule*/  return new Property("rule", "code", "identical | matching | different | no-rule | custom.", 0, 1, rule);
1750          case -1795452264: /*expression*/  return new Property("expression", "string", "Custom rule, as a FHIRPath expression.", 0, 1, expression);
1751          case -1724546052: /*description*/  return new Property("description", "string", "Documentation for FHIRPath expression.", 0, 1, description);
1752          default: return super.getNamedProperty(_hash, _name, _checkValid);
1753          }
1754
1755        }
1756
1757      @Override
1758      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1759        switch (hash) {
1760        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<GraphCompartmentUse>
1761        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<CompartmentCode>
1762        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : new Base[] {this.rule}; // Enumeration<GraphCompartmentRule>
1763        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
1764        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1765        default: return super.getProperty(hash, name, checkValid);
1766        }
1767
1768      }
1769
1770      @Override
1771      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1772        switch (hash) {
1773        case 116103: // use
1774          value = new GraphCompartmentUseEnumFactory().fromType(castToCode(value));
1775          this.use = (Enumeration) value; // Enumeration<GraphCompartmentUse>
1776          return value;
1777        case 3059181: // code
1778          value = new CompartmentCodeEnumFactory().fromType(castToCode(value));
1779          this.code = (Enumeration) value; // Enumeration<CompartmentCode>
1780          return value;
1781        case 3512060: // rule
1782          value = new GraphCompartmentRuleEnumFactory().fromType(castToCode(value));
1783          this.rule = (Enumeration) value; // Enumeration<GraphCompartmentRule>
1784          return value;
1785        case -1795452264: // expression
1786          this.expression = castToString(value); // StringType
1787          return value;
1788        case -1724546052: // description
1789          this.description = castToString(value); // StringType
1790          return value;
1791        default: return super.setProperty(hash, name, value);
1792        }
1793
1794      }
1795
1796      @Override
1797      public Base setProperty(String name, Base value) throws FHIRException {
1798        if (name.equals("use")) {
1799          value = new GraphCompartmentUseEnumFactory().fromType(castToCode(value));
1800          this.use = (Enumeration) value; // Enumeration<GraphCompartmentUse>
1801        } else if (name.equals("code")) {
1802          value = new CompartmentCodeEnumFactory().fromType(castToCode(value));
1803          this.code = (Enumeration) value; // Enumeration<CompartmentCode>
1804        } else if (name.equals("rule")) {
1805          value = new GraphCompartmentRuleEnumFactory().fromType(castToCode(value));
1806          this.rule = (Enumeration) value; // Enumeration<GraphCompartmentRule>
1807        } else if (name.equals("expression")) {
1808          this.expression = castToString(value); // StringType
1809        } else if (name.equals("description")) {
1810          this.description = castToString(value); // StringType
1811        } else
1812          return super.setProperty(name, value);
1813        return value;
1814      }
1815
1816      @Override
1817      public Base makeProperty(int hash, String name) throws FHIRException {
1818        switch (hash) {
1819        case 116103:  return getUseElement();
1820        case 3059181:  return getCodeElement();
1821        case 3512060:  return getRuleElement();
1822        case -1795452264:  return getExpressionElement();
1823        case -1724546052:  return getDescriptionElement();
1824        default: return super.makeProperty(hash, name);
1825        }
1826
1827      }
1828
1829      @Override
1830      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1831        switch (hash) {
1832        case 116103: /*use*/ return new String[] {"code"};
1833        case 3059181: /*code*/ return new String[] {"code"};
1834        case 3512060: /*rule*/ return new String[] {"code"};
1835        case -1795452264: /*expression*/ return new String[] {"string"};
1836        case -1724546052: /*description*/ return new String[] {"string"};
1837        default: return super.getTypesForProperty(hash, name);
1838        }
1839
1840      }
1841
1842      @Override
1843      public Base addChild(String name) throws FHIRException {
1844        if (name.equals("use")) {
1845          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.use");
1846        }
1847        else if (name.equals("code")) {
1848          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.code");
1849        }
1850        else if (name.equals("rule")) {
1851          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.rule");
1852        }
1853        else if (name.equals("expression")) {
1854          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.expression");
1855        }
1856        else if (name.equals("description")) {
1857          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.description");
1858        }
1859        else
1860          return super.addChild(name);
1861      }
1862
1863      public GraphDefinitionLinkTargetCompartmentComponent copy() {
1864        GraphDefinitionLinkTargetCompartmentComponent dst = new GraphDefinitionLinkTargetCompartmentComponent();
1865        copyValues(dst);
1866        return dst;
1867      }
1868
1869      public void copyValues(GraphDefinitionLinkTargetCompartmentComponent dst) {
1870        super.copyValues(dst);
1871        dst.use = use == null ? null : use.copy();
1872        dst.code = code == null ? null : code.copy();
1873        dst.rule = rule == null ? null : rule.copy();
1874        dst.expression = expression == null ? null : expression.copy();
1875        dst.description = description == null ? null : description.copy();
1876      }
1877
1878      @Override
1879      public boolean equalsDeep(Base other_) {
1880        if (!super.equalsDeep(other_))
1881          return false;
1882        if (!(other_ instanceof GraphDefinitionLinkTargetCompartmentComponent))
1883          return false;
1884        GraphDefinitionLinkTargetCompartmentComponent o = (GraphDefinitionLinkTargetCompartmentComponent) other_;
1885        return compareDeep(use, o.use, true) && compareDeep(code, o.code, true) && compareDeep(rule, o.rule, true)
1886           && compareDeep(expression, o.expression, true) && compareDeep(description, o.description, true)
1887          ;
1888      }
1889
1890      @Override
1891      public boolean equalsShallow(Base other_) {
1892        if (!super.equalsShallow(other_))
1893          return false;
1894        if (!(other_ instanceof GraphDefinitionLinkTargetCompartmentComponent))
1895          return false;
1896        GraphDefinitionLinkTargetCompartmentComponent o = (GraphDefinitionLinkTargetCompartmentComponent) other_;
1897        return compareValues(use, o.use, true) && compareValues(code, o.code, true) && compareValues(rule, o.rule, true)
1898           && compareValues(expression, o.expression, true) && compareValues(description, o.description, true)
1899          ;
1900      }
1901
1902      public boolean isEmpty() {
1903        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, code, rule, expression
1904          , description);
1905      }
1906
1907  public String fhirType() {
1908    return "GraphDefinition.link.target.compartment";
1909
1910  }
1911
1912  }
1913
1914    /**
1915     * Explanation of why this graph definition is needed and why it has been designed as it has.
1916     */
1917    @Child(name = "purpose", type = {MarkdownType.class}, order=0, min=0, max=1, modifier=false, summary=false)
1918    @Description(shortDefinition="Why this graph definition is defined", formalDefinition="Explanation of why this graph definition is needed and why it has been designed as it has." )
1919    protected MarkdownType purpose;
1920
1921    /**
1922     * The type of FHIR resource at which instances of this graph start.
1923     */
1924    @Child(name = "start", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1925    @Description(shortDefinition="Type of resource at which the graph starts", formalDefinition="The type of FHIR resource at which instances of this graph start." )
1926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
1927    protected CodeType start;
1928
1929    /**
1930     * The profile that describes the use of the base resource.
1931     */
1932    @Child(name = "profile", type = {CanonicalType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1933    @Description(shortDefinition="Profile on base resource", formalDefinition="The profile that describes the use of the base resource." )
1934    protected CanonicalType profile;
1935
1936    /**
1937     * Links this graph makes rules about.
1938     */
1939    @Child(name = "link", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1940    @Description(shortDefinition="Links this graph makes rules about", formalDefinition="Links this graph makes rules about." )
1941    protected List<GraphDefinitionLinkComponent> link;
1942
1943    private static final long serialVersionUID = 1529157887L;
1944
1945  /**
1946   * Constructor
1947   */
1948    public GraphDefinition() {
1949      super();
1950    }
1951
1952  /**
1953   * Constructor
1954   */
1955    public GraphDefinition(StringType name, Enumeration<PublicationStatus> status, CodeType start) {
1956      super();
1957      this.name = name;
1958      this.status = status;
1959      this.start = start;
1960    }
1961
1962    /**
1963     * @return {@link #url} (An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1964     */
1965    public UriType getUrlElement() { 
1966      if (this.url == null)
1967        if (Configuration.errorOnAutoCreate())
1968          throw new Error("Attempt to auto-create GraphDefinition.url");
1969        else if (Configuration.doAutoCreate())
1970          this.url = new UriType(); // bb
1971      return this.url;
1972    }
1973
1974    public boolean hasUrlElement() { 
1975      return this.url != null && !this.url.isEmpty();
1976    }
1977
1978    public boolean hasUrl() { 
1979      return this.url != null && !this.url.isEmpty();
1980    }
1981
1982    /**
1983     * @param value {@link #url} (An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1984     */
1985    public GraphDefinition setUrlElement(UriType value) { 
1986      this.url = value;
1987      return this;
1988    }
1989
1990    /**
1991     * @return An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.
1992     */
1993    public String getUrl() { 
1994      return this.url == null ? null : this.url.getValue();
1995    }
1996
1997    /**
1998     * @param value An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.
1999     */
2000    public GraphDefinition setUrl(String value) { 
2001      if (Utilities.noString(value))
2002        this.url = null;
2003      else {
2004        if (this.url == null)
2005          this.url = new UriType();
2006        this.url.setValue(value);
2007      }
2008      return this;
2009    }
2010
2011    /**
2012     * @return {@link #version} (The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2013     */
2014    public StringType getVersionElement() { 
2015      if (this.version == null)
2016        if (Configuration.errorOnAutoCreate())
2017          throw new Error("Attempt to auto-create GraphDefinition.version");
2018        else if (Configuration.doAutoCreate())
2019          this.version = new StringType(); // bb
2020      return this.version;
2021    }
2022
2023    public boolean hasVersionElement() { 
2024      return this.version != null && !this.version.isEmpty();
2025    }
2026
2027    public boolean hasVersion() { 
2028      return this.version != null && !this.version.isEmpty();
2029    }
2030
2031    /**
2032     * @param value {@link #version} (The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2033     */
2034    public GraphDefinition setVersionElement(StringType value) { 
2035      this.version = value;
2036      return this;
2037    }
2038
2039    /**
2040     * @return The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
2041     */
2042    public String getVersion() { 
2043      return this.version == null ? null : this.version.getValue();
2044    }
2045
2046    /**
2047     * @param value The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
2048     */
2049    public GraphDefinition setVersion(String value) { 
2050      if (Utilities.noString(value))
2051        this.version = null;
2052      else {
2053        if (this.version == null)
2054          this.version = new StringType();
2055        this.version.setValue(value);
2056      }
2057      return this;
2058    }
2059
2060    /**
2061     * @return {@link #name} (A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2062     */
2063    public StringType getNameElement() { 
2064      if (this.name == null)
2065        if (Configuration.errorOnAutoCreate())
2066          throw new Error("Attempt to auto-create GraphDefinition.name");
2067        else if (Configuration.doAutoCreate())
2068          this.name = new StringType(); // bb
2069      return this.name;
2070    }
2071
2072    public boolean hasNameElement() { 
2073      return this.name != null && !this.name.isEmpty();
2074    }
2075
2076    public boolean hasName() { 
2077      return this.name != null && !this.name.isEmpty();
2078    }
2079
2080    /**
2081     * @param value {@link #name} (A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2082     */
2083    public GraphDefinition setNameElement(StringType value) { 
2084      this.name = value;
2085      return this;
2086    }
2087
2088    /**
2089     * @return A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
2090     */
2091    public String getName() { 
2092      return this.name == null ? null : this.name.getValue();
2093    }
2094
2095    /**
2096     * @param value A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
2097     */
2098    public GraphDefinition setName(String value) { 
2099        if (this.name == null)
2100          this.name = new StringType();
2101        this.name.setValue(value);
2102      return this;
2103    }
2104
2105    /**
2106     * @return {@link #status} (The status of this graph definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2107     */
2108    public Enumeration<PublicationStatus> getStatusElement() { 
2109      if (this.status == null)
2110        if (Configuration.errorOnAutoCreate())
2111          throw new Error("Attempt to auto-create GraphDefinition.status");
2112        else if (Configuration.doAutoCreate())
2113          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2114      return this.status;
2115    }
2116
2117    public boolean hasStatusElement() { 
2118      return this.status != null && !this.status.isEmpty();
2119    }
2120
2121    public boolean hasStatus() { 
2122      return this.status != null && !this.status.isEmpty();
2123    }
2124
2125    /**
2126     * @param value {@link #status} (The status of this graph definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2127     */
2128    public GraphDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
2129      this.status = value;
2130      return this;
2131    }
2132
2133    /**
2134     * @return The status of this graph definition. Enables tracking the life-cycle of the content.
2135     */
2136    public PublicationStatus getStatus() { 
2137      return this.status == null ? null : this.status.getValue();
2138    }
2139
2140    /**
2141     * @param value The status of this graph definition. Enables tracking the life-cycle of the content.
2142     */
2143    public GraphDefinition setStatus(PublicationStatus value) { 
2144        if (this.status == null)
2145          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2146        this.status.setValue(value);
2147      return this;
2148    }
2149
2150    /**
2151     * @return {@link #experimental} (A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2152     */
2153    public BooleanType getExperimentalElement() { 
2154      if (this.experimental == null)
2155        if (Configuration.errorOnAutoCreate())
2156          throw new Error("Attempt to auto-create GraphDefinition.experimental");
2157        else if (Configuration.doAutoCreate())
2158          this.experimental = new BooleanType(); // bb
2159      return this.experimental;
2160    }
2161
2162    public boolean hasExperimentalElement() { 
2163      return this.experimental != null && !this.experimental.isEmpty();
2164    }
2165
2166    public boolean hasExperimental() { 
2167      return this.experimental != null && !this.experimental.isEmpty();
2168    }
2169
2170    /**
2171     * @param value {@link #experimental} (A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2172     */
2173    public GraphDefinition setExperimentalElement(BooleanType value) { 
2174      this.experimental = value;
2175      return this;
2176    }
2177
2178    /**
2179     * @return A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
2180     */
2181    public boolean getExperimental() { 
2182      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2183    }
2184
2185    /**
2186     * @param value A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
2187     */
2188    public GraphDefinition setExperimental(boolean value) { 
2189        if (this.experimental == null)
2190          this.experimental = new BooleanType();
2191        this.experimental.setValue(value);
2192      return this;
2193    }
2194
2195    /**
2196     * @return {@link #date} (The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2197     */
2198    public DateTimeType getDateElement() { 
2199      if (this.date == null)
2200        if (Configuration.errorOnAutoCreate())
2201          throw new Error("Attempt to auto-create GraphDefinition.date");
2202        else if (Configuration.doAutoCreate())
2203          this.date = new DateTimeType(); // bb
2204      return this.date;
2205    }
2206
2207    public boolean hasDateElement() { 
2208      return this.date != null && !this.date.isEmpty();
2209    }
2210
2211    public boolean hasDate() { 
2212      return this.date != null && !this.date.isEmpty();
2213    }
2214
2215    /**
2216     * @param value {@link #date} (The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2217     */
2218    public GraphDefinition setDateElement(DateTimeType value) { 
2219      this.date = value;
2220      return this;
2221    }
2222
2223    /**
2224     * @return The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.
2225     */
2226    public Date getDate() { 
2227      return this.date == null ? null : this.date.getValue();
2228    }
2229
2230    /**
2231     * @param value The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.
2232     */
2233    public GraphDefinition setDate(Date value) { 
2234      if (value == null)
2235        this.date = null;
2236      else {
2237        if (this.date == null)
2238          this.date = new DateTimeType();
2239        this.date.setValue(value);
2240      }
2241      return this;
2242    }
2243
2244    /**
2245     * @return {@link #publisher} (The name of the organization or individual that published the graph definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
2246     */
2247    public StringType getPublisherElement() { 
2248      if (this.publisher == null)
2249        if (Configuration.errorOnAutoCreate())
2250          throw new Error("Attempt to auto-create GraphDefinition.publisher");
2251        else if (Configuration.doAutoCreate())
2252          this.publisher = new StringType(); // bb
2253      return this.publisher;
2254    }
2255
2256    public boolean hasPublisherElement() { 
2257      return this.publisher != null && !this.publisher.isEmpty();
2258    }
2259
2260    public boolean hasPublisher() { 
2261      return this.publisher != null && !this.publisher.isEmpty();
2262    }
2263
2264    /**
2265     * @param value {@link #publisher} (The name of the organization or individual that published the graph definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
2266     */
2267    public GraphDefinition setPublisherElement(StringType value) { 
2268      this.publisher = value;
2269      return this;
2270    }
2271
2272    /**
2273     * @return The name of the organization or individual that published the graph definition.
2274     */
2275    public String getPublisher() { 
2276      return this.publisher == null ? null : this.publisher.getValue();
2277    }
2278
2279    /**
2280     * @param value The name of the organization or individual that published the graph definition.
2281     */
2282    public GraphDefinition setPublisher(String value) { 
2283      if (Utilities.noString(value))
2284        this.publisher = null;
2285      else {
2286        if (this.publisher == null)
2287          this.publisher = new StringType();
2288        this.publisher.setValue(value);
2289      }
2290      return this;
2291    }
2292
2293    /**
2294     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
2295     */
2296    public List<ContactDetail> getContact() { 
2297      if (this.contact == null)
2298        this.contact = new ArrayList<ContactDetail>();
2299      return this.contact;
2300    }
2301
2302    /**
2303     * @return Returns a reference to <code>this</code> for easy method chaining
2304     */
2305    public GraphDefinition setContact(List<ContactDetail> theContact) { 
2306      this.contact = theContact;
2307      return this;
2308    }
2309
2310    public boolean hasContact() { 
2311      if (this.contact == null)
2312        return false;
2313      for (ContactDetail item : this.contact)
2314        if (!item.isEmpty())
2315          return true;
2316      return false;
2317    }
2318
2319    public ContactDetail addContact() { //3
2320      ContactDetail t = new ContactDetail();
2321      if (this.contact == null)
2322        this.contact = new ArrayList<ContactDetail>();
2323      this.contact.add(t);
2324      return t;
2325    }
2326
2327    public GraphDefinition addContact(ContactDetail t) { //3
2328      if (t == null)
2329        return this;
2330      if (this.contact == null)
2331        this.contact = new ArrayList<ContactDetail>();
2332      this.contact.add(t);
2333      return this;
2334    }
2335
2336    /**
2337     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
2338     */
2339    public ContactDetail getContactFirstRep() { 
2340      if (getContact().isEmpty()) {
2341        addContact();
2342      }
2343      return getContact().get(0);
2344    }
2345
2346    /**
2347     * @return {@link #description} (A free text natural language description of the graph definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2348     */
2349    public MarkdownType getDescriptionElement() { 
2350      if (this.description == null)
2351        if (Configuration.errorOnAutoCreate())
2352          throw new Error("Attempt to auto-create GraphDefinition.description");
2353        else if (Configuration.doAutoCreate())
2354          this.description = new MarkdownType(); // bb
2355      return this.description;
2356    }
2357
2358    public boolean hasDescriptionElement() { 
2359      return this.description != null && !this.description.isEmpty();
2360    }
2361
2362    public boolean hasDescription() { 
2363      return this.description != null && !this.description.isEmpty();
2364    }
2365
2366    /**
2367     * @param value {@link #description} (A free text natural language description of the graph definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2368     */
2369    public GraphDefinition setDescriptionElement(MarkdownType value) { 
2370      this.description = value;
2371      return this;
2372    }
2373
2374    /**
2375     * @return A free text natural language description of the graph definition from a consumer's perspective.
2376     */
2377    public String getDescription() { 
2378      return this.description == null ? null : this.description.getValue();
2379    }
2380
2381    /**
2382     * @param value A free text natural language description of the graph definition from a consumer's perspective.
2383     */
2384    public GraphDefinition setDescription(String value) { 
2385      if (value == null)
2386        this.description = null;
2387      else {
2388        if (this.description == null)
2389          this.description = new MarkdownType();
2390        this.description.setValue(value);
2391      }
2392      return this;
2393    }
2394
2395    /**
2396     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instances.)
2397     */
2398    public List<UsageContext> getUseContext() { 
2399      if (this.useContext == null)
2400        this.useContext = new ArrayList<UsageContext>();
2401      return this.useContext;
2402    }
2403
2404    /**
2405     * @return Returns a reference to <code>this</code> for easy method chaining
2406     */
2407    public GraphDefinition setUseContext(List<UsageContext> theUseContext) { 
2408      this.useContext = theUseContext;
2409      return this;
2410    }
2411
2412    public boolean hasUseContext() { 
2413      if (this.useContext == null)
2414        return false;
2415      for (UsageContext item : this.useContext)
2416        if (!item.isEmpty())
2417          return true;
2418      return false;
2419    }
2420
2421    public UsageContext addUseContext() { //3
2422      UsageContext t = new UsageContext();
2423      if (this.useContext == null)
2424        this.useContext = new ArrayList<UsageContext>();
2425      this.useContext.add(t);
2426      return t;
2427    }
2428
2429    public GraphDefinition addUseContext(UsageContext t) { //3
2430      if (t == null)
2431        return this;
2432      if (this.useContext == null)
2433        this.useContext = new ArrayList<UsageContext>();
2434      this.useContext.add(t);
2435      return this;
2436    }
2437
2438    /**
2439     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
2440     */
2441    public UsageContext getUseContextFirstRep() { 
2442      if (getUseContext().isEmpty()) {
2443        addUseContext();
2444      }
2445      return getUseContext().get(0);
2446    }
2447
2448    /**
2449     * @return {@link #jurisdiction} (A legal or geographic region in which the graph definition is intended to be used.)
2450     */
2451    public List<CodeableConcept> getJurisdiction() { 
2452      if (this.jurisdiction == null)
2453        this.jurisdiction = new ArrayList<CodeableConcept>();
2454      return this.jurisdiction;
2455    }
2456
2457    /**
2458     * @return Returns a reference to <code>this</code> for easy method chaining
2459     */
2460    public GraphDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
2461      this.jurisdiction = theJurisdiction;
2462      return this;
2463    }
2464
2465    public boolean hasJurisdiction() { 
2466      if (this.jurisdiction == null)
2467        return false;
2468      for (CodeableConcept item : this.jurisdiction)
2469        if (!item.isEmpty())
2470          return true;
2471      return false;
2472    }
2473
2474    public CodeableConcept addJurisdiction() { //3
2475      CodeableConcept t = new CodeableConcept();
2476      if (this.jurisdiction == null)
2477        this.jurisdiction = new ArrayList<CodeableConcept>();
2478      this.jurisdiction.add(t);
2479      return t;
2480    }
2481
2482    public GraphDefinition addJurisdiction(CodeableConcept t) { //3
2483      if (t == null)
2484        return this;
2485      if (this.jurisdiction == null)
2486        this.jurisdiction = new ArrayList<CodeableConcept>();
2487      this.jurisdiction.add(t);
2488      return this;
2489    }
2490
2491    /**
2492     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
2493     */
2494    public CodeableConcept getJurisdictionFirstRep() { 
2495      if (getJurisdiction().isEmpty()) {
2496        addJurisdiction();
2497      }
2498      return getJurisdiction().get(0);
2499    }
2500
2501    /**
2502     * @return {@link #purpose} (Explanation of why this graph definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2503     */
2504    public MarkdownType getPurposeElement() { 
2505      if (this.purpose == null)
2506        if (Configuration.errorOnAutoCreate())
2507          throw new Error("Attempt to auto-create GraphDefinition.purpose");
2508        else if (Configuration.doAutoCreate())
2509          this.purpose = new MarkdownType(); // bb
2510      return this.purpose;
2511    }
2512
2513    public boolean hasPurposeElement() { 
2514      return this.purpose != null && !this.purpose.isEmpty();
2515    }
2516
2517    public boolean hasPurpose() { 
2518      return this.purpose != null && !this.purpose.isEmpty();
2519    }
2520
2521    /**
2522     * @param value {@link #purpose} (Explanation of why this graph definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2523     */
2524    public GraphDefinition setPurposeElement(MarkdownType value) { 
2525      this.purpose = value;
2526      return this;
2527    }
2528
2529    /**
2530     * @return Explanation of why this graph definition is needed and why it has been designed as it has.
2531     */
2532    public String getPurpose() { 
2533      return this.purpose == null ? null : this.purpose.getValue();
2534    }
2535
2536    /**
2537     * @param value Explanation of why this graph definition is needed and why it has been designed as it has.
2538     */
2539    public GraphDefinition setPurpose(String value) { 
2540      if (value == null)
2541        this.purpose = null;
2542      else {
2543        if (this.purpose == null)
2544          this.purpose = new MarkdownType();
2545        this.purpose.setValue(value);
2546      }
2547      return this;
2548    }
2549
2550    /**
2551     * @return {@link #start} (The type of FHIR resource at which instances of this graph start.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
2552     */
2553    public CodeType getStartElement() { 
2554      if (this.start == null)
2555        if (Configuration.errorOnAutoCreate())
2556          throw new Error("Attempt to auto-create GraphDefinition.start");
2557        else if (Configuration.doAutoCreate())
2558          this.start = new CodeType(); // bb
2559      return this.start;
2560    }
2561
2562    public boolean hasStartElement() { 
2563      return this.start != null && !this.start.isEmpty();
2564    }
2565
2566    public boolean hasStart() { 
2567      return this.start != null && !this.start.isEmpty();
2568    }
2569
2570    /**
2571     * @param value {@link #start} (The type of FHIR resource at which instances of this graph start.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
2572     */
2573    public GraphDefinition setStartElement(CodeType value) { 
2574      this.start = value;
2575      return this;
2576    }
2577
2578    /**
2579     * @return The type of FHIR resource at which instances of this graph start.
2580     */
2581    public String getStart() { 
2582      return this.start == null ? null : this.start.getValue();
2583    }
2584
2585    /**
2586     * @param value The type of FHIR resource at which instances of this graph start.
2587     */
2588    public GraphDefinition setStart(String value) { 
2589        if (this.start == null)
2590          this.start = new CodeType();
2591        this.start.setValue(value);
2592      return this;
2593    }
2594
2595    /**
2596     * @return {@link #profile} (The profile that describes the use of the base resource.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
2597     */
2598    public CanonicalType getProfileElement() { 
2599      if (this.profile == null)
2600        if (Configuration.errorOnAutoCreate())
2601          throw new Error("Attempt to auto-create GraphDefinition.profile");
2602        else if (Configuration.doAutoCreate())
2603          this.profile = new CanonicalType(); // bb
2604      return this.profile;
2605    }
2606
2607    public boolean hasProfileElement() { 
2608      return this.profile != null && !this.profile.isEmpty();
2609    }
2610
2611    public boolean hasProfile() { 
2612      return this.profile != null && !this.profile.isEmpty();
2613    }
2614
2615    /**
2616     * @param value {@link #profile} (The profile that describes the use of the base resource.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
2617     */
2618    public GraphDefinition setProfileElement(CanonicalType value) { 
2619      this.profile = value;
2620      return this;
2621    }
2622
2623    /**
2624     * @return The profile that describes the use of the base resource.
2625     */
2626    public String getProfile() { 
2627      return this.profile == null ? null : this.profile.getValue();
2628    }
2629
2630    /**
2631     * @param value The profile that describes the use of the base resource.
2632     */
2633    public GraphDefinition setProfile(String value) { 
2634      if (Utilities.noString(value))
2635        this.profile = null;
2636      else {
2637        if (this.profile == null)
2638          this.profile = new CanonicalType();
2639        this.profile.setValue(value);
2640      }
2641      return this;
2642    }
2643
2644    /**
2645     * @return {@link #link} (Links this graph makes rules about.)
2646     */
2647    public List<GraphDefinitionLinkComponent> getLink() { 
2648      if (this.link == null)
2649        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2650      return this.link;
2651    }
2652
2653    /**
2654     * @return Returns a reference to <code>this</code> for easy method chaining
2655     */
2656    public GraphDefinition setLink(List<GraphDefinitionLinkComponent> theLink) { 
2657      this.link = theLink;
2658      return this;
2659    }
2660
2661    public boolean hasLink() { 
2662      if (this.link == null)
2663        return false;
2664      for (GraphDefinitionLinkComponent item : this.link)
2665        if (!item.isEmpty())
2666          return true;
2667      return false;
2668    }
2669
2670    public GraphDefinitionLinkComponent addLink() { //3
2671      GraphDefinitionLinkComponent t = new GraphDefinitionLinkComponent();
2672      if (this.link == null)
2673        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2674      this.link.add(t);
2675      return t;
2676    }
2677
2678    public GraphDefinition addLink(GraphDefinitionLinkComponent t) { //3
2679      if (t == null)
2680        return this;
2681      if (this.link == null)
2682        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2683      this.link.add(t);
2684      return this;
2685    }
2686
2687    /**
2688     * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist
2689     */
2690    public GraphDefinitionLinkComponent getLinkFirstRep() { 
2691      if (getLink().isEmpty()) {
2692        addLink();
2693      }
2694      return getLink().get(0);
2695    }
2696
2697      protected void listChildren(List<Property> children) {
2698        super.listChildren(children);
2699        children.add(new Property("url", "uri", "An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.", 0, 1, url));
2700        children.add(new Property("version", "string", "The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version));
2701        children.add(new Property("name", "string", "A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
2702        children.add(new Property("status", "code", "The status of this graph definition. Enables tracking the life-cycle of the content.", 0, 1, status));
2703        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
2704        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.", 0, 1, date));
2705        children.add(new Property("publisher", "string", "The name of the organization or individual that published the graph definition.", 0, 1, publisher));
2706        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
2707        children.add(new Property("description", "markdown", "A free text natural language description of the graph definition from a consumer's perspective.", 0, 1, description));
2708        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
2709        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the graph definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
2710        children.add(new Property("purpose", "markdown", "Explanation of why this graph definition is needed and why it has been designed as it has.", 0, 1, purpose));
2711        children.add(new Property("start", "code", "The type of FHIR resource at which instances of this graph start.", 0, 1, start));
2712        children.add(new Property("profile", "canonical(StructureDefinition)", "The profile that describes the use of the base resource.", 0, 1, profile));
2713        children.add(new Property("link", "", "Links this graph makes rules about.", 0, java.lang.Integer.MAX_VALUE, link));
2714      }
2715
2716      @Override
2717      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2718        switch (_hash) {
2719        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this graph definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the graph definition is stored on different servers.", 0, 1, url);
2720        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version);
2721        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
2722        case -892481550: /*status*/  return new Property("status", "code", "The status of this graph definition. Enables tracking the life-cycle of the content.", 0, 1, status);
2723        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
2724        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the graph definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.", 0, 1, date);
2725        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the graph definition.", 0, 1, publisher);
2726        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
2727        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the graph definition from a consumer's perspective.", 0, 1, description);
2728        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate graph definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
2729        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the graph definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
2730        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this graph definition is needed and why it has been designed as it has.", 0, 1, purpose);
2731        case 109757538: /*start*/  return new Property("start", "code", "The type of FHIR resource at which instances of this graph start.", 0, 1, start);
2732        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "The profile that describes the use of the base resource.", 0, 1, profile);
2733        case 3321850: /*link*/  return new Property("link", "", "Links this graph makes rules about.", 0, java.lang.Integer.MAX_VALUE, link);
2734        default: return super.getNamedProperty(_hash, _name, _checkValid);
2735        }
2736
2737      }
2738
2739      @Override
2740      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2741        switch (hash) {
2742        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
2743        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
2744        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2745        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
2746        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
2747        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2748        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
2749        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
2750        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2751        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
2752        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
2753        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
2754        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // CodeType
2755        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType
2756        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // GraphDefinitionLinkComponent
2757        default: return super.getProperty(hash, name, checkValid);
2758        }
2759
2760      }
2761
2762      @Override
2763      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2764        switch (hash) {
2765        case 116079: // url
2766          this.url = castToUri(value); // UriType
2767          return value;
2768        case 351608024: // version
2769          this.version = castToString(value); // StringType
2770          return value;
2771        case 3373707: // name
2772          this.name = castToString(value); // StringType
2773          return value;
2774        case -892481550: // status
2775          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2776          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2777          return value;
2778        case -404562712: // experimental
2779          this.experimental = castToBoolean(value); // BooleanType
2780          return value;
2781        case 3076014: // date
2782          this.date = castToDateTime(value); // DateTimeType
2783          return value;
2784        case 1447404028: // publisher
2785          this.publisher = castToString(value); // StringType
2786          return value;
2787        case 951526432: // contact
2788          this.getContact().add(castToContactDetail(value)); // ContactDetail
2789          return value;
2790        case -1724546052: // description
2791          this.description = castToMarkdown(value); // MarkdownType
2792          return value;
2793        case -669707736: // useContext
2794          this.getUseContext().add(castToUsageContext(value)); // UsageContext
2795          return value;
2796        case -507075711: // jurisdiction
2797          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
2798          return value;
2799        case -220463842: // purpose
2800          this.purpose = castToMarkdown(value); // MarkdownType
2801          return value;
2802        case 109757538: // start
2803          this.start = castToCode(value); // CodeType
2804          return value;
2805        case -309425751: // profile
2806          this.profile = castToCanonical(value); // CanonicalType
2807          return value;
2808        case 3321850: // link
2809          this.getLink().add((GraphDefinitionLinkComponent) value); // GraphDefinitionLinkComponent
2810          return value;
2811        default: return super.setProperty(hash, name, value);
2812        }
2813
2814      }
2815
2816      @Override
2817      public Base setProperty(String name, Base value) throws FHIRException {
2818        if (name.equals("url")) {
2819          this.url = castToUri(value); // UriType
2820        } else if (name.equals("version")) {
2821          this.version = castToString(value); // StringType
2822        } else if (name.equals("name")) {
2823          this.name = castToString(value); // StringType
2824        } else if (name.equals("status")) {
2825          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2826          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2827        } else if (name.equals("experimental")) {
2828          this.experimental = castToBoolean(value); // BooleanType
2829        } else if (name.equals("date")) {
2830          this.date = castToDateTime(value); // DateTimeType
2831        } else if (name.equals("publisher")) {
2832          this.publisher = castToString(value); // StringType
2833        } else if (name.equals("contact")) {
2834          this.getContact().add(castToContactDetail(value));
2835        } else if (name.equals("description")) {
2836          this.description = castToMarkdown(value); // MarkdownType
2837        } else if (name.equals("useContext")) {
2838          this.getUseContext().add(castToUsageContext(value));
2839        } else if (name.equals("jurisdiction")) {
2840          this.getJurisdiction().add(castToCodeableConcept(value));
2841        } else if (name.equals("purpose")) {
2842          this.purpose = castToMarkdown(value); // MarkdownType
2843        } else if (name.equals("start")) {
2844          this.start = castToCode(value); // CodeType
2845        } else if (name.equals("profile")) {
2846          this.profile = castToCanonical(value); // CanonicalType
2847        } else if (name.equals("link")) {
2848          this.getLink().add((GraphDefinitionLinkComponent) value);
2849        } else
2850          return super.setProperty(name, value);
2851        return value;
2852      }
2853
2854      @Override
2855      public Base makeProperty(int hash, String name) throws FHIRException {
2856        switch (hash) {
2857        case 116079:  return getUrlElement();
2858        case 351608024:  return getVersionElement();
2859        case 3373707:  return getNameElement();
2860        case -892481550:  return getStatusElement();
2861        case -404562712:  return getExperimentalElement();
2862        case 3076014:  return getDateElement();
2863        case 1447404028:  return getPublisherElement();
2864        case 951526432:  return addContact(); 
2865        case -1724546052:  return getDescriptionElement();
2866        case -669707736:  return addUseContext(); 
2867        case -507075711:  return addJurisdiction(); 
2868        case -220463842:  return getPurposeElement();
2869        case 109757538:  return getStartElement();
2870        case -309425751:  return getProfileElement();
2871        case 3321850:  return addLink(); 
2872        default: return super.makeProperty(hash, name);
2873        }
2874
2875      }
2876
2877      @Override
2878      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2879        switch (hash) {
2880        case 116079: /*url*/ return new String[] {"uri"};
2881        case 351608024: /*version*/ return new String[] {"string"};
2882        case 3373707: /*name*/ return new String[] {"string"};
2883        case -892481550: /*status*/ return new String[] {"code"};
2884        case -404562712: /*experimental*/ return new String[] {"boolean"};
2885        case 3076014: /*date*/ return new String[] {"dateTime"};
2886        case 1447404028: /*publisher*/ return new String[] {"string"};
2887        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
2888        case -1724546052: /*description*/ return new String[] {"markdown"};
2889        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
2890        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
2891        case -220463842: /*purpose*/ return new String[] {"markdown"};
2892        case 109757538: /*start*/ return new String[] {"code"};
2893        case -309425751: /*profile*/ return new String[] {"canonical"};
2894        case 3321850: /*link*/ return new String[] {};
2895        default: return super.getTypesForProperty(hash, name);
2896        }
2897
2898      }
2899
2900      @Override
2901      public Base addChild(String name) throws FHIRException {
2902        if (name.equals("url")) {
2903          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.url");
2904        }
2905        else if (name.equals("version")) {
2906          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.version");
2907        }
2908        else if (name.equals("name")) {
2909          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.name");
2910        }
2911        else if (name.equals("status")) {
2912          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.status");
2913        }
2914        else if (name.equals("experimental")) {
2915          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.experimental");
2916        }
2917        else if (name.equals("date")) {
2918          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.date");
2919        }
2920        else if (name.equals("publisher")) {
2921          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.publisher");
2922        }
2923        else if (name.equals("contact")) {
2924          return addContact();
2925        }
2926        else if (name.equals("description")) {
2927          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.description");
2928        }
2929        else if (name.equals("useContext")) {
2930          return addUseContext();
2931        }
2932        else if (name.equals("jurisdiction")) {
2933          return addJurisdiction();
2934        }
2935        else if (name.equals("purpose")) {
2936          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.purpose");
2937        }
2938        else if (name.equals("start")) {
2939          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.start");
2940        }
2941        else if (name.equals("profile")) {
2942          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.profile");
2943        }
2944        else if (name.equals("link")) {
2945          return addLink();
2946        }
2947        else
2948          return super.addChild(name);
2949      }
2950
2951  public String fhirType() {
2952    return "GraphDefinition";
2953
2954  }
2955
2956      public GraphDefinition copy() {
2957        GraphDefinition dst = new GraphDefinition();
2958        copyValues(dst);
2959        return dst;
2960      }
2961
2962      public void copyValues(GraphDefinition dst) {
2963        super.copyValues(dst);
2964        dst.url = url == null ? null : url.copy();
2965        dst.version = version == null ? null : version.copy();
2966        dst.name = name == null ? null : name.copy();
2967        dst.status = status == null ? null : status.copy();
2968        dst.experimental = experimental == null ? null : experimental.copy();
2969        dst.date = date == null ? null : date.copy();
2970        dst.publisher = publisher == null ? null : publisher.copy();
2971        if (contact != null) {
2972          dst.contact = new ArrayList<ContactDetail>();
2973          for (ContactDetail i : contact)
2974            dst.contact.add(i.copy());
2975        };
2976        dst.description = description == null ? null : description.copy();
2977        if (useContext != null) {
2978          dst.useContext = new ArrayList<UsageContext>();
2979          for (UsageContext i : useContext)
2980            dst.useContext.add(i.copy());
2981        };
2982        if (jurisdiction != null) {
2983          dst.jurisdiction = new ArrayList<CodeableConcept>();
2984          for (CodeableConcept i : jurisdiction)
2985            dst.jurisdiction.add(i.copy());
2986        };
2987        dst.purpose = purpose == null ? null : purpose.copy();
2988        dst.start = start == null ? null : start.copy();
2989        dst.profile = profile == null ? null : profile.copy();
2990        if (link != null) {
2991          dst.link = new ArrayList<GraphDefinitionLinkComponent>();
2992          for (GraphDefinitionLinkComponent i : link)
2993            dst.link.add(i.copy());
2994        };
2995      }
2996
2997      protected GraphDefinition typedCopy() {
2998        return copy();
2999      }
3000
3001      @Override
3002      public boolean equalsDeep(Base other_) {
3003        if (!super.equalsDeep(other_))
3004          return false;
3005        if (!(other_ instanceof GraphDefinition))
3006          return false;
3007        GraphDefinition o = (GraphDefinition) other_;
3008        return compareDeep(purpose, o.purpose, true) && compareDeep(start, o.start, true) && compareDeep(profile, o.profile, true)
3009           && compareDeep(link, o.link, true);
3010      }
3011
3012      @Override
3013      public boolean equalsShallow(Base other_) {
3014        if (!super.equalsShallow(other_))
3015          return false;
3016        if (!(other_ instanceof GraphDefinition))
3017          return false;
3018        GraphDefinition o = (GraphDefinition) other_;
3019        return compareValues(purpose, o.purpose, true) && compareValues(start, o.start, true);
3020      }
3021
3022      public boolean isEmpty() {
3023        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(purpose, start, profile
3024          , link);
3025      }
3026
3027  @Override
3028  public ResourceType getResourceType() {
3029    return ResourceType.GraphDefinition;
3030   }
3031
3032 /**
3033   * Search parameter: <b>date</b>
3034   * <p>
3035   * Description: <b>The graph definition publication date</b><br>
3036   * Type: <b>date</b><br>
3037   * Path: <b>GraphDefinition.date</b><br>
3038   * </p>
3039   */
3040  @SearchParamDefinition(name="date", path="GraphDefinition.date", description="The graph definition publication date", type="date" )
3041  public static final String SP_DATE = "date";
3042 /**
3043   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3044   * <p>
3045   * Description: <b>The graph definition publication date</b><br>
3046   * Type: <b>date</b><br>
3047   * Path: <b>GraphDefinition.date</b><br>
3048   * </p>
3049   */
3050  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3051
3052 /**
3053   * Search parameter: <b>context-type-value</b>
3054   * <p>
3055   * Description: <b>A use context type and value assigned to the graph definition</b><br>
3056   * Type: <b>composite</b><br>
3057   * Path: <b></b><br>
3058   * </p>
3059   */
3060  @SearchParamDefinition(name="context-type-value", path="GraphDefinition.useContext", description="A use context type and value assigned to the graph definition", type="composite", compositeOf={"context-type", "context"} )
3061  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
3062 /**
3063   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
3064   * <p>
3065   * Description: <b>A use context type and value assigned to the graph definition</b><br>
3066   * Type: <b>composite</b><br>
3067   * Path: <b></b><br>
3068   * </p>
3069   */
3070  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CONTEXT_TYPE_VALUE);
3071
3072 /**
3073   * Search parameter: <b>jurisdiction</b>
3074   * <p>
3075   * Description: <b>Intended jurisdiction for the graph definition</b><br>
3076   * Type: <b>token</b><br>
3077   * Path: <b>GraphDefinition.jurisdiction</b><br>
3078   * </p>
3079   */
3080  @SearchParamDefinition(name="jurisdiction", path="GraphDefinition.jurisdiction", description="Intended jurisdiction for the graph definition", type="token" )
3081  public static final String SP_JURISDICTION = "jurisdiction";
3082 /**
3083   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
3084   * <p>
3085   * Description: <b>Intended jurisdiction for the graph definition</b><br>
3086   * Type: <b>token</b><br>
3087   * Path: <b>GraphDefinition.jurisdiction</b><br>
3088   * </p>
3089   */
3090  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
3091
3092 /**
3093   * Search parameter: <b>start</b>
3094   * <p>
3095   * Description: <b>Type of resource at which the graph starts</b><br>
3096   * Type: <b>token</b><br>
3097   * Path: <b>GraphDefinition.start</b><br>
3098   * </p>
3099   */
3100  @SearchParamDefinition(name="start", path="GraphDefinition.start", description="Type of resource at which the graph starts", type="token" )
3101  public static final String SP_START = "start";
3102 /**
3103   * <b>Fluent Client</b> search parameter constant for <b>start</b>
3104   * <p>
3105   * Description: <b>Type of resource at which the graph starts</b><br>
3106   * Type: <b>token</b><br>
3107   * Path: <b>GraphDefinition.start</b><br>
3108   * </p>
3109   */
3110  public static final ca.uhn.fhir.rest.gclient.TokenClientParam START = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_START);
3111
3112 /**
3113   * Search parameter: <b>description</b>
3114   * <p>
3115   * Description: <b>The description of the graph definition</b><br>
3116   * Type: <b>string</b><br>
3117   * Path: <b>GraphDefinition.description</b><br>
3118   * </p>
3119   */
3120  @SearchParamDefinition(name="description", path="GraphDefinition.description", description="The description of the graph definition", type="string" )
3121  public static final String SP_DESCRIPTION = "description";
3122 /**
3123   * <b>Fluent Client</b> search parameter constant for <b>description</b>
3124   * <p>
3125   * Description: <b>The description of the graph definition</b><br>
3126   * Type: <b>string</b><br>
3127   * Path: <b>GraphDefinition.description</b><br>
3128   * </p>
3129   */
3130  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
3131
3132 /**
3133   * Search parameter: <b>context-type</b>
3134   * <p>
3135   * Description: <b>A type of use context assigned to the graph definition</b><br>
3136   * Type: <b>token</b><br>
3137   * Path: <b>GraphDefinition.useContext.code</b><br>
3138   * </p>
3139   */
3140  @SearchParamDefinition(name="context-type", path="GraphDefinition.useContext.code", description="A type of use context assigned to the graph definition", type="token" )
3141  public static final String SP_CONTEXT_TYPE = "context-type";
3142 /**
3143   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
3144   * <p>
3145   * Description: <b>A type of use context assigned to the graph definition</b><br>
3146   * Type: <b>token</b><br>
3147   * Path: <b>GraphDefinition.useContext.code</b><br>
3148   * </p>
3149   */
3150  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
3151
3152 /**
3153   * Search parameter: <b>version</b>
3154   * <p>
3155   * Description: <b>The business version of the graph definition</b><br>
3156   * Type: <b>token</b><br>
3157   * Path: <b>GraphDefinition.version</b><br>
3158   * </p>
3159   */
3160  @SearchParamDefinition(name="version", path="GraphDefinition.version", description="The business version of the graph definition", type="token" )
3161  public static final String SP_VERSION = "version";
3162 /**
3163   * <b>Fluent Client</b> search parameter constant for <b>version</b>
3164   * <p>
3165   * Description: <b>The business version of the graph definition</b><br>
3166   * Type: <b>token</b><br>
3167   * Path: <b>GraphDefinition.version</b><br>
3168   * </p>
3169   */
3170  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
3171
3172 /**
3173   * Search parameter: <b>url</b>
3174   * <p>
3175   * Description: <b>The uri that identifies the graph definition</b><br>
3176   * Type: <b>uri</b><br>
3177   * Path: <b>GraphDefinition.url</b><br>
3178   * </p>
3179   */
3180  @SearchParamDefinition(name="url", path="GraphDefinition.url", description="The uri that identifies the graph definition", type="uri" )
3181  public static final String SP_URL = "url";
3182 /**
3183   * <b>Fluent Client</b> search parameter constant for <b>url</b>
3184   * <p>
3185   * Description: <b>The uri that identifies the graph definition</b><br>
3186   * Type: <b>uri</b><br>
3187   * Path: <b>GraphDefinition.url</b><br>
3188   * </p>
3189   */
3190  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
3191
3192 /**
3193   * Search parameter: <b>context-quantity</b>
3194   * <p>
3195   * Description: <b>A quantity- or range-valued use context assigned to the graph definition</b><br>
3196   * Type: <b>quantity</b><br>
3197   * Path: <b>GraphDefinition.useContext.valueQuantity, GraphDefinition.useContext.valueRange</b><br>
3198   * </p>
3199   */
3200  @SearchParamDefinition(name="context-quantity", path="(GraphDefinition.useContext.value as Quantity) | (GraphDefinition.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the graph definition", type="quantity" )
3201  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
3202 /**
3203   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
3204   * <p>
3205   * Description: <b>A quantity- or range-valued use context assigned to the graph definition</b><br>
3206   * Type: <b>quantity</b><br>
3207   * Path: <b>GraphDefinition.useContext.valueQuantity, GraphDefinition.useContext.valueRange</b><br>
3208   * </p>
3209   */
3210  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
3211
3212 /**
3213   * Search parameter: <b>name</b>
3214   * <p>
3215   * Description: <b>Computationally friendly name of the graph definition</b><br>
3216   * Type: <b>string</b><br>
3217   * Path: <b>GraphDefinition.name</b><br>
3218   * </p>
3219   */
3220  @SearchParamDefinition(name="name", path="GraphDefinition.name", description="Computationally friendly name of the graph definition", type="string" )
3221  public static final String SP_NAME = "name";
3222 /**
3223   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3224   * <p>
3225   * Description: <b>Computationally friendly name of the graph definition</b><br>
3226   * Type: <b>string</b><br>
3227   * Path: <b>GraphDefinition.name</b><br>
3228   * </p>
3229   */
3230  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
3231
3232 /**
3233   * Search parameter: <b>context</b>
3234   * <p>
3235   * Description: <b>A use context assigned to the graph definition</b><br>
3236   * Type: <b>token</b><br>
3237   * Path: <b>GraphDefinition.useContext.valueCodeableConcept</b><br>
3238   * </p>
3239   */
3240  @SearchParamDefinition(name="context", path="(GraphDefinition.useContext.value as CodeableConcept)", description="A use context assigned to the graph definition", type="token" )
3241  public static final String SP_CONTEXT = "context";
3242 /**
3243   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3244   * <p>
3245   * Description: <b>A use context assigned to the graph definition</b><br>
3246   * Type: <b>token</b><br>
3247   * Path: <b>GraphDefinition.useContext.valueCodeableConcept</b><br>
3248   * </p>
3249   */
3250  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
3251
3252 /**
3253   * Search parameter: <b>publisher</b>
3254   * <p>
3255   * Description: <b>Name of the publisher of the graph definition</b><br>
3256   * Type: <b>string</b><br>
3257   * Path: <b>GraphDefinition.publisher</b><br>
3258   * </p>
3259   */
3260  @SearchParamDefinition(name="publisher", path="GraphDefinition.publisher", description="Name of the publisher of the graph definition", type="string" )
3261  public static final String SP_PUBLISHER = "publisher";
3262 /**
3263   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
3264   * <p>
3265   * Description: <b>Name of the publisher of the graph definition</b><br>
3266   * Type: <b>string</b><br>
3267   * Path: <b>GraphDefinition.publisher</b><br>
3268   * </p>
3269   */
3270  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
3271
3272 /**
3273   * Search parameter: <b>context-type-quantity</b>
3274   * <p>
3275   * Description: <b>A use context type and quantity- or range-based value assigned to the graph definition</b><br>
3276   * Type: <b>composite</b><br>
3277   * Path: <b></b><br>
3278   * </p>
3279   */
3280  @SearchParamDefinition(name="context-type-quantity", path="GraphDefinition.useContext", description="A use context type and quantity- or range-based value assigned to the graph definition", type="composite", compositeOf={"context-type", "context-quantity"} )
3281  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
3282 /**
3283   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
3284   * <p>
3285   * Description: <b>A use context type and quantity- or range-based value assigned to the graph definition</b><br>
3286   * Type: <b>composite</b><br>
3287   * Path: <b></b><br>
3288   * </p>
3289   */
3290  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CONTEXT_TYPE_QUANTITY);
3291
3292 /**
3293   * Search parameter: <b>status</b>
3294   * <p>
3295   * Description: <b>The current status of the graph definition</b><br>
3296   * Type: <b>token</b><br>
3297   * Path: <b>GraphDefinition.status</b><br>
3298   * </p>
3299   */
3300  @SearchParamDefinition(name="status", path="GraphDefinition.status", description="The current status of the graph definition", type="token" )
3301  public static final String SP_STATUS = "status";
3302 /**
3303   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3304   * <p>
3305   * Description: <b>The current status of the graph definition</b><br>
3306   * Type: <b>token</b><br>
3307   * Path: <b>GraphDefinition.status</b><br>
3308   * </p>
3309   */
3310  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3311
3312
3313}