001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus;
038import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory;
039import ca.uhn.fhir.model.api.annotation.Block;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import org.hl7.fhir.exceptions.FHIRException;
046import org.hl7.fhir.utilities.Utilities;
047
048/**
049 * A definition of a FHIR structure. This resource is used to describe the
050 * underlying resources, data types defined in FHIR, and also for describing
051 * extensions, and constraints on resources and data types.
052 */
053@ResourceDef(name = "StructureDefinition", profile = "http://hl7.org/fhir/Profile/StructureDefinition")
054public class StructureDefinition extends DomainResource {
055
056  public enum StructureDefinitionKind {
057    /**
058     * A data type - either a primitive or complex structure that defines a set of
059     * data elements. These can be used throughout Resource and extension
060     * definitions.
061     */
062    DATATYPE,
063    /**
064     * A resource defined by the FHIR specification.
065     */
066    RESOURCE,
067    /**
068     * A logical model - a conceptual package of data that will be mapped to
069     * resources for implementation.
070     */
071    LOGICAL,
072    /**
073     * added to help the parsers
074     */
075    NULL;
076
077    public static StructureDefinitionKind fromCode(String codeString) throws FHIRException {
078      if (codeString == null || "".equals(codeString))
079        return null;
080      if ("datatype".equals(codeString))
081        return DATATYPE;
082      if ("resource".equals(codeString))
083        return RESOURCE;
084      if ("logical".equals(codeString))
085        return LOGICAL;
086      throw new FHIRException("Unknown StructureDefinitionKind code '" + codeString + "'");
087    }
088
089    public String toCode() {
090      switch (this) {
091      case DATATYPE:
092        return "datatype";
093      case RESOURCE:
094        return "resource";
095      case LOGICAL:
096        return "logical";
097      case NULL:
098        return null;
099      default:
100        return "?";
101      }
102    }
103
104    public String getSystem() {
105      switch (this) {
106      case DATATYPE:
107        return "http://hl7.org/fhir/structure-definition-kind";
108      case RESOURCE:
109        return "http://hl7.org/fhir/structure-definition-kind";
110      case LOGICAL:
111        return "http://hl7.org/fhir/structure-definition-kind";
112      case NULL:
113        return null;
114      default:
115        return "?";
116      }
117    }
118
119    public String getDefinition() {
120      switch (this) {
121      case DATATYPE:
122        return "A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions.";
123      case RESOURCE:
124        return "A resource defined by the FHIR specification.";
125      case LOGICAL:
126        return "A logical model - a conceptual package of data that will be mapped to resources for implementation.";
127      case NULL:
128        return null;
129      default:
130        return "?";
131      }
132    }
133
134    public String getDisplay() {
135      switch (this) {
136      case DATATYPE:
137        return "Data Type";
138      case RESOURCE:
139        return "Resource";
140      case LOGICAL:
141        return "Logical Model";
142      case NULL:
143        return null;
144      default:
145        return "?";
146      }
147    }
148  }
149
150  public static class StructureDefinitionKindEnumFactory implements EnumFactory<StructureDefinitionKind> {
151    public StructureDefinitionKind fromCode(String codeString) throws IllegalArgumentException {
152      if (codeString == null || "".equals(codeString))
153        if (codeString == null || "".equals(codeString))
154          return null;
155      if ("datatype".equals(codeString))
156        return StructureDefinitionKind.DATATYPE;
157      if ("resource".equals(codeString))
158        return StructureDefinitionKind.RESOURCE;
159      if ("logical".equals(codeString))
160        return StructureDefinitionKind.LOGICAL;
161      throw new IllegalArgumentException("Unknown StructureDefinitionKind code '" + codeString + "'");
162    }
163
164    public Enumeration<StructureDefinitionKind> fromType(Base code) throws FHIRException {
165      if (code == null || code.isEmpty())
166        return null;
167      String codeString = ((PrimitiveType) code).asStringValue();
168      if (codeString == null || "".equals(codeString))
169        return null;
170      if ("datatype".equals(codeString))
171        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.DATATYPE);
172      if ("resource".equals(codeString))
173        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.RESOURCE);
174      if ("logical".equals(codeString))
175        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.LOGICAL);
176      throw new FHIRException("Unknown StructureDefinitionKind code '" + codeString + "'");
177    }
178
179    public String toCode(StructureDefinitionKind code) {
180      if (code == StructureDefinitionKind.DATATYPE)
181        return "datatype";
182      if (code == StructureDefinitionKind.RESOURCE)
183        return "resource";
184      if (code == StructureDefinitionKind.LOGICAL)
185        return "logical";
186      return "?";
187    }
188  }
189
190  public enum ExtensionContext {
191    /**
192     * The context is all elements matching a particular resource element path.
193     */
194    RESOURCE,
195    /**
196     * The context is all nodes matching a particular data type element path (root
197     * or repeating element) or all elements referencing a particular primitive data
198     * type (expressed as the datatype name).
199     */
200    DATATYPE,
201    /**
202     * The context is all nodes whose mapping to a specified reference model
203     * corresponds to a particular mapping structure. The context identifies the
204     * mapping target. The mapping should clearly identify where such an extension
205     * could be used.
206     */
207    MAPPING,
208    /**
209     * The context is a particular extension from a particular profile, a uri that
210     * identifies the extension definition.
211     */
212    EXTENSION,
213    /**
214     * added to help the parsers
215     */
216    NULL;
217
218    public static ExtensionContext fromCode(String codeString) throws FHIRException {
219      if (codeString == null || "".equals(codeString))
220        return null;
221      if ("resource".equals(codeString))
222        return RESOURCE;
223      if ("datatype".equals(codeString))
224        return DATATYPE;
225      if ("mapping".equals(codeString))
226        return MAPPING;
227      if ("extension".equals(codeString))
228        return EXTENSION;
229      throw new FHIRException("Unknown ExtensionContext code '" + codeString + "'");
230    }
231
232    public String toCode() {
233      switch (this) {
234      case RESOURCE:
235        return "resource";
236      case DATATYPE:
237        return "datatype";
238      case MAPPING:
239        return "mapping";
240      case EXTENSION:
241        return "extension";
242      case NULL:
243        return null;
244      default:
245        return "?";
246      }
247    }
248
249    public String getSystem() {
250      switch (this) {
251      case RESOURCE:
252        return "http://hl7.org/fhir/extension-context";
253      case DATATYPE:
254        return "http://hl7.org/fhir/extension-context";
255      case MAPPING:
256        return "http://hl7.org/fhir/extension-context";
257      case EXTENSION:
258        return "http://hl7.org/fhir/extension-context";
259      case NULL:
260        return null;
261      default:
262        return "?";
263      }
264    }
265
266    public String getDefinition() {
267      switch (this) {
268      case RESOURCE:
269        return "The context is all elements matching a particular resource element path.";
270      case DATATYPE:
271        return "The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).";
272      case MAPPING:
273        return "The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.";
274      case EXTENSION:
275        return "The context is a particular extension from a particular profile, a uri that identifies the extension definition.";
276      case NULL:
277        return null;
278      default:
279        return "?";
280      }
281    }
282
283    public String getDisplay() {
284      switch (this) {
285      case RESOURCE:
286        return "Resource";
287      case DATATYPE:
288        return "Datatype";
289      case MAPPING:
290        return "Mapping";
291      case EXTENSION:
292        return "Extension";
293      case NULL:
294        return null;
295      default:
296        return "?";
297      }
298    }
299  }
300
301  public static class ExtensionContextEnumFactory implements EnumFactory<ExtensionContext> {
302    public ExtensionContext fromCode(String codeString) throws IllegalArgumentException {
303      if (codeString == null || "".equals(codeString))
304        if (codeString == null || "".equals(codeString))
305          return null;
306      if ("resource".equals(codeString))
307        return ExtensionContext.RESOURCE;
308      if ("datatype".equals(codeString))
309        return ExtensionContext.DATATYPE;
310      if ("mapping".equals(codeString))
311        return ExtensionContext.MAPPING;
312      if ("extension".equals(codeString))
313        return ExtensionContext.EXTENSION;
314      throw new IllegalArgumentException("Unknown ExtensionContext code '" + codeString + "'");
315    }
316
317    public Enumeration<ExtensionContext> fromType(Base code) throws FHIRException {
318      if (code == null || code.isEmpty())
319        return null;
320      String codeString = ((PrimitiveType) code).asStringValue();
321      if (codeString == null || "".equals(codeString))
322        return null;
323      if ("resource".equals(codeString))
324        return new Enumeration<ExtensionContext>(this, ExtensionContext.RESOURCE);
325      if ("datatype".equals(codeString))
326        return new Enumeration<ExtensionContext>(this, ExtensionContext.DATATYPE);
327      if ("mapping".equals(codeString))
328        return new Enumeration<ExtensionContext>(this, ExtensionContext.MAPPING);
329      if ("extension".equals(codeString))
330        return new Enumeration<ExtensionContext>(this, ExtensionContext.EXTENSION);
331      throw new FHIRException("Unknown ExtensionContext code '" + codeString + "'");
332    }
333
334    public String toCode(ExtensionContext code) {
335      if (code == ExtensionContext.RESOURCE)
336        return "resource";
337      if (code == ExtensionContext.DATATYPE)
338        return "datatype";
339      if (code == ExtensionContext.MAPPING)
340        return "mapping";
341      if (code == ExtensionContext.EXTENSION)
342        return "extension";
343      return "?";
344    }
345  }
346
347  @Block()
348  public static class StructureDefinitionContactComponent extends BackboneElement implements IBaseBackboneElement {
349    /**
350     * The name of an individual to contact regarding the structure definition.
351     */
352    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
353    @Description(shortDefinition = "Name of a individual to contact", formalDefinition = "The name of an individual to contact regarding the structure definition.")
354    protected StringType name;
355
356    /**
357     * Contact details for individual (if a name was provided) or the publisher.
358     */
359    @Child(name = "telecom", type = {
360        ContactPoint.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
361    @Description(shortDefinition = "Contact details for individual or publisher", formalDefinition = "Contact details for individual (if a name was provided) or the publisher.")
362    protected List<ContactPoint> telecom;
363
364    private static final long serialVersionUID = -1179697803L;
365
366    /*
367     * Constructor
368     */
369    public StructureDefinitionContactComponent() {
370      super();
371    }
372
373    /**
374     * @return {@link #name} (The name of an individual to contact regarding the
375     *         structure definition.). This is the underlying object with id, value
376     *         and extensions. The accessor "getName" gives direct access to the
377     *         value
378     */
379    public StringType getNameElement() {
380      if (this.name == null)
381        if (Configuration.errorOnAutoCreate())
382          throw new Error("Attempt to auto-create StructureDefinitionContactComponent.name");
383        else if (Configuration.doAutoCreate())
384          this.name = new StringType(); // bb
385      return this.name;
386    }
387
388    public boolean hasNameElement() {
389      return this.name != null && !this.name.isEmpty();
390    }
391
392    public boolean hasName() {
393      return this.name != null && !this.name.isEmpty();
394    }
395
396    /**
397     * @param value {@link #name} (The name of an individual to contact regarding
398     *              the structure definition.). This is the underlying object with
399     *              id, value and extensions. The accessor "getName" gives direct
400     *              access to the value
401     */
402    public StructureDefinitionContactComponent setNameElement(StringType value) {
403      this.name = value;
404      return this;
405    }
406
407    /**
408     * @return The name of an individual to contact regarding the structure
409     *         definition.
410     */
411    public String getName() {
412      return this.name == null ? null : this.name.getValue();
413    }
414
415    /**
416     * @param value The name of an individual to contact regarding the structure
417     *              definition.
418     */
419    public StructureDefinitionContactComponent setName(String value) {
420      if (Utilities.noString(value))
421        this.name = null;
422      else {
423        if (this.name == null)
424          this.name = new StringType();
425        this.name.setValue(value);
426      }
427      return this;
428    }
429
430    /**
431     * @return {@link #telecom} (Contact details for individual (if a name was
432     *         provided) or the publisher.)
433     */
434    public List<ContactPoint> getTelecom() {
435      if (this.telecom == null)
436        this.telecom = new ArrayList<ContactPoint>();
437      return this.telecom;
438    }
439
440    public boolean hasTelecom() {
441      if (this.telecom == null)
442        return false;
443      for (ContactPoint item : this.telecom)
444        if (!item.isEmpty())
445          return true;
446      return false;
447    }
448
449    /**
450     * @return {@link #telecom} (Contact details for individual (if a name was
451     *         provided) or the publisher.)
452     */
453    // syntactic sugar
454    public ContactPoint addTelecom() { // 3
455      ContactPoint t = new ContactPoint();
456      if (this.telecom == null)
457        this.telecom = new ArrayList<ContactPoint>();
458      this.telecom.add(t);
459      return t;
460    }
461
462    // syntactic sugar
463    public StructureDefinitionContactComponent addTelecom(ContactPoint t) { // 3
464      if (t == null)
465        return this;
466      if (this.telecom == null)
467        this.telecom = new ArrayList<ContactPoint>();
468      this.telecom.add(t);
469      return this;
470    }
471
472    protected void listChildren(List<Property> childrenList) {
473      super.listChildren(childrenList);
474      childrenList.add(
475          new Property("name", "string", "The name of an individual to contact regarding the structure definition.", 0,
476              java.lang.Integer.MAX_VALUE, name));
477      childrenList.add(new Property("telecom", "ContactPoint",
478          "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE,
479          telecom));
480    }
481
482    @Override
483    public void setProperty(String name, Base value) throws FHIRException {
484      if (name.equals("name"))
485        this.name = castToString(value); // StringType
486      else if (name.equals("telecom"))
487        this.getTelecom().add(castToContactPoint(value));
488      else
489        super.setProperty(name, value);
490    }
491
492    @Override
493    public Base addChild(String name) throws FHIRException {
494      if (name.equals("name")) {
495        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.name");
496      } else if (name.equals("telecom")) {
497        return addTelecom();
498      } else
499        return super.addChild(name);
500    }
501
502    public StructureDefinitionContactComponent copy() {
503      StructureDefinitionContactComponent dst = new StructureDefinitionContactComponent();
504      copyValues(dst);
505      dst.name = name == null ? null : name.copy();
506      if (telecom != null) {
507        dst.telecom = new ArrayList<ContactPoint>();
508        for (ContactPoint i : telecom)
509          dst.telecom.add(i.copy());
510      }
511      ;
512      return dst;
513    }
514
515    @Override
516    public boolean equalsDeep(Base other) {
517      if (!super.equalsDeep(other))
518        return false;
519      if (!(other instanceof StructureDefinitionContactComponent))
520        return false;
521      StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
522      return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
523    }
524
525    @Override
526    public boolean equalsShallow(Base other) {
527      if (!super.equalsShallow(other))
528        return false;
529      if (!(other instanceof StructureDefinitionContactComponent))
530        return false;
531      StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
532      return compareValues(name, o.name, true);
533    }
534
535    public boolean isEmpty() {
536      return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty());
537    }
538
539    public String fhirType() {
540      return "StructureDefinition.contact";
541
542    }
543
544  }
545
546  @Block()
547  public static class StructureDefinitionMappingComponent extends BackboneElement implements IBaseBackboneElement {
548    /**
549     * An Internal id that is used to identify this mapping set when specific
550     * mappings are made.
551     */
552    @Child(name = "identity", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
553    @Description(shortDefinition = "Internal id when this mapping is used", formalDefinition = "An Internal id that is used to identify this mapping set when specific mappings are made.")
554    protected IdType identity;
555
556    /**
557     * An absolute URI that identifies the specification that this mapping is
558     * expressed to.
559     */
560    @Child(name = "uri", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
561    @Description(shortDefinition = "Identifies what this mapping refers to", formalDefinition = "An absolute URI that identifies the specification that this mapping is expressed to.")
562    protected UriType uri;
563
564    /**
565     * A name for the specification that is being mapped to.
566     */
567    @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
568    @Description(shortDefinition = "Names what this mapping refers to", formalDefinition = "A name for the specification that is being mapped to.")
569    protected StringType name;
570
571    /**
572     * Comments about this mapping, including version notes, issues, scope
573     * limitations, and other important notes for usage.
574     */
575    @Child(name = "comments", type = {
576        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
577    @Description(shortDefinition = "Versions, Issues, Scope limitations etc.", formalDefinition = "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.")
578    protected StringType comments;
579
580    private static final long serialVersionUID = 299630820L;
581
582    /*
583     * Constructor
584     */
585    public StructureDefinitionMappingComponent() {
586      super();
587    }
588
589    /*
590     * Constructor
591     */
592    public StructureDefinitionMappingComponent(IdType identity) {
593      super();
594      this.identity = identity;
595    }
596
597    /**
598     * @return {@link #identity} (An Internal id that is used to identify this
599     *         mapping set when specific mappings are made.). This is the underlying
600     *         object with id, value and extensions. The accessor "getIdentity"
601     *         gives direct access to the value
602     */
603    public IdType getIdentityElement() {
604      if (this.identity == null)
605        if (Configuration.errorOnAutoCreate())
606          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.identity");
607        else if (Configuration.doAutoCreate())
608          this.identity = new IdType(); // bb
609      return this.identity;
610    }
611
612    public boolean hasIdentityElement() {
613      return this.identity != null && !this.identity.isEmpty();
614    }
615
616    public boolean hasIdentity() {
617      return this.identity != null && !this.identity.isEmpty();
618    }
619
620    /**
621     * @param value {@link #identity} (An Internal id that is used to identify this
622     *              mapping set when specific mappings are made.). This is the
623     *              underlying object with id, value and extensions. The accessor
624     *              "getIdentity" gives direct access to the value
625     */
626    public StructureDefinitionMappingComponent setIdentityElement(IdType value) {
627      this.identity = value;
628      return this;
629    }
630
631    /**
632     * @return An Internal id that is used to identify this mapping set when
633     *         specific mappings are made.
634     */
635    public String getIdentity() {
636      return this.identity == null ? null : this.identity.getValue();
637    }
638
639    /**
640     * @param value An Internal id that is used to identify this mapping set when
641     *              specific mappings are made.
642     */
643    public StructureDefinitionMappingComponent setIdentity(String value) {
644      if (this.identity == null)
645        this.identity = new IdType();
646      this.identity.setValue(value);
647      return this;
648    }
649
650    /**
651     * @return {@link #uri} (An absolute URI that identifies the specification that
652     *         this mapping is expressed to.). This is the underlying object with
653     *         id, value and extensions. The accessor "getUri" gives direct access
654     *         to the value
655     */
656    public UriType getUriElement() {
657      if (this.uri == null)
658        if (Configuration.errorOnAutoCreate())
659          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.uri");
660        else if (Configuration.doAutoCreate())
661          this.uri = new UriType(); // bb
662      return this.uri;
663    }
664
665    public boolean hasUriElement() {
666      return this.uri != null && !this.uri.isEmpty();
667    }
668
669    public boolean hasUri() {
670      return this.uri != null && !this.uri.isEmpty();
671    }
672
673    /**
674     * @param value {@link #uri} (An absolute URI that identifies the specification
675     *              that this mapping is expressed to.). This is the underlying
676     *              object with id, value and extensions. The accessor "getUri"
677     *              gives direct access to the value
678     */
679    public StructureDefinitionMappingComponent setUriElement(UriType value) {
680      this.uri = value;
681      return this;
682    }
683
684    /**
685     * @return An absolute URI that identifies the specification that this mapping
686     *         is expressed to.
687     */
688    public String getUri() {
689      return this.uri == null ? null : this.uri.getValue();
690    }
691
692    /**
693     * @param value An absolute URI that identifies the specification that this
694     *              mapping is expressed to.
695     */
696    public StructureDefinitionMappingComponent setUri(String value) {
697      if (Utilities.noString(value))
698        this.uri = null;
699      else {
700        if (this.uri == null)
701          this.uri = new UriType();
702        this.uri.setValue(value);
703      }
704      return this;
705    }
706
707    /**
708     * @return {@link #name} (A name for the specification that is being mapped
709     *         to.). This is the underlying object with id, value and extensions.
710     *         The accessor "getName" gives direct access to the value
711     */
712    public StringType getNameElement() {
713      if (this.name == null)
714        if (Configuration.errorOnAutoCreate())
715          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.name");
716        else if (Configuration.doAutoCreate())
717          this.name = new StringType(); // bb
718      return this.name;
719    }
720
721    public boolean hasNameElement() {
722      return this.name != null && !this.name.isEmpty();
723    }
724
725    public boolean hasName() {
726      return this.name != null && !this.name.isEmpty();
727    }
728
729    /**
730     * @param value {@link #name} (A name for the specification that is being mapped
731     *              to.). This is the underlying object with id, value and
732     *              extensions. The accessor "getName" gives direct access to the
733     *              value
734     */
735    public StructureDefinitionMappingComponent setNameElement(StringType value) {
736      this.name = value;
737      return this;
738    }
739
740    /**
741     * @return A name for the specification that is being mapped to.
742     */
743    public String getName() {
744      return this.name == null ? null : this.name.getValue();
745    }
746
747    /**
748     * @param value A name for the specification that is being mapped to.
749     */
750    public StructureDefinitionMappingComponent setName(String value) {
751      if (Utilities.noString(value))
752        this.name = null;
753      else {
754        if (this.name == null)
755          this.name = new StringType();
756        this.name.setValue(value);
757      }
758      return this;
759    }
760
761    /**
762     * @return {@link #comments} (Comments about this mapping, including version
763     *         notes, issues, scope limitations, and other important notes for
764     *         usage.). This is the underlying object with id, value and extensions.
765     *         The accessor "getComments" gives direct access to the value
766     */
767    public StringType getCommentsElement() {
768      if (this.comments == null)
769        if (Configuration.errorOnAutoCreate())
770          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.comments");
771        else if (Configuration.doAutoCreate())
772          this.comments = new StringType(); // bb
773      return this.comments;
774    }
775
776    public boolean hasCommentsElement() {
777      return this.comments != null && !this.comments.isEmpty();
778    }
779
780    public boolean hasComments() {
781      return this.comments != null && !this.comments.isEmpty();
782    }
783
784    /**
785     * @param value {@link #comments} (Comments about this mapping, including
786     *              version notes, issues, scope limitations, and other important
787     *              notes for usage.). This is the underlying object with id, value
788     *              and extensions. The accessor "getComments" gives direct access
789     *              to the value
790     */
791    public StructureDefinitionMappingComponent setCommentsElement(StringType value) {
792      this.comments = value;
793      return this;
794    }
795
796    /**
797     * @return Comments about this mapping, including version notes, issues, scope
798     *         limitations, and other important notes for usage.
799     */
800    public String getComments() {
801      return this.comments == null ? null : this.comments.getValue();
802    }
803
804    /**
805     * @param value Comments about this mapping, including version notes, issues,
806     *              scope limitations, and other important notes for usage.
807     */
808    public StructureDefinitionMappingComponent setComments(String value) {
809      if (Utilities.noString(value))
810        this.comments = null;
811      else {
812        if (this.comments == null)
813          this.comments = new StringType();
814        this.comments.setValue(value);
815      }
816      return this;
817    }
818
819    protected void listChildren(List<Property> childrenList) {
820      super.listChildren(childrenList);
821      childrenList.add(new Property("identity", "id",
822          "An Internal id that is used to identify this mapping set when specific mappings are made.", 0,
823          java.lang.Integer.MAX_VALUE, identity));
824      childrenList.add(new Property("uri", "uri",
825          "An absolute URI that identifies the specification that this mapping is expressed to.", 0,
826          java.lang.Integer.MAX_VALUE, uri));
827      childrenList.add(new Property("name", "string", "A name for the specification that is being mapped to.", 0,
828          java.lang.Integer.MAX_VALUE, name));
829      childrenList.add(new Property("comments", "string",
830          "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.",
831          0, java.lang.Integer.MAX_VALUE, comments));
832    }
833
834    @Override
835    public void setProperty(String name, Base value) throws FHIRException {
836      if (name.equals("identity"))
837        this.identity = castToId(value); // IdType
838      else if (name.equals("uri"))
839        this.uri = castToUri(value); // UriType
840      else if (name.equals("name"))
841        this.name = castToString(value); // StringType
842      else if (name.equals("comments"))
843        this.comments = castToString(value); // StringType
844      else
845        super.setProperty(name, value);
846    }
847
848    @Override
849    public Base addChild(String name) throws FHIRException {
850      if (name.equals("identity")) {
851        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.identity");
852      } else if (name.equals("uri")) {
853        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.uri");
854      } else if (name.equals("name")) {
855        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.name");
856      } else if (name.equals("comments")) {
857        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.comments");
858      } else
859        return super.addChild(name);
860    }
861
862    public StructureDefinitionMappingComponent copy() {
863      StructureDefinitionMappingComponent dst = new StructureDefinitionMappingComponent();
864      copyValues(dst);
865      dst.identity = identity == null ? null : identity.copy();
866      dst.uri = uri == null ? null : uri.copy();
867      dst.name = name == null ? null : name.copy();
868      dst.comments = comments == null ? null : comments.copy();
869      return dst;
870    }
871
872    @Override
873    public boolean equalsDeep(Base other) {
874      if (!super.equalsDeep(other))
875        return false;
876      if (!(other instanceof StructureDefinitionMappingComponent))
877        return false;
878      StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
879      return compareDeep(identity, o.identity, true) && compareDeep(uri, o.uri, true) && compareDeep(name, o.name, true)
880          && compareDeep(comments, o.comments, true);
881    }
882
883    @Override
884    public boolean equalsShallow(Base other) {
885      if (!super.equalsShallow(other))
886        return false;
887      if (!(other instanceof StructureDefinitionMappingComponent))
888        return false;
889      StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
890      return compareValues(identity, o.identity, true) && compareValues(uri, o.uri, true)
891          && compareValues(name, o.name, true) && compareValues(comments, o.comments, true);
892    }
893
894    public boolean isEmpty() {
895      return super.isEmpty() && (identity == null || identity.isEmpty()) && (uri == null || uri.isEmpty())
896          && (name == null || name.isEmpty()) && (comments == null || comments.isEmpty());
897    }
898
899    public String fhirType() {
900      return "StructureDefinition.mapping";
901
902    }
903
904  }
905
906  @Block()
907  public static class StructureDefinitionSnapshotComponent extends BackboneElement implements IBaseBackboneElement {
908    /**
909     * Captures constraints on each element within the resource.
910     */
911    @Child(name = "element", type = {
912        ElementDefinition.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
913    @Description(shortDefinition = "Definition of elements in the resource (if no StructureDefinition)", formalDefinition = "Captures constraints on each element within the resource.")
914    protected List<ElementDefinition> element;
915
916    private static final long serialVersionUID = 53896641L;
917
918    /*
919     * Constructor
920     */
921    public StructureDefinitionSnapshotComponent() {
922      super();
923    }
924
925    /**
926     * @return {@link #element} (Captures constraints on each element within the
927     *         resource.)
928     */
929    public List<ElementDefinition> getElement() {
930      if (this.element == null)
931        this.element = new ArrayList<ElementDefinition>();
932      return this.element;
933    }
934
935    public boolean hasElement() {
936      if (this.element == null)
937        return false;
938      for (ElementDefinition item : this.element)
939        if (!item.isEmpty())
940          return true;
941      return false;
942    }
943
944    /**
945     * @return {@link #element} (Captures constraints on each element within the
946     *         resource.)
947     */
948    // syntactic sugar
949    public ElementDefinition addElement() { // 3
950      ElementDefinition t = new ElementDefinition();
951      if (this.element == null)
952        this.element = new ArrayList<ElementDefinition>();
953      this.element.add(t);
954      return t;
955    }
956
957    // syntactic sugar
958    public StructureDefinitionSnapshotComponent addElement(ElementDefinition t) { // 3
959      if (t == null)
960        return this;
961      if (this.element == null)
962        this.element = new ArrayList<ElementDefinition>();
963      this.element.add(t);
964      return this;
965    }
966
967    protected void listChildren(List<Property> childrenList) {
968      super.listChildren(childrenList);
969      childrenList.add(new Property("element", "ElementDefinition",
970          "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
971    }
972
973    @Override
974    public void setProperty(String name, Base value) throws FHIRException {
975      if (name.equals("element"))
976        this.getElement().add(castToElementDefinition(value));
977      else
978        super.setProperty(name, value);
979    }
980
981    @Override
982    public Base addChild(String name) throws FHIRException {
983      if (name.equals("element")) {
984        return addElement();
985      } else
986        return super.addChild(name);
987    }
988
989    public StructureDefinitionSnapshotComponent copy() {
990      StructureDefinitionSnapshotComponent dst = new StructureDefinitionSnapshotComponent();
991      copyValues(dst);
992      if (element != null) {
993        dst.element = new ArrayList<ElementDefinition>();
994        for (ElementDefinition i : element)
995          dst.element.add(i.copy());
996      }
997      ;
998      return dst;
999    }
1000
1001    @Override
1002    public boolean equalsDeep(Base other) {
1003      if (!super.equalsDeep(other))
1004        return false;
1005      if (!(other instanceof StructureDefinitionSnapshotComponent))
1006        return false;
1007      StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
1008      return compareDeep(element, o.element, true);
1009    }
1010
1011    @Override
1012    public boolean equalsShallow(Base other) {
1013      if (!super.equalsShallow(other))
1014        return false;
1015      if (!(other instanceof StructureDefinitionSnapshotComponent))
1016        return false;
1017      StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
1018      return true;
1019    }
1020
1021    public boolean isEmpty() {
1022      return super.isEmpty() && (element == null || element.isEmpty());
1023    }
1024
1025    public String fhirType() {
1026      return "StructureDefinition.snapshot";
1027
1028    }
1029
1030  }
1031
1032  @Block()
1033  public static class StructureDefinitionDifferentialComponent extends BackboneElement implements IBaseBackboneElement {
1034    /**
1035     * Captures constraints on each element within the resource.
1036     */
1037    @Child(name = "element", type = {
1038        ElementDefinition.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1039    @Description(shortDefinition = "Definition of elements in the resource (if no StructureDefinition)", formalDefinition = "Captures constraints on each element within the resource.")
1040    protected List<ElementDefinition> element;
1041
1042    private static final long serialVersionUID = 53896641L;
1043
1044    /*
1045     * Constructor
1046     */
1047    public StructureDefinitionDifferentialComponent() {
1048      super();
1049    }
1050
1051    /**
1052     * @return {@link #element} (Captures constraints on each element within the
1053     *         resource.)
1054     */
1055    public List<ElementDefinition> getElement() {
1056      if (this.element == null)
1057        this.element = new ArrayList<ElementDefinition>();
1058      return this.element;
1059    }
1060
1061    public boolean hasElement() {
1062      if (this.element == null)
1063        return false;
1064      for (ElementDefinition item : this.element)
1065        if (!item.isEmpty())
1066          return true;
1067      return false;
1068    }
1069
1070    /**
1071     * @return {@link #element} (Captures constraints on each element within the
1072     *         resource.)
1073     */
1074    // syntactic sugar
1075    public ElementDefinition addElement() { // 3
1076      ElementDefinition t = new ElementDefinition();
1077      if (this.element == null)
1078        this.element = new ArrayList<ElementDefinition>();
1079      this.element.add(t);
1080      return t;
1081    }
1082
1083    // syntactic sugar
1084    public StructureDefinitionDifferentialComponent addElement(ElementDefinition t) { // 3
1085      if (t == null)
1086        return this;
1087      if (this.element == null)
1088        this.element = new ArrayList<ElementDefinition>();
1089      this.element.add(t);
1090      return this;
1091    }
1092
1093    protected void listChildren(List<Property> childrenList) {
1094      super.listChildren(childrenList);
1095      childrenList.add(new Property("element", "ElementDefinition",
1096          "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
1097    }
1098
1099    @Override
1100    public void setProperty(String name, Base value) throws FHIRException {
1101      if (name.equals("element"))
1102        this.getElement().add(castToElementDefinition(value));
1103      else
1104        super.setProperty(name, value);
1105    }
1106
1107    @Override
1108    public Base addChild(String name) throws FHIRException {
1109      if (name.equals("element")) {
1110        return addElement();
1111      } else
1112        return super.addChild(name);
1113    }
1114
1115    public StructureDefinitionDifferentialComponent copy() {
1116      StructureDefinitionDifferentialComponent dst = new StructureDefinitionDifferentialComponent();
1117      copyValues(dst);
1118      if (element != null) {
1119        dst.element = new ArrayList<ElementDefinition>();
1120        for (ElementDefinition i : element)
1121          dst.element.add(i.copy());
1122      }
1123      ;
1124      return dst;
1125    }
1126
1127    @Override
1128    public boolean equalsDeep(Base other) {
1129      if (!super.equalsDeep(other))
1130        return false;
1131      if (!(other instanceof StructureDefinitionDifferentialComponent))
1132        return false;
1133      StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
1134      return compareDeep(element, o.element, true);
1135    }
1136
1137    @Override
1138    public boolean equalsShallow(Base other) {
1139      if (!super.equalsShallow(other))
1140        return false;
1141      if (!(other instanceof StructureDefinitionDifferentialComponent))
1142        return false;
1143      StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
1144      return true;
1145    }
1146
1147    public boolean isEmpty() {
1148      return super.isEmpty() && (element == null || element.isEmpty());
1149    }
1150
1151    public String fhirType() {
1152      return "StructureDefinition.differential";
1153
1154    }
1155
1156  }
1157
1158  /**
1159   * An absolute URL that is used to identify this structure definition when it is
1160   * referenced in a specification, model, design or an instance. This SHALL be a
1161   * URL, SHOULD be globally unique, and SHOULD be an address at which this
1162   * structure definition is (or will be) published.
1163   */
1164  @Child(name = "url", type = { UriType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
1165  @Description(shortDefinition = "Absolute URL used to reference this StructureDefinition", formalDefinition = "An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.")
1166  protected UriType url;
1167
1168  /**
1169   * Formal identifier that is used to identify this StructureDefinition when it
1170   * is represented in other formats, or referenced in a specification, model,
1171   * design or an instance (should be globally unique OID, UUID, or URI), (if it's
1172   * not possible to use the literal URI).
1173   */
1174  @Child(name = "identifier", type = {
1175      Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1176  @Description(shortDefinition = "Other identifiers for the StructureDefinition", formalDefinition = "Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).")
1177  protected List<Identifier> identifier;
1178
1179  /**
1180   * The identifier that is used to identify this version of the
1181   * StructureDefinition when it is referenced in a specification, model, design
1182   * or instance. This is an arbitrary value managed by the StructureDefinition
1183   * author manually.
1184   */
1185  @Child(name = "version", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1186  @Description(shortDefinition = "Logical id for this version of the StructureDefinition", formalDefinition = "The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.")
1187  protected StringType version;
1188
1189  /**
1190   * A free text natural language name identifying the StructureDefinition.
1191   */
1192  @Child(name = "name", type = { StringType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
1193  @Description(shortDefinition = "Informal name for this StructureDefinition", formalDefinition = "A free text natural language name identifying the StructureDefinition.")
1194  protected StringType name;
1195
1196  /**
1197   * Defined so that applications can use this name when displaying the value of
1198   * the extension to the user.
1199   */
1200  @Child(name = "display", type = { StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1201  @Description(shortDefinition = "Use this name when displaying the value", formalDefinition = "Defined so that applications can use this name when displaying the value of the extension to the user.")
1202  protected StringType display;
1203
1204  /**
1205   * The status of the StructureDefinition.
1206   */
1207  @Child(name = "status", type = { CodeType.class }, order = 5, min = 1, max = 1, modifier = true, summary = true)
1208  @Description(shortDefinition = "draft | active | retired", formalDefinition = "The status of the StructureDefinition.")
1209  protected Enumeration<ConformanceResourceStatus> status;
1210
1211  /**
1212   * This StructureDefinition was authored for testing purposes (or
1213   * education/evaluation/marketing), and is not intended to be used for genuine
1214   * usage.
1215   */
1216  @Child(name = "experimental", type = {
1217      BooleanType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1218  @Description(shortDefinition = "If for testing purposes, not real usage", formalDefinition = "This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.")
1219  protected BooleanType experimental;
1220
1221  /**
1222   * The name of the individual or organization that published the structure
1223   * definition.
1224   */
1225  @Child(name = "publisher", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1226  @Description(shortDefinition = "Name of the publisher (Organization or individual)", formalDefinition = "The name of the individual or organization that published the structure definition.")
1227  protected StringType publisher;
1228
1229  /**
1230   * Contacts to assist a user in finding and communicating with the publisher.
1231   */
1232  @Child(name = "contact", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1233  @Description(shortDefinition = "Contact details of the publisher", formalDefinition = "Contacts to assist a user in finding and communicating with the publisher.")
1234  protected List<StructureDefinitionContactComponent> contact;
1235
1236  /**
1237   * The date this version of the structure definition was published. The date
1238   * must change when the business version changes, if it does, and it must change
1239   * if the status code changes. In addition, it should change when the
1240   * substantive content of the structure definition changes.
1241   */
1242  @Child(name = "date", type = { DateTimeType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1243  @Description(shortDefinition = "Date for this version of the StructureDefinition", formalDefinition = "The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.")
1244  protected DateTimeType date;
1245
1246  /**
1247   * A free text natural language description of the StructureDefinition and its
1248   * use.
1249   */
1250  @Child(name = "description", type = {
1251      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true)
1252  @Description(shortDefinition = "Natural language description of the StructureDefinition", formalDefinition = "A free text natural language description of the StructureDefinition and its use.")
1253  protected StringType description;
1254
1255  /**
1256   * The content was developed with a focus and intent of supporting the contexts
1257   * that are listed. These terms may be used to assist with indexing and
1258   * searching of structure definitions.
1259   */
1260  @Child(name = "useContext", type = {
1261      CodeableConcept.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1262  @Description(shortDefinition = "Content intends to support these contexts", formalDefinition = "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.")
1263  protected List<CodeableConcept> useContext;
1264
1265  /**
1266   * Explains why this structure definition is needed and why it's been
1267   * constrained as it has.
1268   */
1269  @Child(name = "requirements", type = {
1270      StringType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
1271  @Description(shortDefinition = "Scope and Usage this structure definition is for", formalDefinition = "Explains why this structure definition is needed and why it's been constrained as it has.")
1272  protected StringType requirements;
1273
1274  /**
1275   * A copyright statement relating to the structure definition and/or its
1276   * contents. Copyright statements are generally legal restrictions on the use
1277   * and publishing of the details of the constraints and mappings.
1278   */
1279  @Child(name = "copyright", type = {
1280      StringType.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
1281  @Description(shortDefinition = "Use and/or publishing restrictions", formalDefinition = "A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.")
1282  protected StringType copyright;
1283
1284  /**
1285   * A set of terms from external terminologies that may be used to assist with
1286   * indexing and searching of templates.
1287   */
1288  @Child(name = "code", type = {
1289      Coding.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1290  @Description(shortDefinition = "Assist with indexing and finding", formalDefinition = "A set of terms from external terminologies that may be used to assist with indexing and searching of templates.")
1291  protected List<Coding> code;
1292
1293  /**
1294   * The version of the FHIR specification on which this StructureDefinition is
1295   * based - this is the formal version of the specification, without the revision
1296   * number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1297   */
1298  @Child(name = "fhirVersion", type = { IdType.class }, order = 15, min = 0, max = 1, modifier = false, summary = true)
1299  @Description(shortDefinition = "FHIR Version this StructureDefinition targets", formalDefinition = "The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.")
1300  protected IdType fhirVersion;
1301
1302  /**
1303   * An external specification that the content is mapped to.
1304   */
1305  @Child(name = "mapping", type = {}, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1306  @Description(shortDefinition = "External specification that the content is mapped to", formalDefinition = "An external specification that the content is mapped to.")
1307  protected List<StructureDefinitionMappingComponent> mapping;
1308
1309  /**
1310   * Defines the kind of structure that this definition is describing.
1311   */
1312  @Child(name = "kind", type = { CodeType.class }, order = 17, min = 1, max = 1, modifier = false, summary = true)
1313  @Description(shortDefinition = "datatype | resource | logical", formalDefinition = "Defines the kind of structure that this definition is describing.")
1314  protected Enumeration<StructureDefinitionKind> kind;
1315
1316  /**
1317   * The type of type that is being constrained - a data type, an extension, a
1318   * resource, including abstract ones. If this field is present, it indicates
1319   * that the structure definition is a constraint. If it is not present, then the
1320   * structure definition is the definition of a base structure.
1321   */
1322  @Child(name = "constrainedType", type = {
1323      CodeType.class }, order = 18, min = 0, max = 1, modifier = false, summary = true)
1324  @Description(shortDefinition = "Any datatype or resource, including abstract ones", formalDefinition = "The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.")
1325  protected CodeType constrainedType;
1326
1327  /**
1328   * Whether structure this definition describes is abstract or not - that is,
1329   * whether an actual exchanged item can ever be of this type.
1330   */
1331  @Child(name = "abstract", type = {
1332      BooleanType.class }, order = 19, min = 1, max = 1, modifier = false, summary = true)
1333  @Description(shortDefinition = "Whether the structure is abstract", formalDefinition = "Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.")
1334  protected BooleanType abstract_;
1335
1336  /**
1337   * If this is an extension, Identifies the context within FHIR resources where
1338   * the extension can be used.
1339   */
1340  @Child(name = "contextType", type = {
1341      CodeType.class }, order = 20, min = 0, max = 1, modifier = false, summary = true)
1342  @Description(shortDefinition = "resource | datatype | mapping | extension", formalDefinition = "If this is an extension, Identifies the context within FHIR resources where the extension can be used.")
1343  protected Enumeration<ExtensionContext> contextType;
1344
1345  /**
1346   * Identifies the types of resource or data type elements to which the extension
1347   * can be applied.
1348   */
1349  @Child(name = "context", type = {
1350      StringType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1351  @Description(shortDefinition = "Where the extension can be used in instances", formalDefinition = "Identifies the types of resource or data type elements to which the extension can be applied.")
1352  protected List<StringType> context;
1353
1354  /**
1355   * An absolute URI that is the base structure from which this set of constraints
1356   * is derived.
1357   */
1358  @Child(name = "base", type = { UriType.class }, order = 22, min = 0, max = 1, modifier = false, summary = true)
1359  @Description(shortDefinition = "Structure that this set of constraints applies to", formalDefinition = "An absolute URI that is the base structure from which this set of constraints is derived.")
1360  protected UriType base;
1361
1362  /**
1363   * A snapshot view is expressed in a stand alone form that can be used and
1364   * interpreted without considering the base StructureDefinition.
1365   */
1366  @Child(name = "snapshot", type = {}, order = 23, min = 0, max = 1, modifier = false, summary = false)
1367  @Description(shortDefinition = "Snapshot view of the structure", formalDefinition = "A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.")
1368  protected StructureDefinitionSnapshotComponent snapshot;
1369
1370  /**
1371   * A differential view is expressed relative to the base StructureDefinition - a
1372   * statement of differences that it applies.
1373   */
1374  @Child(name = "differential", type = {}, order = 24, min = 0, max = 1, modifier = false, summary = false)
1375  @Description(shortDefinition = "Differential view of the structure", formalDefinition = "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.")
1376  protected StructureDefinitionDifferentialComponent differential;
1377
1378  private static final long serialVersionUID = -580779569L;
1379
1380  /*
1381   * Constructor
1382   */
1383  public StructureDefinition() {
1384    super();
1385  }
1386
1387  /*
1388   * Constructor
1389   */
1390  public StructureDefinition(UriType url, StringType name, Enumeration<ConformanceResourceStatus> status,
1391      Enumeration<StructureDefinitionKind> kind, BooleanType abstract_) {
1392    super();
1393    this.url = url;
1394    this.name = name;
1395    this.status = status;
1396    this.kind = kind;
1397    this.abstract_ = abstract_;
1398  }
1399
1400  /**
1401   * @return {@link #url} (An absolute URL that is used to identify this structure
1402   *         definition when it is referenced in a specification, model, design or
1403   *         an instance. This SHALL be a URL, SHOULD be globally unique, and
1404   *         SHOULD be an address at which this structure definition is (or will
1405   *         be) published.). This is the underlying object with id, value and
1406   *         extensions. The accessor "getUrl" gives direct access to the value
1407   */
1408  public UriType getUrlElement() {
1409    if (this.url == null)
1410      if (Configuration.errorOnAutoCreate())
1411        throw new Error("Attempt to auto-create StructureDefinition.url");
1412      else if (Configuration.doAutoCreate())
1413        this.url = new UriType(); // bb
1414    return this.url;
1415  }
1416
1417  public boolean hasUrlElement() {
1418    return this.url != null && !this.url.isEmpty();
1419  }
1420
1421  public boolean hasUrl() {
1422    return this.url != null && !this.url.isEmpty();
1423  }
1424
1425  /**
1426   * @param value {@link #url} (An absolute URL that is used to identify this
1427   *              structure definition when it is referenced in a specification,
1428   *              model, design or an instance. This SHALL be a URL, SHOULD be
1429   *              globally unique, and SHOULD be an address at which this
1430   *              structure definition is (or will be) published.). This is the
1431   *              underlying object with id, value and extensions. The accessor
1432   *              "getUrl" gives direct access to the value
1433   */
1434  public StructureDefinition setUrlElement(UriType value) {
1435    this.url = value;
1436    return this;
1437  }
1438
1439  /**
1440   * @return An absolute URL that is used to identify this structure definition
1441   *         when it is referenced in a specification, model, design or an
1442   *         instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD
1443   *         be an address at which this structure definition is (or will be)
1444   *         published.
1445   */
1446  public String getUrl() {
1447    return this.url == null ? null : this.url.getValue();
1448  }
1449
1450  /**
1451   * @param value An absolute URL that is used to identify this structure
1452   *              definition when it is referenced in a specification, model,
1453   *              design or an instance. This SHALL be a URL, SHOULD be globally
1454   *              unique, and SHOULD be an address at which this structure
1455   *              definition is (or will be) published.
1456   */
1457  public StructureDefinition setUrl(String value) {
1458    if (this.url == null)
1459      this.url = new UriType();
1460    this.url.setValue(value);
1461    return this;
1462  }
1463
1464  /**
1465   * @return {@link #identifier} (Formal identifier that is used to identify this
1466   *         StructureDefinition when it is represented in other formats, or
1467   *         referenced in a specification, model, design or an instance (should
1468   *         be globally unique OID, UUID, or URI), (if it's not possible to use
1469   *         the literal URI).)
1470   */
1471  public List<Identifier> getIdentifier() {
1472    if (this.identifier == null)
1473      this.identifier = new ArrayList<Identifier>();
1474    return this.identifier;
1475  }
1476
1477  public boolean hasIdentifier() {
1478    if (this.identifier == null)
1479      return false;
1480    for (Identifier item : this.identifier)
1481      if (!item.isEmpty())
1482        return true;
1483    return false;
1484  }
1485
1486  /**
1487   * @return {@link #identifier} (Formal identifier that is used to identify this
1488   *         StructureDefinition when it is represented in other formats, or
1489   *         referenced in a specification, model, design or an instance (should
1490   *         be globally unique OID, UUID, or URI), (if it's not possible to use
1491   *         the literal URI).)
1492   */
1493  // syntactic sugar
1494  public Identifier addIdentifier() { // 3
1495    Identifier t = new Identifier();
1496    if (this.identifier == null)
1497      this.identifier = new ArrayList<Identifier>();
1498    this.identifier.add(t);
1499    return t;
1500  }
1501
1502  // syntactic sugar
1503  public StructureDefinition addIdentifier(Identifier t) { // 3
1504    if (t == null)
1505      return this;
1506    if (this.identifier == null)
1507      this.identifier = new ArrayList<Identifier>();
1508    this.identifier.add(t);
1509    return this;
1510  }
1511
1512  /**
1513   * @return {@link #version} (The identifier that is used to identify this
1514   *         version of the StructureDefinition when it is referenced in a
1515   *         specification, model, design or instance. This is an arbitrary value
1516   *         managed by the StructureDefinition author manually.). This is the
1517   *         underlying object with id, value and extensions. The accessor
1518   *         "getVersion" gives direct access to the value
1519   */
1520  public StringType getVersionElement() {
1521    if (this.version == null)
1522      if (Configuration.errorOnAutoCreate())
1523        throw new Error("Attempt to auto-create StructureDefinition.version");
1524      else if (Configuration.doAutoCreate())
1525        this.version = new StringType(); // bb
1526    return this.version;
1527  }
1528
1529  public boolean hasVersionElement() {
1530    return this.version != null && !this.version.isEmpty();
1531  }
1532
1533  public boolean hasVersion() {
1534    return this.version != null && !this.version.isEmpty();
1535  }
1536
1537  /**
1538   * @param value {@link #version} (The identifier that is used to identify this
1539   *              version of the StructureDefinition when it is referenced in a
1540   *              specification, model, design or instance. This is an arbitrary
1541   *              value managed by the StructureDefinition author manually.). This
1542   *              is the underlying object with id, value and extensions. The
1543   *              accessor "getVersion" gives direct access to the value
1544   */
1545  public StructureDefinition setVersionElement(StringType value) {
1546    this.version = value;
1547    return this;
1548  }
1549
1550  /**
1551   * @return The identifier that is used to identify this version of the
1552   *         StructureDefinition when it is referenced in a specification, model,
1553   *         design or instance. This is an arbitrary value managed by the
1554   *         StructureDefinition author manually.
1555   */
1556  public String getVersion() {
1557    return this.version == null ? null : this.version.getValue();
1558  }
1559
1560  /**
1561   * @param value The identifier that is used to identify this version of the
1562   *              StructureDefinition when it is referenced in a specification,
1563   *              model, design or instance. This is an arbitrary value managed by
1564   *              the StructureDefinition author manually.
1565   */
1566  public StructureDefinition setVersion(String value) {
1567    if (Utilities.noString(value))
1568      this.version = null;
1569    else {
1570      if (this.version == null)
1571        this.version = new StringType();
1572      this.version.setValue(value);
1573    }
1574    return this;
1575  }
1576
1577  /**
1578   * @return {@link #name} (A free text natural language name identifying the
1579   *         StructureDefinition.). This is the underlying object with id, value
1580   *         and extensions. The accessor "getName" gives direct access to the
1581   *         value
1582   */
1583  public StringType getNameElement() {
1584    if (this.name == null)
1585      if (Configuration.errorOnAutoCreate())
1586        throw new Error("Attempt to auto-create StructureDefinition.name");
1587      else if (Configuration.doAutoCreate())
1588        this.name = new StringType(); // bb
1589    return this.name;
1590  }
1591
1592  public boolean hasNameElement() {
1593    return this.name != null && !this.name.isEmpty();
1594  }
1595
1596  public boolean hasName() {
1597    return this.name != null && !this.name.isEmpty();
1598  }
1599
1600  /**
1601   * @param value {@link #name} (A free text natural language name identifying the
1602   *              StructureDefinition.). This is the underlying object with id,
1603   *              value and extensions. The accessor "getName" gives direct access
1604   *              to the value
1605   */
1606  public StructureDefinition setNameElement(StringType value) {
1607    this.name = value;
1608    return this;
1609  }
1610
1611  /**
1612   * @return A free text natural language name identifying the
1613   *         StructureDefinition.
1614   */
1615  public String getName() {
1616    return this.name == null ? null : this.name.getValue();
1617  }
1618
1619  /**
1620   * @param value A free text natural language name identifying the
1621   *              StructureDefinition.
1622   */
1623  public StructureDefinition setName(String value) {
1624    if (this.name == null)
1625      this.name = new StringType();
1626    this.name.setValue(value);
1627    return this;
1628  }
1629
1630  /**
1631   * @return {@link #display} (Defined so that applications can use this name when
1632   *         displaying the value of the extension to the user.). This is the
1633   *         underlying object with id, value and extensions. The accessor
1634   *         "getDisplay" gives direct access to the value
1635   */
1636  public StringType getDisplayElement() {
1637    if (this.display == null)
1638      if (Configuration.errorOnAutoCreate())
1639        throw new Error("Attempt to auto-create StructureDefinition.display");
1640      else if (Configuration.doAutoCreate())
1641        this.display = new StringType(); // bb
1642    return this.display;
1643  }
1644
1645  public boolean hasDisplayElement() {
1646    return this.display != null && !this.display.isEmpty();
1647  }
1648
1649  public boolean hasDisplay() {
1650    return this.display != null && !this.display.isEmpty();
1651  }
1652
1653  /**
1654   * @param value {@link #display} (Defined so that applications can use this name
1655   *              when displaying the value of the extension to the user.). This
1656   *              is the underlying object with id, value and extensions. The
1657   *              accessor "getDisplay" gives direct access to the value
1658   */
1659  public StructureDefinition setDisplayElement(StringType value) {
1660    this.display = value;
1661    return this;
1662  }
1663
1664  /**
1665   * @return Defined so that applications can use this name when displaying the
1666   *         value of the extension to the user.
1667   */
1668  public String getDisplay() {
1669    return this.display == null ? null : this.display.getValue();
1670  }
1671
1672  /**
1673   * @param value Defined so that applications can use this name when displaying
1674   *              the value of the extension to the user.
1675   */
1676  public StructureDefinition setDisplay(String value) {
1677    if (Utilities.noString(value))
1678      this.display = null;
1679    else {
1680      if (this.display == null)
1681        this.display = new StringType();
1682      this.display.setValue(value);
1683    }
1684    return this;
1685  }
1686
1687  /**
1688   * @return {@link #status} (The status of the StructureDefinition.). This is the
1689   *         underlying object with id, value and extensions. The accessor
1690   *         "getStatus" gives direct access to the value
1691   */
1692  public Enumeration<ConformanceResourceStatus> getStatusElement() {
1693    if (this.status == null)
1694      if (Configuration.errorOnAutoCreate())
1695        throw new Error("Attempt to auto-create StructureDefinition.status");
1696      else if (Configuration.doAutoCreate())
1697        this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1698    return this.status;
1699  }
1700
1701  public boolean hasStatusElement() {
1702    return this.status != null && !this.status.isEmpty();
1703  }
1704
1705  public boolean hasStatus() {
1706    return this.status != null && !this.status.isEmpty();
1707  }
1708
1709  /**
1710   * @param value {@link #status} (The status of the StructureDefinition.). This
1711   *              is the underlying object with id, value and extensions. The
1712   *              accessor "getStatus" gives direct access to the value
1713   */
1714  public StructureDefinition setStatusElement(Enumeration<ConformanceResourceStatus> value) {
1715    this.status = value;
1716    return this;
1717  }
1718
1719  /**
1720   * @return The status of the StructureDefinition.
1721   */
1722  public ConformanceResourceStatus getStatus() {
1723    return this.status == null ? null : this.status.getValue();
1724  }
1725
1726  /**
1727   * @param value The status of the StructureDefinition.
1728   */
1729  public StructureDefinition setStatus(ConformanceResourceStatus value) {
1730    if (this.status == null)
1731      this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1732    this.status.setValue(value);
1733    return this;
1734  }
1735
1736  /**
1737   * @return {@link #experimental} (This StructureDefinition was authored for
1738   *         testing purposes (or education/evaluation/marketing), and is not
1739   *         intended to be used for genuine usage.). This is the underlying
1740   *         object with id, value and extensions. The accessor "getExperimental"
1741   *         gives direct access to the value
1742   */
1743  public BooleanType getExperimentalElement() {
1744    if (this.experimental == null)
1745      if (Configuration.errorOnAutoCreate())
1746        throw new Error("Attempt to auto-create StructureDefinition.experimental");
1747      else if (Configuration.doAutoCreate())
1748        this.experimental = new BooleanType(); // bb
1749    return this.experimental;
1750  }
1751
1752  public boolean hasExperimentalElement() {
1753    return this.experimental != null && !this.experimental.isEmpty();
1754  }
1755
1756  public boolean hasExperimental() {
1757    return this.experimental != null && !this.experimental.isEmpty();
1758  }
1759
1760  /**
1761   * @param value {@link #experimental} (This StructureDefinition was authored for
1762   *              testing purposes (or education/evaluation/marketing), and is not
1763   *              intended to be used for genuine usage.). This is the underlying
1764   *              object with id, value and extensions. The accessor
1765   *              "getExperimental" gives direct access to the value
1766   */
1767  public StructureDefinition setExperimentalElement(BooleanType value) {
1768    this.experimental = value;
1769    return this;
1770  }
1771
1772  /**
1773   * @return This StructureDefinition was authored for testing purposes (or
1774   *         education/evaluation/marketing), and is not intended to be used for
1775   *         genuine usage.
1776   */
1777  public boolean getExperimental() {
1778    return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1779  }
1780
1781  /**
1782   * @param value This StructureDefinition was authored for testing purposes (or
1783   *              education/evaluation/marketing), and is not intended to be used
1784   *              for genuine usage.
1785   */
1786  public StructureDefinition setExperimental(boolean value) {
1787    if (this.experimental == null)
1788      this.experimental = new BooleanType();
1789    this.experimental.setValue(value);
1790    return this;
1791  }
1792
1793  /**
1794   * @return {@link #publisher} (The name of the individual or organization that
1795   *         published the structure definition.). This is the underlying object
1796   *         with id, value and extensions. The accessor "getPublisher" gives
1797   *         direct access to the value
1798   */
1799  public StringType getPublisherElement() {
1800    if (this.publisher == null)
1801      if (Configuration.errorOnAutoCreate())
1802        throw new Error("Attempt to auto-create StructureDefinition.publisher");
1803      else if (Configuration.doAutoCreate())
1804        this.publisher = new StringType(); // bb
1805    return this.publisher;
1806  }
1807
1808  public boolean hasPublisherElement() {
1809    return this.publisher != null && !this.publisher.isEmpty();
1810  }
1811
1812  public boolean hasPublisher() {
1813    return this.publisher != null && !this.publisher.isEmpty();
1814  }
1815
1816  /**
1817   * @param value {@link #publisher} (The name of the individual or organization
1818   *              that published the structure definition.). This is the
1819   *              underlying object with id, value and extensions. The accessor
1820   *              "getPublisher" gives direct access to the value
1821   */
1822  public StructureDefinition setPublisherElement(StringType value) {
1823    this.publisher = value;
1824    return this;
1825  }
1826
1827  /**
1828   * @return The name of the individual or organization that published the
1829   *         structure definition.
1830   */
1831  public String getPublisher() {
1832    return this.publisher == null ? null : this.publisher.getValue();
1833  }
1834
1835  /**
1836   * @param value The name of the individual or organization that published the
1837   *              structure definition.
1838   */
1839  public StructureDefinition setPublisher(String value) {
1840    if (Utilities.noString(value))
1841      this.publisher = null;
1842    else {
1843      if (this.publisher == null)
1844        this.publisher = new StringType();
1845      this.publisher.setValue(value);
1846    }
1847    return this;
1848  }
1849
1850  /**
1851   * @return {@link #contact} (Contacts to assist a user in finding and
1852   *         communicating with the publisher.)
1853   */
1854  public List<StructureDefinitionContactComponent> getContact() {
1855    if (this.contact == null)
1856      this.contact = new ArrayList<StructureDefinitionContactComponent>();
1857    return this.contact;
1858  }
1859
1860  public boolean hasContact() {
1861    if (this.contact == null)
1862      return false;
1863    for (StructureDefinitionContactComponent item : this.contact)
1864      if (!item.isEmpty())
1865        return true;
1866    return false;
1867  }
1868
1869  /**
1870   * @return {@link #contact} (Contacts to assist a user in finding and
1871   *         communicating with the publisher.)
1872   */
1873  // syntactic sugar
1874  public StructureDefinitionContactComponent addContact() { // 3
1875    StructureDefinitionContactComponent t = new StructureDefinitionContactComponent();
1876    if (this.contact == null)
1877      this.contact = new ArrayList<StructureDefinitionContactComponent>();
1878    this.contact.add(t);
1879    return t;
1880  }
1881
1882  // syntactic sugar
1883  public StructureDefinition addContact(StructureDefinitionContactComponent t) { // 3
1884    if (t == null)
1885      return this;
1886    if (this.contact == null)
1887      this.contact = new ArrayList<StructureDefinitionContactComponent>();
1888    this.contact.add(t);
1889    return this;
1890  }
1891
1892  /**
1893   * @return {@link #date} (The date this version of the structure definition was
1894   *         published. The date must change when the business version changes, if
1895   *         it does, and it must change if the status code changes. In addition,
1896   *         it should change when the substantive content of the structure
1897   *         definition changes.). This is the underlying object with id, value
1898   *         and extensions. The accessor "getDate" gives direct access to the
1899   *         value
1900   */
1901  public DateTimeType getDateElement() {
1902    if (this.date == null)
1903      if (Configuration.errorOnAutoCreate())
1904        throw new Error("Attempt to auto-create StructureDefinition.date");
1905      else if (Configuration.doAutoCreate())
1906        this.date = new DateTimeType(); // bb
1907    return this.date;
1908  }
1909
1910  public boolean hasDateElement() {
1911    return this.date != null && !this.date.isEmpty();
1912  }
1913
1914  public boolean hasDate() {
1915    return this.date != null && !this.date.isEmpty();
1916  }
1917
1918  /**
1919   * @param value {@link #date} (The date this version of the structure definition
1920   *              was published. The date must change when the business version
1921   *              changes, if it does, and it must change if the status code
1922   *              changes. In addition, it should change when the substantive
1923   *              content of the structure definition changes.). This is the
1924   *              underlying object with id, value and extensions. The accessor
1925   *              "getDate" gives direct access to the value
1926   */
1927  public StructureDefinition setDateElement(DateTimeType value) {
1928    this.date = value;
1929    return this;
1930  }
1931
1932  /**
1933   * @return The date this version of the structure definition was published. The
1934   *         date must change when the business version changes, if it does, and
1935   *         it must change if the status code changes. In addition, it should
1936   *         change when the substantive content of the structure definition
1937   *         changes.
1938   */
1939  public Date getDate() {
1940    return this.date == null ? null : this.date.getValue();
1941  }
1942
1943  /**
1944   * @param value The date this version of the structure definition was published.
1945   *              The date must change when the business version changes, if it
1946   *              does, and it must change if the status code changes. In
1947   *              addition, it should change when the substantive content of the
1948   *              structure definition changes.
1949   */
1950  public StructureDefinition setDate(Date value) {
1951    if (value == null)
1952      this.date = null;
1953    else {
1954      if (this.date == null)
1955        this.date = new DateTimeType();
1956      this.date.setValue(value);
1957    }
1958    return this;
1959  }
1960
1961  /**
1962   * @return {@link #description} (A free text natural language description of the
1963   *         StructureDefinition and its use.). This is the underlying object with
1964   *         id, value and extensions. The accessor "getDescription" gives direct
1965   *         access to the value
1966   */
1967  public StringType getDescriptionElement() {
1968    if (this.description == null)
1969      if (Configuration.errorOnAutoCreate())
1970        throw new Error("Attempt to auto-create StructureDefinition.description");
1971      else if (Configuration.doAutoCreate())
1972        this.description = new StringType(); // bb
1973    return this.description;
1974  }
1975
1976  public boolean hasDescriptionElement() {
1977    return this.description != null && !this.description.isEmpty();
1978  }
1979
1980  public boolean hasDescription() {
1981    return this.description != null && !this.description.isEmpty();
1982  }
1983
1984  /**
1985   * @param value {@link #description} (A free text natural language description
1986   *              of the StructureDefinition and its use.). This is the underlying
1987   *              object with id, value and extensions. The accessor
1988   *              "getDescription" gives direct access to the value
1989   */
1990  public StructureDefinition setDescriptionElement(StringType value) {
1991    this.description = value;
1992    return this;
1993  }
1994
1995  /**
1996   * @return A free text natural language description of the StructureDefinition
1997   *         and its use.
1998   */
1999  public String getDescription() {
2000    return this.description == null ? null : this.description.getValue();
2001  }
2002
2003  /**
2004   * @param value A free text natural language description of the
2005   *              StructureDefinition and its use.
2006   */
2007  public StructureDefinition setDescription(String value) {
2008    if (Utilities.noString(value))
2009      this.description = null;
2010    else {
2011      if (this.description == null)
2012        this.description = new StringType();
2013      this.description.setValue(value);
2014    }
2015    return this;
2016  }
2017
2018  /**
2019   * @return {@link #useContext} (The content was developed with a focus and
2020   *         intent of supporting the contexts that are listed. These terms may be
2021   *         used to assist with indexing and searching of structure definitions.)
2022   */
2023  public List<CodeableConcept> getUseContext() {
2024    if (this.useContext == null)
2025      this.useContext = new ArrayList<CodeableConcept>();
2026    return this.useContext;
2027  }
2028
2029  public boolean hasUseContext() {
2030    if (this.useContext == null)
2031      return false;
2032    for (CodeableConcept item : this.useContext)
2033      if (!item.isEmpty())
2034        return true;
2035    return false;
2036  }
2037
2038  /**
2039   * @return {@link #useContext} (The content was developed with a focus and
2040   *         intent of supporting the contexts that are listed. These terms may be
2041   *         used to assist with indexing and searching of structure definitions.)
2042   */
2043  // syntactic sugar
2044  public CodeableConcept addUseContext() { // 3
2045    CodeableConcept t = new CodeableConcept();
2046    if (this.useContext == null)
2047      this.useContext = new ArrayList<CodeableConcept>();
2048    this.useContext.add(t);
2049    return t;
2050  }
2051
2052  // syntactic sugar
2053  public StructureDefinition addUseContext(CodeableConcept t) { // 3
2054    if (t == null)
2055      return this;
2056    if (this.useContext == null)
2057      this.useContext = new ArrayList<CodeableConcept>();
2058    this.useContext.add(t);
2059    return this;
2060  }
2061
2062  /**
2063   * @return {@link #requirements} (Explains why this structure definition is
2064   *         needed and why it's been constrained as it has.). This is the
2065   *         underlying object with id, value and extensions. The accessor
2066   *         "getRequirements" gives direct access to the value
2067   */
2068  public StringType getRequirementsElement() {
2069    if (this.requirements == null)
2070      if (Configuration.errorOnAutoCreate())
2071        throw new Error("Attempt to auto-create StructureDefinition.requirements");
2072      else if (Configuration.doAutoCreate())
2073        this.requirements = new StringType(); // bb
2074    return this.requirements;
2075  }
2076
2077  public boolean hasRequirementsElement() {
2078    return this.requirements != null && !this.requirements.isEmpty();
2079  }
2080
2081  public boolean hasRequirements() {
2082    return this.requirements != null && !this.requirements.isEmpty();
2083  }
2084
2085  /**
2086   * @param value {@link #requirements} (Explains why this structure definition is
2087   *              needed and why it's been constrained as it has.). This is the
2088   *              underlying object with id, value and extensions. The accessor
2089   *              "getRequirements" gives direct access to the value
2090   */
2091  public StructureDefinition setRequirementsElement(StringType value) {
2092    this.requirements = value;
2093    return this;
2094  }
2095
2096  /**
2097   * @return Explains why this structure definition is needed and why it's been
2098   *         constrained as it has.
2099   */
2100  public String getRequirements() {
2101    return this.requirements == null ? null : this.requirements.getValue();
2102  }
2103
2104  /**
2105   * @param value Explains why this structure definition is needed and why it's
2106   *              been constrained as it has.
2107   */
2108  public StructureDefinition setRequirements(String value) {
2109    if (Utilities.noString(value))
2110      this.requirements = null;
2111    else {
2112      if (this.requirements == null)
2113        this.requirements = new StringType();
2114      this.requirements.setValue(value);
2115    }
2116    return this;
2117  }
2118
2119  /**
2120   * @return {@link #copyright} (A copyright statement relating to the structure
2121   *         definition and/or its contents. Copyright statements are generally
2122   *         legal restrictions on the use and publishing of the details of the
2123   *         constraints and mappings.). This is the underlying object with id,
2124   *         value and extensions. The accessor "getCopyright" gives direct access
2125   *         to the value
2126   */
2127  public StringType getCopyrightElement() {
2128    if (this.copyright == null)
2129      if (Configuration.errorOnAutoCreate())
2130        throw new Error("Attempt to auto-create StructureDefinition.copyright");
2131      else if (Configuration.doAutoCreate())
2132        this.copyright = new StringType(); // bb
2133    return this.copyright;
2134  }
2135
2136  public boolean hasCopyrightElement() {
2137    return this.copyright != null && !this.copyright.isEmpty();
2138  }
2139
2140  public boolean hasCopyright() {
2141    return this.copyright != null && !this.copyright.isEmpty();
2142  }
2143
2144  /**
2145   * @param value {@link #copyright} (A copyright statement relating to the
2146   *              structure definition and/or its contents. Copyright statements
2147   *              are generally legal restrictions on the use and publishing of
2148   *              the details of the constraints and mappings.). This is the
2149   *              underlying object with id, value and extensions. The accessor
2150   *              "getCopyright" gives direct access to the value
2151   */
2152  public StructureDefinition setCopyrightElement(StringType value) {
2153    this.copyright = value;
2154    return this;
2155  }
2156
2157  /**
2158   * @return A copyright statement relating to the structure definition and/or its
2159   *         contents. Copyright statements are generally legal restrictions on
2160   *         the use and publishing of the details of the constraints and
2161   *         mappings.
2162   */
2163  public String getCopyright() {
2164    return this.copyright == null ? null : this.copyright.getValue();
2165  }
2166
2167  /**
2168   * @param value A copyright statement relating to the structure definition
2169   *              and/or its contents. Copyright statements are generally legal
2170   *              restrictions on the use and publishing of the details of the
2171   *              constraints and mappings.
2172   */
2173  public StructureDefinition setCopyright(String value) {
2174    if (Utilities.noString(value))
2175      this.copyright = null;
2176    else {
2177      if (this.copyright == null)
2178        this.copyright = new StringType();
2179      this.copyright.setValue(value);
2180    }
2181    return this;
2182  }
2183
2184  /**
2185   * @return {@link #code} (A set of terms from external terminologies that may be
2186   *         used to assist with indexing and searching of templates.)
2187   */
2188  public List<Coding> getCode() {
2189    if (this.code == null)
2190      this.code = new ArrayList<Coding>();
2191    return this.code;
2192  }
2193
2194  public boolean hasCode() {
2195    if (this.code == null)
2196      return false;
2197    for (Coding item : this.code)
2198      if (!item.isEmpty())
2199        return true;
2200    return false;
2201  }
2202
2203  /**
2204   * @return {@link #code} (A set of terms from external terminologies that may be
2205   *         used to assist with indexing and searching of templates.)
2206   */
2207  // syntactic sugar
2208  public Coding addCode() { // 3
2209    Coding t = new Coding();
2210    if (this.code == null)
2211      this.code = new ArrayList<Coding>();
2212    this.code.add(t);
2213    return t;
2214  }
2215
2216  // syntactic sugar
2217  public StructureDefinition addCode(Coding t) { // 3
2218    if (t == null)
2219      return this;
2220    if (this.code == null)
2221      this.code = new ArrayList<Coding>();
2222    this.code.add(t);
2223    return this;
2224  }
2225
2226  /**
2227   * @return {@link #fhirVersion} (The version of the FHIR specification on which
2228   *         this StructureDefinition is based - this is the formal version of the
2229   *         specification, without the revision number, e.g.
2230   *         [publication].[major].[minor], which is 1.0.2 for this version.).
2231   *         This is the underlying object with id, value and extensions. The
2232   *         accessor "getFhirVersion" gives direct access to the value
2233   */
2234  public IdType getFhirVersionElement() {
2235    if (this.fhirVersion == null)
2236      if (Configuration.errorOnAutoCreate())
2237        throw new Error("Attempt to auto-create StructureDefinition.fhirVersion");
2238      else if (Configuration.doAutoCreate())
2239        this.fhirVersion = new IdType(); // bb
2240    return this.fhirVersion;
2241  }
2242
2243  public boolean hasFhirVersionElement() {
2244    return this.fhirVersion != null && !this.fhirVersion.isEmpty();
2245  }
2246
2247  public boolean hasFhirVersion() {
2248    return this.fhirVersion != null && !this.fhirVersion.isEmpty();
2249  }
2250
2251  /**
2252   * @param value {@link #fhirVersion} (The version of the FHIR specification on
2253   *              which this StructureDefinition is based - this is the formal
2254   *              version of the specification, without the revision number, e.g.
2255   *              [publication].[major].[minor], which is 1.0.2 for this
2256   *              version.). This is the underlying object with id, value and
2257   *              extensions. The accessor "getFhirVersion" gives direct access to
2258   *              the value
2259   */
2260  public StructureDefinition setFhirVersionElement(IdType value) {
2261    this.fhirVersion = value;
2262    return this;
2263  }
2264
2265  /**
2266   * @return The version of the FHIR specification on which this
2267   *         StructureDefinition is based - this is the formal version of the
2268   *         specification, without the revision number, e.g.
2269   *         [publication].[major].[minor], which is 1.0.2 for this version.
2270   */
2271  public String getFhirVersion() {
2272    return this.fhirVersion == null ? null : this.fhirVersion.getValue();
2273  }
2274
2275  /**
2276   * @param value The version of the FHIR specification on which this
2277   *              StructureDefinition is based - this is the formal version of the
2278   *              specification, without the revision number, e.g.
2279   *              [publication].[major].[minor], which is 1.0.2 for this version.
2280   */
2281  public StructureDefinition setFhirVersion(String value) {
2282    if (Utilities.noString(value))
2283      this.fhirVersion = null;
2284    else {
2285      if (this.fhirVersion == null)
2286        this.fhirVersion = new IdType();
2287      this.fhirVersion.setValue(value);
2288    }
2289    return this;
2290  }
2291
2292  /**
2293   * @return {@link #mapping} (An external specification that the content is
2294   *         mapped to.)
2295   */
2296  public List<StructureDefinitionMappingComponent> getMapping() {
2297    if (this.mapping == null)
2298      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2299    return this.mapping;
2300  }
2301
2302  public boolean hasMapping() {
2303    if (this.mapping == null)
2304      return false;
2305    for (StructureDefinitionMappingComponent item : this.mapping)
2306      if (!item.isEmpty())
2307        return true;
2308    return false;
2309  }
2310
2311  /**
2312   * @return {@link #mapping} (An external specification that the content is
2313   *         mapped to.)
2314   */
2315  // syntactic sugar
2316  public StructureDefinitionMappingComponent addMapping() { // 3
2317    StructureDefinitionMappingComponent t = new StructureDefinitionMappingComponent();
2318    if (this.mapping == null)
2319      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2320    this.mapping.add(t);
2321    return t;
2322  }
2323
2324  // syntactic sugar
2325  public StructureDefinition addMapping(StructureDefinitionMappingComponent t) { // 3
2326    if (t == null)
2327      return this;
2328    if (this.mapping == null)
2329      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2330    this.mapping.add(t);
2331    return this;
2332  }
2333
2334  /**
2335   * @return {@link #kind} (Defines the kind of structure that this definition is
2336   *         describing.). This is the underlying object with id, value and
2337   *         extensions. The accessor "getKind" gives direct access to the value
2338   */
2339  public Enumeration<StructureDefinitionKind> getKindElement() {
2340    if (this.kind == null)
2341      if (Configuration.errorOnAutoCreate())
2342        throw new Error("Attempt to auto-create StructureDefinition.kind");
2343      else if (Configuration.doAutoCreate())
2344        this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory()); // bb
2345    return this.kind;
2346  }
2347
2348  public boolean hasKindElement() {
2349    return this.kind != null && !this.kind.isEmpty();
2350  }
2351
2352  public boolean hasKind() {
2353    return this.kind != null && !this.kind.isEmpty();
2354  }
2355
2356  /**
2357   * @param value {@link #kind} (Defines the kind of structure that this
2358   *              definition is describing.). This is the underlying object with
2359   *              id, value and extensions. The accessor "getKind" gives direct
2360   *              access to the value
2361   */
2362  public StructureDefinition setKindElement(Enumeration<StructureDefinitionKind> value) {
2363    this.kind = value;
2364    return this;
2365  }
2366
2367  /**
2368   * @return Defines the kind of structure that this definition is describing.
2369   */
2370  public StructureDefinitionKind getKind() {
2371    return this.kind == null ? null : this.kind.getValue();
2372  }
2373
2374  /**
2375   * @param value Defines the kind of structure that this definition is
2376   *              describing.
2377   */
2378  public StructureDefinition setKind(StructureDefinitionKind value) {
2379    if (this.kind == null)
2380      this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory());
2381    this.kind.setValue(value);
2382    return this;
2383  }
2384
2385  /**
2386   * @return {@link #constrainedType} (The type of type that is being constrained
2387   *         - a data type, an extension, a resource, including abstract ones. If
2388   *         this field is present, it indicates that the structure definition is
2389   *         a constraint. If it is not present, then the structure definition is
2390   *         the definition of a base structure.). This is the underlying object
2391   *         with id, value and extensions. The accessor "getConstrainedType"
2392   *         gives direct access to the value
2393   */
2394  public CodeType getConstrainedTypeElement() {
2395    if (this.constrainedType == null)
2396      if (Configuration.errorOnAutoCreate())
2397        throw new Error("Attempt to auto-create StructureDefinition.constrainedType");
2398      else if (Configuration.doAutoCreate())
2399        this.constrainedType = new CodeType(); // bb
2400    return this.constrainedType;
2401  }
2402
2403  public boolean hasConstrainedTypeElement() {
2404    return this.constrainedType != null && !this.constrainedType.isEmpty();
2405  }
2406
2407  public boolean hasConstrainedType() {
2408    return this.constrainedType != null && !this.constrainedType.isEmpty();
2409  }
2410
2411  /**
2412   * @param value {@link #constrainedType} (The type of type that is being
2413   *              constrained - a data type, an extension, a resource, including
2414   *              abstract ones. If this field is present, it indicates that the
2415   *              structure definition is a constraint. If it is not present, then
2416   *              the structure definition is the definition of a base
2417   *              structure.). This is the underlying object with id, value and
2418   *              extensions. The accessor "getConstrainedType" gives direct
2419   *              access to the value
2420   */
2421  public StructureDefinition setConstrainedTypeElement(CodeType value) {
2422    this.constrainedType = value;
2423    return this;
2424  }
2425
2426  /**
2427   * @return The type of type that is being constrained - a data type, an
2428   *         extension, a resource, including abstract ones. If this field is
2429   *         present, it indicates that the structure definition is a constraint.
2430   *         If it is not present, then the structure definition is the definition
2431   *         of a base structure.
2432   */
2433  public String getConstrainedType() {
2434    return this.constrainedType == null ? null : this.constrainedType.getValue();
2435  }
2436
2437  /**
2438   * @param value The type of type that is being constrained - a data type, an
2439   *              extension, a resource, including abstract ones. If this field is
2440   *              present, it indicates that the structure definition is a
2441   *              constraint. If it is not present, then the structure definition
2442   *              is the definition of a base structure.
2443   */
2444  public StructureDefinition setConstrainedType(String value) {
2445    if (Utilities.noString(value))
2446      this.constrainedType = null;
2447    else {
2448      if (this.constrainedType == null)
2449        this.constrainedType = new CodeType();
2450      this.constrainedType.setValue(value);
2451    }
2452    return this;
2453  }
2454
2455  /**
2456   * @return {@link #abstract_} (Whether structure this definition describes is
2457   *         abstract or not - that is, whether an actual exchanged item can ever
2458   *         be of this type.). This is the underlying object with id, value and
2459   *         extensions. The accessor "getAbstract" gives direct access to the
2460   *         value
2461   */
2462  public BooleanType getAbstractElement() {
2463    if (this.abstract_ == null)
2464      if (Configuration.errorOnAutoCreate())
2465        throw new Error("Attempt to auto-create StructureDefinition.abstract_");
2466      else if (Configuration.doAutoCreate())
2467        this.abstract_ = new BooleanType(); // bb
2468    return this.abstract_;
2469  }
2470
2471  public boolean hasAbstractElement() {
2472    return this.abstract_ != null && !this.abstract_.isEmpty();
2473  }
2474
2475  public boolean hasAbstract() {
2476    return this.abstract_ != null && !this.abstract_.isEmpty();
2477  }
2478
2479  /**
2480   * @param value {@link #abstract_} (Whether structure this definition describes
2481   *              is abstract or not - that is, whether an actual exchanged item
2482   *              can ever be of this type.). This is the underlying object with
2483   *              id, value and extensions. The accessor "getAbstract" gives
2484   *              direct access to the value
2485   */
2486  public StructureDefinition setAbstractElement(BooleanType value) {
2487    this.abstract_ = value;
2488    return this;
2489  }
2490
2491  /**
2492   * @return Whether structure this definition describes is abstract or not - that
2493   *         is, whether an actual exchanged item can ever be of this type.
2494   */
2495  public boolean getAbstract() {
2496    return this.abstract_ == null || this.abstract_.isEmpty() ? false : this.abstract_.getValue();
2497  }
2498
2499  /**
2500   * @param value Whether structure this definition describes is abstract or not -
2501   *              that is, whether an actual exchanged item can ever be of this
2502   *              type.
2503   */
2504  public StructureDefinition setAbstract(boolean value) {
2505    if (this.abstract_ == null)
2506      this.abstract_ = new BooleanType();
2507    this.abstract_.setValue(value);
2508    return this;
2509  }
2510
2511  /**
2512   * @return {@link #contextType} (If this is an extension, Identifies the context
2513   *         within FHIR resources where the extension can be used.). This is the
2514   *         underlying object with id, value and extensions. The accessor
2515   *         "getContextType" gives direct access to the value
2516   */
2517  public Enumeration<ExtensionContext> getContextTypeElement() {
2518    if (this.contextType == null)
2519      if (Configuration.errorOnAutoCreate())
2520        throw new Error("Attempt to auto-create StructureDefinition.contextType");
2521      else if (Configuration.doAutoCreate())
2522        this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory()); // bb
2523    return this.contextType;
2524  }
2525
2526  public boolean hasContextTypeElement() {
2527    return this.contextType != null && !this.contextType.isEmpty();
2528  }
2529
2530  public boolean hasContextType() {
2531    return this.contextType != null && !this.contextType.isEmpty();
2532  }
2533
2534  /**
2535   * @param value {@link #contextType} (If this is an extension, Identifies the
2536   *              context within FHIR resources where the extension can be used.).
2537   *              This is the underlying object with id, value and extensions. The
2538   *              accessor "getContextType" gives direct access to the value
2539   */
2540  public StructureDefinition setContextTypeElement(Enumeration<ExtensionContext> value) {
2541    this.contextType = value;
2542    return this;
2543  }
2544
2545  /**
2546   * @return If this is an extension, Identifies the context within FHIR resources
2547   *         where the extension can be used.
2548   */
2549  public ExtensionContext getContextType() {
2550    return this.contextType == null ? null : this.contextType.getValue();
2551  }
2552
2553  /**
2554   * @param value If this is an extension, Identifies the context within FHIR
2555   *              resources where the extension can be used.
2556   */
2557  public StructureDefinition setContextType(ExtensionContext value) {
2558    if (value == null)
2559      this.contextType = null;
2560    else {
2561      if (this.contextType == null)
2562        this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory());
2563      this.contextType.setValue(value);
2564    }
2565    return this;
2566  }
2567
2568  /**
2569   * @return {@link #context} (Identifies the types of resource or data type
2570   *         elements to which the extension can be applied.)
2571   */
2572  public List<StringType> getContext() {
2573    if (this.context == null)
2574      this.context = new ArrayList<StringType>();
2575    return this.context;
2576  }
2577
2578  public boolean hasContext() {
2579    if (this.context == null)
2580      return false;
2581    for (StringType item : this.context)
2582      if (!item.isEmpty())
2583        return true;
2584    return false;
2585  }
2586
2587  /**
2588   * @return {@link #context} (Identifies the types of resource or data type
2589   *         elements to which the extension can be applied.)
2590   */
2591  // syntactic sugar
2592  public StringType addContextElement() {// 2
2593    StringType t = new StringType();
2594    if (this.context == null)
2595      this.context = new ArrayList<StringType>();
2596    this.context.add(t);
2597    return t;
2598  }
2599
2600  /**
2601   * @param value {@link #context} (Identifies the types of resource or data type
2602   *              elements to which the extension can be applied.)
2603   */
2604  public StructureDefinition addContext(String value) { // 1
2605    StringType t = new StringType();
2606    t.setValue(value);
2607    if (this.context == null)
2608      this.context = new ArrayList<StringType>();
2609    this.context.add(t);
2610    return this;
2611  }
2612
2613  /**
2614   * @param value {@link #context} (Identifies the types of resource or data type
2615   *              elements to which the extension can be applied.)
2616   */
2617  public boolean hasContext(String value) {
2618    if (this.context == null)
2619      return false;
2620    for (StringType v : this.context)
2621      if (v.equals(value)) // string
2622        return true;
2623    return false;
2624  }
2625
2626  /**
2627   * @return {@link #base} (An absolute URI that is the base structure from which
2628   *         this set of constraints is derived.). This is the underlying object
2629   *         with id, value and extensions. The accessor "getBase" gives direct
2630   *         access to the value
2631   */
2632  public UriType getBaseElement() {
2633    if (this.base == null)
2634      if (Configuration.errorOnAutoCreate())
2635        throw new Error("Attempt to auto-create StructureDefinition.base");
2636      else if (Configuration.doAutoCreate())
2637        this.base = new UriType(); // bb
2638    return this.base;
2639  }
2640
2641  public boolean hasBaseElement() {
2642    return this.base != null && !this.base.isEmpty();
2643  }
2644
2645  public boolean hasBase() {
2646    return this.base != null && !this.base.isEmpty();
2647  }
2648
2649  /**
2650   * @param value {@link #base} (An absolute URI that is the base structure from
2651   *              which this set of constraints is derived.). This is the
2652   *              underlying object with id, value and extensions. The accessor
2653   *              "getBase" gives direct access to the value
2654   */
2655  public StructureDefinition setBaseElement(UriType value) {
2656    this.base = value;
2657    return this;
2658  }
2659
2660  /**
2661   * @return An absolute URI that is the base structure from which this set of
2662   *         constraints is derived.
2663   */
2664  public String getBase() {
2665    return this.base == null ? null : this.base.getValue();
2666  }
2667
2668  /**
2669   * @param value An absolute URI that is the base structure from which this set
2670   *              of constraints is derived.
2671   */
2672  public StructureDefinition setBase(String value) {
2673    if (Utilities.noString(value))
2674      this.base = null;
2675    else {
2676      if (this.base == null)
2677        this.base = new UriType();
2678      this.base.setValue(value);
2679    }
2680    return this;
2681  }
2682
2683  /**
2684   * @return {@link #snapshot} (A snapshot view is expressed in a stand alone form
2685   *         that can be used and interpreted without considering the base
2686   *         StructureDefinition.)
2687   */
2688  public StructureDefinitionSnapshotComponent getSnapshot() {
2689    if (this.snapshot == null)
2690      if (Configuration.errorOnAutoCreate())
2691        throw new Error("Attempt to auto-create StructureDefinition.snapshot");
2692      else if (Configuration.doAutoCreate())
2693        this.snapshot = new StructureDefinitionSnapshotComponent(); // cc
2694    return this.snapshot;
2695  }
2696
2697  public boolean hasSnapshot() {
2698    return this.snapshot != null && !this.snapshot.isEmpty();
2699  }
2700
2701  /**
2702   * @param value {@link #snapshot} (A snapshot view is expressed in a stand alone
2703   *              form that can be used and interpreted without considering the
2704   *              base StructureDefinition.)
2705   */
2706  public StructureDefinition setSnapshot(StructureDefinitionSnapshotComponent value) {
2707    this.snapshot = value;
2708    return this;
2709  }
2710
2711  /**
2712   * @return {@link #differential} (A differential view is expressed relative to
2713   *         the base StructureDefinition - a statement of differences that it
2714   *         applies.)
2715   */
2716  public StructureDefinitionDifferentialComponent getDifferential() {
2717    if (this.differential == null)
2718      if (Configuration.errorOnAutoCreate())
2719        throw new Error("Attempt to auto-create StructureDefinition.differential");
2720      else if (Configuration.doAutoCreate())
2721        this.differential = new StructureDefinitionDifferentialComponent(); // cc
2722    return this.differential;
2723  }
2724
2725  public boolean hasDifferential() {
2726    return this.differential != null && !this.differential.isEmpty();
2727  }
2728
2729  /**
2730   * @param value {@link #differential} (A differential view is expressed relative
2731   *              to the base StructureDefinition - a statement of differences
2732   *              that it applies.)
2733   */
2734  public StructureDefinition setDifferential(StructureDefinitionDifferentialComponent value) {
2735    this.differential = value;
2736    return this;
2737  }
2738
2739  protected void listChildren(List<Property> childrenList) {
2740    super.listChildren(childrenList);
2741    childrenList.add(new Property("url", "uri",
2742        "An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.",
2743        0, java.lang.Integer.MAX_VALUE, url));
2744    childrenList.add(new Property("identifier", "Identifier",
2745        "Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).",
2746        0, java.lang.Integer.MAX_VALUE, identifier));
2747    childrenList.add(new Property("version", "string",
2748        "The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.",
2749        0, java.lang.Integer.MAX_VALUE, version));
2750    childrenList
2751        .add(new Property("name", "string", "A free text natural language name identifying the StructureDefinition.", 0,
2752            java.lang.Integer.MAX_VALUE, name));
2753    childrenList.add(new Property("display", "string",
2754        "Defined so that applications can use this name when displaying the value of the extension to the user.", 0,
2755        java.lang.Integer.MAX_VALUE, display));
2756    childrenList.add(new Property("status", "code", "The status of the StructureDefinition.", 0,
2757        java.lang.Integer.MAX_VALUE, status));
2758    childrenList.add(new Property("experimental", "boolean",
2759        "This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.",
2760        0, java.lang.Integer.MAX_VALUE, experimental));
2761    childrenList.add(new Property("publisher", "string",
2762        "The name of the individual or organization that published the structure definition.", 0,
2763        java.lang.Integer.MAX_VALUE, publisher));
2764    childrenList
2765        .add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.",
2766            0, java.lang.Integer.MAX_VALUE, contact));
2767    childrenList.add(new Property("date", "dateTime",
2768        "The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.",
2769        0, java.lang.Integer.MAX_VALUE, date));
2770    childrenList.add(new Property("description", "string",
2771        "A free text natural language description of the StructureDefinition and its use.", 0,
2772        java.lang.Integer.MAX_VALUE, description));
2773    childrenList.add(new Property("useContext", "CodeableConcept",
2774        "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.",
2775        0, java.lang.Integer.MAX_VALUE, useContext));
2776    childrenList.add(new Property("requirements", "string",
2777        "Explains why this structure definition is needed and why it's been constrained as it has.", 0,
2778        java.lang.Integer.MAX_VALUE, requirements));
2779    childrenList.add(new Property("copyright", "string",
2780        "A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.",
2781        0, java.lang.Integer.MAX_VALUE, copyright));
2782    childrenList.add(new Property("code", "Coding",
2783        "A set of terms from external terminologies that may be used to assist with indexing and searching of templates.",
2784        0, java.lang.Integer.MAX_VALUE, code));
2785    childrenList.add(new Property("fhirVersion", "id",
2786        "The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.",
2787        0, java.lang.Integer.MAX_VALUE, fhirVersion));
2788    childrenList.add(new Property("mapping", "", "An external specification that the content is mapped to.", 0,
2789        java.lang.Integer.MAX_VALUE, mapping));
2790    childrenList.add(new Property("kind", "code", "Defines the kind of structure that this definition is describing.",
2791        0, java.lang.Integer.MAX_VALUE, kind));
2792    childrenList.add(new Property("constrainedType", "code",
2793        "The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.",
2794        0, java.lang.Integer.MAX_VALUE, constrainedType));
2795    childrenList.add(new Property("abstract", "boolean",
2796        "Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.",
2797        0, java.lang.Integer.MAX_VALUE, abstract_));
2798    childrenList.add(new Property("contextType", "code",
2799        "If this is an extension, Identifies the context within FHIR resources where the extension can be used.", 0,
2800        java.lang.Integer.MAX_VALUE, contextType));
2801    childrenList.add(new Property("context", "string",
2802        "Identifies the types of resource or data type elements to which the extension can be applied.", 0,
2803        java.lang.Integer.MAX_VALUE, context));
2804    childrenList.add(new Property("base", "uri",
2805        "An absolute URI that is the base structure from which this set of constraints is derived.", 0,
2806        java.lang.Integer.MAX_VALUE, base));
2807    childrenList.add(new Property("snapshot", "",
2808        "A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.",
2809        0, java.lang.Integer.MAX_VALUE, snapshot));
2810    childrenList.add(new Property("differential", "",
2811        "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.",
2812        0, java.lang.Integer.MAX_VALUE, differential));
2813  }
2814
2815  @Override
2816  public void setProperty(String name, Base value) throws FHIRException {
2817    if (name.equals("url"))
2818      this.url = castToUri(value); // UriType
2819    else if (name.equals("identifier"))
2820      this.getIdentifier().add(castToIdentifier(value));
2821    else if (name.equals("version"))
2822      this.version = castToString(value); // StringType
2823    else if (name.equals("name"))
2824      this.name = castToString(value); // StringType
2825    else if (name.equals("display"))
2826      this.display = castToString(value); // StringType
2827    else if (name.equals("status"))
2828      this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
2829    else if (name.equals("experimental"))
2830      this.experimental = castToBoolean(value); // BooleanType
2831    else if (name.equals("publisher"))
2832      this.publisher = castToString(value); // StringType
2833    else if (name.equals("contact"))
2834      this.getContact().add((StructureDefinitionContactComponent) value);
2835    else if (name.equals("date"))
2836      this.date = castToDateTime(value); // DateTimeType
2837    else if (name.equals("description"))
2838      this.description = castToString(value); // StringType
2839    else if (name.equals("useContext"))
2840      this.getUseContext().add(castToCodeableConcept(value));
2841    else if (name.equals("requirements"))
2842      this.requirements = castToString(value); // StringType
2843    else if (name.equals("copyright"))
2844      this.copyright = castToString(value); // StringType
2845    else if (name.equals("code"))
2846      this.getCode().add(castToCoding(value));
2847    else if (name.equals("fhirVersion"))
2848      this.fhirVersion = castToId(value); // IdType
2849    else if (name.equals("mapping"))
2850      this.getMapping().add((StructureDefinitionMappingComponent) value);
2851    else if (name.equals("kind"))
2852      this.kind = new StructureDefinitionKindEnumFactory().fromType(value); // Enumeration<StructureDefinitionKind>
2853    else if (name.equals("constrainedType"))
2854      this.constrainedType = castToCode(value); // CodeType
2855    else if (name.equals("abstract"))
2856      this.abstract_ = castToBoolean(value); // BooleanType
2857    else if (name.equals("contextType"))
2858      this.contextType = new ExtensionContextEnumFactory().fromType(value); // Enumeration<ExtensionContext>
2859    else if (name.equals("context"))
2860      this.getContext().add(castToString(value));
2861    else if (name.equals("base"))
2862      this.base = castToUri(value); // UriType
2863    else if (name.equals("snapshot"))
2864      this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
2865    else if (name.equals("differential"))
2866      this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
2867    else
2868      super.setProperty(name, value);
2869  }
2870
2871  @Override
2872  public Base addChild(String name) throws FHIRException {
2873    if (name.equals("url")) {
2874      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.url");
2875    } else if (name.equals("identifier")) {
2876      return addIdentifier();
2877    } else if (name.equals("version")) {
2878      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.version");
2879    } else if (name.equals("name")) {
2880      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.name");
2881    } else if (name.equals("display")) {
2882      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.display");
2883    } else if (name.equals("status")) {
2884      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.status");
2885    } else if (name.equals("experimental")) {
2886      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.experimental");
2887    } else if (name.equals("publisher")) {
2888      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.publisher");
2889    } else if (name.equals("contact")) {
2890      return addContact();
2891    } else if (name.equals("date")) {
2892      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.date");
2893    } else if (name.equals("description")) {
2894      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.description");
2895    } else if (name.equals("useContext")) {
2896      return addUseContext();
2897    } else if (name.equals("requirements")) {
2898      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.requirements");
2899    } else if (name.equals("copyright")) {
2900      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.copyright");
2901    } else if (name.equals("code")) {
2902      return addCode();
2903    } else if (name.equals("fhirVersion")) {
2904      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.fhirVersion");
2905    } else if (name.equals("mapping")) {
2906      return addMapping();
2907    } else if (name.equals("kind")) {
2908      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.kind");
2909    } else if (name.equals("constrainedType")) {
2910      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.constrainedType");
2911    } else if (name.equals("abstract")) {
2912      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.abstract");
2913    } else if (name.equals("contextType")) {
2914      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.contextType");
2915    } else if (name.equals("context")) {
2916      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.context");
2917    } else if (name.equals("base")) {
2918      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.base");
2919    } else if (name.equals("snapshot")) {
2920      this.snapshot = new StructureDefinitionSnapshotComponent();
2921      return this.snapshot;
2922    } else if (name.equals("differential")) {
2923      this.differential = new StructureDefinitionDifferentialComponent();
2924      return this.differential;
2925    } else
2926      return super.addChild(name);
2927  }
2928
2929  public String fhirType() {
2930    return "StructureDefinition";
2931
2932  }
2933
2934  public StructureDefinition copy() {
2935    StructureDefinition dst = new StructureDefinition();
2936    copyValues(dst);
2937    dst.url = url == null ? null : url.copy();
2938    if (identifier != null) {
2939      dst.identifier = new ArrayList<Identifier>();
2940      for (Identifier i : identifier)
2941        dst.identifier.add(i.copy());
2942    }
2943    ;
2944    dst.version = version == null ? null : version.copy();
2945    dst.name = name == null ? null : name.copy();
2946    dst.display = display == null ? null : display.copy();
2947    dst.status = status == null ? null : status.copy();
2948    dst.experimental = experimental == null ? null : experimental.copy();
2949    dst.publisher = publisher == null ? null : publisher.copy();
2950    if (contact != null) {
2951      dst.contact = new ArrayList<StructureDefinitionContactComponent>();
2952      for (StructureDefinitionContactComponent i : contact)
2953        dst.contact.add(i.copy());
2954    }
2955    ;
2956    dst.date = date == null ? null : date.copy();
2957    dst.description = description == null ? null : description.copy();
2958    if (useContext != null) {
2959      dst.useContext = new ArrayList<CodeableConcept>();
2960      for (CodeableConcept i : useContext)
2961        dst.useContext.add(i.copy());
2962    }
2963    ;
2964    dst.requirements = requirements == null ? null : requirements.copy();
2965    dst.copyright = copyright == null ? null : copyright.copy();
2966    if (code != null) {
2967      dst.code = new ArrayList<Coding>();
2968      for (Coding i : code)
2969        dst.code.add(i.copy());
2970    }
2971    ;
2972    dst.fhirVersion = fhirVersion == null ? null : fhirVersion.copy();
2973    if (mapping != null) {
2974      dst.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2975      for (StructureDefinitionMappingComponent i : mapping)
2976        dst.mapping.add(i.copy());
2977    }
2978    ;
2979    dst.kind = kind == null ? null : kind.copy();
2980    dst.constrainedType = constrainedType == null ? null : constrainedType.copy();
2981    dst.abstract_ = abstract_ == null ? null : abstract_.copy();
2982    dst.contextType = contextType == null ? null : contextType.copy();
2983    if (context != null) {
2984      dst.context = new ArrayList<StringType>();
2985      for (StringType i : context)
2986        dst.context.add(i.copy());
2987    }
2988    ;
2989    dst.base = base == null ? null : base.copy();
2990    dst.snapshot = snapshot == null ? null : snapshot.copy();
2991    dst.differential = differential == null ? null : differential.copy();
2992    return dst;
2993  }
2994
2995  protected StructureDefinition typedCopy() {
2996    return copy();
2997  }
2998
2999  @Override
3000  public boolean equalsDeep(Base other) {
3001    if (!super.equalsDeep(other))
3002      return false;
3003    if (!(other instanceof StructureDefinition))
3004      return false;
3005    StructureDefinition o = (StructureDefinition) other;
3006    return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true)
3007        && compareDeep(version, o.version, true) && compareDeep(name, o.name, true)
3008        && compareDeep(display, o.display, true) && compareDeep(status, o.status, true)
3009        && compareDeep(experimental, o.experimental, true) && compareDeep(publisher, o.publisher, true)
3010        && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
3011        && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
3012        && compareDeep(requirements, o.requirements, true) && compareDeep(copyright, o.copyright, true)
3013        && compareDeep(code, o.code, true) && compareDeep(fhirVersion, o.fhirVersion, true)
3014        && compareDeep(mapping, o.mapping, true) && compareDeep(kind, o.kind, true)
3015        && compareDeep(constrainedType, o.constrainedType, true) && compareDeep(abstract_, o.abstract_, true)
3016        && compareDeep(contextType, o.contextType, true) && compareDeep(context, o.context, true)
3017        && compareDeep(base, o.base, true) && compareDeep(snapshot, o.snapshot, true)
3018        && compareDeep(differential, o.differential, true);
3019  }
3020
3021  @Override
3022  public boolean equalsShallow(Base other) {
3023    if (!super.equalsShallow(other))
3024      return false;
3025    if (!(other instanceof StructureDefinition))
3026      return false;
3027    StructureDefinition o = (StructureDefinition) other;
3028    return compareValues(url, o.url, true) && compareValues(version, o.version, true)
3029        && compareValues(name, o.name, true) && compareValues(display, o.display, true)
3030        && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
3031        && compareValues(publisher, o.publisher, true) && compareValues(date, o.date, true)
3032        && compareValues(description, o.description, true) && compareValues(requirements, o.requirements, true)
3033        && compareValues(copyright, o.copyright, true) && compareValues(fhirVersion, o.fhirVersion, true)
3034        && compareValues(kind, o.kind, true) && compareValues(constrainedType, o.constrainedType, true)
3035        && compareValues(abstract_, o.abstract_, true) && compareValues(contextType, o.contextType, true)
3036        && compareValues(context, o.context, true) && compareValues(base, o.base, true);
3037  }
3038
3039  public boolean isEmpty() {
3040    return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
3041        && (version == null || version.isEmpty()) && (name == null || name.isEmpty())
3042        && (display == null || display.isEmpty()) && (status == null || status.isEmpty())
3043        && (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
3044        && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty())
3045        && (description == null || description.isEmpty()) && (useContext == null || useContext.isEmpty())
3046        && (requirements == null || requirements.isEmpty()) && (copyright == null || copyright.isEmpty())
3047        && (code == null || code.isEmpty()) && (fhirVersion == null || fhirVersion.isEmpty())
3048        && (mapping == null || mapping.isEmpty()) && (kind == null || kind.isEmpty())
3049        && (constrainedType == null || constrainedType.isEmpty()) && (abstract_ == null || abstract_.isEmpty())
3050        && (contextType == null || contextType.isEmpty()) && (context == null || context.isEmpty())
3051        && (base == null || base.isEmpty()) && (snapshot == null || snapshot.isEmpty())
3052        && (differential == null || differential.isEmpty());
3053  }
3054
3055  @Override
3056  public ResourceType getResourceType() {
3057    return ResourceType.StructureDefinition;
3058  }
3059
3060  @SearchParamDefinition(name = "date", path = "StructureDefinition.date", description = "The profile publication date", type = "date")
3061  public static final String SP_DATE = "date";
3062  @SearchParamDefinition(name = "identifier", path = "StructureDefinition.identifier", description = "The identifier of the profile", type = "token")
3063  public static final String SP_IDENTIFIER = "identifier";
3064  @SearchParamDefinition(name = "code", path = "StructureDefinition.code", description = "A code for the profile", type = "token")
3065  public static final String SP_CODE = "code";
3066  @SearchParamDefinition(name = "valueset", path = "StructureDefinition.snapshot.element.binding.valueSet[x]", description = "A vocabulary binding reference", type = "reference")
3067  public static final String SP_VALUESET = "valueset";
3068  @SearchParamDefinition(name = "kind", path = "StructureDefinition.kind", description = "datatype | resource | logical", type = "token")
3069  public static final String SP_KIND = "kind";
3070  @SearchParamDefinition(name = "display", path = "StructureDefinition.display", description = "Use this name when displaying the value", type = "string")
3071  public static final String SP_DISPLAY = "display";
3072  @SearchParamDefinition(name = "description", path = "StructureDefinition.description", description = "Text search in the description of the profile", type = "string")
3073  public static final String SP_DESCRIPTION = "description";
3074  @SearchParamDefinition(name = "experimental", path = "StructureDefinition.experimental", description = "If for testing purposes, not real usage", type = "token")
3075  public static final String SP_EXPERIMENTAL = "experimental";
3076  @SearchParamDefinition(name = "context-type", path = "StructureDefinition.contextType", description = "resource | datatype | mapping | extension", type = "token")
3077  public static final String SP_CONTEXTTYPE = "context-type";
3078  @SearchParamDefinition(name = "abstract", path = "StructureDefinition.abstract", description = "Whether the structure is abstract", type = "token")
3079  public static final String SP_ABSTRACT = "abstract";
3080  @SearchParamDefinition(name = "type", path = "StructureDefinition.constrainedType", description = "Any datatype or resource, including abstract ones", type = "token")
3081  public static final String SP_TYPE = "type";
3082  @SearchParamDefinition(name = "version", path = "StructureDefinition.version", description = "The version identifier of the profile", type = "token")
3083  public static final String SP_VERSION = "version";
3084  @SearchParamDefinition(name = "url", path = "StructureDefinition.url", description = "Absolute URL used to reference this StructureDefinition", type = "uri")
3085  public static final String SP_URL = "url";
3086  @SearchParamDefinition(name = "path", path = "StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path", description = "A path that is constrained in the profile", type = "token")
3087  public static final String SP_PATH = "path";
3088  @SearchParamDefinition(name = "ext-context", path = "StructureDefinition.context", description = "Where the extension can be used in instances", type = "string")
3089  public static final String SP_EXTCONTEXT = "ext-context";
3090  @SearchParamDefinition(name = "name", path = "StructureDefinition.name", description = "Name of the profile", type = "string")
3091  public static final String SP_NAME = "name";
3092  @SearchParamDefinition(name = "context", path = "StructureDefinition.useContext", description = "A use context assigned to the structure", type = "token")
3093  public static final String SP_CONTEXT = "context";
3094  @SearchParamDefinition(name = "base-path", path = "StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path", description = "Path that identifies the base element", type = "token")
3095  public static final String SP_BASEPATH = "base-path";
3096  @SearchParamDefinition(name = "publisher", path = "StructureDefinition.publisher", description = "Name of the publisher of the profile", type = "string")
3097  public static final String SP_PUBLISHER = "publisher";
3098  @SearchParamDefinition(name = "status", path = "StructureDefinition.status", description = "The current status of the profile", type = "token")
3099  public static final String SP_STATUS = "status";
3100  @SearchParamDefinition(name = "base", path = "StructureDefinition.base", description = "Structure that this set of constraints applies to", type = "uri")
3101  public static final String SP_BASE = "base";
3102
3103}