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