001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
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;
056
057import org.hl7.fhir.exceptions.FHIRException;
058import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
059import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
060import org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory;
061import org.hl7.fhir.utilities.Utilities;
062
063import ca.uhn.fhir.model.api.annotation.Block;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.ResourceDef;
068import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
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        dst.path = path == null ? null : path.copy();
918        dst.sliceName = sliceName == null ? null : sliceName.copy();
919        dst.min = min == null ? null : min.copy();
920        dst.max = max == null ? null : max.copy();
921        dst.description = description == null ? null : description.copy();
922        if (target != null) {
923          dst.target = new ArrayList<GraphDefinitionLinkTargetComponent>();
924          for (GraphDefinitionLinkTargetComponent i : target)
925            dst.target.add(i.copy());
926        };
927        return dst;
928      }
929
930      @Override
931      public boolean equalsDeep(Base other_) {
932        if (!super.equalsDeep(other_))
933          return false;
934        if (!(other_ instanceof GraphDefinitionLinkComponent))
935          return false;
936        GraphDefinitionLinkComponent o = (GraphDefinitionLinkComponent) other_;
937        return compareDeep(path, o.path, true) && compareDeep(sliceName, o.sliceName, true) && compareDeep(min, o.min, true)
938           && compareDeep(max, o.max, true) && compareDeep(description, o.description, true) && compareDeep(target, o.target, true)
939          ;
940      }
941
942      @Override
943      public boolean equalsShallow(Base other_) {
944        if (!super.equalsShallow(other_))
945          return false;
946        if (!(other_ instanceof GraphDefinitionLinkComponent))
947          return false;
948        GraphDefinitionLinkComponent o = (GraphDefinitionLinkComponent) other_;
949        return compareValues(path, o.path, true) && compareValues(sliceName, o.sliceName, true) && compareValues(min, o.min, true)
950           && compareValues(max, o.max, true) && compareValues(description, o.description, true);
951      }
952
953      public boolean isEmpty() {
954        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, sliceName, min, max
955          , description, target);
956      }
957
958  public String fhirType() {
959    return "GraphDefinition.link";
960
961  }
962
963  }
964
965    @Block()
966    public static class GraphDefinitionLinkTargetComponent extends BackboneElement implements IBaseBackboneElement {
967        /**
968         * Type of resource this link refers to.
969         */
970        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
971        @Description(shortDefinition="Type of resource this link refers to", formalDefinition="Type of resource this link refers to." )
972        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
973        protected CodeType type;
974
975        /**
976         * A set of parameters to look up.
977         */
978        @Child(name = "params", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
979        @Description(shortDefinition="Criteria for reverse lookup", formalDefinition="A set of parameters to look up." )
980        protected StringType params;
981
982        /**
983         * Profile for the target resource.
984         */
985        @Child(name = "profile", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
986        @Description(shortDefinition="Profile for the target resource", formalDefinition="Profile for the target resource." )
987        protected CanonicalType profile;
988
989        /**
990         * Compartment Consistency Rules.
991         */
992        @Child(name = "compartment", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
993        @Description(shortDefinition="Compartment Consistency Rules", formalDefinition="Compartment Consistency Rules." )
994        protected List<GraphDefinitionLinkTargetCompartmentComponent> compartment;
995
996        /**
997         * Additional links from target resource.
998         */
999        @Child(name = "link", type = {GraphDefinitionLinkComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1000        @Description(shortDefinition="Additional links from target resource", formalDefinition="Additional links from target resource." )
1001        protected List<GraphDefinitionLinkComponent> link;
1002
1003        private static final long serialVersionUID = -35248998L;
1004
1005    /**
1006     * Constructor
1007     */
1008      public GraphDefinitionLinkTargetComponent() {
1009        super();
1010      }
1011
1012    /**
1013     * Constructor
1014     */
1015      public GraphDefinitionLinkTargetComponent(CodeType type) {
1016        super();
1017        this.type = type;
1018      }
1019
1020        /**
1021         * @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
1022         */
1023        public CodeType getTypeElement() { 
1024          if (this.type == null)
1025            if (Configuration.errorOnAutoCreate())
1026              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.type");
1027            else if (Configuration.doAutoCreate())
1028              this.type = new CodeType(); // bb
1029          return this.type;
1030        }
1031
1032        public boolean hasTypeElement() { 
1033          return this.type != null && !this.type.isEmpty();
1034        }
1035
1036        public boolean hasType() { 
1037          return this.type != null && !this.type.isEmpty();
1038        }
1039
1040        /**
1041         * @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
1042         */
1043        public GraphDefinitionLinkTargetComponent setTypeElement(CodeType value) { 
1044          this.type = value;
1045          return this;
1046        }
1047
1048        /**
1049         * @return Type of resource this link refers to.
1050         */
1051        public String getType() { 
1052          return this.type == null ? null : this.type.getValue();
1053        }
1054
1055        /**
1056         * @param value Type of resource this link refers to.
1057         */
1058        public GraphDefinitionLinkTargetComponent setType(String value) { 
1059            if (this.type == null)
1060              this.type = new CodeType();
1061            this.type.setValue(value);
1062          return this;
1063        }
1064
1065        /**
1066         * @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
1067         */
1068        public StringType getParamsElement() { 
1069          if (this.params == null)
1070            if (Configuration.errorOnAutoCreate())
1071              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.params");
1072            else if (Configuration.doAutoCreate())
1073              this.params = new StringType(); // bb
1074          return this.params;
1075        }
1076
1077        public boolean hasParamsElement() { 
1078          return this.params != null && !this.params.isEmpty();
1079        }
1080
1081        public boolean hasParams() { 
1082          return this.params != null && !this.params.isEmpty();
1083        }
1084
1085        /**
1086         * @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
1087         */
1088        public GraphDefinitionLinkTargetComponent setParamsElement(StringType value) { 
1089          this.params = value;
1090          return this;
1091        }
1092
1093        /**
1094         * @return A set of parameters to look up.
1095         */
1096        public String getParams() { 
1097          return this.params == null ? null : this.params.getValue();
1098        }
1099
1100        /**
1101         * @param value A set of parameters to look up.
1102         */
1103        public GraphDefinitionLinkTargetComponent setParams(String value) { 
1104          if (Utilities.noString(value))
1105            this.params = null;
1106          else {
1107            if (this.params == null)
1108              this.params = new StringType();
1109            this.params.setValue(value);
1110          }
1111          return this;
1112        }
1113
1114        /**
1115         * @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
1116         */
1117        public CanonicalType getProfileElement() { 
1118          if (this.profile == null)
1119            if (Configuration.errorOnAutoCreate())
1120              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetComponent.profile");
1121            else if (Configuration.doAutoCreate())
1122              this.profile = new CanonicalType(); // bb
1123          return this.profile;
1124        }
1125
1126        public boolean hasProfileElement() { 
1127          return this.profile != null && !this.profile.isEmpty();
1128        }
1129
1130        public boolean hasProfile() { 
1131          return this.profile != null && !this.profile.isEmpty();
1132        }
1133
1134        /**
1135         * @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
1136         */
1137        public GraphDefinitionLinkTargetComponent setProfileElement(CanonicalType value) { 
1138          this.profile = value;
1139          return this;
1140        }
1141
1142        /**
1143         * @return Profile for the target resource.
1144         */
1145        public String getProfile() { 
1146          return this.profile == null ? null : this.profile.getValue();
1147        }
1148
1149        /**
1150         * @param value Profile for the target resource.
1151         */
1152        public GraphDefinitionLinkTargetComponent setProfile(String value) { 
1153          if (Utilities.noString(value))
1154            this.profile = null;
1155          else {
1156            if (this.profile == null)
1157              this.profile = new CanonicalType();
1158            this.profile.setValue(value);
1159          }
1160          return this;
1161        }
1162
1163        /**
1164         * @return {@link #compartment} (Compartment Consistency Rules.)
1165         */
1166        public List<GraphDefinitionLinkTargetCompartmentComponent> getCompartment() { 
1167          if (this.compartment == null)
1168            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1169          return this.compartment;
1170        }
1171
1172        /**
1173         * @return Returns a reference to <code>this</code> for easy method chaining
1174         */
1175        public GraphDefinitionLinkTargetComponent setCompartment(List<GraphDefinitionLinkTargetCompartmentComponent> theCompartment) { 
1176          this.compartment = theCompartment;
1177          return this;
1178        }
1179
1180        public boolean hasCompartment() { 
1181          if (this.compartment == null)
1182            return false;
1183          for (GraphDefinitionLinkTargetCompartmentComponent item : this.compartment)
1184            if (!item.isEmpty())
1185              return true;
1186          return false;
1187        }
1188
1189        public GraphDefinitionLinkTargetCompartmentComponent addCompartment() { //3
1190          GraphDefinitionLinkTargetCompartmentComponent t = new GraphDefinitionLinkTargetCompartmentComponent();
1191          if (this.compartment == null)
1192            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1193          this.compartment.add(t);
1194          return t;
1195        }
1196
1197        public GraphDefinitionLinkTargetComponent addCompartment(GraphDefinitionLinkTargetCompartmentComponent t) { //3
1198          if (t == null)
1199            return this;
1200          if (this.compartment == null)
1201            this.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1202          this.compartment.add(t);
1203          return this;
1204        }
1205
1206        /**
1207         * @return The first repetition of repeating field {@link #compartment}, creating it if it does not already exist
1208         */
1209        public GraphDefinitionLinkTargetCompartmentComponent getCompartmentFirstRep() { 
1210          if (getCompartment().isEmpty()) {
1211            addCompartment();
1212          }
1213          return getCompartment().get(0);
1214        }
1215
1216        /**
1217         * @return {@link #link} (Additional links from target resource.)
1218         */
1219        public List<GraphDefinitionLinkComponent> getLink() { 
1220          if (this.link == null)
1221            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1222          return this.link;
1223        }
1224
1225        /**
1226         * @return Returns a reference to <code>this</code> for easy method chaining
1227         */
1228        public GraphDefinitionLinkTargetComponent setLink(List<GraphDefinitionLinkComponent> theLink) { 
1229          this.link = theLink;
1230          return this;
1231        }
1232
1233        public boolean hasLink() { 
1234          if (this.link == null)
1235            return false;
1236          for (GraphDefinitionLinkComponent item : this.link)
1237            if (!item.isEmpty())
1238              return true;
1239          return false;
1240        }
1241
1242        public GraphDefinitionLinkComponent addLink() { //3
1243          GraphDefinitionLinkComponent t = new GraphDefinitionLinkComponent();
1244          if (this.link == null)
1245            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1246          this.link.add(t);
1247          return t;
1248        }
1249
1250        public GraphDefinitionLinkTargetComponent addLink(GraphDefinitionLinkComponent t) { //3
1251          if (t == null)
1252            return this;
1253          if (this.link == null)
1254            this.link = new ArrayList<GraphDefinitionLinkComponent>();
1255          this.link.add(t);
1256          return this;
1257        }
1258
1259        /**
1260         * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist
1261         */
1262        public GraphDefinitionLinkComponent getLinkFirstRep() { 
1263          if (getLink().isEmpty()) {
1264            addLink();
1265          }
1266          return getLink().get(0);
1267        }
1268
1269        protected void listChildren(List<Property> children) {
1270          super.listChildren(children);
1271          children.add(new Property("type", "code", "Type of resource this link refers to.", 0, 1, type));
1272          children.add(new Property("params", "string", "A set of parameters to look up.", 0, 1, params));
1273          children.add(new Property("profile", "canonical(StructureDefinition)", "Profile for the target resource.", 0, 1, profile));
1274          children.add(new Property("compartment", "", "Compartment Consistency Rules.", 0, java.lang.Integer.MAX_VALUE, compartment));
1275          children.add(new Property("link", "@GraphDefinition.link", "Additional links from target resource.", 0, java.lang.Integer.MAX_VALUE, link));
1276        }
1277
1278        @Override
1279        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1280          switch (_hash) {
1281          case 3575610: /*type*/  return new Property("type", "code", "Type of resource this link refers to.", 0, 1, type);
1282          case -995427962: /*params*/  return new Property("params", "string", "A set of parameters to look up.", 0, 1, params);
1283          case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "Profile for the target resource.", 0, 1, profile);
1284          case -397756334: /*compartment*/  return new Property("compartment", "", "Compartment Consistency Rules.", 0, java.lang.Integer.MAX_VALUE, compartment);
1285          case 3321850: /*link*/  return new Property("link", "@GraphDefinition.link", "Additional links from target resource.", 0, java.lang.Integer.MAX_VALUE, link);
1286          default: return super.getNamedProperty(_hash, _name, _checkValid);
1287          }
1288
1289        }
1290
1291      @Override
1292      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1293        switch (hash) {
1294        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1295        case -995427962: /*params*/ return this.params == null ? new Base[0] : new Base[] {this.params}; // StringType
1296        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType
1297        case -397756334: /*compartment*/ return this.compartment == null ? new Base[0] : this.compartment.toArray(new Base[this.compartment.size()]); // GraphDefinitionLinkTargetCompartmentComponent
1298        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // GraphDefinitionLinkComponent
1299        default: return super.getProperty(hash, name, checkValid);
1300        }
1301
1302      }
1303
1304      @Override
1305      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1306        switch (hash) {
1307        case 3575610: // type
1308          this.type = castToCode(value); // CodeType
1309          return value;
1310        case -995427962: // params
1311          this.params = castToString(value); // StringType
1312          return value;
1313        case -309425751: // profile
1314          this.profile = castToCanonical(value); // CanonicalType
1315          return value;
1316        case -397756334: // compartment
1317          this.getCompartment().add((GraphDefinitionLinkTargetCompartmentComponent) value); // GraphDefinitionLinkTargetCompartmentComponent
1318          return value;
1319        case 3321850: // link
1320          this.getLink().add((GraphDefinitionLinkComponent) value); // GraphDefinitionLinkComponent
1321          return value;
1322        default: return super.setProperty(hash, name, value);
1323        }
1324
1325      }
1326
1327      @Override
1328      public Base setProperty(String name, Base value) throws FHIRException {
1329        if (name.equals("type")) {
1330          this.type = castToCode(value); // CodeType
1331        } else if (name.equals("params")) {
1332          this.params = castToString(value); // StringType
1333        } else if (name.equals("profile")) {
1334          this.profile = castToCanonical(value); // CanonicalType
1335        } else if (name.equals("compartment")) {
1336          this.getCompartment().add((GraphDefinitionLinkTargetCompartmentComponent) value);
1337        } else if (name.equals("link")) {
1338          this.getLink().add((GraphDefinitionLinkComponent) value);
1339        } else
1340          return super.setProperty(name, value);
1341        return value;
1342      }
1343
1344      @Override
1345      public Base makeProperty(int hash, String name) throws FHIRException {
1346        switch (hash) {
1347        case 3575610:  return getTypeElement();
1348        case -995427962:  return getParamsElement();
1349        case -309425751:  return getProfileElement();
1350        case -397756334:  return addCompartment(); 
1351        case 3321850:  return addLink(); 
1352        default: return super.makeProperty(hash, name);
1353        }
1354
1355      }
1356
1357      @Override
1358      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1359        switch (hash) {
1360        case 3575610: /*type*/ return new String[] {"code"};
1361        case -995427962: /*params*/ return new String[] {"string"};
1362        case -309425751: /*profile*/ return new String[] {"canonical"};
1363        case -397756334: /*compartment*/ return new String[] {};
1364        case 3321850: /*link*/ return new String[] {"@GraphDefinition.link"};
1365        default: return super.getTypesForProperty(hash, name);
1366        }
1367
1368      }
1369
1370      @Override
1371      public Base addChild(String name) throws FHIRException {
1372        if (name.equals("type")) {
1373          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.type");
1374        }
1375        else if (name.equals("params")) {
1376          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.params");
1377        }
1378        else if (name.equals("profile")) {
1379          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.profile");
1380        }
1381        else if (name.equals("compartment")) {
1382          return addCompartment();
1383        }
1384        else if (name.equals("link")) {
1385          return addLink();
1386        }
1387        else
1388          return super.addChild(name);
1389      }
1390
1391      public GraphDefinitionLinkTargetComponent copy() {
1392        GraphDefinitionLinkTargetComponent dst = new GraphDefinitionLinkTargetComponent();
1393        copyValues(dst);
1394        dst.type = type == null ? null : type.copy();
1395        dst.params = params == null ? null : params.copy();
1396        dst.profile = profile == null ? null : profile.copy();
1397        if (compartment != null) {
1398          dst.compartment = new ArrayList<GraphDefinitionLinkTargetCompartmentComponent>();
1399          for (GraphDefinitionLinkTargetCompartmentComponent i : compartment)
1400            dst.compartment.add(i.copy());
1401        };
1402        if (link != null) {
1403          dst.link = new ArrayList<GraphDefinitionLinkComponent>();
1404          for (GraphDefinitionLinkComponent i : link)
1405            dst.link.add(i.copy());
1406        };
1407        return dst;
1408      }
1409
1410      @Override
1411      public boolean equalsDeep(Base other_) {
1412        if (!super.equalsDeep(other_))
1413          return false;
1414        if (!(other_ instanceof GraphDefinitionLinkTargetComponent))
1415          return false;
1416        GraphDefinitionLinkTargetComponent o = (GraphDefinitionLinkTargetComponent) other_;
1417        return compareDeep(type, o.type, true) && compareDeep(params, o.params, true) && compareDeep(profile, o.profile, true)
1418           && compareDeep(compartment, o.compartment, true) && compareDeep(link, o.link, true);
1419      }
1420
1421      @Override
1422      public boolean equalsShallow(Base other_) {
1423        if (!super.equalsShallow(other_))
1424          return false;
1425        if (!(other_ instanceof GraphDefinitionLinkTargetComponent))
1426          return false;
1427        GraphDefinitionLinkTargetComponent o = (GraphDefinitionLinkTargetComponent) other_;
1428        return compareValues(type, o.type, true) && compareValues(params, o.params, true);
1429      }
1430
1431      public boolean isEmpty() {
1432        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, params, profile, compartment
1433          , link);
1434      }
1435
1436  public String fhirType() {
1437    return "GraphDefinition.link.target";
1438
1439  }
1440
1441  }
1442
1443    @Block()
1444    public static class GraphDefinitionLinkTargetCompartmentComponent extends BackboneElement implements IBaseBackboneElement {
1445        /**
1446         * 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.
1447         */
1448        @Child(name = "use", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1449        @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." )
1450        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/graph-compartment-use")
1451        protected Enumeration<GraphCompartmentUse> use;
1452
1453        /**
1454         * Identifies the compartment.
1455         */
1456        @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1457        @Description(shortDefinition="Identifies the compartment", formalDefinition="Identifies the compartment." )
1458        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/compartment-type")
1459        protected Enumeration<CompartmentCode> code;
1460
1461        /**
1462         * identical | matching | different | no-rule | custom.
1463         */
1464        @Child(name = "rule", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1465        @Description(shortDefinition="identical | matching | different | custom", formalDefinition="identical | matching | different | no-rule | custom." )
1466        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/graph-compartment-rule")
1467        protected Enumeration<GraphCompartmentRule> rule;
1468
1469        /**
1470         * Custom rule, as a FHIRPath expression.
1471         */
1472        @Child(name = "expression", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1473        @Description(shortDefinition="Custom rule, as a FHIRPath expression", formalDefinition="Custom rule, as a FHIRPath expression." )
1474        protected StringType expression;
1475
1476        /**
1477         * Documentation for FHIRPath expression.
1478         */
1479        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1480        @Description(shortDefinition="Documentation for FHIRPath expression", formalDefinition="Documentation for FHIRPath expression." )
1481        protected StringType description;
1482
1483        private static final long serialVersionUID = 1023364175L;
1484
1485    /**
1486     * Constructor
1487     */
1488      public GraphDefinitionLinkTargetCompartmentComponent() {
1489        super();
1490      }
1491
1492    /**
1493     * Constructor
1494     */
1495      public GraphDefinitionLinkTargetCompartmentComponent(Enumeration<GraphCompartmentUse> use, Enumeration<CompartmentCode> code, Enumeration<GraphCompartmentRule> rule) {
1496        super();
1497        this.use = use;
1498        this.code = code;
1499        this.rule = rule;
1500      }
1501
1502        /**
1503         * @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
1504         */
1505        public Enumeration<GraphCompartmentUse> getUseElement() { 
1506          if (this.use == null)
1507            if (Configuration.errorOnAutoCreate())
1508              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.use");
1509            else if (Configuration.doAutoCreate())
1510              this.use = new Enumeration<GraphCompartmentUse>(new GraphCompartmentUseEnumFactory()); // bb
1511          return this.use;
1512        }
1513
1514        public boolean hasUseElement() { 
1515          return this.use != null && !this.use.isEmpty();
1516        }
1517
1518        public boolean hasUse() { 
1519          return this.use != null && !this.use.isEmpty();
1520        }
1521
1522        /**
1523         * @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
1524         */
1525        public GraphDefinitionLinkTargetCompartmentComponent setUseElement(Enumeration<GraphCompartmentUse> value) { 
1526          this.use = value;
1527          return this;
1528        }
1529
1530        /**
1531         * @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.
1532         */
1533        public GraphCompartmentUse getUse() { 
1534          return this.use == null ? null : this.use.getValue();
1535        }
1536
1537        /**
1538         * @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.
1539         */
1540        public GraphDefinitionLinkTargetCompartmentComponent setUse(GraphCompartmentUse value) { 
1541            if (this.use == null)
1542              this.use = new Enumeration<GraphCompartmentUse>(new GraphCompartmentUseEnumFactory());
1543            this.use.setValue(value);
1544          return this;
1545        }
1546
1547        /**
1548         * @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
1549         */
1550        public Enumeration<CompartmentCode> getCodeElement() { 
1551          if (this.code == null)
1552            if (Configuration.errorOnAutoCreate())
1553              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.code");
1554            else if (Configuration.doAutoCreate())
1555              this.code = new Enumeration<CompartmentCode>(new CompartmentCodeEnumFactory()); // bb
1556          return this.code;
1557        }
1558
1559        public boolean hasCodeElement() { 
1560          return this.code != null && !this.code.isEmpty();
1561        }
1562
1563        public boolean hasCode() { 
1564          return this.code != null && !this.code.isEmpty();
1565        }
1566
1567        /**
1568         * @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
1569         */
1570        public GraphDefinitionLinkTargetCompartmentComponent setCodeElement(Enumeration<CompartmentCode> value) { 
1571          this.code = value;
1572          return this;
1573        }
1574
1575        /**
1576         * @return Identifies the compartment.
1577         */
1578        public CompartmentCode getCode() { 
1579          return this.code == null ? null : this.code.getValue();
1580        }
1581
1582        /**
1583         * @param value Identifies the compartment.
1584         */
1585        public GraphDefinitionLinkTargetCompartmentComponent setCode(CompartmentCode value) { 
1586            if (this.code == null)
1587              this.code = new Enumeration<CompartmentCode>(new CompartmentCodeEnumFactory());
1588            this.code.setValue(value);
1589          return this;
1590        }
1591
1592        /**
1593         * @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
1594         */
1595        public Enumeration<GraphCompartmentRule> getRuleElement() { 
1596          if (this.rule == null)
1597            if (Configuration.errorOnAutoCreate())
1598              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.rule");
1599            else if (Configuration.doAutoCreate())
1600              this.rule = new Enumeration<GraphCompartmentRule>(new GraphCompartmentRuleEnumFactory()); // bb
1601          return this.rule;
1602        }
1603
1604        public boolean hasRuleElement() { 
1605          return this.rule != null && !this.rule.isEmpty();
1606        }
1607
1608        public boolean hasRule() { 
1609          return this.rule != null && !this.rule.isEmpty();
1610        }
1611
1612        /**
1613         * @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
1614         */
1615        public GraphDefinitionLinkTargetCompartmentComponent setRuleElement(Enumeration<GraphCompartmentRule> value) { 
1616          this.rule = value;
1617          return this;
1618        }
1619
1620        /**
1621         * @return identical | matching | different | no-rule | custom.
1622         */
1623        public GraphCompartmentRule getRule() { 
1624          return this.rule == null ? null : this.rule.getValue();
1625        }
1626
1627        /**
1628         * @param value identical | matching | different | no-rule | custom.
1629         */
1630        public GraphDefinitionLinkTargetCompartmentComponent setRule(GraphCompartmentRule value) { 
1631            if (this.rule == null)
1632              this.rule = new Enumeration<GraphCompartmentRule>(new GraphCompartmentRuleEnumFactory());
1633            this.rule.setValue(value);
1634          return this;
1635        }
1636
1637        /**
1638         * @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
1639         */
1640        public StringType getExpressionElement() { 
1641          if (this.expression == null)
1642            if (Configuration.errorOnAutoCreate())
1643              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.expression");
1644            else if (Configuration.doAutoCreate())
1645              this.expression = new StringType(); // bb
1646          return this.expression;
1647        }
1648
1649        public boolean hasExpressionElement() { 
1650          return this.expression != null && !this.expression.isEmpty();
1651        }
1652
1653        public boolean hasExpression() { 
1654          return this.expression != null && !this.expression.isEmpty();
1655        }
1656
1657        /**
1658         * @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
1659         */
1660        public GraphDefinitionLinkTargetCompartmentComponent setExpressionElement(StringType value) { 
1661          this.expression = value;
1662          return this;
1663        }
1664
1665        /**
1666         * @return Custom rule, as a FHIRPath expression.
1667         */
1668        public String getExpression() { 
1669          return this.expression == null ? null : this.expression.getValue();
1670        }
1671
1672        /**
1673         * @param value Custom rule, as a FHIRPath expression.
1674         */
1675        public GraphDefinitionLinkTargetCompartmentComponent setExpression(String value) { 
1676          if (Utilities.noString(value))
1677            this.expression = null;
1678          else {
1679            if (this.expression == null)
1680              this.expression = new StringType();
1681            this.expression.setValue(value);
1682          }
1683          return this;
1684        }
1685
1686        /**
1687         * @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
1688         */
1689        public StringType getDescriptionElement() { 
1690          if (this.description == null)
1691            if (Configuration.errorOnAutoCreate())
1692              throw new Error("Attempt to auto-create GraphDefinitionLinkTargetCompartmentComponent.description");
1693            else if (Configuration.doAutoCreate())
1694              this.description = new StringType(); // bb
1695          return this.description;
1696        }
1697
1698        public boolean hasDescriptionElement() { 
1699          return this.description != null && !this.description.isEmpty();
1700        }
1701
1702        public boolean hasDescription() { 
1703          return this.description != null && !this.description.isEmpty();
1704        }
1705
1706        /**
1707         * @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
1708         */
1709        public GraphDefinitionLinkTargetCompartmentComponent setDescriptionElement(StringType value) { 
1710          this.description = value;
1711          return this;
1712        }
1713
1714        /**
1715         * @return Documentation for FHIRPath expression.
1716         */
1717        public String getDescription() { 
1718          return this.description == null ? null : this.description.getValue();
1719        }
1720
1721        /**
1722         * @param value Documentation for FHIRPath expression.
1723         */
1724        public GraphDefinitionLinkTargetCompartmentComponent setDescription(String value) { 
1725          if (Utilities.noString(value))
1726            this.description = null;
1727          else {
1728            if (this.description == null)
1729              this.description = new StringType();
1730            this.description.setValue(value);
1731          }
1732          return this;
1733        }
1734
1735        protected void listChildren(List<Property> children) {
1736          super.listChildren(children);
1737          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));
1738          children.add(new Property("code", "code", "Identifies the compartment.", 0, 1, code));
1739          children.add(new Property("rule", "code", "identical | matching | different | no-rule | custom.", 0, 1, rule));
1740          children.add(new Property("expression", "string", "Custom rule, as a FHIRPath expression.", 0, 1, expression));
1741          children.add(new Property("description", "string", "Documentation for FHIRPath expression.", 0, 1, description));
1742        }
1743
1744        @Override
1745        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1746          switch (_hash) {
1747          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);
1748          case 3059181: /*code*/  return new Property("code", "code", "Identifies the compartment.", 0, 1, code);
1749          case 3512060: /*rule*/  return new Property("rule", "code", "identical | matching | different | no-rule | custom.", 0, 1, rule);
1750          case -1795452264: /*expression*/  return new Property("expression", "string", "Custom rule, as a FHIRPath expression.", 0, 1, expression);
1751          case -1724546052: /*description*/  return new Property("description", "string", "Documentation for FHIRPath expression.", 0, 1, description);
1752          default: return super.getNamedProperty(_hash, _name, _checkValid);
1753          }
1754
1755        }
1756
1757      @Override
1758      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1759        switch (hash) {
1760        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<GraphCompartmentUse>
1761        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<CompartmentCode>
1762        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : new Base[] {this.rule}; // Enumeration<GraphCompartmentRule>
1763        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
1764        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1765        default: return super.getProperty(hash, name, checkValid);
1766        }
1767
1768      }
1769
1770      @Override
1771      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1772        switch (hash) {
1773        case 116103: // use
1774          value = new GraphCompartmentUseEnumFactory().fromType(castToCode(value));
1775          this.use = (Enumeration) value; // Enumeration<GraphCompartmentUse>
1776          return value;
1777        case 3059181: // code
1778          value = new CompartmentCodeEnumFactory().fromType(castToCode(value));
1779          this.code = (Enumeration) value; // Enumeration<CompartmentCode>
1780          return value;
1781        case 3512060: // rule
1782          value = new GraphCompartmentRuleEnumFactory().fromType(castToCode(value));
1783          this.rule = (Enumeration) value; // Enumeration<GraphCompartmentRule>
1784          return value;
1785        case -1795452264: // expression
1786          this.expression = castToString(value); // StringType
1787          return value;
1788        case -1724546052: // description
1789          this.description = castToString(value); // StringType
1790          return value;
1791        default: return super.setProperty(hash, name, value);
1792        }
1793
1794      }
1795
1796      @Override
1797      public Base setProperty(String name, Base value) throws FHIRException {
1798        if (name.equals("use")) {
1799          value = new GraphCompartmentUseEnumFactory().fromType(castToCode(value));
1800          this.use = (Enumeration) value; // Enumeration<GraphCompartmentUse>
1801        } else if (name.equals("code")) {
1802          value = new CompartmentCodeEnumFactory().fromType(castToCode(value));
1803          this.code = (Enumeration) value; // Enumeration<CompartmentCode>
1804        } else if (name.equals("rule")) {
1805          value = new GraphCompartmentRuleEnumFactory().fromType(castToCode(value));
1806          this.rule = (Enumeration) value; // Enumeration<GraphCompartmentRule>
1807        } else if (name.equals("expression")) {
1808          this.expression = castToString(value); // StringType
1809        } else if (name.equals("description")) {
1810          this.description = castToString(value); // StringType
1811        } else
1812          return super.setProperty(name, value);
1813        return value;
1814      }
1815
1816      @Override
1817      public Base makeProperty(int hash, String name) throws FHIRException {
1818        switch (hash) {
1819        case 116103:  return getUseElement();
1820        case 3059181:  return getCodeElement();
1821        case 3512060:  return getRuleElement();
1822        case -1795452264:  return getExpressionElement();
1823        case -1724546052:  return getDescriptionElement();
1824        default: return super.makeProperty(hash, name);
1825        }
1826
1827      }
1828
1829      @Override
1830      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1831        switch (hash) {
1832        case 116103: /*use*/ return new String[] {"code"};
1833        case 3059181: /*code*/ return new String[] {"code"};
1834        case 3512060: /*rule*/ return new String[] {"code"};
1835        case -1795452264: /*expression*/ return new String[] {"string"};
1836        case -1724546052: /*description*/ return new String[] {"string"};
1837        default: return super.getTypesForProperty(hash, name);
1838        }
1839
1840      }
1841
1842      @Override
1843      public Base addChild(String name) throws FHIRException {
1844        if (name.equals("use")) {
1845          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.use");
1846        }
1847        else if (name.equals("code")) {
1848          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.code");
1849        }
1850        else if (name.equals("rule")) {
1851          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.rule");
1852        }
1853        else if (name.equals("expression")) {
1854          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.expression");
1855        }
1856        else if (name.equals("description")) {
1857          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.description");
1858        }
1859        else
1860          return super.addChild(name);
1861      }
1862
1863      public GraphDefinitionLinkTargetCompartmentComponent copy() {
1864        GraphDefinitionLinkTargetCompartmentComponent dst = new GraphDefinitionLinkTargetCompartmentComponent();
1865        copyValues(dst);
1866        dst.use = use == null ? null : use.copy();
1867        dst.code = code == null ? null : code.copy();
1868        dst.rule = rule == null ? null : rule.copy();
1869        dst.expression = expression == null ? null : expression.copy();
1870        dst.description = description == null ? null : description.copy();
1871        return dst;
1872      }
1873
1874      @Override
1875      public boolean equalsDeep(Base other_) {
1876        if (!super.equalsDeep(other_))
1877          return false;
1878        if (!(other_ instanceof GraphDefinitionLinkTargetCompartmentComponent))
1879          return false;
1880        GraphDefinitionLinkTargetCompartmentComponent o = (GraphDefinitionLinkTargetCompartmentComponent) other_;
1881        return compareDeep(use, o.use, true) && compareDeep(code, o.code, true) && compareDeep(rule, o.rule, true)
1882           && compareDeep(expression, o.expression, true) && compareDeep(description, o.description, true)
1883          ;
1884      }
1885
1886      @Override
1887      public boolean equalsShallow(Base other_) {
1888        if (!super.equalsShallow(other_))
1889          return false;
1890        if (!(other_ instanceof GraphDefinitionLinkTargetCompartmentComponent))
1891          return false;
1892        GraphDefinitionLinkTargetCompartmentComponent o = (GraphDefinitionLinkTargetCompartmentComponent) other_;
1893        return compareValues(use, o.use, true) && compareValues(code, o.code, true) && compareValues(rule, o.rule, true)
1894           && compareValues(expression, o.expression, true) && compareValues(description, o.description, true)
1895          ;
1896      }
1897
1898      public boolean isEmpty() {
1899        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, code, rule, expression
1900          , description);
1901      }
1902
1903  public String fhirType() {
1904    return "GraphDefinition.link.target.compartment";
1905
1906  }
1907
1908  }
1909
1910    /**
1911     * Explanation of why this graph definition is needed and why it has been designed as it has.
1912     */
1913    @Child(name = "purpose", type = {MarkdownType.class}, order=0, min=0, max=1, modifier=false, summary=false)
1914    @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." )
1915    protected MarkdownType purpose;
1916
1917    /**
1918     * The type of FHIR resource at which instances of this graph start.
1919     */
1920    @Child(name = "start", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1921    @Description(shortDefinition="Type of resource at which the graph starts", formalDefinition="The type of FHIR resource at which instances of this graph start." )
1922    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
1923    protected CodeType start;
1924
1925    /**
1926     * The profile that describes the use of the base resource.
1927     */
1928    @Child(name = "profile", type = {CanonicalType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1929    @Description(shortDefinition="Profile on base resource", formalDefinition="The profile that describes the use of the base resource." )
1930    protected CanonicalType profile;
1931
1932    /**
1933     * Links this graph makes rules about.
1934     */
1935    @Child(name = "link", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1936    @Description(shortDefinition="Links this graph makes rules about", formalDefinition="Links this graph makes rules about." )
1937    protected List<GraphDefinitionLinkComponent> link;
1938
1939    private static final long serialVersionUID = 1529157887L;
1940
1941  /**
1942   * Constructor
1943   */
1944    public GraphDefinition() {
1945      super();
1946    }
1947
1948  /**
1949   * Constructor
1950   */
1951    public GraphDefinition(StringType name, Enumeration<PublicationStatus> status, CodeType start) {
1952      super();
1953      this.name = name;
1954      this.status = status;
1955      this.start = start;
1956    }
1957
1958    /**
1959     * @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
1960     */
1961    public UriType getUrlElement() { 
1962      if (this.url == null)
1963        if (Configuration.errorOnAutoCreate())
1964          throw new Error("Attempt to auto-create GraphDefinition.url");
1965        else if (Configuration.doAutoCreate())
1966          this.url = new UriType(); // bb
1967      return this.url;
1968    }
1969
1970    public boolean hasUrlElement() { 
1971      return this.url != null && !this.url.isEmpty();
1972    }
1973
1974    public boolean hasUrl() { 
1975      return this.url != null && !this.url.isEmpty();
1976    }
1977
1978    /**
1979     * @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
1980     */
1981    public GraphDefinition setUrlElement(UriType value) { 
1982      this.url = value;
1983      return this;
1984    }
1985
1986    /**
1987     * @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.
1988     */
1989    public String getUrl() { 
1990      return this.url == null ? null : this.url.getValue();
1991    }
1992
1993    /**
1994     * @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.
1995     */
1996    public GraphDefinition setUrl(String value) { 
1997      if (Utilities.noString(value))
1998        this.url = null;
1999      else {
2000        if (this.url == null)
2001          this.url = new UriType();
2002        this.url.setValue(value);
2003      }
2004      return this;
2005    }
2006
2007    /**
2008     * @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
2009     */
2010    public StringType getVersionElement() { 
2011      if (this.version == null)
2012        if (Configuration.errorOnAutoCreate())
2013          throw new Error("Attempt to auto-create GraphDefinition.version");
2014        else if (Configuration.doAutoCreate())
2015          this.version = new StringType(); // bb
2016      return this.version;
2017    }
2018
2019    public boolean hasVersionElement() { 
2020      return this.version != null && !this.version.isEmpty();
2021    }
2022
2023    public boolean hasVersion() { 
2024      return this.version != null && !this.version.isEmpty();
2025    }
2026
2027    /**
2028     * @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
2029     */
2030    public GraphDefinition setVersionElement(StringType value) { 
2031      this.version = value;
2032      return this;
2033    }
2034
2035    /**
2036     * @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.
2037     */
2038    public String getVersion() { 
2039      return this.version == null ? null : this.version.getValue();
2040    }
2041
2042    /**
2043     * @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.
2044     */
2045    public GraphDefinition setVersion(String value) { 
2046      if (Utilities.noString(value))
2047        this.version = null;
2048      else {
2049        if (this.version == null)
2050          this.version = new StringType();
2051        this.version.setValue(value);
2052      }
2053      return this;
2054    }
2055
2056    /**
2057     * @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
2058     */
2059    public StringType getNameElement() { 
2060      if (this.name == null)
2061        if (Configuration.errorOnAutoCreate())
2062          throw new Error("Attempt to auto-create GraphDefinition.name");
2063        else if (Configuration.doAutoCreate())
2064          this.name = new StringType(); // bb
2065      return this.name;
2066    }
2067
2068    public boolean hasNameElement() { 
2069      return this.name != null && !this.name.isEmpty();
2070    }
2071
2072    public boolean hasName() { 
2073      return this.name != null && !this.name.isEmpty();
2074    }
2075
2076    /**
2077     * @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
2078     */
2079    public GraphDefinition setNameElement(StringType value) { 
2080      this.name = value;
2081      return this;
2082    }
2083
2084    /**
2085     * @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.
2086     */
2087    public String getName() { 
2088      return this.name == null ? null : this.name.getValue();
2089    }
2090
2091    /**
2092     * @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.
2093     */
2094    public GraphDefinition setName(String value) { 
2095        if (this.name == null)
2096          this.name = new StringType();
2097        this.name.setValue(value);
2098      return this;
2099    }
2100
2101    /**
2102     * @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
2103     */
2104    public Enumeration<PublicationStatus> getStatusElement() { 
2105      if (this.status == null)
2106        if (Configuration.errorOnAutoCreate())
2107          throw new Error("Attempt to auto-create GraphDefinition.status");
2108        else if (Configuration.doAutoCreate())
2109          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2110      return this.status;
2111    }
2112
2113    public boolean hasStatusElement() { 
2114      return this.status != null && !this.status.isEmpty();
2115    }
2116
2117    public boolean hasStatus() { 
2118      return this.status != null && !this.status.isEmpty();
2119    }
2120
2121    /**
2122     * @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
2123     */
2124    public GraphDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
2125      this.status = value;
2126      return this;
2127    }
2128
2129    /**
2130     * @return The status of this graph definition. Enables tracking the life-cycle of the content.
2131     */
2132    public PublicationStatus getStatus() { 
2133      return this.status == null ? null : this.status.getValue();
2134    }
2135
2136    /**
2137     * @param value The status of this graph definition. Enables tracking the life-cycle of the content.
2138     */
2139    public GraphDefinition setStatus(PublicationStatus value) { 
2140        if (this.status == null)
2141          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2142        this.status.setValue(value);
2143      return this;
2144    }
2145
2146    /**
2147     * @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
2148     */
2149    public BooleanType getExperimentalElement() { 
2150      if (this.experimental == null)
2151        if (Configuration.errorOnAutoCreate())
2152          throw new Error("Attempt to auto-create GraphDefinition.experimental");
2153        else if (Configuration.doAutoCreate())
2154          this.experimental = new BooleanType(); // bb
2155      return this.experimental;
2156    }
2157
2158    public boolean hasExperimentalElement() { 
2159      return this.experimental != null && !this.experimental.isEmpty();
2160    }
2161
2162    public boolean hasExperimental() { 
2163      return this.experimental != null && !this.experimental.isEmpty();
2164    }
2165
2166    /**
2167     * @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
2168     */
2169    public GraphDefinition setExperimentalElement(BooleanType value) { 
2170      this.experimental = value;
2171      return this;
2172    }
2173
2174    /**
2175     * @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.
2176     */
2177    public boolean getExperimental() { 
2178      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2179    }
2180
2181    /**
2182     * @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.
2183     */
2184    public GraphDefinition setExperimental(boolean value) { 
2185        if (this.experimental == null)
2186          this.experimental = new BooleanType();
2187        this.experimental.setValue(value);
2188      return this;
2189    }
2190
2191    /**
2192     * @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
2193     */
2194    public DateTimeType getDateElement() { 
2195      if (this.date == null)
2196        if (Configuration.errorOnAutoCreate())
2197          throw new Error("Attempt to auto-create GraphDefinition.date");
2198        else if (Configuration.doAutoCreate())
2199          this.date = new DateTimeType(); // bb
2200      return this.date;
2201    }
2202
2203    public boolean hasDateElement() { 
2204      return this.date != null && !this.date.isEmpty();
2205    }
2206
2207    public boolean hasDate() { 
2208      return this.date != null && !this.date.isEmpty();
2209    }
2210
2211    /**
2212     * @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
2213     */
2214    public GraphDefinition setDateElement(DateTimeType value) { 
2215      this.date = value;
2216      return this;
2217    }
2218
2219    /**
2220     * @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.
2221     */
2222    public Date getDate() { 
2223      return this.date == null ? null : this.date.getValue();
2224    }
2225
2226    /**
2227     * @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.
2228     */
2229    public GraphDefinition setDate(Date value) { 
2230      if (value == null)
2231        this.date = null;
2232      else {
2233        if (this.date == null)
2234          this.date = new DateTimeType();
2235        this.date.setValue(value);
2236      }
2237      return this;
2238    }
2239
2240    /**
2241     * @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
2242     */
2243    public StringType getPublisherElement() { 
2244      if (this.publisher == null)
2245        if (Configuration.errorOnAutoCreate())
2246          throw new Error("Attempt to auto-create GraphDefinition.publisher");
2247        else if (Configuration.doAutoCreate())
2248          this.publisher = new StringType(); // bb
2249      return this.publisher;
2250    }
2251
2252    public boolean hasPublisherElement() { 
2253      return this.publisher != null && !this.publisher.isEmpty();
2254    }
2255
2256    public boolean hasPublisher() { 
2257      return this.publisher != null && !this.publisher.isEmpty();
2258    }
2259
2260    /**
2261     * @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
2262     */
2263    public GraphDefinition setPublisherElement(StringType value) { 
2264      this.publisher = value;
2265      return this;
2266    }
2267
2268    /**
2269     * @return The name of the organization or individual that published the graph definition.
2270     */
2271    public String getPublisher() { 
2272      return this.publisher == null ? null : this.publisher.getValue();
2273    }
2274
2275    /**
2276     * @param value The name of the organization or individual that published the graph definition.
2277     */
2278    public GraphDefinition setPublisher(String value) { 
2279      if (Utilities.noString(value))
2280        this.publisher = null;
2281      else {
2282        if (this.publisher == null)
2283          this.publisher = new StringType();
2284        this.publisher.setValue(value);
2285      }
2286      return this;
2287    }
2288
2289    /**
2290     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
2291     */
2292    public List<ContactDetail> getContact() { 
2293      if (this.contact == null)
2294        this.contact = new ArrayList<ContactDetail>();
2295      return this.contact;
2296    }
2297
2298    /**
2299     * @return Returns a reference to <code>this</code> for easy method chaining
2300     */
2301    public GraphDefinition setContact(List<ContactDetail> theContact) { 
2302      this.contact = theContact;
2303      return this;
2304    }
2305
2306    public boolean hasContact() { 
2307      if (this.contact == null)
2308        return false;
2309      for (ContactDetail item : this.contact)
2310        if (!item.isEmpty())
2311          return true;
2312      return false;
2313    }
2314
2315    public ContactDetail addContact() { //3
2316      ContactDetail t = new ContactDetail();
2317      if (this.contact == null)
2318        this.contact = new ArrayList<ContactDetail>();
2319      this.contact.add(t);
2320      return t;
2321    }
2322
2323    public GraphDefinition addContact(ContactDetail t) { //3
2324      if (t == null)
2325        return this;
2326      if (this.contact == null)
2327        this.contact = new ArrayList<ContactDetail>();
2328      this.contact.add(t);
2329      return this;
2330    }
2331
2332    /**
2333     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
2334     */
2335    public ContactDetail getContactFirstRep() { 
2336      if (getContact().isEmpty()) {
2337        addContact();
2338      }
2339      return getContact().get(0);
2340    }
2341
2342    /**
2343     * @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
2344     */
2345    public MarkdownType getDescriptionElement() { 
2346      if (this.description == null)
2347        if (Configuration.errorOnAutoCreate())
2348          throw new Error("Attempt to auto-create GraphDefinition.description");
2349        else if (Configuration.doAutoCreate())
2350          this.description = new MarkdownType(); // bb
2351      return this.description;
2352    }
2353
2354    public boolean hasDescriptionElement() { 
2355      return this.description != null && !this.description.isEmpty();
2356    }
2357
2358    public boolean hasDescription() { 
2359      return this.description != null && !this.description.isEmpty();
2360    }
2361
2362    /**
2363     * @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
2364     */
2365    public GraphDefinition setDescriptionElement(MarkdownType value) { 
2366      this.description = value;
2367      return this;
2368    }
2369
2370    /**
2371     * @return A free text natural language description of the graph definition from a consumer's perspective.
2372     */
2373    public String getDescription() { 
2374      return this.description == null ? null : this.description.getValue();
2375    }
2376
2377    /**
2378     * @param value A free text natural language description of the graph definition from a consumer's perspective.
2379     */
2380    public GraphDefinition setDescription(String value) { 
2381      if (value == null)
2382        this.description = null;
2383      else {
2384        if (this.description == null)
2385          this.description = new MarkdownType();
2386        this.description.setValue(value);
2387      }
2388      return this;
2389    }
2390
2391    /**
2392     * @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.)
2393     */
2394    public List<UsageContext> getUseContext() { 
2395      if (this.useContext == null)
2396        this.useContext = new ArrayList<UsageContext>();
2397      return this.useContext;
2398    }
2399
2400    /**
2401     * @return Returns a reference to <code>this</code> for easy method chaining
2402     */
2403    public GraphDefinition setUseContext(List<UsageContext> theUseContext) { 
2404      this.useContext = theUseContext;
2405      return this;
2406    }
2407
2408    public boolean hasUseContext() { 
2409      if (this.useContext == null)
2410        return false;
2411      for (UsageContext item : this.useContext)
2412        if (!item.isEmpty())
2413          return true;
2414      return false;
2415    }
2416
2417    public UsageContext addUseContext() { //3
2418      UsageContext t = new UsageContext();
2419      if (this.useContext == null)
2420        this.useContext = new ArrayList<UsageContext>();
2421      this.useContext.add(t);
2422      return t;
2423    }
2424
2425    public GraphDefinition addUseContext(UsageContext t) { //3
2426      if (t == null)
2427        return this;
2428      if (this.useContext == null)
2429        this.useContext = new ArrayList<UsageContext>();
2430      this.useContext.add(t);
2431      return this;
2432    }
2433
2434    /**
2435     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
2436     */
2437    public UsageContext getUseContextFirstRep() { 
2438      if (getUseContext().isEmpty()) {
2439        addUseContext();
2440      }
2441      return getUseContext().get(0);
2442    }
2443
2444    /**
2445     * @return {@link #jurisdiction} (A legal or geographic region in which the graph definition is intended to be used.)
2446     */
2447    public List<CodeableConcept> getJurisdiction() { 
2448      if (this.jurisdiction == null)
2449        this.jurisdiction = new ArrayList<CodeableConcept>();
2450      return this.jurisdiction;
2451    }
2452
2453    /**
2454     * @return Returns a reference to <code>this</code> for easy method chaining
2455     */
2456    public GraphDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
2457      this.jurisdiction = theJurisdiction;
2458      return this;
2459    }
2460
2461    public boolean hasJurisdiction() { 
2462      if (this.jurisdiction == null)
2463        return false;
2464      for (CodeableConcept item : this.jurisdiction)
2465        if (!item.isEmpty())
2466          return true;
2467      return false;
2468    }
2469
2470    public CodeableConcept addJurisdiction() { //3
2471      CodeableConcept t = new CodeableConcept();
2472      if (this.jurisdiction == null)
2473        this.jurisdiction = new ArrayList<CodeableConcept>();
2474      this.jurisdiction.add(t);
2475      return t;
2476    }
2477
2478    public GraphDefinition addJurisdiction(CodeableConcept t) { //3
2479      if (t == null)
2480        return this;
2481      if (this.jurisdiction == null)
2482        this.jurisdiction = new ArrayList<CodeableConcept>();
2483      this.jurisdiction.add(t);
2484      return this;
2485    }
2486
2487    /**
2488     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
2489     */
2490    public CodeableConcept getJurisdictionFirstRep() { 
2491      if (getJurisdiction().isEmpty()) {
2492        addJurisdiction();
2493      }
2494      return getJurisdiction().get(0);
2495    }
2496
2497    /**
2498     * @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
2499     */
2500    public MarkdownType getPurposeElement() { 
2501      if (this.purpose == null)
2502        if (Configuration.errorOnAutoCreate())
2503          throw new Error("Attempt to auto-create GraphDefinition.purpose");
2504        else if (Configuration.doAutoCreate())
2505          this.purpose = new MarkdownType(); // bb
2506      return this.purpose;
2507    }
2508
2509    public boolean hasPurposeElement() { 
2510      return this.purpose != null && !this.purpose.isEmpty();
2511    }
2512
2513    public boolean hasPurpose() { 
2514      return this.purpose != null && !this.purpose.isEmpty();
2515    }
2516
2517    /**
2518     * @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
2519     */
2520    public GraphDefinition setPurposeElement(MarkdownType value) { 
2521      this.purpose = value;
2522      return this;
2523    }
2524
2525    /**
2526     * @return Explanation of why this graph definition is needed and why it has been designed as it has.
2527     */
2528    public String getPurpose() { 
2529      return this.purpose == null ? null : this.purpose.getValue();
2530    }
2531
2532    /**
2533     * @param value Explanation of why this graph definition is needed and why it has been designed as it has.
2534     */
2535    public GraphDefinition setPurpose(String value) { 
2536      if (value == null)
2537        this.purpose = null;
2538      else {
2539        if (this.purpose == null)
2540          this.purpose = new MarkdownType();
2541        this.purpose.setValue(value);
2542      }
2543      return this;
2544    }
2545
2546    /**
2547     * @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
2548     */
2549    public CodeType getStartElement() { 
2550      if (this.start == null)
2551        if (Configuration.errorOnAutoCreate())
2552          throw new Error("Attempt to auto-create GraphDefinition.start");
2553        else if (Configuration.doAutoCreate())
2554          this.start = new CodeType(); // bb
2555      return this.start;
2556    }
2557
2558    public boolean hasStartElement() { 
2559      return this.start != null && !this.start.isEmpty();
2560    }
2561
2562    public boolean hasStart() { 
2563      return this.start != null && !this.start.isEmpty();
2564    }
2565
2566    /**
2567     * @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
2568     */
2569    public GraphDefinition setStartElement(CodeType value) { 
2570      this.start = value;
2571      return this;
2572    }
2573
2574    /**
2575     * @return The type of FHIR resource at which instances of this graph start.
2576     */
2577    public String getStart() { 
2578      return this.start == null ? null : this.start.getValue();
2579    }
2580
2581    /**
2582     * @param value The type of FHIR resource at which instances of this graph start.
2583     */
2584    public GraphDefinition setStart(String value) { 
2585        if (this.start == null)
2586          this.start = new CodeType();
2587        this.start.setValue(value);
2588      return this;
2589    }
2590
2591    /**
2592     * @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
2593     */
2594    public CanonicalType getProfileElement() { 
2595      if (this.profile == null)
2596        if (Configuration.errorOnAutoCreate())
2597          throw new Error("Attempt to auto-create GraphDefinition.profile");
2598        else if (Configuration.doAutoCreate())
2599          this.profile = new CanonicalType(); // bb
2600      return this.profile;
2601    }
2602
2603    public boolean hasProfileElement() { 
2604      return this.profile != null && !this.profile.isEmpty();
2605    }
2606
2607    public boolean hasProfile() { 
2608      return this.profile != null && !this.profile.isEmpty();
2609    }
2610
2611    /**
2612     * @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
2613     */
2614    public GraphDefinition setProfileElement(CanonicalType value) { 
2615      this.profile = value;
2616      return this;
2617    }
2618
2619    /**
2620     * @return The profile that describes the use of the base resource.
2621     */
2622    public String getProfile() { 
2623      return this.profile == null ? null : this.profile.getValue();
2624    }
2625
2626    /**
2627     * @param value The profile that describes the use of the base resource.
2628     */
2629    public GraphDefinition setProfile(String value) { 
2630      if (Utilities.noString(value))
2631        this.profile = null;
2632      else {
2633        if (this.profile == null)
2634          this.profile = new CanonicalType();
2635        this.profile.setValue(value);
2636      }
2637      return this;
2638    }
2639
2640    /**
2641     * @return {@link #link} (Links this graph makes rules about.)
2642     */
2643    public List<GraphDefinitionLinkComponent> getLink() { 
2644      if (this.link == null)
2645        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2646      return this.link;
2647    }
2648
2649    /**
2650     * @return Returns a reference to <code>this</code> for easy method chaining
2651     */
2652    public GraphDefinition setLink(List<GraphDefinitionLinkComponent> theLink) { 
2653      this.link = theLink;
2654      return this;
2655    }
2656
2657    public boolean hasLink() { 
2658      if (this.link == null)
2659        return false;
2660      for (GraphDefinitionLinkComponent item : this.link)
2661        if (!item.isEmpty())
2662          return true;
2663      return false;
2664    }
2665
2666    public GraphDefinitionLinkComponent addLink() { //3
2667      GraphDefinitionLinkComponent t = new GraphDefinitionLinkComponent();
2668      if (this.link == null)
2669        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2670      this.link.add(t);
2671      return t;
2672    }
2673
2674    public GraphDefinition addLink(GraphDefinitionLinkComponent t) { //3
2675      if (t == null)
2676        return this;
2677      if (this.link == null)
2678        this.link = new ArrayList<GraphDefinitionLinkComponent>();
2679      this.link.add(t);
2680      return this;
2681    }
2682
2683    /**
2684     * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist
2685     */
2686    public GraphDefinitionLinkComponent getLinkFirstRep() { 
2687      if (getLink().isEmpty()) {
2688        addLink();
2689      }
2690      return getLink().get(0);
2691    }
2692
2693      protected void listChildren(List<Property> children) {
2694        super.listChildren(children);
2695        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));
2696        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));
2697        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));
2698        children.add(new Property("status", "code", "The status of this graph definition. Enables tracking the life-cycle of the content.", 0, 1, status));
2699        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));
2700        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));
2701        children.add(new Property("publisher", "string", "The name of the organization or individual that published the graph definition.", 0, 1, publisher));
2702        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));
2703        children.add(new Property("description", "markdown", "A free text natural language description of the graph definition from a consumer's perspective.", 0, 1, description));
2704        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));
2705        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));
2706        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));
2707        children.add(new Property("start", "code", "The type of FHIR resource at which instances of this graph start.", 0, 1, start));
2708        children.add(new Property("profile", "canonical(StructureDefinition)", "The profile that describes the use of the base resource.", 0, 1, profile));
2709        children.add(new Property("link", "", "Links this graph makes rules about.", 0, java.lang.Integer.MAX_VALUE, link));
2710      }
2711
2712      @Override
2713      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2714        switch (_hash) {
2715        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);
2716        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);
2717        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);
2718        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);
2719        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);
2720        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);
2721        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the graph definition.", 0, 1, publisher);
2722        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);
2723        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);
2724        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);
2725        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);
2726        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);
2727        case 109757538: /*start*/  return new Property("start", "code", "The type of FHIR resource at which instances of this graph start.", 0, 1, start);
2728        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "The profile that describes the use of the base resource.", 0, 1, profile);
2729        case 3321850: /*link*/  return new Property("link", "", "Links this graph makes rules about.", 0, java.lang.Integer.MAX_VALUE, link);
2730        default: return super.getNamedProperty(_hash, _name, _checkValid);
2731        }
2732
2733      }
2734
2735      @Override
2736      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2737        switch (hash) {
2738        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
2739        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
2740        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2741        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
2742        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
2743        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2744        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
2745        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
2746        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2747        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
2748        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
2749        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
2750        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // CodeType
2751        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType
2752        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // GraphDefinitionLinkComponent
2753        default: return super.getProperty(hash, name, checkValid);
2754        }
2755
2756      }
2757
2758      @Override
2759      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2760        switch (hash) {
2761        case 116079: // url
2762          this.url = castToUri(value); // UriType
2763          return value;
2764        case 351608024: // version
2765          this.version = castToString(value); // StringType
2766          return value;
2767        case 3373707: // name
2768          this.name = castToString(value); // StringType
2769          return value;
2770        case -892481550: // status
2771          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2772          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2773          return value;
2774        case -404562712: // experimental
2775          this.experimental = castToBoolean(value); // BooleanType
2776          return value;
2777        case 3076014: // date
2778          this.date = castToDateTime(value); // DateTimeType
2779          return value;
2780        case 1447404028: // publisher
2781          this.publisher = castToString(value); // StringType
2782          return value;
2783        case 951526432: // contact
2784          this.getContact().add(castToContactDetail(value)); // ContactDetail
2785          return value;
2786        case -1724546052: // description
2787          this.description = castToMarkdown(value); // MarkdownType
2788          return value;
2789        case -669707736: // useContext
2790          this.getUseContext().add(castToUsageContext(value)); // UsageContext
2791          return value;
2792        case -507075711: // jurisdiction
2793          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
2794          return value;
2795        case -220463842: // purpose
2796          this.purpose = castToMarkdown(value); // MarkdownType
2797          return value;
2798        case 109757538: // start
2799          this.start = castToCode(value); // CodeType
2800          return value;
2801        case -309425751: // profile
2802          this.profile = castToCanonical(value); // CanonicalType
2803          return value;
2804        case 3321850: // link
2805          this.getLink().add((GraphDefinitionLinkComponent) value); // GraphDefinitionLinkComponent
2806          return value;
2807        default: return super.setProperty(hash, name, value);
2808        }
2809
2810      }
2811
2812      @Override
2813      public Base setProperty(String name, Base value) throws FHIRException {
2814        if (name.equals("url")) {
2815          this.url = castToUri(value); // UriType
2816        } else if (name.equals("version")) {
2817          this.version = castToString(value); // StringType
2818        } else if (name.equals("name")) {
2819          this.name = castToString(value); // StringType
2820        } else if (name.equals("status")) {
2821          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2822          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2823        } else if (name.equals("experimental")) {
2824          this.experimental = castToBoolean(value); // BooleanType
2825        } else if (name.equals("date")) {
2826          this.date = castToDateTime(value); // DateTimeType
2827        } else if (name.equals("publisher")) {
2828          this.publisher = castToString(value); // StringType
2829        } else if (name.equals("contact")) {
2830          this.getContact().add(castToContactDetail(value));
2831        } else if (name.equals("description")) {
2832          this.description = castToMarkdown(value); // MarkdownType
2833        } else if (name.equals("useContext")) {
2834          this.getUseContext().add(castToUsageContext(value));
2835        } else if (name.equals("jurisdiction")) {
2836          this.getJurisdiction().add(castToCodeableConcept(value));
2837        } else if (name.equals("purpose")) {
2838          this.purpose = castToMarkdown(value); // MarkdownType
2839        } else if (name.equals("start")) {
2840          this.start = castToCode(value); // CodeType
2841        } else if (name.equals("profile")) {
2842          this.profile = castToCanonical(value); // CanonicalType
2843        } else if (name.equals("link")) {
2844          this.getLink().add((GraphDefinitionLinkComponent) value);
2845        } else
2846          return super.setProperty(name, value);
2847        return value;
2848      }
2849
2850      @Override
2851      public Base makeProperty(int hash, String name) throws FHIRException {
2852        switch (hash) {
2853        case 116079:  return getUrlElement();
2854        case 351608024:  return getVersionElement();
2855        case 3373707:  return getNameElement();
2856        case -892481550:  return getStatusElement();
2857        case -404562712:  return getExperimentalElement();
2858        case 3076014:  return getDateElement();
2859        case 1447404028:  return getPublisherElement();
2860        case 951526432:  return addContact(); 
2861        case -1724546052:  return getDescriptionElement();
2862        case -669707736:  return addUseContext(); 
2863        case -507075711:  return addJurisdiction(); 
2864        case -220463842:  return getPurposeElement();
2865        case 109757538:  return getStartElement();
2866        case -309425751:  return getProfileElement();
2867        case 3321850:  return addLink(); 
2868        default: return super.makeProperty(hash, name);
2869        }
2870
2871      }
2872
2873      @Override
2874      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2875        switch (hash) {
2876        case 116079: /*url*/ return new String[] {"uri"};
2877        case 351608024: /*version*/ return new String[] {"string"};
2878        case 3373707: /*name*/ return new String[] {"string"};
2879        case -892481550: /*status*/ return new String[] {"code"};
2880        case -404562712: /*experimental*/ return new String[] {"boolean"};
2881        case 3076014: /*date*/ return new String[] {"dateTime"};
2882        case 1447404028: /*publisher*/ return new String[] {"string"};
2883        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
2884        case -1724546052: /*description*/ return new String[] {"markdown"};
2885        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
2886        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
2887        case -220463842: /*purpose*/ return new String[] {"markdown"};
2888        case 109757538: /*start*/ return new String[] {"code"};
2889        case -309425751: /*profile*/ return new String[] {"canonical"};
2890        case 3321850: /*link*/ return new String[] {};
2891        default: return super.getTypesForProperty(hash, name);
2892        }
2893
2894      }
2895
2896      @Override
2897      public Base addChild(String name) throws FHIRException {
2898        if (name.equals("url")) {
2899          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.url");
2900        }
2901        else if (name.equals("version")) {
2902          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.version");
2903        }
2904        else if (name.equals("name")) {
2905          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.name");
2906        }
2907        else if (name.equals("status")) {
2908          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.status");
2909        }
2910        else if (name.equals("experimental")) {
2911          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.experimental");
2912        }
2913        else if (name.equals("date")) {
2914          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.date");
2915        }
2916        else if (name.equals("publisher")) {
2917          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.publisher");
2918        }
2919        else if (name.equals("contact")) {
2920          return addContact();
2921        }
2922        else if (name.equals("description")) {
2923          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.description");
2924        }
2925        else if (name.equals("useContext")) {
2926          return addUseContext();
2927        }
2928        else if (name.equals("jurisdiction")) {
2929          return addJurisdiction();
2930        }
2931        else if (name.equals("purpose")) {
2932          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.purpose");
2933        }
2934        else if (name.equals("start")) {
2935          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.start");
2936        }
2937        else if (name.equals("profile")) {
2938          throw new FHIRException("Cannot call addChild on a primitive type GraphDefinition.profile");
2939        }
2940        else if (name.equals("link")) {
2941          return addLink();
2942        }
2943        else
2944          return super.addChild(name);
2945      }
2946
2947  public String fhirType() {
2948    return "GraphDefinition";
2949
2950  }
2951
2952      public GraphDefinition copy() {
2953        GraphDefinition dst = new GraphDefinition();
2954        copyValues(dst);
2955        dst.url = url == null ? null : url.copy();
2956        dst.version = version == null ? null : version.copy();
2957        dst.name = name == null ? null : name.copy();
2958        dst.status = status == null ? null : status.copy();
2959        dst.experimental = experimental == null ? null : experimental.copy();
2960        dst.date = date == null ? null : date.copy();
2961        dst.publisher = publisher == null ? null : publisher.copy();
2962        if (contact != null) {
2963          dst.contact = new ArrayList<ContactDetail>();
2964          for (ContactDetail i : contact)
2965            dst.contact.add(i.copy());
2966        };
2967        dst.description = description == null ? null : description.copy();
2968        if (useContext != null) {
2969          dst.useContext = new ArrayList<UsageContext>();
2970          for (UsageContext i : useContext)
2971            dst.useContext.add(i.copy());
2972        };
2973        if (jurisdiction != null) {
2974          dst.jurisdiction = new ArrayList<CodeableConcept>();
2975          for (CodeableConcept i : jurisdiction)
2976            dst.jurisdiction.add(i.copy());
2977        };
2978        dst.purpose = purpose == null ? null : purpose.copy();
2979        dst.start = start == null ? null : start.copy();
2980        dst.profile = profile == null ? null : profile.copy();
2981        if (link != null) {
2982          dst.link = new ArrayList<GraphDefinitionLinkComponent>();
2983          for (GraphDefinitionLinkComponent i : link)
2984            dst.link.add(i.copy());
2985        };
2986        return dst;
2987      }
2988
2989      protected GraphDefinition typedCopy() {
2990        return copy();
2991      }
2992
2993      @Override
2994      public boolean equalsDeep(Base other_) {
2995        if (!super.equalsDeep(other_))
2996          return false;
2997        if (!(other_ instanceof GraphDefinition))
2998          return false;
2999        GraphDefinition o = (GraphDefinition) other_;
3000        return compareDeep(purpose, o.purpose, true) && compareDeep(start, o.start, true) && compareDeep(profile, o.profile, true)
3001           && compareDeep(link, o.link, true);
3002      }
3003
3004      @Override
3005      public boolean equalsShallow(Base other_) {
3006        if (!super.equalsShallow(other_))
3007          return false;
3008        if (!(other_ instanceof GraphDefinition))
3009          return false;
3010        GraphDefinition o = (GraphDefinition) other_;
3011        return compareValues(purpose, o.purpose, true) && compareValues(start, o.start, true);
3012      }
3013
3014      public boolean isEmpty() {
3015        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(purpose, start, profile
3016          , link);
3017      }
3018
3019  @Override
3020  public ResourceType getResourceType() {
3021    return ResourceType.GraphDefinition;
3022   }
3023
3024 /**
3025   * Search parameter: <b>date</b>
3026   * <p>
3027   * Description: <b>The graph definition publication date</b><br>
3028   * Type: <b>date</b><br>
3029   * Path: <b>GraphDefinition.date</b><br>
3030   * </p>
3031   */
3032  @SearchParamDefinition(name="date", path="GraphDefinition.date", description="The graph definition publication date", type="date" )
3033  public static final String SP_DATE = "date";
3034 /**
3035   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3036   * <p>
3037   * Description: <b>The graph definition publication date</b><br>
3038   * Type: <b>date</b><br>
3039   * Path: <b>GraphDefinition.date</b><br>
3040   * </p>
3041   */
3042  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3043
3044 /**
3045   * Search parameter: <b>context-type-value</b>
3046   * <p>
3047   * Description: <b>A use context type and value assigned to the graph definition</b><br>
3048   * Type: <b>composite</b><br>
3049   * Path: <b></b><br>
3050   * </p>
3051   */
3052  @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"} )
3053  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
3054 /**
3055   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
3056   * <p>
3057   * Description: <b>A use context type and value assigned to the graph definition</b><br>
3058   * Type: <b>composite</b><br>
3059   * Path: <b></b><br>
3060   * </p>
3061   */
3062  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);
3063
3064 /**
3065   * Search parameter: <b>jurisdiction</b>
3066   * <p>
3067   * Description: <b>Intended jurisdiction for the graph definition</b><br>
3068   * Type: <b>token</b><br>
3069   * Path: <b>GraphDefinition.jurisdiction</b><br>
3070   * </p>
3071   */
3072  @SearchParamDefinition(name="jurisdiction", path="GraphDefinition.jurisdiction", description="Intended jurisdiction for the graph definition", type="token" )
3073  public static final String SP_JURISDICTION = "jurisdiction";
3074 /**
3075   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
3076   * <p>
3077   * Description: <b>Intended jurisdiction for the graph definition</b><br>
3078   * Type: <b>token</b><br>
3079   * Path: <b>GraphDefinition.jurisdiction</b><br>
3080   * </p>
3081   */
3082  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
3083
3084 /**
3085   * Search parameter: <b>start</b>
3086   * <p>
3087   * Description: <b>Type of resource at which the graph starts</b><br>
3088   * Type: <b>token</b><br>
3089   * Path: <b>GraphDefinition.start</b><br>
3090   * </p>
3091   */
3092  @SearchParamDefinition(name="start", path="GraphDefinition.start", description="Type of resource at which the graph starts", type="token" )
3093  public static final String SP_START = "start";
3094 /**
3095   * <b>Fluent Client</b> search parameter constant for <b>start</b>
3096   * <p>
3097   * Description: <b>Type of resource at which the graph starts</b><br>
3098   * Type: <b>token</b><br>
3099   * Path: <b>GraphDefinition.start</b><br>
3100   * </p>
3101   */
3102  public static final ca.uhn.fhir.rest.gclient.TokenClientParam START = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_START);
3103
3104 /**
3105   * Search parameter: <b>description</b>
3106   * <p>
3107   * Description: <b>The description of the graph definition</b><br>
3108   * Type: <b>string</b><br>
3109   * Path: <b>GraphDefinition.description</b><br>
3110   * </p>
3111   */
3112  @SearchParamDefinition(name="description", path="GraphDefinition.description", description="The description of the graph definition", type="string" )
3113  public static final String SP_DESCRIPTION = "description";
3114 /**
3115   * <b>Fluent Client</b> search parameter constant for <b>description</b>
3116   * <p>
3117   * Description: <b>The description of the graph definition</b><br>
3118   * Type: <b>string</b><br>
3119   * Path: <b>GraphDefinition.description</b><br>
3120   * </p>
3121   */
3122  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
3123
3124 /**
3125   * Search parameter: <b>context-type</b>
3126   * <p>
3127   * Description: <b>A type of use context assigned to the graph definition</b><br>
3128   * Type: <b>token</b><br>
3129   * Path: <b>GraphDefinition.useContext.code</b><br>
3130   * </p>
3131   */
3132  @SearchParamDefinition(name="context-type", path="GraphDefinition.useContext.code", description="A type of use context assigned to the graph definition", type="token" )
3133  public static final String SP_CONTEXT_TYPE = "context-type";
3134 /**
3135   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
3136   * <p>
3137   * Description: <b>A type of use context assigned to the graph definition</b><br>
3138   * Type: <b>token</b><br>
3139   * Path: <b>GraphDefinition.useContext.code</b><br>
3140   * </p>
3141   */
3142  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
3143
3144 /**
3145   * Search parameter: <b>version</b>
3146   * <p>
3147   * Description: <b>The business version of the graph definition</b><br>
3148   * Type: <b>token</b><br>
3149   * Path: <b>GraphDefinition.version</b><br>
3150   * </p>
3151   */
3152  @SearchParamDefinition(name="version", path="GraphDefinition.version", description="The business version of the graph definition", type="token" )
3153  public static final String SP_VERSION = "version";
3154 /**
3155   * <b>Fluent Client</b> search parameter constant for <b>version</b>
3156   * <p>
3157   * Description: <b>The business version of the graph definition</b><br>
3158   * Type: <b>token</b><br>
3159   * Path: <b>GraphDefinition.version</b><br>
3160   * </p>
3161   */
3162  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
3163
3164 /**
3165   * Search parameter: <b>url</b>
3166   * <p>
3167   * Description: <b>The uri that identifies the graph definition</b><br>
3168   * Type: <b>uri</b><br>
3169   * Path: <b>GraphDefinition.url</b><br>
3170   * </p>
3171   */
3172  @SearchParamDefinition(name="url", path="GraphDefinition.url", description="The uri that identifies the graph definition", type="uri" )
3173  public static final String SP_URL = "url";
3174 /**
3175   * <b>Fluent Client</b> search parameter constant for <b>url</b>
3176   * <p>
3177   * Description: <b>The uri that identifies the graph definition</b><br>
3178   * Type: <b>uri</b><br>
3179   * Path: <b>GraphDefinition.url</b><br>
3180   * </p>
3181   */
3182  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
3183
3184 /**
3185   * Search parameter: <b>context-quantity</b>
3186   * <p>
3187   * Description: <b>A quantity- or range-valued use context assigned to the graph definition</b><br>
3188   * Type: <b>quantity</b><br>
3189   * Path: <b>GraphDefinition.useContext.valueQuantity, GraphDefinition.useContext.valueRange</b><br>
3190   * </p>
3191   */
3192  @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" )
3193  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
3194 /**
3195   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
3196   * <p>
3197   * Description: <b>A quantity- or range-valued use context assigned to the graph definition</b><br>
3198   * Type: <b>quantity</b><br>
3199   * Path: <b>GraphDefinition.useContext.valueQuantity, GraphDefinition.useContext.valueRange</b><br>
3200   * </p>
3201   */
3202  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
3203
3204 /**
3205   * Search parameter: <b>name</b>
3206   * <p>
3207   * Description: <b>Computationally friendly name of the graph definition</b><br>
3208   * Type: <b>string</b><br>
3209   * Path: <b>GraphDefinition.name</b><br>
3210   * </p>
3211   */
3212  @SearchParamDefinition(name="name", path="GraphDefinition.name", description="Computationally friendly name of the graph definition", type="string" )
3213  public static final String SP_NAME = "name";
3214 /**
3215   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3216   * <p>
3217   * Description: <b>Computationally friendly name of the graph definition</b><br>
3218   * Type: <b>string</b><br>
3219   * Path: <b>GraphDefinition.name</b><br>
3220   * </p>
3221   */
3222  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
3223
3224 /**
3225   * Search parameter: <b>context</b>
3226   * <p>
3227   * Description: <b>A use context assigned to the graph definition</b><br>
3228   * Type: <b>token</b><br>
3229   * Path: <b>GraphDefinition.useContext.valueCodeableConcept</b><br>
3230   * </p>
3231   */
3232  @SearchParamDefinition(name="context", path="(GraphDefinition.useContext.value as CodeableConcept)", description="A use context assigned to the graph definition", type="token" )
3233  public static final String SP_CONTEXT = "context";
3234 /**
3235   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3236   * <p>
3237   * Description: <b>A use context assigned to the graph definition</b><br>
3238   * Type: <b>token</b><br>
3239   * Path: <b>GraphDefinition.useContext.valueCodeableConcept</b><br>
3240   * </p>
3241   */
3242  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
3243
3244 /**
3245   * Search parameter: <b>publisher</b>
3246   * <p>
3247   * Description: <b>Name of the publisher of the graph definition</b><br>
3248   * Type: <b>string</b><br>
3249   * Path: <b>GraphDefinition.publisher</b><br>
3250   * </p>
3251   */
3252  @SearchParamDefinition(name="publisher", path="GraphDefinition.publisher", description="Name of the publisher of the graph definition", type="string" )
3253  public static final String SP_PUBLISHER = "publisher";
3254 /**
3255   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
3256   * <p>
3257   * Description: <b>Name of the publisher of the graph definition</b><br>
3258   * Type: <b>string</b><br>
3259   * Path: <b>GraphDefinition.publisher</b><br>
3260   * </p>
3261   */
3262  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
3263
3264 /**
3265   * Search parameter: <b>context-type-quantity</b>
3266   * <p>
3267   * Description: <b>A use context type and quantity- or range-based value assigned to the graph definition</b><br>
3268   * Type: <b>composite</b><br>
3269   * Path: <b></b><br>
3270   * </p>
3271   */
3272  @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"} )
3273  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
3274 /**
3275   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
3276   * <p>
3277   * Description: <b>A use context type and quantity- or range-based value assigned to the graph definition</b><br>
3278   * Type: <b>composite</b><br>
3279   * Path: <b></b><br>
3280   * </p>
3281   */
3282  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);
3283
3284 /**
3285   * Search parameter: <b>status</b>
3286   * <p>
3287   * Description: <b>The current status of the graph definition</b><br>
3288   * Type: <b>token</b><br>
3289   * Path: <b>GraphDefinition.status</b><br>
3290   * </p>
3291   */
3292  @SearchParamDefinition(name="status", path="GraphDefinition.status", description="The current status of the graph definition", type="token" )
3293  public static final String SP_STATUS = "status";
3294 /**
3295   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3296   * <p>
3297   * Description: <b>The current status of the graph definition</b><br>
3298   * Type: <b>token</b><br>
3299   * Path: <b>GraphDefinition.status</b><br>
3300   * </p>
3301   */
3302  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3303
3304
3305}
3306