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