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