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