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