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