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