001package org.hl7.fhir.instance.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.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
037import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.*;
042/**
043 * The formal description of a single piece of information that can be gathered and reported.
044 */
045@ResourceDef(name="DataElement", profile="http://hl7.org/fhir/Profile/DataElement")
046public class DataElement extends DomainResource {
047
048    public enum DataElementStringency {
049        /**
050         * The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).
051         */
052        COMPARABLE, 
053        /**
054         * The data element is fully specified down to a single value set, single unit of measure, single data type, etc.  Multiple pieces of data associated with this data element are fully comparable.
055         */
056        FULLYSPECIFIED, 
057        /**
058         * The data element allows multiple units of measure having equivalent meaning; e.g. "cc" (cubic centimeter) and "mL" (milliliter).
059         */
060        EQUIVALENT, 
061        /**
062         * The data element allows multiple units of measure that are convertable between each other (e.g. inches and centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing conversion of meaning.
063         */
064        CONVERTABLE, 
065        /**
066         * A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg.
067         */
068        SCALEABLE, 
069        /**
070         * The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated comparison of data captured using the data element is not possible.
071         */
072        FLEXIBLE, 
073        /**
074         * added to help the parsers
075         */
076        NULL;
077        public static DataElementStringency fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("comparable".equals(codeString))
081          return COMPARABLE;
082        if ("fully-specified".equals(codeString))
083          return FULLYSPECIFIED;
084        if ("equivalent".equals(codeString))
085          return EQUIVALENT;
086        if ("convertable".equals(codeString))
087          return CONVERTABLE;
088        if ("scaleable".equals(codeString))
089          return SCALEABLE;
090        if ("flexible".equals(codeString))
091          return FLEXIBLE;
092        throw new FHIRException("Unknown DataElementStringency code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case COMPARABLE: return "comparable";
097            case FULLYSPECIFIED: return "fully-specified";
098            case EQUIVALENT: return "equivalent";
099            case CONVERTABLE: return "convertable";
100            case SCALEABLE: return "scaleable";
101            case FLEXIBLE: return "flexible";
102            default: return "?";
103          }
104        }
105        public String getSystem() {
106          switch (this) {
107            case COMPARABLE: return "http://hl7.org/fhir/dataelement-stringency";
108            case FULLYSPECIFIED: return "http://hl7.org/fhir/dataelement-stringency";
109            case EQUIVALENT: return "http://hl7.org/fhir/dataelement-stringency";
110            case CONVERTABLE: return "http://hl7.org/fhir/dataelement-stringency";
111            case SCALEABLE: return "http://hl7.org/fhir/dataelement-stringency";
112            case FLEXIBLE: return "http://hl7.org/fhir/dataelement-stringency";
113            default: return "?";
114          }
115        }
116        public String getDefinition() {
117          switch (this) {
118            case COMPARABLE: return "The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).";
119            case FULLYSPECIFIED: return "The data element is fully specified down to a single value set, single unit of measure, single data type, etc.  Multiple pieces of data associated with this data element are fully comparable.";
120            case EQUIVALENT: return "The data element allows multiple units of measure having equivalent meaning; e.g. \"cc\" (cubic centimeter) and \"mL\" (milliliter).";
121            case CONVERTABLE: return "The data element allows multiple units of measure that are convertable between each other (e.g. inches and centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing conversion of meaning.";
122            case SCALEABLE: return "A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg.";
123            case FLEXIBLE: return "The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated comparison of data captured using the data element is not possible.";
124            default: return "?";
125          }
126        }
127        public String getDisplay() {
128          switch (this) {
129            case COMPARABLE: return "Comparable";
130            case FULLYSPECIFIED: return "Fully Specified";
131            case EQUIVALENT: return "Equivalent";
132            case CONVERTABLE: return "Convertable";
133            case SCALEABLE: return "Scaleable";
134            case FLEXIBLE: return "Flexible";
135            default: return "?";
136          }
137        }
138    }
139
140  public static class DataElementStringencyEnumFactory implements EnumFactory<DataElementStringency> {
141    public DataElementStringency fromCode(String codeString) throws IllegalArgumentException {
142      if (codeString == null || "".equals(codeString))
143            if (codeString == null || "".equals(codeString))
144                return null;
145        if ("comparable".equals(codeString))
146          return DataElementStringency.COMPARABLE;
147        if ("fully-specified".equals(codeString))
148          return DataElementStringency.FULLYSPECIFIED;
149        if ("equivalent".equals(codeString))
150          return DataElementStringency.EQUIVALENT;
151        if ("convertable".equals(codeString))
152          return DataElementStringency.CONVERTABLE;
153        if ("scaleable".equals(codeString))
154          return DataElementStringency.SCALEABLE;
155        if ("flexible".equals(codeString))
156          return DataElementStringency.FLEXIBLE;
157        throw new IllegalArgumentException("Unknown DataElementStringency code '"+codeString+"'");
158        }
159        public Enumeration<DataElementStringency> fromType(Base code) throws FHIRException {
160          if (code == null || code.isEmpty())
161            return null;
162          String codeString = ((PrimitiveType) code).asStringValue();
163          if (codeString == null || "".equals(codeString))
164            return null;
165        if ("comparable".equals(codeString))
166          return new Enumeration<DataElementStringency>(this, DataElementStringency.COMPARABLE);
167        if ("fully-specified".equals(codeString))
168          return new Enumeration<DataElementStringency>(this, DataElementStringency.FULLYSPECIFIED);
169        if ("equivalent".equals(codeString))
170          return new Enumeration<DataElementStringency>(this, DataElementStringency.EQUIVALENT);
171        if ("convertable".equals(codeString))
172          return new Enumeration<DataElementStringency>(this, DataElementStringency.CONVERTABLE);
173        if ("scaleable".equals(codeString))
174          return new Enumeration<DataElementStringency>(this, DataElementStringency.SCALEABLE);
175        if ("flexible".equals(codeString))
176          return new Enumeration<DataElementStringency>(this, DataElementStringency.FLEXIBLE);
177        throw new FHIRException("Unknown DataElementStringency code '"+codeString+"'");
178        }
179    public String toCode(DataElementStringency code) {
180      if (code == DataElementStringency.COMPARABLE)
181        return "comparable";
182      if (code == DataElementStringency.FULLYSPECIFIED)
183        return "fully-specified";
184      if (code == DataElementStringency.EQUIVALENT)
185        return "equivalent";
186      if (code == DataElementStringency.CONVERTABLE)
187        return "convertable";
188      if (code == DataElementStringency.SCALEABLE)
189        return "scaleable";
190      if (code == DataElementStringency.FLEXIBLE)
191        return "flexible";
192      return "?";
193      }
194    }
195
196    @Block()
197    public static class DataElementContactComponent extends BackboneElement implements IBaseBackboneElement {
198        /**
199         * The name of an individual to contact regarding the data element.
200         */
201        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
202        @Description(shortDefinition="Name of a individual to contact", formalDefinition="The name of an individual to contact regarding the data element." )
203        protected StringType name;
204
205        /**
206         * Contact details for individual (if a name was provided) or the publisher.
207         */
208        @Child(name = "telecom", type = {ContactPoint.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
209        @Description(shortDefinition="Contact details for individual or publisher", formalDefinition="Contact details for individual (if a name was provided) or the publisher." )
210        protected List<ContactPoint> telecom;
211
212        private static final long serialVersionUID = -1179697803L;
213
214    /*
215     * Constructor
216     */
217      public DataElementContactComponent() {
218        super();
219      }
220
221        /**
222         * @return {@link #name} (The name of an individual to contact regarding the data element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
223         */
224        public StringType getNameElement() { 
225          if (this.name == null)
226            if (Configuration.errorOnAutoCreate())
227              throw new Error("Attempt to auto-create DataElementContactComponent.name");
228            else if (Configuration.doAutoCreate())
229              this.name = new StringType(); // bb
230          return this.name;
231        }
232
233        public boolean hasNameElement() { 
234          return this.name != null && !this.name.isEmpty();
235        }
236
237        public boolean hasName() { 
238          return this.name != null && !this.name.isEmpty();
239        }
240
241        /**
242         * @param value {@link #name} (The name of an individual to contact regarding the data element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
243         */
244        public DataElementContactComponent setNameElement(StringType value) { 
245          this.name = value;
246          return this;
247        }
248
249        /**
250         * @return The name of an individual to contact regarding the data element.
251         */
252        public String getName() { 
253          return this.name == null ? null : this.name.getValue();
254        }
255
256        /**
257         * @param value The name of an individual to contact regarding the data element.
258         */
259        public DataElementContactComponent setName(String value) { 
260          if (Utilities.noString(value))
261            this.name = null;
262          else {
263            if (this.name == null)
264              this.name = new StringType();
265            this.name.setValue(value);
266          }
267          return this;
268        }
269
270        /**
271         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
272         */
273        public List<ContactPoint> getTelecom() { 
274          if (this.telecom == null)
275            this.telecom = new ArrayList<ContactPoint>();
276          return this.telecom;
277        }
278
279        public boolean hasTelecom() { 
280          if (this.telecom == null)
281            return false;
282          for (ContactPoint item : this.telecom)
283            if (!item.isEmpty())
284              return true;
285          return false;
286        }
287
288        /**
289         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
290         */
291    // syntactic sugar
292        public ContactPoint addTelecom() { //3
293          ContactPoint t = new ContactPoint();
294          if (this.telecom == null)
295            this.telecom = new ArrayList<ContactPoint>();
296          this.telecom.add(t);
297          return t;
298        }
299
300    // syntactic sugar
301        public DataElementContactComponent addTelecom(ContactPoint t) { //3
302          if (t == null)
303            return this;
304          if (this.telecom == null)
305            this.telecom = new ArrayList<ContactPoint>();
306          this.telecom.add(t);
307          return this;
308        }
309
310        protected void listChildren(List<Property> childrenList) {
311          super.listChildren(childrenList);
312          childrenList.add(new Property("name", "string", "The name of an individual to contact regarding the data element.", 0, java.lang.Integer.MAX_VALUE, name));
313          childrenList.add(new Property("telecom", "ContactPoint", "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE, telecom));
314        }
315
316      @Override
317      public void setProperty(String name, Base value) throws FHIRException {
318        if (name.equals("name"))
319          this.name = castToString(value); // StringType
320        else if (name.equals("telecom"))
321          this.getTelecom().add(castToContactPoint(value));
322        else
323          super.setProperty(name, value);
324      }
325
326      @Override
327      public Base addChild(String name) throws FHIRException {
328        if (name.equals("name")) {
329          throw new FHIRException("Cannot call addChild on a primitive type DataElement.name");
330        }
331        else if (name.equals("telecom")) {
332          return addTelecom();
333        }
334        else
335          return super.addChild(name);
336      }
337
338      public DataElementContactComponent copy() {
339        DataElementContactComponent dst = new DataElementContactComponent();
340        copyValues(dst);
341        dst.name = name == null ? null : name.copy();
342        if (telecom != null) {
343          dst.telecom = new ArrayList<ContactPoint>();
344          for (ContactPoint i : telecom)
345            dst.telecom.add(i.copy());
346        };
347        return dst;
348      }
349
350      @Override
351      public boolean equalsDeep(Base other) {
352        if (!super.equalsDeep(other))
353          return false;
354        if (!(other instanceof DataElementContactComponent))
355          return false;
356        DataElementContactComponent o = (DataElementContactComponent) other;
357        return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
358      }
359
360      @Override
361      public boolean equalsShallow(Base other) {
362        if (!super.equalsShallow(other))
363          return false;
364        if (!(other instanceof DataElementContactComponent))
365          return false;
366        DataElementContactComponent o = (DataElementContactComponent) other;
367        return compareValues(name, o.name, true);
368      }
369
370      public boolean isEmpty() {
371        return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
372          ;
373      }
374
375  public String fhirType() {
376    return "DataElement.contact";
377
378  }
379
380  }
381
382    @Block()
383    public static class DataElementMappingComponent extends BackboneElement implements IBaseBackboneElement {
384        /**
385         * An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.
386         */
387        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
388        @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 on a per-element basis." )
389        protected IdType identity;
390
391        /**
392         * An absolute URI that identifies the specification that this mapping is expressed to.
393         */
394        @Child(name = "uri", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
395        @Description(shortDefinition="Identifies what this mapping refers to", formalDefinition="An absolute URI that identifies the specification that this mapping is expressed to." )
396        protected UriType uri;
397
398        /**
399         * A name for the specification that is being mapped to.
400         */
401        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
402        @Description(shortDefinition="Names what this mapping refers to", formalDefinition="A name for the specification that is being mapped to." )
403        protected StringType name;
404
405        /**
406         * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
407         */
408        @Child(name = "comments", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
409        @Description(shortDefinition="Versions, Issues, Scope limitations etc.", formalDefinition="Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage." )
410        protected StringType comments;
411
412        private static final long serialVersionUID = 299630820L;
413
414    /*
415     * Constructor
416     */
417      public DataElementMappingComponent() {
418        super();
419      }
420
421    /*
422     * Constructor
423     */
424      public DataElementMappingComponent(IdType identity) {
425        super();
426        this.identity = identity;
427      }
428
429        /**
430         * @return {@link #identity} (An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
431         */
432        public IdType getIdentityElement() { 
433          if (this.identity == null)
434            if (Configuration.errorOnAutoCreate())
435              throw new Error("Attempt to auto-create DataElementMappingComponent.identity");
436            else if (Configuration.doAutoCreate())
437              this.identity = new IdType(); // bb
438          return this.identity;
439        }
440
441        public boolean hasIdentityElement() { 
442          return this.identity != null && !this.identity.isEmpty();
443        }
444
445        public boolean hasIdentity() { 
446          return this.identity != null && !this.identity.isEmpty();
447        }
448
449        /**
450         * @param value {@link #identity} (An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
451         */
452        public DataElementMappingComponent setIdentityElement(IdType value) { 
453          this.identity = value;
454          return this;
455        }
456
457        /**
458         * @return An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.
459         */
460        public String getIdentity() { 
461          return this.identity == null ? null : this.identity.getValue();
462        }
463
464        /**
465         * @param value An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.
466         */
467        public DataElementMappingComponent setIdentity(String value) { 
468            if (this.identity == null)
469              this.identity = new IdType();
470            this.identity.setValue(value);
471          return this;
472        }
473
474        /**
475         * @return {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
476         */
477        public UriType getUriElement() { 
478          if (this.uri == null)
479            if (Configuration.errorOnAutoCreate())
480              throw new Error("Attempt to auto-create DataElementMappingComponent.uri");
481            else if (Configuration.doAutoCreate())
482              this.uri = new UriType(); // bb
483          return this.uri;
484        }
485
486        public boolean hasUriElement() { 
487          return this.uri != null && !this.uri.isEmpty();
488        }
489
490        public boolean hasUri() { 
491          return this.uri != null && !this.uri.isEmpty();
492        }
493
494        /**
495         * @param value {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
496         */
497        public DataElementMappingComponent setUriElement(UriType value) { 
498          this.uri = value;
499          return this;
500        }
501
502        /**
503         * @return An absolute URI that identifies the specification that this mapping is expressed to.
504         */
505        public String getUri() { 
506          return this.uri == null ? null : this.uri.getValue();
507        }
508
509        /**
510         * @param value An absolute URI that identifies the specification that this mapping is expressed to.
511         */
512        public DataElementMappingComponent setUri(String value) { 
513          if (Utilities.noString(value))
514            this.uri = null;
515          else {
516            if (this.uri == null)
517              this.uri = new UriType();
518            this.uri.setValue(value);
519          }
520          return this;
521        }
522
523        /**
524         * @return {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
525         */
526        public StringType getNameElement() { 
527          if (this.name == null)
528            if (Configuration.errorOnAutoCreate())
529              throw new Error("Attempt to auto-create DataElementMappingComponent.name");
530            else if (Configuration.doAutoCreate())
531              this.name = new StringType(); // bb
532          return this.name;
533        }
534
535        public boolean hasNameElement() { 
536          return this.name != null && !this.name.isEmpty();
537        }
538
539        public boolean hasName() { 
540          return this.name != null && !this.name.isEmpty();
541        }
542
543        /**
544         * @param value {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
545         */
546        public DataElementMappingComponent setNameElement(StringType value) { 
547          this.name = value;
548          return this;
549        }
550
551        /**
552         * @return A name for the specification that is being mapped to.
553         */
554        public String getName() { 
555          return this.name == null ? null : this.name.getValue();
556        }
557
558        /**
559         * @param value A name for the specification that is being mapped to.
560         */
561        public DataElementMappingComponent setName(String value) { 
562          if (Utilities.noString(value))
563            this.name = null;
564          else {
565            if (this.name == null)
566              this.name = new StringType();
567            this.name.setValue(value);
568          }
569          return this;
570        }
571
572        /**
573         * @return {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
574         */
575        public StringType getCommentsElement() { 
576          if (this.comments == null)
577            if (Configuration.errorOnAutoCreate())
578              throw new Error("Attempt to auto-create DataElementMappingComponent.comments");
579            else if (Configuration.doAutoCreate())
580              this.comments = new StringType(); // bb
581          return this.comments;
582        }
583
584        public boolean hasCommentsElement() { 
585          return this.comments != null && !this.comments.isEmpty();
586        }
587
588        public boolean hasComments() { 
589          return this.comments != null && !this.comments.isEmpty();
590        }
591
592        /**
593         * @param value {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
594         */
595        public DataElementMappingComponent setCommentsElement(StringType value) { 
596          this.comments = value;
597          return this;
598        }
599
600        /**
601         * @return Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
602         */
603        public String getComments() { 
604          return this.comments == null ? null : this.comments.getValue();
605        }
606
607        /**
608         * @param value Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
609         */
610        public DataElementMappingComponent setComments(String value) { 
611          if (Utilities.noString(value))
612            this.comments = null;
613          else {
614            if (this.comments == null)
615              this.comments = new StringType();
616            this.comments.setValue(value);
617          }
618          return this;
619        }
620
621        protected void listChildren(List<Property> childrenList) {
622          super.listChildren(childrenList);
623          childrenList.add(new Property("identity", "id", "An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.", 0, java.lang.Integer.MAX_VALUE, identity));
624          childrenList.add(new Property("uri", "uri", "An absolute URI that identifies the specification that this mapping is expressed to.", 0, java.lang.Integer.MAX_VALUE, uri));
625          childrenList.add(new Property("name", "string", "A name for the specification that is being mapped to.", 0, java.lang.Integer.MAX_VALUE, name));
626          childrenList.add(new Property("comments", "string", "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.", 0, java.lang.Integer.MAX_VALUE, comments));
627        }
628
629      @Override
630      public void setProperty(String name, Base value) throws FHIRException {
631        if (name.equals("identity"))
632          this.identity = castToId(value); // IdType
633        else if (name.equals("uri"))
634          this.uri = castToUri(value); // UriType
635        else if (name.equals("name"))
636          this.name = castToString(value); // StringType
637        else if (name.equals("comments"))
638          this.comments = castToString(value); // StringType
639        else
640          super.setProperty(name, value);
641      }
642
643      @Override
644      public Base addChild(String name) throws FHIRException {
645        if (name.equals("identity")) {
646          throw new FHIRException("Cannot call addChild on a primitive type DataElement.identity");
647        }
648        else if (name.equals("uri")) {
649          throw new FHIRException("Cannot call addChild on a primitive type DataElement.uri");
650        }
651        else if (name.equals("name")) {
652          throw new FHIRException("Cannot call addChild on a primitive type DataElement.name");
653        }
654        else if (name.equals("comments")) {
655          throw new FHIRException("Cannot call addChild on a primitive type DataElement.comments");
656        }
657        else
658          return super.addChild(name);
659      }
660
661      public DataElementMappingComponent copy() {
662        DataElementMappingComponent dst = new DataElementMappingComponent();
663        copyValues(dst);
664        dst.identity = identity == null ? null : identity.copy();
665        dst.uri = uri == null ? null : uri.copy();
666        dst.name = name == null ? null : name.copy();
667        dst.comments = comments == null ? null : comments.copy();
668        return dst;
669      }
670
671      @Override
672      public boolean equalsDeep(Base other) {
673        if (!super.equalsDeep(other))
674          return false;
675        if (!(other instanceof DataElementMappingComponent))
676          return false;
677        DataElementMappingComponent o = (DataElementMappingComponent) other;
678        return compareDeep(identity, o.identity, true) && compareDeep(uri, o.uri, true) && compareDeep(name, o.name, true)
679           && compareDeep(comments, o.comments, true);
680      }
681
682      @Override
683      public boolean equalsShallow(Base other) {
684        if (!super.equalsShallow(other))
685          return false;
686        if (!(other instanceof DataElementMappingComponent))
687          return false;
688        DataElementMappingComponent o = (DataElementMappingComponent) other;
689        return compareValues(identity, o.identity, true) && compareValues(uri, o.uri, true) && compareValues(name, o.name, true)
690           && compareValues(comments, o.comments, true);
691      }
692
693      public boolean isEmpty() {
694        return super.isEmpty() && (identity == null || identity.isEmpty()) && (uri == null || uri.isEmpty())
695           && (name == null || name.isEmpty()) && (comments == null || comments.isEmpty());
696      }
697
698  public String fhirType() {
699    return "DataElement.mapping";
700
701  }
702
703  }
704
705    /**
706     * An absolute URL that is used to identify this data element 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 data element is (or will be) published.
707     */
708    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
709    @Description(shortDefinition="Globally unique logical id for data element", formalDefinition="An absolute URL that is used to identify this data element 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 data element is (or will be) published." )
710    protected UriType url;
711
712    /**
713     * Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.
714     */
715    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
716    @Description(shortDefinition="Logical id to reference this data element", formalDefinition="Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance." )
717    protected List<Identifier> identifier;
718
719    /**
720     * The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.
721     */
722    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
723    @Description(shortDefinition="Logical id for this version of the data element", formalDefinition="The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually." )
724    protected StringType version;
725
726    /**
727     * The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.
728     */
729    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
730    @Description(shortDefinition="Descriptive label for this element definition", formalDefinition="The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used." )
731    protected StringType name;
732
733    /**
734     * The status of the data element.
735     */
736    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
737    @Description(shortDefinition="draft | active | retired", formalDefinition="The status of the data element." )
738    protected Enumeration<ConformanceResourceStatus> status;
739
740    /**
741     * A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
742     */
743    @Child(name = "experimental", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=true)
744    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
745    protected BooleanType experimental;
746
747    /**
748     * The name of the individual or organization that published the data element.
749     */
750    @Child(name = "publisher", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
751    @Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the data element." )
752    protected StringType publisher;
753
754    /**
755     * Contacts to assist a user in finding and communicating with the publisher.
756     */
757    @Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
758    @Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
759    protected List<DataElementContactComponent> contact;
760
761    /**
762     * The date this version of the data element 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 data element  changes.
763     */
764    @Child(name = "date", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
765    @Description(shortDefinition="Date for this version of the data element", formalDefinition="The date this version of the data element 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 data element  changes." )
766    protected DateTimeType date;
767
768    /**
769     * 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 data element definitions.
770     */
771    @Child(name = "useContext", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
772    @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 data element definitions." )
773    protected List<CodeableConcept> useContext;
774
775    /**
776     * A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
777     */
778    @Child(name = "copyright", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
779    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element." )
780    protected StringType copyright;
781
782    /**
783     * Identifies how precise the data element is in its definition.
784     */
785    @Child(name = "stringency", type = {CodeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
786    @Description(shortDefinition="comparable | fully-specified | equivalent | convertable | scaleable | flexible", formalDefinition="Identifies how precise the data element is in its definition." )
787    protected Enumeration<DataElementStringency> stringency;
788
789    /**
790     * Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with.
791     */
792    @Child(name = "mapping", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
793    @Description(shortDefinition="External specification mapped to", formalDefinition="Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with." )
794    protected List<DataElementMappingComponent> mapping;
795
796    /**
797     * Defines the structure, type, allowed values and other constraining characteristics of the data element.
798     */
799    @Child(name = "element", type = {ElementDefinition.class}, order=13, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
800    @Description(shortDefinition="Definition of element", formalDefinition="Defines the structure, type, allowed values and other constraining characteristics of the data element." )
801    protected List<ElementDefinition> element;
802
803    private static final long serialVersionUID = 2017352331L;
804
805  /*
806   * Constructor
807   */
808    public DataElement() {
809      super();
810    }
811
812  /*
813   * Constructor
814   */
815    public DataElement(Enumeration<ConformanceResourceStatus> status) {
816      super();
817      this.status = status;
818    }
819
820    /**
821     * @return {@link #url} (An absolute URL that is used to identify this data element 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 data element is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
822     */
823    public UriType getUrlElement() { 
824      if (this.url == null)
825        if (Configuration.errorOnAutoCreate())
826          throw new Error("Attempt to auto-create DataElement.url");
827        else if (Configuration.doAutoCreate())
828          this.url = new UriType(); // bb
829      return this.url;
830    }
831
832    public boolean hasUrlElement() { 
833      return this.url != null && !this.url.isEmpty();
834    }
835
836    public boolean hasUrl() { 
837      return this.url != null && !this.url.isEmpty();
838    }
839
840    /**
841     * @param value {@link #url} (An absolute URL that is used to identify this data element 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 data element is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
842     */
843    public DataElement setUrlElement(UriType value) { 
844      this.url = value;
845      return this;
846    }
847
848    /**
849     * @return An absolute URL that is used to identify this data element 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 data element is (or will be) published.
850     */
851    public String getUrl() { 
852      return this.url == null ? null : this.url.getValue();
853    }
854
855    /**
856     * @param value An absolute URL that is used to identify this data element 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 data element is (or will be) published.
857     */
858    public DataElement setUrl(String value) { 
859      if (Utilities.noString(value))
860        this.url = null;
861      else {
862        if (this.url == null)
863          this.url = new UriType();
864        this.url.setValue(value);
865      }
866      return this;
867    }
868
869    /**
870     * @return {@link #identifier} (Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.)
871     */
872    public List<Identifier> getIdentifier() { 
873      if (this.identifier == null)
874        this.identifier = new ArrayList<Identifier>();
875      return this.identifier;
876    }
877
878    public boolean hasIdentifier() { 
879      if (this.identifier == null)
880        return false;
881      for (Identifier item : this.identifier)
882        if (!item.isEmpty())
883          return true;
884      return false;
885    }
886
887    /**
888     * @return {@link #identifier} (Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.)
889     */
890    // syntactic sugar
891    public Identifier addIdentifier() { //3
892      Identifier t = new Identifier();
893      if (this.identifier == null)
894        this.identifier = new ArrayList<Identifier>();
895      this.identifier.add(t);
896      return t;
897    }
898
899    // syntactic sugar
900    public DataElement addIdentifier(Identifier t) { //3
901      if (t == null)
902        return this;
903      if (this.identifier == null)
904        this.identifier = new ArrayList<Identifier>();
905      this.identifier.add(t);
906      return this;
907    }
908
909    /**
910     * @return {@link #version} (The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
911     */
912    public StringType getVersionElement() { 
913      if (this.version == null)
914        if (Configuration.errorOnAutoCreate())
915          throw new Error("Attempt to auto-create DataElement.version");
916        else if (Configuration.doAutoCreate())
917          this.version = new StringType(); // bb
918      return this.version;
919    }
920
921    public boolean hasVersionElement() { 
922      return this.version != null && !this.version.isEmpty();
923    }
924
925    public boolean hasVersion() { 
926      return this.version != null && !this.version.isEmpty();
927    }
928
929    /**
930     * @param value {@link #version} (The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
931     */
932    public DataElement setVersionElement(StringType value) { 
933      this.version = value;
934      return this;
935    }
936
937    /**
938     * @return The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.
939     */
940    public String getVersion() { 
941      return this.version == null ? null : this.version.getValue();
942    }
943
944    /**
945     * @param value The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.
946     */
947    public DataElement setVersion(String value) { 
948      if (Utilities.noString(value))
949        this.version = null;
950      else {
951        if (this.version == null)
952          this.version = new StringType();
953        this.version.setValue(value);
954      }
955      return this;
956    }
957
958    /**
959     * @return {@link #name} (The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
960     */
961    public StringType getNameElement() { 
962      if (this.name == null)
963        if (Configuration.errorOnAutoCreate())
964          throw new Error("Attempt to auto-create DataElement.name");
965        else if (Configuration.doAutoCreate())
966          this.name = new StringType(); // bb
967      return this.name;
968    }
969
970    public boolean hasNameElement() { 
971      return this.name != null && !this.name.isEmpty();
972    }
973
974    public boolean hasName() { 
975      return this.name != null && !this.name.isEmpty();
976    }
977
978    /**
979     * @param value {@link #name} (The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
980     */
981    public DataElement setNameElement(StringType value) { 
982      this.name = value;
983      return this;
984    }
985
986    /**
987     * @return The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.
988     */
989    public String getName() { 
990      return this.name == null ? null : this.name.getValue();
991    }
992
993    /**
994     * @param value The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.
995     */
996    public DataElement setName(String value) { 
997      if (Utilities.noString(value))
998        this.name = null;
999      else {
1000        if (this.name == null)
1001          this.name = new StringType();
1002        this.name.setValue(value);
1003      }
1004      return this;
1005    }
1006
1007    /**
1008     * @return {@link #status} (The status of the data element.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1009     */
1010    public Enumeration<ConformanceResourceStatus> getStatusElement() { 
1011      if (this.status == null)
1012        if (Configuration.errorOnAutoCreate())
1013          throw new Error("Attempt to auto-create DataElement.status");
1014        else if (Configuration.doAutoCreate())
1015          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1016      return this.status;
1017    }
1018
1019    public boolean hasStatusElement() { 
1020      return this.status != null && !this.status.isEmpty();
1021    }
1022
1023    public boolean hasStatus() { 
1024      return this.status != null && !this.status.isEmpty();
1025    }
1026
1027    /**
1028     * @param value {@link #status} (The status of the data element.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1029     */
1030    public DataElement setStatusElement(Enumeration<ConformanceResourceStatus> value) { 
1031      this.status = value;
1032      return this;
1033    }
1034
1035    /**
1036     * @return The status of the data element.
1037     */
1038    public ConformanceResourceStatus getStatus() { 
1039      return this.status == null ? null : this.status.getValue();
1040    }
1041
1042    /**
1043     * @param value The status of the data element.
1044     */
1045    public DataElement setStatus(ConformanceResourceStatus value) { 
1046        if (this.status == null)
1047          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1048        this.status.setValue(value);
1049      return this;
1050    }
1051
1052    /**
1053     * @return {@link #experimental} (A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1054     */
1055    public BooleanType getExperimentalElement() { 
1056      if (this.experimental == null)
1057        if (Configuration.errorOnAutoCreate())
1058          throw new Error("Attempt to auto-create DataElement.experimental");
1059        else if (Configuration.doAutoCreate())
1060          this.experimental = new BooleanType(); // bb
1061      return this.experimental;
1062    }
1063
1064    public boolean hasExperimentalElement() { 
1065      return this.experimental != null && !this.experimental.isEmpty();
1066    }
1067
1068    public boolean hasExperimental() { 
1069      return this.experimental != null && !this.experimental.isEmpty();
1070    }
1071
1072    /**
1073     * @param value {@link #experimental} (A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1074     */
1075    public DataElement setExperimentalElement(BooleanType value) { 
1076      this.experimental = value;
1077      return this;
1078    }
1079
1080    /**
1081     * @return A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1082     */
1083    public boolean getExperimental() { 
1084      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1085    }
1086
1087    /**
1088     * @param value A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1089     */
1090    public DataElement setExperimental(boolean value) { 
1091        if (this.experimental == null)
1092          this.experimental = new BooleanType();
1093        this.experimental.setValue(value);
1094      return this;
1095    }
1096
1097    /**
1098     * @return {@link #publisher} (The name of the individual or organization that published the data element.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1099     */
1100    public StringType getPublisherElement() { 
1101      if (this.publisher == null)
1102        if (Configuration.errorOnAutoCreate())
1103          throw new Error("Attempt to auto-create DataElement.publisher");
1104        else if (Configuration.doAutoCreate())
1105          this.publisher = new StringType(); // bb
1106      return this.publisher;
1107    }
1108
1109    public boolean hasPublisherElement() { 
1110      return this.publisher != null && !this.publisher.isEmpty();
1111    }
1112
1113    public boolean hasPublisher() { 
1114      return this.publisher != null && !this.publisher.isEmpty();
1115    }
1116
1117    /**
1118     * @param value {@link #publisher} (The name of the individual or organization that published the data element.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1119     */
1120    public DataElement setPublisherElement(StringType value) { 
1121      this.publisher = value;
1122      return this;
1123    }
1124
1125    /**
1126     * @return The name of the individual or organization that published the data element.
1127     */
1128    public String getPublisher() { 
1129      return this.publisher == null ? null : this.publisher.getValue();
1130    }
1131
1132    /**
1133     * @param value The name of the individual or organization that published the data element.
1134     */
1135    public DataElement setPublisher(String value) { 
1136      if (Utilities.noString(value))
1137        this.publisher = null;
1138      else {
1139        if (this.publisher == null)
1140          this.publisher = new StringType();
1141        this.publisher.setValue(value);
1142      }
1143      return this;
1144    }
1145
1146    /**
1147     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1148     */
1149    public List<DataElementContactComponent> getContact() { 
1150      if (this.contact == null)
1151        this.contact = new ArrayList<DataElementContactComponent>();
1152      return this.contact;
1153    }
1154
1155    public boolean hasContact() { 
1156      if (this.contact == null)
1157        return false;
1158      for (DataElementContactComponent item : this.contact)
1159        if (!item.isEmpty())
1160          return true;
1161      return false;
1162    }
1163
1164    /**
1165     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1166     */
1167    // syntactic sugar
1168    public DataElementContactComponent addContact() { //3
1169      DataElementContactComponent t = new DataElementContactComponent();
1170      if (this.contact == null)
1171        this.contact = new ArrayList<DataElementContactComponent>();
1172      this.contact.add(t);
1173      return t;
1174    }
1175
1176    // syntactic sugar
1177    public DataElement addContact(DataElementContactComponent t) { //3
1178      if (t == null)
1179        return this;
1180      if (this.contact == null)
1181        this.contact = new ArrayList<DataElementContactComponent>();
1182      this.contact.add(t);
1183      return this;
1184    }
1185
1186    /**
1187     * @return {@link #date} (The date this version of the data element 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 data element  changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1188     */
1189    public DateTimeType getDateElement() { 
1190      if (this.date == null)
1191        if (Configuration.errorOnAutoCreate())
1192          throw new Error("Attempt to auto-create DataElement.date");
1193        else if (Configuration.doAutoCreate())
1194          this.date = new DateTimeType(); // bb
1195      return this.date;
1196    }
1197
1198    public boolean hasDateElement() { 
1199      return this.date != null && !this.date.isEmpty();
1200    }
1201
1202    public boolean hasDate() { 
1203      return this.date != null && !this.date.isEmpty();
1204    }
1205
1206    /**
1207     * @param value {@link #date} (The date this version of the data element 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 data element  changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1208     */
1209    public DataElement setDateElement(DateTimeType value) { 
1210      this.date = value;
1211      return this;
1212    }
1213
1214    /**
1215     * @return The date this version of the data element 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 data element  changes.
1216     */
1217    public Date getDate() { 
1218      return this.date == null ? null : this.date.getValue();
1219    }
1220
1221    /**
1222     * @param value The date this version of the data element 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 data element  changes.
1223     */
1224    public DataElement setDate(Date value) { 
1225      if (value == null)
1226        this.date = null;
1227      else {
1228        if (this.date == null)
1229          this.date = new DateTimeType();
1230        this.date.setValue(value);
1231      }
1232      return this;
1233    }
1234
1235    /**
1236     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
1237     */
1238    public List<CodeableConcept> getUseContext() { 
1239      if (this.useContext == null)
1240        this.useContext = new ArrayList<CodeableConcept>();
1241      return this.useContext;
1242    }
1243
1244    public boolean hasUseContext() { 
1245      if (this.useContext == null)
1246        return false;
1247      for (CodeableConcept item : this.useContext)
1248        if (!item.isEmpty())
1249          return true;
1250      return false;
1251    }
1252
1253    /**
1254     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
1255     */
1256    // syntactic sugar
1257    public CodeableConcept addUseContext() { //3
1258      CodeableConcept t = new CodeableConcept();
1259      if (this.useContext == null)
1260        this.useContext = new ArrayList<CodeableConcept>();
1261      this.useContext.add(t);
1262      return t;
1263    }
1264
1265    // syntactic sugar
1266    public DataElement addUseContext(CodeableConcept t) { //3
1267      if (t == null)
1268        return this;
1269      if (this.useContext == null)
1270        this.useContext = new ArrayList<CodeableConcept>();
1271      this.useContext.add(t);
1272      return this;
1273    }
1274
1275    /**
1276     * @return {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1277     */
1278    public StringType getCopyrightElement() { 
1279      if (this.copyright == null)
1280        if (Configuration.errorOnAutoCreate())
1281          throw new Error("Attempt to auto-create DataElement.copyright");
1282        else if (Configuration.doAutoCreate())
1283          this.copyright = new StringType(); // bb
1284      return this.copyright;
1285    }
1286
1287    public boolean hasCopyrightElement() { 
1288      return this.copyright != null && !this.copyright.isEmpty();
1289    }
1290
1291    public boolean hasCopyright() { 
1292      return this.copyright != null && !this.copyright.isEmpty();
1293    }
1294
1295    /**
1296     * @param value {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1297     */
1298    public DataElement setCopyrightElement(StringType value) { 
1299      this.copyright = value;
1300      return this;
1301    }
1302
1303    /**
1304     * @return A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
1305     */
1306    public String getCopyright() { 
1307      return this.copyright == null ? null : this.copyright.getValue();
1308    }
1309
1310    /**
1311     * @param value A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
1312     */
1313    public DataElement setCopyright(String value) { 
1314      if (Utilities.noString(value))
1315        this.copyright = null;
1316      else {
1317        if (this.copyright == null)
1318          this.copyright = new StringType();
1319        this.copyright.setValue(value);
1320      }
1321      return this;
1322    }
1323
1324    /**
1325     * @return {@link #stringency} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getStringency" gives direct access to the value
1326     */
1327    public Enumeration<DataElementStringency> getStringencyElement() { 
1328      if (this.stringency == null)
1329        if (Configuration.errorOnAutoCreate())
1330          throw new Error("Attempt to auto-create DataElement.stringency");
1331        else if (Configuration.doAutoCreate())
1332          this.stringency = new Enumeration<DataElementStringency>(new DataElementStringencyEnumFactory()); // bb
1333      return this.stringency;
1334    }
1335
1336    public boolean hasStringencyElement() { 
1337      return this.stringency != null && !this.stringency.isEmpty();
1338    }
1339
1340    public boolean hasStringency() { 
1341      return this.stringency != null && !this.stringency.isEmpty();
1342    }
1343
1344    /**
1345     * @param value {@link #stringency} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getStringency" gives direct access to the value
1346     */
1347    public DataElement setStringencyElement(Enumeration<DataElementStringency> value) { 
1348      this.stringency = value;
1349      return this;
1350    }
1351
1352    /**
1353     * @return Identifies how precise the data element is in its definition.
1354     */
1355    public DataElementStringency getStringency() { 
1356      return this.stringency == null ? null : this.stringency.getValue();
1357    }
1358
1359    /**
1360     * @param value Identifies how precise the data element is in its definition.
1361     */
1362    public DataElement setStringency(DataElementStringency value) { 
1363      if (value == null)
1364        this.stringency = null;
1365      else {
1366        if (this.stringency == null)
1367          this.stringency = new Enumeration<DataElementStringency>(new DataElementStringencyEnumFactory());
1368        this.stringency.setValue(value);
1369      }
1370      return this;
1371    }
1372
1373    /**
1374     * @return {@link #mapping} (Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with.)
1375     */
1376    public List<DataElementMappingComponent> getMapping() { 
1377      if (this.mapping == null)
1378        this.mapping = new ArrayList<DataElementMappingComponent>();
1379      return this.mapping;
1380    }
1381
1382    public boolean hasMapping() { 
1383      if (this.mapping == null)
1384        return false;
1385      for (DataElementMappingComponent item : this.mapping)
1386        if (!item.isEmpty())
1387          return true;
1388      return false;
1389    }
1390
1391    /**
1392     * @return {@link #mapping} (Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with.)
1393     */
1394    // syntactic sugar
1395    public DataElementMappingComponent addMapping() { //3
1396      DataElementMappingComponent t = new DataElementMappingComponent();
1397      if (this.mapping == null)
1398        this.mapping = new ArrayList<DataElementMappingComponent>();
1399      this.mapping.add(t);
1400      return t;
1401    }
1402
1403    // syntactic sugar
1404    public DataElement addMapping(DataElementMappingComponent t) { //3
1405      if (t == null)
1406        return this;
1407      if (this.mapping == null)
1408        this.mapping = new ArrayList<DataElementMappingComponent>();
1409      this.mapping.add(t);
1410      return this;
1411    }
1412
1413    /**
1414     * @return {@link #element} (Defines the structure, type, allowed values and other constraining characteristics of the data element.)
1415     */
1416    public List<ElementDefinition> getElement() { 
1417      if (this.element == null)
1418        this.element = new ArrayList<ElementDefinition>();
1419      return this.element;
1420    }
1421
1422    public boolean hasElement() { 
1423      if (this.element == null)
1424        return false;
1425      for (ElementDefinition item : this.element)
1426        if (!item.isEmpty())
1427          return true;
1428      return false;
1429    }
1430
1431    /**
1432     * @return {@link #element} (Defines the structure, type, allowed values and other constraining characteristics of the data element.)
1433     */
1434    // syntactic sugar
1435    public ElementDefinition addElement() { //3
1436      ElementDefinition t = new ElementDefinition();
1437      if (this.element == null)
1438        this.element = new ArrayList<ElementDefinition>();
1439      this.element.add(t);
1440      return t;
1441    }
1442
1443    // syntactic sugar
1444    public DataElement addElement(ElementDefinition t) { //3
1445      if (t == null)
1446        return this;
1447      if (this.element == null)
1448        this.element = new ArrayList<ElementDefinition>();
1449      this.element.add(t);
1450      return this;
1451    }
1452
1453      protected void listChildren(List<Property> childrenList) {
1454        super.listChildren(childrenList);
1455        childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this data element 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 data element is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
1456        childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
1457        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.", 0, java.lang.Integer.MAX_VALUE, version));
1458        childrenList.add(new Property("name", "string", "The term used by humans to refer to the data element.  Should ideally be unique within the context in which the data element is expected to be used.", 0, java.lang.Integer.MAX_VALUE, name));
1459        childrenList.add(new Property("status", "code", "The status of the data element.", 0, java.lang.Integer.MAX_VALUE, status));
1460        childrenList.add(new Property("experimental", "boolean", "A flag to indicate that this search data element definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
1461        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the data element.", 0, java.lang.Integer.MAX_VALUE, publisher));
1462        childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
1463        childrenList.add(new Property("date", "dateTime", "The date this version of the data element 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 data element  changes.", 0, java.lang.Integer.MAX_VALUE, date));
1464        childrenList.add(new Property("useContext", "CodeableConcept", "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 data element definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
1465        childrenList.add(new Property("copyright", "string", "A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.", 0, java.lang.Integer.MAX_VALUE, copyright));
1466        childrenList.add(new Property("stringency", "code", "Identifies how precise the data element is in its definition.", 0, java.lang.Integer.MAX_VALUE, stringency));
1467        childrenList.add(new Property("mapping", "", "Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with.", 0, java.lang.Integer.MAX_VALUE, mapping));
1468        childrenList.add(new Property("element", "ElementDefinition", "Defines the structure, type, allowed values and other constraining characteristics of the data element.", 0, java.lang.Integer.MAX_VALUE, element));
1469      }
1470
1471      @Override
1472      public void setProperty(String name, Base value) throws FHIRException {
1473        if (name.equals("url"))
1474          this.url = castToUri(value); // UriType
1475        else if (name.equals("identifier"))
1476          this.getIdentifier().add(castToIdentifier(value));
1477        else if (name.equals("version"))
1478          this.version = castToString(value); // StringType
1479        else if (name.equals("name"))
1480          this.name = castToString(value); // StringType
1481        else if (name.equals("status"))
1482          this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
1483        else if (name.equals("experimental"))
1484          this.experimental = castToBoolean(value); // BooleanType
1485        else if (name.equals("publisher"))
1486          this.publisher = castToString(value); // StringType
1487        else if (name.equals("contact"))
1488          this.getContact().add((DataElementContactComponent) value);
1489        else if (name.equals("date"))
1490          this.date = castToDateTime(value); // DateTimeType
1491        else if (name.equals("useContext"))
1492          this.getUseContext().add(castToCodeableConcept(value));
1493        else if (name.equals("copyright"))
1494          this.copyright = castToString(value); // StringType
1495        else if (name.equals("stringency"))
1496          this.stringency = new DataElementStringencyEnumFactory().fromType(value); // Enumeration<DataElementStringency>
1497        else if (name.equals("mapping"))
1498          this.getMapping().add((DataElementMappingComponent) value);
1499        else if (name.equals("element"))
1500          this.getElement().add(castToElementDefinition(value));
1501        else
1502          super.setProperty(name, value);
1503      }
1504
1505      @Override
1506      public Base addChild(String name) throws FHIRException {
1507        if (name.equals("url")) {
1508          throw new FHIRException("Cannot call addChild on a primitive type DataElement.url");
1509        }
1510        else if (name.equals("identifier")) {
1511          return addIdentifier();
1512        }
1513        else if (name.equals("version")) {
1514          throw new FHIRException("Cannot call addChild on a primitive type DataElement.version");
1515        }
1516        else if (name.equals("name")) {
1517          throw new FHIRException("Cannot call addChild on a primitive type DataElement.name");
1518        }
1519        else if (name.equals("status")) {
1520          throw new FHIRException("Cannot call addChild on a primitive type DataElement.status");
1521        }
1522        else if (name.equals("experimental")) {
1523          throw new FHIRException("Cannot call addChild on a primitive type DataElement.experimental");
1524        }
1525        else if (name.equals("publisher")) {
1526          throw new FHIRException("Cannot call addChild on a primitive type DataElement.publisher");
1527        }
1528        else if (name.equals("contact")) {
1529          return addContact();
1530        }
1531        else if (name.equals("date")) {
1532          throw new FHIRException("Cannot call addChild on a primitive type DataElement.date");
1533        }
1534        else if (name.equals("useContext")) {
1535          return addUseContext();
1536        }
1537        else if (name.equals("copyright")) {
1538          throw new FHIRException("Cannot call addChild on a primitive type DataElement.copyright");
1539        }
1540        else if (name.equals("stringency")) {
1541          throw new FHIRException("Cannot call addChild on a primitive type DataElement.stringency");
1542        }
1543        else if (name.equals("mapping")) {
1544          return addMapping();
1545        }
1546        else if (name.equals("element")) {
1547          return addElement();
1548        }
1549        else
1550          return super.addChild(name);
1551      }
1552
1553  public String fhirType() {
1554    return "DataElement";
1555
1556  }
1557
1558      public DataElement copy() {
1559        DataElement dst = new DataElement();
1560        copyValues(dst);
1561        dst.url = url == null ? null : url.copy();
1562        if (identifier != null) {
1563          dst.identifier = new ArrayList<Identifier>();
1564          for (Identifier i : identifier)
1565            dst.identifier.add(i.copy());
1566        };
1567        dst.version = version == null ? null : version.copy();
1568        dst.name = name == null ? null : name.copy();
1569        dst.status = status == null ? null : status.copy();
1570        dst.experimental = experimental == null ? null : experimental.copy();
1571        dst.publisher = publisher == null ? null : publisher.copy();
1572        if (contact != null) {
1573          dst.contact = new ArrayList<DataElementContactComponent>();
1574          for (DataElementContactComponent i : contact)
1575            dst.contact.add(i.copy());
1576        };
1577        dst.date = date == null ? null : date.copy();
1578        if (useContext != null) {
1579          dst.useContext = new ArrayList<CodeableConcept>();
1580          for (CodeableConcept i : useContext)
1581            dst.useContext.add(i.copy());
1582        };
1583        dst.copyright = copyright == null ? null : copyright.copy();
1584        dst.stringency = stringency == null ? null : stringency.copy();
1585        if (mapping != null) {
1586          dst.mapping = new ArrayList<DataElementMappingComponent>();
1587          for (DataElementMappingComponent i : mapping)
1588            dst.mapping.add(i.copy());
1589        };
1590        if (element != null) {
1591          dst.element = new ArrayList<ElementDefinition>();
1592          for (ElementDefinition i : element)
1593            dst.element.add(i.copy());
1594        };
1595        return dst;
1596      }
1597
1598      protected DataElement typedCopy() {
1599        return copy();
1600      }
1601
1602      @Override
1603      public boolean equalsDeep(Base other) {
1604        if (!super.equalsDeep(other))
1605          return false;
1606        if (!(other instanceof DataElement))
1607          return false;
1608        DataElement o = (DataElement) other;
1609        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
1610           && compareDeep(name, o.name, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
1611           && compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
1612           && compareDeep(useContext, o.useContext, true) && compareDeep(copyright, o.copyright, true) && compareDeep(stringency, o.stringency, true)
1613           && compareDeep(mapping, o.mapping, true) && compareDeep(element, o.element, true);
1614      }
1615
1616      @Override
1617      public boolean equalsShallow(Base other) {
1618        if (!super.equalsShallow(other))
1619          return false;
1620        if (!(other instanceof DataElement))
1621          return false;
1622        DataElement o = (DataElement) other;
1623        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
1624           && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true) && compareValues(publisher, o.publisher, true)
1625           && compareValues(date, o.date, true) && compareValues(copyright, o.copyright, true) && compareValues(stringency, o.stringency, true)
1626          ;
1627      }
1628
1629      public boolean isEmpty() {
1630        return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
1631           && (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (status == null || status.isEmpty())
1632           && (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
1633           && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty()) && (useContext == null || useContext.isEmpty())
1634           && (copyright == null || copyright.isEmpty()) && (stringency == null || stringency.isEmpty())
1635           && (mapping == null || mapping.isEmpty()) && (element == null || element.isEmpty());
1636      }
1637
1638  @Override
1639  public ResourceType getResourceType() {
1640    return ResourceType.DataElement;
1641   }
1642
1643  @SearchParamDefinition(name="date", path="DataElement.date", description="The data element publication date", type="date" )
1644  public static final String SP_DATE = "date";
1645  @SearchParamDefinition(name="identifier", path="DataElement.identifier", description="The identifier of the data element", type="token" )
1646  public static final String SP_IDENTIFIER = "identifier";
1647  @SearchParamDefinition(name="code", path="DataElement.element.code", description="A code for the data element (server may choose to do subsumption)", type="token" )
1648  public static final String SP_CODE = "code";
1649  @SearchParamDefinition(name="stringency", path="DataElement.stringency", description="The stringency of the data element definition", type="token" )
1650  public static final String SP_STRINGENCY = "stringency";
1651  @SearchParamDefinition(name="name", path="DataElement.name", description="Name of the data element", type="string" )
1652  public static final String SP_NAME = "name";
1653  @SearchParamDefinition(name="context", path="DataElement.useContext", description="A use context assigned to the data element", type="token" )
1654  public static final String SP_CONTEXT = "context";
1655  @SearchParamDefinition(name="publisher", path="DataElement.publisher", description="Name of the publisher of the data element", type="string" )
1656  public static final String SP_PUBLISHER = "publisher";
1657  @SearchParamDefinition(name="description", path="DataElement.element.definition", description="Text search in the description of the data element.  This corresponds to the definition of the first DataElement.element.", type="string" )
1658  public static final String SP_DESCRIPTION = "description";
1659  @SearchParamDefinition(name="version", path="DataElement.version", description="The version identifier of the data element", type="string" )
1660  public static final String SP_VERSION = "version";
1661  @SearchParamDefinition(name="url", path="DataElement.url", description="The official URL for the data element", type="uri" )
1662  public static final String SP_URL = "url";
1663  @SearchParamDefinition(name="status", path="DataElement.status", description="The current status of the data element", type="token" )
1664  public static final String SP_STATUS = "status";
1665
1666}
1667