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