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