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