001package org.hl7.fhir.instance.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.Enumerations.*;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.*;
041/**
042 * A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.
043 */
044@ResourceDef(name="ConceptMap", profile="http://hl7.org/fhir/Profile/ConceptMap")
045public class ConceptMap extends DomainResource {
046
047    @Block()
048    public static class ConceptMapContactComponent extends BackboneElement implements IBaseBackboneElement {
049        /**
050         * The name of an individual to contact regarding the concept map.
051         */
052        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
053        @Description(shortDefinition="Name of a individual to contact", formalDefinition="The name of an individual to contact regarding the concept map." )
054        protected StringType name;
055
056        /**
057         * Contact details for individual (if a name was provided) or the publisher.
058         */
059        @Child(name = "telecom", type = {ContactPoint.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
060        @Description(shortDefinition="Contact details for individual or publisher", formalDefinition="Contact details for individual (if a name was provided) or the publisher." )
061        protected List<ContactPoint> telecom;
062
063        private static final long serialVersionUID = -1179697803L;
064
065    /*
066     * Constructor
067     */
068      public ConceptMapContactComponent() {
069        super();
070      }
071
072        /**
073         * @return {@link #name} (The name of an individual to contact regarding the concept map.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
074         */
075        public StringType getNameElement() { 
076          if (this.name == null)
077            if (Configuration.errorOnAutoCreate())
078              throw new Error("Attempt to auto-create ConceptMapContactComponent.name");
079            else if (Configuration.doAutoCreate())
080              this.name = new StringType(); // bb
081          return this.name;
082        }
083
084        public boolean hasNameElement() { 
085          return this.name != null && !this.name.isEmpty();
086        }
087
088        public boolean hasName() { 
089          return this.name != null && !this.name.isEmpty();
090        }
091
092        /**
093         * @param value {@link #name} (The name of an individual to contact regarding the concept map.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
094         */
095        public ConceptMapContactComponent setNameElement(StringType value) { 
096          this.name = value;
097          return this;
098        }
099
100        /**
101         * @return The name of an individual to contact regarding the concept map.
102         */
103        public String getName() { 
104          return this.name == null ? null : this.name.getValue();
105        }
106
107        /**
108         * @param value The name of an individual to contact regarding the concept map.
109         */
110        public ConceptMapContactComponent setName(String value) { 
111          if (Utilities.noString(value))
112            this.name = null;
113          else {
114            if (this.name == null)
115              this.name = new StringType();
116            this.name.setValue(value);
117          }
118          return this;
119        }
120
121        /**
122         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
123         */
124        public List<ContactPoint> getTelecom() { 
125          if (this.telecom == null)
126            this.telecom = new ArrayList<ContactPoint>();
127          return this.telecom;
128        }
129
130        public boolean hasTelecom() { 
131          if (this.telecom == null)
132            return false;
133          for (ContactPoint item : this.telecom)
134            if (!item.isEmpty())
135              return true;
136          return false;
137        }
138
139        /**
140         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
141         */
142    // syntactic sugar
143        public ContactPoint addTelecom() { //3
144          ContactPoint t = new ContactPoint();
145          if (this.telecom == null)
146            this.telecom = new ArrayList<ContactPoint>();
147          this.telecom.add(t);
148          return t;
149        }
150
151    // syntactic sugar
152        public ConceptMapContactComponent addTelecom(ContactPoint t) { //3
153          if (t == null)
154            return this;
155          if (this.telecom == null)
156            this.telecom = new ArrayList<ContactPoint>();
157          this.telecom.add(t);
158          return this;
159        }
160
161        protected void listChildren(List<Property> childrenList) {
162          super.listChildren(childrenList);
163          childrenList.add(new Property("name", "string", "The name of an individual to contact regarding the concept map.", 0, java.lang.Integer.MAX_VALUE, name));
164          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));
165        }
166
167      @Override
168      public void setProperty(String name, Base value) throws FHIRException {
169        if (name.equals("name"))
170          this.name = castToString(value); // StringType
171        else if (name.equals("telecom"))
172          this.getTelecom().add(castToContactPoint(value));
173        else
174          super.setProperty(name, value);
175      }
176
177      @Override
178      public Base addChild(String name) throws FHIRException {
179        if (name.equals("name")) {
180          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.name");
181        }
182        else if (name.equals("telecom")) {
183          return addTelecom();
184        }
185        else
186          return super.addChild(name);
187      }
188
189      public ConceptMapContactComponent copy() {
190        ConceptMapContactComponent dst = new ConceptMapContactComponent();
191        copyValues(dst);
192        dst.name = name == null ? null : name.copy();
193        if (telecom != null) {
194          dst.telecom = new ArrayList<ContactPoint>();
195          for (ContactPoint i : telecom)
196            dst.telecom.add(i.copy());
197        };
198        return dst;
199      }
200
201      @Override
202      public boolean equalsDeep(Base other) {
203        if (!super.equalsDeep(other))
204          return false;
205        if (!(other instanceof ConceptMapContactComponent))
206          return false;
207        ConceptMapContactComponent o = (ConceptMapContactComponent) other;
208        return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
209      }
210
211      @Override
212      public boolean equalsShallow(Base other) {
213        if (!super.equalsShallow(other))
214          return false;
215        if (!(other instanceof ConceptMapContactComponent))
216          return false;
217        ConceptMapContactComponent o = (ConceptMapContactComponent) other;
218        return compareValues(name, o.name, true);
219      }
220
221      public boolean isEmpty() {
222        return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
223          ;
224      }
225
226  public String fhirType() {
227    return "ConceptMap.contact";
228
229  }
230
231  }
232
233    @Block()
234    public static class SourceElementComponent extends BackboneElement implements IBaseBackboneElement {
235        /**
236         * An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).
237         */
238        @Child(name = "codeSystem", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
239        @Description(shortDefinition="Code System (if value set crosses code systems)", formalDefinition="An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system)." )
240        protected UriType codeSystem;
241
242        /**
243         * Identity (code or path) or the element/item being mapped.
244         */
245        @Child(name = "code", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
246        @Description(shortDefinition="Identifies element being mapped", formalDefinition="Identity (code or path) or the element/item being mapped." )
247        protected CodeType code;
248
249        /**
250         * A concept from the target value set that this concept maps to.
251         */
252        @Child(name = "target", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
253        @Description(shortDefinition="Concept in target system for element", formalDefinition="A concept from the target value set that this concept maps to." )
254        protected List<TargetElementComponent> target;
255
256        private static final long serialVersionUID = -458143877L;
257
258    /*
259     * Constructor
260     */
261      public SourceElementComponent() {
262        super();
263      }
264
265        /**
266         * @return {@link #codeSystem} (An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
267         */
268        public UriType getCodeSystemElement() { 
269          if (this.codeSystem == null)
270            if (Configuration.errorOnAutoCreate())
271              throw new Error("Attempt to auto-create SourceElementComponent.codeSystem");
272            else if (Configuration.doAutoCreate())
273              this.codeSystem = new UriType(); // bb
274          return this.codeSystem;
275        }
276
277        public boolean hasCodeSystemElement() { 
278          return this.codeSystem != null && !this.codeSystem.isEmpty();
279        }
280
281        public boolean hasCodeSystem() { 
282          return this.codeSystem != null && !this.codeSystem.isEmpty();
283        }
284
285        /**
286         * @param value {@link #codeSystem} (An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
287         */
288        public SourceElementComponent setCodeSystemElement(UriType value) { 
289          this.codeSystem = value;
290          return this;
291        }
292
293        /**
294         * @return An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).
295         */
296        public String getCodeSystem() { 
297          return this.codeSystem == null ? null : this.codeSystem.getValue();
298        }
299
300        /**
301         * @param value An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).
302         */
303        public SourceElementComponent setCodeSystem(String value) { 
304          if (Utilities.noString(value))
305            this.codeSystem = null;
306          else {
307            if (this.codeSystem == null)
308              this.codeSystem = new UriType();
309            this.codeSystem.setValue(value);
310          }
311          return this;
312        }
313
314        /**
315         * @return {@link #code} (Identity (code or path) or the element/item being mapped.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
316         */
317        public CodeType getCodeElement() { 
318          if (this.code == null)
319            if (Configuration.errorOnAutoCreate())
320              throw new Error("Attempt to auto-create SourceElementComponent.code");
321            else if (Configuration.doAutoCreate())
322              this.code = new CodeType(); // bb
323          return this.code;
324        }
325
326        public boolean hasCodeElement() { 
327          return this.code != null && !this.code.isEmpty();
328        }
329
330        public boolean hasCode() { 
331          return this.code != null && !this.code.isEmpty();
332        }
333
334        /**
335         * @param value {@link #code} (Identity (code or path) or the element/item being mapped.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
336         */
337        public SourceElementComponent setCodeElement(CodeType value) { 
338          this.code = value;
339          return this;
340        }
341
342        /**
343         * @return Identity (code or path) or the element/item being mapped.
344         */
345        public String getCode() { 
346          return this.code == null ? null : this.code.getValue();
347        }
348
349        /**
350         * @param value Identity (code or path) or the element/item being mapped.
351         */
352        public SourceElementComponent setCode(String value) { 
353          if (Utilities.noString(value))
354            this.code = null;
355          else {
356            if (this.code == null)
357              this.code = new CodeType();
358            this.code.setValue(value);
359          }
360          return this;
361        }
362
363        /**
364         * @return {@link #target} (A concept from the target value set that this concept maps to.)
365         */
366        public List<TargetElementComponent> getTarget() { 
367          if (this.target == null)
368            this.target = new ArrayList<TargetElementComponent>();
369          return this.target;
370        }
371
372        public boolean hasTarget() { 
373          if (this.target == null)
374            return false;
375          for (TargetElementComponent item : this.target)
376            if (!item.isEmpty())
377              return true;
378          return false;
379        }
380
381        /**
382         * @return {@link #target} (A concept from the target value set that this concept maps to.)
383         */
384    // syntactic sugar
385        public TargetElementComponent addTarget() { //3
386          TargetElementComponent t = new TargetElementComponent();
387          if (this.target == null)
388            this.target = new ArrayList<TargetElementComponent>();
389          this.target.add(t);
390          return t;
391        }
392
393    // syntactic sugar
394        public SourceElementComponent addTarget(TargetElementComponent t) { //3
395          if (t == null)
396            return this;
397          if (this.target == null)
398            this.target = new ArrayList<TargetElementComponent>();
399          this.target.add(t);
400          return this;
401        }
402
403        protected void listChildren(List<Property> childrenList) {
404          super.listChildren(childrenList);
405          childrenList.add(new Property("codeSystem", "uri", "An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).", 0, java.lang.Integer.MAX_VALUE, codeSystem));
406          childrenList.add(new Property("code", "code", "Identity (code or path) or the element/item being mapped.", 0, java.lang.Integer.MAX_VALUE, code));
407          childrenList.add(new Property("target", "", "A concept from the target value set that this concept maps to.", 0, java.lang.Integer.MAX_VALUE, target));
408        }
409
410      @Override
411      public void setProperty(String name, Base value) throws FHIRException {
412        if (name.equals("codeSystem"))
413          this.codeSystem = castToUri(value); // UriType
414        else if (name.equals("code"))
415          this.code = castToCode(value); // CodeType
416        else if (name.equals("target"))
417          this.getTarget().add((TargetElementComponent) value);
418        else
419          super.setProperty(name, value);
420      }
421
422      @Override
423      public Base addChild(String name) throws FHIRException {
424        if (name.equals("codeSystem")) {
425          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.codeSystem");
426        }
427        else if (name.equals("code")) {
428          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.code");
429        }
430        else if (name.equals("target")) {
431          return addTarget();
432        }
433        else
434          return super.addChild(name);
435      }
436
437      public SourceElementComponent copy() {
438        SourceElementComponent dst = new SourceElementComponent();
439        copyValues(dst);
440        dst.codeSystem = codeSystem == null ? null : codeSystem.copy();
441        dst.code = code == null ? null : code.copy();
442        if (target != null) {
443          dst.target = new ArrayList<TargetElementComponent>();
444          for (TargetElementComponent i : target)
445            dst.target.add(i.copy());
446        };
447        return dst;
448      }
449
450      @Override
451      public boolean equalsDeep(Base other) {
452        if (!super.equalsDeep(other))
453          return false;
454        if (!(other instanceof SourceElementComponent))
455          return false;
456        SourceElementComponent o = (SourceElementComponent) other;
457        return compareDeep(codeSystem, o.codeSystem, true) && compareDeep(code, o.code, true) && compareDeep(target, o.target, true)
458          ;
459      }
460
461      @Override
462      public boolean equalsShallow(Base other) {
463        if (!super.equalsShallow(other))
464          return false;
465        if (!(other instanceof SourceElementComponent))
466          return false;
467        SourceElementComponent o = (SourceElementComponent) other;
468        return compareValues(codeSystem, o.codeSystem, true) && compareValues(code, o.code, true);
469      }
470
471      public boolean isEmpty() {
472        return super.isEmpty() && (codeSystem == null || codeSystem.isEmpty()) && (code == null || code.isEmpty())
473           && (target == null || target.isEmpty());
474      }
475
476  public String fhirType() {
477    return "ConceptMap.element";
478
479  }
480
481  }
482
483    @Block()
484    public static class TargetElementComponent extends BackboneElement implements IBaseBackboneElement {
485        /**
486         * An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).
487         */
488        @Child(name = "codeSystem", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
489        @Description(shortDefinition="System of the target (if necessary)", formalDefinition="An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems)." )
490        protected UriType codeSystem;
491
492        /**
493         * Identity (code or path) or the element/item that the map refers to.
494         */
495        @Child(name = "code", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
496        @Description(shortDefinition="Code that identifies the target element", formalDefinition="Identity (code or path) or the element/item that the map refers to." )
497        protected CodeType code;
498
499        /**
500         * The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).
501         */
502        @Child(name = "equivalence", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=false)
503        @Description(shortDefinition="equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint", formalDefinition="The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source)." )
504        protected Enumeration<ConceptMapEquivalence> equivalence;
505
506        /**
507         * A description of status/issues in mapping that conveys additional information not represented in  the structured data.
508         */
509        @Child(name = "comments", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
510        @Description(shortDefinition="Description of status/issues in mapping", formalDefinition="A description of status/issues in mapping that conveys additional information not represented in  the structured data." )
511        protected StringType comments;
512
513        /**
514         * A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value.
515         */
516        @Child(name = "dependsOn", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
517        @Description(shortDefinition="Other elements required for this mapping (from context)", formalDefinition="A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value." )
518        protected List<OtherElementComponent> dependsOn;
519
520        /**
521         * A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.
522         */
523        @Child(name = "product", type = {OtherElementComponent.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
524        @Description(shortDefinition="Other concepts that this mapping also produces", formalDefinition="A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on." )
525        protected List<OtherElementComponent> product;
526
527        private static final long serialVersionUID = -804990059L;
528
529    /*
530     * Constructor
531     */
532      public TargetElementComponent() {
533        super();
534      }
535
536    /*
537     * Constructor
538     */
539      public TargetElementComponent(Enumeration<ConceptMapEquivalence> equivalence) {
540        super();
541        this.equivalence = equivalence;
542      }
543
544        /**
545         * @return {@link #codeSystem} (An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
546         */
547        public UriType getCodeSystemElement() { 
548          if (this.codeSystem == null)
549            if (Configuration.errorOnAutoCreate())
550              throw new Error("Attempt to auto-create TargetElementComponent.codeSystem");
551            else if (Configuration.doAutoCreate())
552              this.codeSystem = new UriType(); // bb
553          return this.codeSystem;
554        }
555
556        public boolean hasCodeSystemElement() { 
557          return this.codeSystem != null && !this.codeSystem.isEmpty();
558        }
559
560        public boolean hasCodeSystem() { 
561          return this.codeSystem != null && !this.codeSystem.isEmpty();
562        }
563
564        /**
565         * @param value {@link #codeSystem} (An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
566         */
567        public TargetElementComponent setCodeSystemElement(UriType value) { 
568          this.codeSystem = value;
569          return this;
570        }
571
572        /**
573         * @return An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).
574         */
575        public String getCodeSystem() { 
576          return this.codeSystem == null ? null : this.codeSystem.getValue();
577        }
578
579        /**
580         * @param value An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).
581         */
582        public TargetElementComponent setCodeSystem(String value) { 
583          if (Utilities.noString(value))
584            this.codeSystem = null;
585          else {
586            if (this.codeSystem == null)
587              this.codeSystem = new UriType();
588            this.codeSystem.setValue(value);
589          }
590          return this;
591        }
592
593        /**
594         * @return {@link #code} (Identity (code or path) or the element/item that the map refers to.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
595         */
596        public CodeType getCodeElement() { 
597          if (this.code == null)
598            if (Configuration.errorOnAutoCreate())
599              throw new Error("Attempt to auto-create TargetElementComponent.code");
600            else if (Configuration.doAutoCreate())
601              this.code = new CodeType(); // bb
602          return this.code;
603        }
604
605        public boolean hasCodeElement() { 
606          return this.code != null && !this.code.isEmpty();
607        }
608
609        public boolean hasCode() { 
610          return this.code != null && !this.code.isEmpty();
611        }
612
613        /**
614         * @param value {@link #code} (Identity (code or path) or the element/item that the map refers to.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
615         */
616        public TargetElementComponent setCodeElement(CodeType value) { 
617          this.code = value;
618          return this;
619        }
620
621        /**
622         * @return Identity (code or path) or the element/item that the map refers to.
623         */
624        public String getCode() { 
625          return this.code == null ? null : this.code.getValue();
626        }
627
628        /**
629         * @param value Identity (code or path) or the element/item that the map refers to.
630         */
631        public TargetElementComponent setCode(String value) { 
632          if (Utilities.noString(value))
633            this.code = null;
634          else {
635            if (this.code == null)
636              this.code = new CodeType();
637            this.code.setValue(value);
638          }
639          return this;
640        }
641
642        /**
643         * @return {@link #equivalence} (The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).). This is the underlying object with id, value and extensions. The accessor "getEquivalence" gives direct access to the value
644         */
645        public Enumeration<ConceptMapEquivalence> getEquivalenceElement() { 
646          if (this.equivalence == null)
647            if (Configuration.errorOnAutoCreate())
648              throw new Error("Attempt to auto-create TargetElementComponent.equivalence");
649            else if (Configuration.doAutoCreate())
650              this.equivalence = new Enumeration<ConceptMapEquivalence>(new ConceptMapEquivalenceEnumFactory()); // bb
651          return this.equivalence;
652        }
653
654        public boolean hasEquivalenceElement() { 
655          return this.equivalence != null && !this.equivalence.isEmpty();
656        }
657
658        public boolean hasEquivalence() { 
659          return this.equivalence != null && !this.equivalence.isEmpty();
660        }
661
662        /**
663         * @param value {@link #equivalence} (The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).). This is the underlying object with id, value and extensions. The accessor "getEquivalence" gives direct access to the value
664         */
665        public TargetElementComponent setEquivalenceElement(Enumeration<ConceptMapEquivalence> value) { 
666          this.equivalence = value;
667          return this;
668        }
669
670        /**
671         * @return The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).
672         */
673        public ConceptMapEquivalence getEquivalence() { 
674          return this.equivalence == null ? null : this.equivalence.getValue();
675        }
676
677        /**
678         * @param value The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).
679         */
680        public TargetElementComponent setEquivalence(ConceptMapEquivalence value) { 
681            if (this.equivalence == null)
682              this.equivalence = new Enumeration<ConceptMapEquivalence>(new ConceptMapEquivalenceEnumFactory());
683            this.equivalence.setValue(value);
684          return this;
685        }
686
687        /**
688         * @return {@link #comments} (A description of status/issues in mapping that conveys additional information not represented in  the structured data.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
689         */
690        public StringType getCommentsElement() { 
691          if (this.comments == null)
692            if (Configuration.errorOnAutoCreate())
693              throw new Error("Attempt to auto-create TargetElementComponent.comments");
694            else if (Configuration.doAutoCreate())
695              this.comments = new StringType(); // bb
696          return this.comments;
697        }
698
699        public boolean hasCommentsElement() { 
700          return this.comments != null && !this.comments.isEmpty();
701        }
702
703        public boolean hasComments() { 
704          return this.comments != null && !this.comments.isEmpty();
705        }
706
707        /**
708         * @param value {@link #comments} (A description of status/issues in mapping that conveys additional information not represented in  the structured data.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
709         */
710        public TargetElementComponent setCommentsElement(StringType value) { 
711          this.comments = value;
712          return this;
713        }
714
715        /**
716         * @return A description of status/issues in mapping that conveys additional information not represented in  the structured data.
717         */
718        public String getComments() { 
719          return this.comments == null ? null : this.comments.getValue();
720        }
721
722        /**
723         * @param value A description of status/issues in mapping that conveys additional information not represented in  the structured data.
724         */
725        public TargetElementComponent setComments(String value) { 
726          if (Utilities.noString(value))
727            this.comments = null;
728          else {
729            if (this.comments == null)
730              this.comments = new StringType();
731            this.comments.setValue(value);
732          }
733          return this;
734        }
735
736        /**
737         * @return {@link #dependsOn} (A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value.)
738         */
739        public List<OtherElementComponent> getDependsOn() { 
740          if (this.dependsOn == null)
741            this.dependsOn = new ArrayList<OtherElementComponent>();
742          return this.dependsOn;
743        }
744
745        public boolean hasDependsOn() { 
746          if (this.dependsOn == null)
747            return false;
748          for (OtherElementComponent item : this.dependsOn)
749            if (!item.isEmpty())
750              return true;
751          return false;
752        }
753
754        /**
755         * @return {@link #dependsOn} (A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value.)
756         */
757    // syntactic sugar
758        public OtherElementComponent addDependsOn() { //3
759          OtherElementComponent t = new OtherElementComponent();
760          if (this.dependsOn == null)
761            this.dependsOn = new ArrayList<OtherElementComponent>();
762          this.dependsOn.add(t);
763          return t;
764        }
765
766    // syntactic sugar
767        public TargetElementComponent addDependsOn(OtherElementComponent t) { //3
768          if (t == null)
769            return this;
770          if (this.dependsOn == null)
771            this.dependsOn = new ArrayList<OtherElementComponent>();
772          this.dependsOn.add(t);
773          return this;
774        }
775
776        /**
777         * @return {@link #product} (A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.)
778         */
779        public List<OtherElementComponent> getProduct() { 
780          if (this.product == null)
781            this.product = new ArrayList<OtherElementComponent>();
782          return this.product;
783        }
784
785        public boolean hasProduct() { 
786          if (this.product == null)
787            return false;
788          for (OtherElementComponent item : this.product)
789            if (!item.isEmpty())
790              return true;
791          return false;
792        }
793
794        /**
795         * @return {@link #product} (A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.)
796         */
797    // syntactic sugar
798        public OtherElementComponent addProduct() { //3
799          OtherElementComponent t = new OtherElementComponent();
800          if (this.product == null)
801            this.product = new ArrayList<OtherElementComponent>();
802          this.product.add(t);
803          return t;
804        }
805
806    // syntactic sugar
807        public TargetElementComponent addProduct(OtherElementComponent t) { //3
808          if (t == null)
809            return this;
810          if (this.product == null)
811            this.product = new ArrayList<OtherElementComponent>();
812          this.product.add(t);
813          return this;
814        }
815
816        protected void listChildren(List<Property> childrenList) {
817          super.listChildren(childrenList);
818          childrenList.add(new Property("codeSystem", "uri", "An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).", 0, java.lang.Integer.MAX_VALUE, codeSystem));
819          childrenList.add(new Property("code", "code", "Identity (code or path) or the element/item that the map refers to.", 0, java.lang.Integer.MAX_VALUE, code));
820          childrenList.add(new Property("equivalence", "code", "The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).", 0, java.lang.Integer.MAX_VALUE, equivalence));
821          childrenList.add(new Property("comments", "string", "A description of status/issues in mapping that conveys additional information not represented in  the structured data.", 0, java.lang.Integer.MAX_VALUE, comments));
822          childrenList.add(new Property("dependsOn", "", "A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value.", 0, java.lang.Integer.MAX_VALUE, dependsOn));
823          childrenList.add(new Property("product", "@ConceptMap.element.target.dependsOn", "A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.", 0, java.lang.Integer.MAX_VALUE, product));
824        }
825
826      @Override
827      public void setProperty(String name, Base value) throws FHIRException {
828        if (name.equals("codeSystem"))
829          this.codeSystem = castToUri(value); // UriType
830        else if (name.equals("code"))
831          this.code = castToCode(value); // CodeType
832        else if (name.equals("equivalence"))
833          this.equivalence = new ConceptMapEquivalenceEnumFactory().fromType(value); // Enumeration<ConceptMapEquivalence>
834        else if (name.equals("comments"))
835          this.comments = castToString(value); // StringType
836        else if (name.equals("dependsOn"))
837          this.getDependsOn().add((OtherElementComponent) value);
838        else if (name.equals("product"))
839          this.getProduct().add((OtherElementComponent) value);
840        else
841          super.setProperty(name, value);
842      }
843
844      @Override
845      public Base addChild(String name) throws FHIRException {
846        if (name.equals("codeSystem")) {
847          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.codeSystem");
848        }
849        else if (name.equals("code")) {
850          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.code");
851        }
852        else if (name.equals("equivalence")) {
853          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.equivalence");
854        }
855        else if (name.equals("comments")) {
856          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.comments");
857        }
858        else if (name.equals("dependsOn")) {
859          return addDependsOn();
860        }
861        else if (name.equals("product")) {
862          return addProduct();
863        }
864        else
865          return super.addChild(name);
866      }
867
868      public TargetElementComponent copy() {
869        TargetElementComponent dst = new TargetElementComponent();
870        copyValues(dst);
871        dst.codeSystem = codeSystem == null ? null : codeSystem.copy();
872        dst.code = code == null ? null : code.copy();
873        dst.equivalence = equivalence == null ? null : equivalence.copy();
874        dst.comments = comments == null ? null : comments.copy();
875        if (dependsOn != null) {
876          dst.dependsOn = new ArrayList<OtherElementComponent>();
877          for (OtherElementComponent i : dependsOn)
878            dst.dependsOn.add(i.copy());
879        };
880        if (product != null) {
881          dst.product = new ArrayList<OtherElementComponent>();
882          for (OtherElementComponent i : product)
883            dst.product.add(i.copy());
884        };
885        return dst;
886      }
887
888      @Override
889      public boolean equalsDeep(Base other) {
890        if (!super.equalsDeep(other))
891          return false;
892        if (!(other instanceof TargetElementComponent))
893          return false;
894        TargetElementComponent o = (TargetElementComponent) other;
895        return compareDeep(codeSystem, o.codeSystem, true) && compareDeep(code, o.code, true) && compareDeep(equivalence, o.equivalence, true)
896           && compareDeep(comments, o.comments, true) && compareDeep(dependsOn, o.dependsOn, true) && compareDeep(product, o.product, true)
897          ;
898      }
899
900      @Override
901      public boolean equalsShallow(Base other) {
902        if (!super.equalsShallow(other))
903          return false;
904        if (!(other instanceof TargetElementComponent))
905          return false;
906        TargetElementComponent o = (TargetElementComponent) other;
907        return compareValues(codeSystem, o.codeSystem, true) && compareValues(code, o.code, true) && compareValues(equivalence, o.equivalence, true)
908           && compareValues(comments, o.comments, true);
909      }
910
911      public boolean isEmpty() {
912        return super.isEmpty() && (codeSystem == null || codeSystem.isEmpty()) && (code == null || code.isEmpty())
913           && (equivalence == null || equivalence.isEmpty()) && (comments == null || comments.isEmpty())
914           && (dependsOn == null || dependsOn.isEmpty()) && (product == null || product.isEmpty());
915      }
916
917  public String fhirType() {
918    return "ConceptMap.element.target";
919
920  }
921
922  }
923
924    @Block()
925    public static class OtherElementComponent extends BackboneElement implements IBaseBackboneElement {
926        /**
927         * A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.
928         */
929        @Child(name = "element", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=false)
930        @Description(shortDefinition="Reference to element/field/ValueSet mapping depends on", formalDefinition="A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition." )
931        protected UriType element;
932
933        /**
934         * An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).
935         */
936        @Child(name = "codeSystem", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
937        @Description(shortDefinition="Code System (if necessary)", formalDefinition="An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems)." )
938        protected UriType codeSystem;
939
940        /**
941         * Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.
942         */
943        @Child(name = "code", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
944        @Description(shortDefinition="Value of the referenced element", formalDefinition="Identity (code or path) or the element/item/ValueSet that the map depends on / refers to." )
945        protected StringType code;
946
947        private static final long serialVersionUID = 1488522448L;
948
949    /*
950     * Constructor
951     */
952      public OtherElementComponent() {
953        super();
954      }
955
956    /*
957     * Constructor
958     */
959      public OtherElementComponent(UriType element, UriType codeSystem, StringType code) {
960        super();
961        this.element = element;
962        this.codeSystem = codeSystem;
963        this.code = code;
964      }
965
966        /**
967         * @return {@link #element} (A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
968         */
969        public UriType getElementElement() { 
970          if (this.element == null)
971            if (Configuration.errorOnAutoCreate())
972              throw new Error("Attempt to auto-create OtherElementComponent.element");
973            else if (Configuration.doAutoCreate())
974              this.element = new UriType(); // bb
975          return this.element;
976        }
977
978        public boolean hasElementElement() { 
979          return this.element != null && !this.element.isEmpty();
980        }
981
982        public boolean hasElement() { 
983          return this.element != null && !this.element.isEmpty();
984        }
985
986        /**
987         * @param value {@link #element} (A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
988         */
989        public OtherElementComponent setElementElement(UriType value) { 
990          this.element = value;
991          return this;
992        }
993
994        /**
995         * @return A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.
996         */
997        public String getElement() { 
998          return this.element == null ? null : this.element.getValue();
999        }
1000
1001        /**
1002         * @param value A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.
1003         */
1004        public OtherElementComponent setElement(String value) { 
1005            if (this.element == null)
1006              this.element = new UriType();
1007            this.element.setValue(value);
1008          return this;
1009        }
1010
1011        /**
1012         * @return {@link #codeSystem} (An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
1013         */
1014        public UriType getCodeSystemElement() { 
1015          if (this.codeSystem == null)
1016            if (Configuration.errorOnAutoCreate())
1017              throw new Error("Attempt to auto-create OtherElementComponent.codeSystem");
1018            else if (Configuration.doAutoCreate())
1019              this.codeSystem = new UriType(); // bb
1020          return this.codeSystem;
1021        }
1022
1023        public boolean hasCodeSystemElement() { 
1024          return this.codeSystem != null && !this.codeSystem.isEmpty();
1025        }
1026
1027        public boolean hasCodeSystem() { 
1028          return this.codeSystem != null && !this.codeSystem.isEmpty();
1029        }
1030
1031        /**
1032         * @param value {@link #codeSystem} (An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).). This is the underlying object with id, value and extensions. The accessor "getCodeSystem" gives direct access to the value
1033         */
1034        public OtherElementComponent setCodeSystemElement(UriType value) { 
1035          this.codeSystem = value;
1036          return this;
1037        }
1038
1039        /**
1040         * @return An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).
1041         */
1042        public String getCodeSystem() { 
1043          return this.codeSystem == null ? null : this.codeSystem.getValue();
1044        }
1045
1046        /**
1047         * @param value An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).
1048         */
1049        public OtherElementComponent setCodeSystem(String value) { 
1050            if (this.codeSystem == null)
1051              this.codeSystem = new UriType();
1052            this.codeSystem.setValue(value);
1053          return this;
1054        }
1055
1056        /**
1057         * @return {@link #code} (Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1058         */
1059        public StringType getCodeElement() { 
1060          if (this.code == null)
1061            if (Configuration.errorOnAutoCreate())
1062              throw new Error("Attempt to auto-create OtherElementComponent.code");
1063            else if (Configuration.doAutoCreate())
1064              this.code = new StringType(); // bb
1065          return this.code;
1066        }
1067
1068        public boolean hasCodeElement() { 
1069          return this.code != null && !this.code.isEmpty();
1070        }
1071
1072        public boolean hasCode() { 
1073          return this.code != null && !this.code.isEmpty();
1074        }
1075
1076        /**
1077         * @param value {@link #code} (Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1078         */
1079        public OtherElementComponent setCodeElement(StringType value) { 
1080          this.code = value;
1081          return this;
1082        }
1083
1084        /**
1085         * @return Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.
1086         */
1087        public String getCode() { 
1088          return this.code == null ? null : this.code.getValue();
1089        }
1090
1091        /**
1092         * @param value Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.
1093         */
1094        public OtherElementComponent setCode(String value) { 
1095            if (this.code == null)
1096              this.code = new StringType();
1097            this.code.setValue(value);
1098          return this;
1099        }
1100
1101        protected void listChildren(List<Property> childrenList) {
1102          super.listChildren(childrenList);
1103          childrenList.add(new Property("element", "uri", "A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. HL7 v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.", 0, java.lang.Integer.MAX_VALUE, element));
1104          childrenList.add(new Property("codeSystem", "uri", "An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).", 0, java.lang.Integer.MAX_VALUE, codeSystem));
1105          childrenList.add(new Property("code", "string", "Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.", 0, java.lang.Integer.MAX_VALUE, code));
1106        }
1107
1108      @Override
1109      public void setProperty(String name, Base value) throws FHIRException {
1110        if (name.equals("element"))
1111          this.element = castToUri(value); // UriType
1112        else if (name.equals("codeSystem"))
1113          this.codeSystem = castToUri(value); // UriType
1114        else if (name.equals("code"))
1115          this.code = castToString(value); // StringType
1116        else
1117          super.setProperty(name, value);
1118      }
1119
1120      @Override
1121      public Base addChild(String name) throws FHIRException {
1122        if (name.equals("element")) {
1123          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.element");
1124        }
1125        else if (name.equals("codeSystem")) {
1126          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.codeSystem");
1127        }
1128        else if (name.equals("code")) {
1129          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.code");
1130        }
1131        else
1132          return super.addChild(name);
1133      }
1134
1135      public OtherElementComponent copy() {
1136        OtherElementComponent dst = new OtherElementComponent();
1137        copyValues(dst);
1138        dst.element = element == null ? null : element.copy();
1139        dst.codeSystem = codeSystem == null ? null : codeSystem.copy();
1140        dst.code = code == null ? null : code.copy();
1141        return dst;
1142      }
1143
1144      @Override
1145      public boolean equalsDeep(Base other) {
1146        if (!super.equalsDeep(other))
1147          return false;
1148        if (!(other instanceof OtherElementComponent))
1149          return false;
1150        OtherElementComponent o = (OtherElementComponent) other;
1151        return compareDeep(element, o.element, true) && compareDeep(codeSystem, o.codeSystem, true) && compareDeep(code, o.code, true)
1152          ;
1153      }
1154
1155      @Override
1156      public boolean equalsShallow(Base other) {
1157        if (!super.equalsShallow(other))
1158          return false;
1159        if (!(other instanceof OtherElementComponent))
1160          return false;
1161        OtherElementComponent o = (OtherElementComponent) other;
1162        return compareValues(element, o.element, true) && compareValues(codeSystem, o.codeSystem, true) && compareValues(code, o.code, true)
1163          ;
1164      }
1165
1166      public boolean isEmpty() {
1167        return super.isEmpty() && (element == null || element.isEmpty()) && (codeSystem == null || codeSystem.isEmpty())
1168           && (code == null || code.isEmpty());
1169      }
1170
1171  public String fhirType() {
1172    return "ConceptMap.element.target.dependsOn";
1173
1174  }
1175
1176  }
1177
1178    /**
1179     * An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.
1180     */
1181    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
1182    @Description(shortDefinition="Globally unique logical id for concept map", formalDefinition="An absolute URL that is used to identify this concept map 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 concept map is (or will be) published." )
1183    protected UriType url;
1184
1185    /**
1186     * Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.
1187     */
1188    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1189    @Description(shortDefinition="Additional identifier for the concept map", formalDefinition="Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance." )
1190    protected Identifier identifier;
1191
1192    /**
1193     * The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
1194     */
1195    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1196    @Description(shortDefinition="Logical id for this version of the concept map", formalDefinition="The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp." )
1197    protected StringType version;
1198
1199    /**
1200     * A free text natural language name describing the concept map.
1201     */
1202    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1203    @Description(shortDefinition="Informal name for this concept map", formalDefinition="A free text natural language name describing the concept map." )
1204    protected StringType name;
1205
1206    /**
1207     * The status of the concept map.
1208     */
1209    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
1210    @Description(shortDefinition="draft | active | retired", formalDefinition="The status of the concept map." )
1211    protected Enumeration<ConformanceResourceStatus> status;
1212
1213    /**
1214     * This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1215     */
1216    @Child(name = "experimental", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1217    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
1218    protected BooleanType experimental;
1219
1220    /**
1221     * The name of the individual or organization that published the concept map.
1222     */
1223    @Child(name = "publisher", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1224    @Description(shortDefinition="Name of the publisher (organization or individual)", formalDefinition="The name of the individual or organization that published the concept map." )
1225    protected StringType publisher;
1226
1227    /**
1228     * Contacts to assist a user in finding and communicating with the publisher.
1229     */
1230    @Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1231    @Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
1232    protected List<ConceptMapContactComponent> contact;
1233
1234    /**
1235     * The date this version of the concept map 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 concept map changes.
1236     */
1237    @Child(name = "date", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1238    @Description(shortDefinition="Date for given status", formalDefinition="The date this version of the concept map 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 concept map changes." )
1239    protected DateTimeType date;
1240
1241    /**
1242     * A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
1243     */
1244    @Child(name = "description", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1245    @Description(shortDefinition="Human language description of the concept map", formalDefinition="A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc." )
1246    protected StringType description;
1247
1248    /**
1249     * 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 concept map instances.
1250     */
1251    @Child(name = "useContext", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1252    @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 concept map instances." )
1253    protected List<CodeableConcept> useContext;
1254
1255    /**
1256     * Explains why this concept map is needed and why it has been constrained as it has.
1257     */
1258    @Child(name = "requirements", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1259    @Description(shortDefinition="Why needed", formalDefinition="Explains why this concept map is needed and why it has been constrained as it has." )
1260    protected StringType requirements;
1261
1262    /**
1263     * A copyright statement relating to the concept map and/or its contents.
1264     */
1265    @Child(name = "copyright", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1266    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the concept map and/or its contents." )
1267    protected StringType copyright;
1268
1269    /**
1270     * The source value set that specifies the concepts that are being mapped.
1271     */
1272    @Child(name = "source", type = {UriType.class, ValueSet.class, StructureDefinition.class}, order=13, min=1, max=1, modifier=false, summary=true)
1273    @Description(shortDefinition="Identifies the source of the concepts which are being mapped", formalDefinition="The source value set that specifies the concepts that are being mapped." )
1274    protected Type source;
1275
1276    /**
1277     * The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.
1278     */
1279    @Child(name = "target", type = {UriType.class, ValueSet.class, StructureDefinition.class}, order=14, min=1, max=1, modifier=false, summary=true)
1280    @Description(shortDefinition="Provides context to the mappings", formalDefinition="The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made." )
1281    protected Type target;
1282
1283    /**
1284     * Mappings for an individual concept in the source to one or more concepts in the target.
1285     */
1286    @Child(name = "element", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1287    @Description(shortDefinition="Mappings for a concept from the source set", formalDefinition="Mappings for an individual concept in the source to one or more concepts in the target." )
1288    protected List<SourceElementComponent> element;
1289
1290    private static final long serialVersionUID = 1687563642L;
1291
1292  /*
1293   * Constructor
1294   */
1295    public ConceptMap() {
1296      super();
1297    }
1298
1299  /*
1300   * Constructor
1301   */
1302    public ConceptMap(Enumeration<ConformanceResourceStatus> status, Type source, Type target) {
1303      super();
1304      this.status = status;
1305      this.source = source;
1306      this.target = target;
1307    }
1308
1309    /**
1310     * @return {@link #url} (An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1311     */
1312    public UriType getUrlElement() { 
1313      if (this.url == null)
1314        if (Configuration.errorOnAutoCreate())
1315          throw new Error("Attempt to auto-create ConceptMap.url");
1316        else if (Configuration.doAutoCreate())
1317          this.url = new UriType(); // bb
1318      return this.url;
1319    }
1320
1321    public boolean hasUrlElement() { 
1322      return this.url != null && !this.url.isEmpty();
1323    }
1324
1325    public boolean hasUrl() { 
1326      return this.url != null && !this.url.isEmpty();
1327    }
1328
1329    /**
1330     * @param value {@link #url} (An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1331     */
1332    public ConceptMap setUrlElement(UriType value) { 
1333      this.url = value;
1334      return this;
1335    }
1336
1337    /**
1338     * @return An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.
1339     */
1340    public String getUrl() { 
1341      return this.url == null ? null : this.url.getValue();
1342    }
1343
1344    /**
1345     * @param value An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.
1346     */
1347    public ConceptMap setUrl(String value) { 
1348      if (Utilities.noString(value))
1349        this.url = null;
1350      else {
1351        if (this.url == null)
1352          this.url = new UriType();
1353        this.url.setValue(value);
1354      }
1355      return this;
1356    }
1357
1358    /**
1359     * @return {@link #identifier} (Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.)
1360     */
1361    public Identifier getIdentifier() { 
1362      if (this.identifier == null)
1363        if (Configuration.errorOnAutoCreate())
1364          throw new Error("Attempt to auto-create ConceptMap.identifier");
1365        else if (Configuration.doAutoCreate())
1366          this.identifier = new Identifier(); // cc
1367      return this.identifier;
1368    }
1369
1370    public boolean hasIdentifier() { 
1371      return this.identifier != null && !this.identifier.isEmpty();
1372    }
1373
1374    /**
1375     * @param value {@link #identifier} (Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.)
1376     */
1377    public ConceptMap setIdentifier(Identifier value) { 
1378      this.identifier = value;
1379      return this;
1380    }
1381
1382    /**
1383     * @return {@link #version} (The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1384     */
1385    public StringType getVersionElement() { 
1386      if (this.version == null)
1387        if (Configuration.errorOnAutoCreate())
1388          throw new Error("Attempt to auto-create ConceptMap.version");
1389        else if (Configuration.doAutoCreate())
1390          this.version = new StringType(); // bb
1391      return this.version;
1392    }
1393
1394    public boolean hasVersionElement() { 
1395      return this.version != null && !this.version.isEmpty();
1396    }
1397
1398    public boolean hasVersion() { 
1399      return this.version != null && !this.version.isEmpty();
1400    }
1401
1402    /**
1403     * @param value {@link #version} (The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1404     */
1405    public ConceptMap setVersionElement(StringType value) { 
1406      this.version = value;
1407      return this;
1408    }
1409
1410    /**
1411     * @return The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
1412     */
1413    public String getVersion() { 
1414      return this.version == null ? null : this.version.getValue();
1415    }
1416
1417    /**
1418     * @param value The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.
1419     */
1420    public ConceptMap setVersion(String value) { 
1421      if (Utilities.noString(value))
1422        this.version = null;
1423      else {
1424        if (this.version == null)
1425          this.version = new StringType();
1426        this.version.setValue(value);
1427      }
1428      return this;
1429    }
1430
1431    /**
1432     * @return {@link #name} (A free text natural language name describing the concept map.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1433     */
1434    public StringType getNameElement() { 
1435      if (this.name == null)
1436        if (Configuration.errorOnAutoCreate())
1437          throw new Error("Attempt to auto-create ConceptMap.name");
1438        else if (Configuration.doAutoCreate())
1439          this.name = new StringType(); // bb
1440      return this.name;
1441    }
1442
1443    public boolean hasNameElement() { 
1444      return this.name != null && !this.name.isEmpty();
1445    }
1446
1447    public boolean hasName() { 
1448      return this.name != null && !this.name.isEmpty();
1449    }
1450
1451    /**
1452     * @param value {@link #name} (A free text natural language name describing the concept map.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1453     */
1454    public ConceptMap setNameElement(StringType value) { 
1455      this.name = value;
1456      return this;
1457    }
1458
1459    /**
1460     * @return A free text natural language name describing the concept map.
1461     */
1462    public String getName() { 
1463      return this.name == null ? null : this.name.getValue();
1464    }
1465
1466    /**
1467     * @param value A free text natural language name describing the concept map.
1468     */
1469    public ConceptMap setName(String value) { 
1470      if (Utilities.noString(value))
1471        this.name = null;
1472      else {
1473        if (this.name == null)
1474          this.name = new StringType();
1475        this.name.setValue(value);
1476      }
1477      return this;
1478    }
1479
1480    /**
1481     * @return {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1482     */
1483    public Enumeration<ConformanceResourceStatus> getStatusElement() { 
1484      if (this.status == null)
1485        if (Configuration.errorOnAutoCreate())
1486          throw new Error("Attempt to auto-create ConceptMap.status");
1487        else if (Configuration.doAutoCreate())
1488          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1489      return this.status;
1490    }
1491
1492    public boolean hasStatusElement() { 
1493      return this.status != null && !this.status.isEmpty();
1494    }
1495
1496    public boolean hasStatus() { 
1497      return this.status != null && !this.status.isEmpty();
1498    }
1499
1500    /**
1501     * @param value {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1502     */
1503    public ConceptMap setStatusElement(Enumeration<ConformanceResourceStatus> value) { 
1504      this.status = value;
1505      return this;
1506    }
1507
1508    /**
1509     * @return The status of the concept map.
1510     */
1511    public ConformanceResourceStatus getStatus() { 
1512      return this.status == null ? null : this.status.getValue();
1513    }
1514
1515    /**
1516     * @param value The status of the concept map.
1517     */
1518    public ConceptMap setStatus(ConformanceResourceStatus value) { 
1519        if (this.status == null)
1520          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1521        this.status.setValue(value);
1522      return this;
1523    }
1524
1525    /**
1526     * @return {@link #experimental} (This ConceptMap was 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
1527     */
1528    public BooleanType getExperimentalElement() { 
1529      if (this.experimental == null)
1530        if (Configuration.errorOnAutoCreate())
1531          throw new Error("Attempt to auto-create ConceptMap.experimental");
1532        else if (Configuration.doAutoCreate())
1533          this.experimental = new BooleanType(); // bb
1534      return this.experimental;
1535    }
1536
1537    public boolean hasExperimentalElement() { 
1538      return this.experimental != null && !this.experimental.isEmpty();
1539    }
1540
1541    public boolean hasExperimental() { 
1542      return this.experimental != null && !this.experimental.isEmpty();
1543    }
1544
1545    /**
1546     * @param value {@link #experimental} (This ConceptMap was 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
1547     */
1548    public ConceptMap setExperimentalElement(BooleanType value) { 
1549      this.experimental = value;
1550      return this;
1551    }
1552
1553    /**
1554     * @return This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1555     */
1556    public boolean getExperimental() { 
1557      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1558    }
1559
1560    /**
1561     * @param value This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1562     */
1563    public ConceptMap setExperimental(boolean value) { 
1564        if (this.experimental == null)
1565          this.experimental = new BooleanType();
1566        this.experimental.setValue(value);
1567      return this;
1568    }
1569
1570    /**
1571     * @return {@link #publisher} (The name of the individual or organization that published the concept map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1572     */
1573    public StringType getPublisherElement() { 
1574      if (this.publisher == null)
1575        if (Configuration.errorOnAutoCreate())
1576          throw new Error("Attempt to auto-create ConceptMap.publisher");
1577        else if (Configuration.doAutoCreate())
1578          this.publisher = new StringType(); // bb
1579      return this.publisher;
1580    }
1581
1582    public boolean hasPublisherElement() { 
1583      return this.publisher != null && !this.publisher.isEmpty();
1584    }
1585
1586    public boolean hasPublisher() { 
1587      return this.publisher != null && !this.publisher.isEmpty();
1588    }
1589
1590    /**
1591     * @param value {@link #publisher} (The name of the individual or organization that published the concept map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1592     */
1593    public ConceptMap setPublisherElement(StringType value) { 
1594      this.publisher = value;
1595      return this;
1596    }
1597
1598    /**
1599     * @return The name of the individual or organization that published the concept map.
1600     */
1601    public String getPublisher() { 
1602      return this.publisher == null ? null : this.publisher.getValue();
1603    }
1604
1605    /**
1606     * @param value The name of the individual or organization that published the concept map.
1607     */
1608    public ConceptMap setPublisher(String value) { 
1609      if (Utilities.noString(value))
1610        this.publisher = null;
1611      else {
1612        if (this.publisher == null)
1613          this.publisher = new StringType();
1614        this.publisher.setValue(value);
1615      }
1616      return this;
1617    }
1618
1619    /**
1620     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1621     */
1622    public List<ConceptMapContactComponent> getContact() { 
1623      if (this.contact == null)
1624        this.contact = new ArrayList<ConceptMapContactComponent>();
1625      return this.contact;
1626    }
1627
1628    public boolean hasContact() { 
1629      if (this.contact == null)
1630        return false;
1631      for (ConceptMapContactComponent item : this.contact)
1632        if (!item.isEmpty())
1633          return true;
1634      return false;
1635    }
1636
1637    /**
1638     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1639     */
1640    // syntactic sugar
1641    public ConceptMapContactComponent addContact() { //3
1642      ConceptMapContactComponent t = new ConceptMapContactComponent();
1643      if (this.contact == null)
1644        this.contact = new ArrayList<ConceptMapContactComponent>();
1645      this.contact.add(t);
1646      return t;
1647    }
1648
1649    // syntactic sugar
1650    public ConceptMap addContact(ConceptMapContactComponent t) { //3
1651      if (t == null)
1652        return this;
1653      if (this.contact == null)
1654        this.contact = new ArrayList<ConceptMapContactComponent>();
1655      this.contact.add(t);
1656      return this;
1657    }
1658
1659    /**
1660     * @return {@link #date} (The date this version of the concept map 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 concept map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1661     */
1662    public DateTimeType getDateElement() { 
1663      if (this.date == null)
1664        if (Configuration.errorOnAutoCreate())
1665          throw new Error("Attempt to auto-create ConceptMap.date");
1666        else if (Configuration.doAutoCreate())
1667          this.date = new DateTimeType(); // bb
1668      return this.date;
1669    }
1670
1671    public boolean hasDateElement() { 
1672      return this.date != null && !this.date.isEmpty();
1673    }
1674
1675    public boolean hasDate() { 
1676      return this.date != null && !this.date.isEmpty();
1677    }
1678
1679    /**
1680     * @param value {@link #date} (The date this version of the concept map 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 concept map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1681     */
1682    public ConceptMap setDateElement(DateTimeType value) { 
1683      this.date = value;
1684      return this;
1685    }
1686
1687    /**
1688     * @return The date this version of the concept map 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 concept map changes.
1689     */
1690    public Date getDate() { 
1691      return this.date == null ? null : this.date.getValue();
1692    }
1693
1694    /**
1695     * @param value The date this version of the concept map 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 concept map changes.
1696     */
1697    public ConceptMap setDate(Date value) { 
1698      if (value == null)
1699        this.date = null;
1700      else {
1701        if (this.date == null)
1702          this.date = new DateTimeType();
1703        this.date.setValue(value);
1704      }
1705      return this;
1706    }
1707
1708    /**
1709     * @return {@link #description} (A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1710     */
1711    public StringType getDescriptionElement() { 
1712      if (this.description == null)
1713        if (Configuration.errorOnAutoCreate())
1714          throw new Error("Attempt to auto-create ConceptMap.description");
1715        else if (Configuration.doAutoCreate())
1716          this.description = new StringType(); // bb
1717      return this.description;
1718    }
1719
1720    public boolean hasDescriptionElement() { 
1721      return this.description != null && !this.description.isEmpty();
1722    }
1723
1724    public boolean hasDescription() { 
1725      return this.description != null && !this.description.isEmpty();
1726    }
1727
1728    /**
1729     * @param value {@link #description} (A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1730     */
1731    public ConceptMap setDescriptionElement(StringType value) { 
1732      this.description = value;
1733      return this;
1734    }
1735
1736    /**
1737     * @return A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
1738     */
1739    public String getDescription() { 
1740      return this.description == null ? null : this.description.getValue();
1741    }
1742
1743    /**
1744     * @param value A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
1745     */
1746    public ConceptMap setDescription(String value) { 
1747      if (Utilities.noString(value))
1748        this.description = null;
1749      else {
1750        if (this.description == null)
1751          this.description = new StringType();
1752        this.description.setValue(value);
1753      }
1754      return this;
1755    }
1756
1757    /**
1758     * @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 concept map instances.)
1759     */
1760    public List<CodeableConcept> getUseContext() { 
1761      if (this.useContext == null)
1762        this.useContext = new ArrayList<CodeableConcept>();
1763      return this.useContext;
1764    }
1765
1766    public boolean hasUseContext() { 
1767      if (this.useContext == null)
1768        return false;
1769      for (CodeableConcept item : this.useContext)
1770        if (!item.isEmpty())
1771          return true;
1772      return false;
1773    }
1774
1775    /**
1776     * @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 concept map instances.)
1777     */
1778    // syntactic sugar
1779    public CodeableConcept addUseContext() { //3
1780      CodeableConcept t = new CodeableConcept();
1781      if (this.useContext == null)
1782        this.useContext = new ArrayList<CodeableConcept>();
1783      this.useContext.add(t);
1784      return t;
1785    }
1786
1787    // syntactic sugar
1788    public ConceptMap addUseContext(CodeableConcept t) { //3
1789      if (t == null)
1790        return this;
1791      if (this.useContext == null)
1792        this.useContext = new ArrayList<CodeableConcept>();
1793      this.useContext.add(t);
1794      return this;
1795    }
1796
1797    /**
1798     * @return {@link #requirements} (Explains why this concept map is needed and why it has been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1799     */
1800    public StringType getRequirementsElement() { 
1801      if (this.requirements == null)
1802        if (Configuration.errorOnAutoCreate())
1803          throw new Error("Attempt to auto-create ConceptMap.requirements");
1804        else if (Configuration.doAutoCreate())
1805          this.requirements = new StringType(); // bb
1806      return this.requirements;
1807    }
1808
1809    public boolean hasRequirementsElement() { 
1810      return this.requirements != null && !this.requirements.isEmpty();
1811    }
1812
1813    public boolean hasRequirements() { 
1814      return this.requirements != null && !this.requirements.isEmpty();
1815    }
1816
1817    /**
1818     * @param value {@link #requirements} (Explains why this concept map is needed and why it has been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1819     */
1820    public ConceptMap setRequirementsElement(StringType value) { 
1821      this.requirements = value;
1822      return this;
1823    }
1824
1825    /**
1826     * @return Explains why this concept map is needed and why it has been constrained as it has.
1827     */
1828    public String getRequirements() { 
1829      return this.requirements == null ? null : this.requirements.getValue();
1830    }
1831
1832    /**
1833     * @param value Explains why this concept map is needed and why it has been constrained as it has.
1834     */
1835    public ConceptMap setRequirements(String value) { 
1836      if (Utilities.noString(value))
1837        this.requirements = null;
1838      else {
1839        if (this.requirements == null)
1840          this.requirements = new StringType();
1841        this.requirements.setValue(value);
1842      }
1843      return this;
1844    }
1845
1846    /**
1847     * @return {@link #copyright} (A copyright statement relating to the concept map and/or its contents.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1848     */
1849    public StringType getCopyrightElement() { 
1850      if (this.copyright == null)
1851        if (Configuration.errorOnAutoCreate())
1852          throw new Error("Attempt to auto-create ConceptMap.copyright");
1853        else if (Configuration.doAutoCreate())
1854          this.copyright = new StringType(); // bb
1855      return this.copyright;
1856    }
1857
1858    public boolean hasCopyrightElement() { 
1859      return this.copyright != null && !this.copyright.isEmpty();
1860    }
1861
1862    public boolean hasCopyright() { 
1863      return this.copyright != null && !this.copyright.isEmpty();
1864    }
1865
1866    /**
1867     * @param value {@link #copyright} (A copyright statement relating to the concept map and/or its contents.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1868     */
1869    public ConceptMap setCopyrightElement(StringType value) { 
1870      this.copyright = value;
1871      return this;
1872    }
1873
1874    /**
1875     * @return A copyright statement relating to the concept map and/or its contents.
1876     */
1877    public String getCopyright() { 
1878      return this.copyright == null ? null : this.copyright.getValue();
1879    }
1880
1881    /**
1882     * @param value A copyright statement relating to the concept map and/or its contents.
1883     */
1884    public ConceptMap setCopyright(String value) { 
1885      if (Utilities.noString(value))
1886        this.copyright = null;
1887      else {
1888        if (this.copyright == null)
1889          this.copyright = new StringType();
1890        this.copyright.setValue(value);
1891      }
1892      return this;
1893    }
1894
1895    /**
1896     * @return {@link #source} (The source value set that specifies the concepts that are being mapped.)
1897     */
1898    public Type getSource() { 
1899      return this.source;
1900    }
1901
1902    /**
1903     * @return {@link #source} (The source value set that specifies the concepts that are being mapped.)
1904     */
1905    public UriType getSourceUriType() throws FHIRException { 
1906      if (!(this.source instanceof UriType))
1907        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.source.getClass().getName()+" was encountered");
1908      return (UriType) this.source;
1909    }
1910
1911    public boolean hasSourceUriType() { 
1912      return this.source instanceof UriType;
1913    }
1914
1915    /**
1916     * @return {@link #source} (The source value set that specifies the concepts that are being mapped.)
1917     */
1918    public Reference getSourceReference() throws FHIRException { 
1919      if (!(this.source instanceof Reference))
1920        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.source.getClass().getName()+" was encountered");
1921      return (Reference) this.source;
1922    }
1923
1924    public boolean hasSourceReference() { 
1925      return this.source instanceof Reference;
1926    }
1927
1928    public boolean hasSource() { 
1929      return this.source != null && !this.source.isEmpty();
1930    }
1931
1932    /**
1933     * @param value {@link #source} (The source value set that specifies the concepts that are being mapped.)
1934     */
1935    public ConceptMap setSource(Type value) { 
1936      this.source = value;
1937      return this;
1938    }
1939
1940    /**
1941     * @return {@link #target} (The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.)
1942     */
1943    public Type getTarget() { 
1944      return this.target;
1945    }
1946
1947    /**
1948     * @return {@link #target} (The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.)
1949     */
1950    public UriType getTargetUriType() throws FHIRException { 
1951      if (!(this.target instanceof UriType))
1952        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.target.getClass().getName()+" was encountered");
1953      return (UriType) this.target;
1954    }
1955
1956    public boolean hasTargetUriType() { 
1957      return this.target instanceof UriType;
1958    }
1959
1960    /**
1961     * @return {@link #target} (The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.)
1962     */
1963    public Reference getTargetReference() throws FHIRException { 
1964      if (!(this.target instanceof Reference))
1965        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.target.getClass().getName()+" was encountered");
1966      return (Reference) this.target;
1967    }
1968
1969    public boolean hasTargetReference() { 
1970      return this.target instanceof Reference;
1971    }
1972
1973    public boolean hasTarget() { 
1974      return this.target != null && !this.target.isEmpty();
1975    }
1976
1977    /**
1978     * @param value {@link #target} (The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.)
1979     */
1980    public ConceptMap setTarget(Type value) { 
1981      this.target = value;
1982      return this;
1983    }
1984
1985    /**
1986     * @return {@link #element} (Mappings for an individual concept in the source to one or more concepts in the target.)
1987     */
1988    public List<SourceElementComponent> getElement() { 
1989      if (this.element == null)
1990        this.element = new ArrayList<SourceElementComponent>();
1991      return this.element;
1992    }
1993
1994    public boolean hasElement() { 
1995      if (this.element == null)
1996        return false;
1997      for (SourceElementComponent item : this.element)
1998        if (!item.isEmpty())
1999          return true;
2000      return false;
2001    }
2002
2003    /**
2004     * @return {@link #element} (Mappings for an individual concept in the source to one or more concepts in the target.)
2005     */
2006    // syntactic sugar
2007    public SourceElementComponent addElement() { //3
2008      SourceElementComponent t = new SourceElementComponent();
2009      if (this.element == null)
2010        this.element = new ArrayList<SourceElementComponent>();
2011      this.element.add(t);
2012      return t;
2013    }
2014
2015    // syntactic sugar
2016    public ConceptMap addElement(SourceElementComponent t) { //3
2017      if (t == null)
2018        return this;
2019      if (this.element == null)
2020        this.element = new ArrayList<SourceElementComponent>();
2021      this.element.add(t);
2022      return this;
2023    }
2024
2025      protected void listChildren(List<Property> childrenList) {
2026        super.listChildren(childrenList);
2027        childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this concept map 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 concept map is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
2028        childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2029        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.", 0, java.lang.Integer.MAX_VALUE, version));
2030        childrenList.add(new Property("name", "string", "A free text natural language name describing the concept map.", 0, java.lang.Integer.MAX_VALUE, name));
2031        childrenList.add(new Property("status", "code", "The status of the concept map.", 0, java.lang.Integer.MAX_VALUE, status));
2032        childrenList.add(new Property("experimental", "boolean", "This ConceptMap was 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));
2033        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the concept map.", 0, java.lang.Integer.MAX_VALUE, publisher));
2034        childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
2035        childrenList.add(new Property("date", "dateTime", "The date this version of the concept map 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 concept map changes.", 0, java.lang.Integer.MAX_VALUE, date));
2036        childrenList.add(new Property("description", "string", "A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.", 0, java.lang.Integer.MAX_VALUE, description));
2037        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 concept map instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
2038        childrenList.add(new Property("requirements", "string", "Explains why this concept map is needed and why it has been constrained as it has.", 0, java.lang.Integer.MAX_VALUE, requirements));
2039        childrenList.add(new Property("copyright", "string", "A copyright statement relating to the concept map and/or its contents.", 0, java.lang.Integer.MAX_VALUE, copyright));
2040        childrenList.add(new Property("source[x]", "uri|Reference(ValueSet|StructureDefinition)", "The source value set that specifies the concepts that are being mapped.", 0, java.lang.Integer.MAX_VALUE, source));
2041        childrenList.add(new Property("target[x]", "uri|Reference(ValueSet|StructureDefinition)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, java.lang.Integer.MAX_VALUE, target));
2042        childrenList.add(new Property("element", "", "Mappings for an individual concept in the source to one or more concepts in the target.", 0, java.lang.Integer.MAX_VALUE, element));
2043      }
2044
2045      @Override
2046      public void setProperty(String name, Base value) throws FHIRException {
2047        if (name.equals("url"))
2048          this.url = castToUri(value); // UriType
2049        else if (name.equals("identifier"))
2050          this.identifier = castToIdentifier(value); // Identifier
2051        else if (name.equals("version"))
2052          this.version = castToString(value); // StringType
2053        else if (name.equals("name"))
2054          this.name = castToString(value); // StringType
2055        else if (name.equals("status"))
2056          this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
2057        else if (name.equals("experimental"))
2058          this.experimental = castToBoolean(value); // BooleanType
2059        else if (name.equals("publisher"))
2060          this.publisher = castToString(value); // StringType
2061        else if (name.equals("contact"))
2062          this.getContact().add((ConceptMapContactComponent) value);
2063        else if (name.equals("date"))
2064          this.date = castToDateTime(value); // DateTimeType
2065        else if (name.equals("description"))
2066          this.description = castToString(value); // StringType
2067        else if (name.equals("useContext"))
2068          this.getUseContext().add(castToCodeableConcept(value));
2069        else if (name.equals("requirements"))
2070          this.requirements = castToString(value); // StringType
2071        else if (name.equals("copyright"))
2072          this.copyright = castToString(value); // StringType
2073        else if (name.equals("source[x]"))
2074          this.source = (Type) value; // Type
2075        else if (name.equals("target[x]"))
2076          this.target = (Type) value; // Type
2077        else if (name.equals("element"))
2078          this.getElement().add((SourceElementComponent) value);
2079        else
2080          super.setProperty(name, value);
2081      }
2082
2083      @Override
2084      public Base addChild(String name) throws FHIRException {
2085        if (name.equals("url")) {
2086          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.url");
2087        }
2088        else if (name.equals("identifier")) {
2089          this.identifier = new Identifier();
2090          return this.identifier;
2091        }
2092        else if (name.equals("version")) {
2093          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.version");
2094        }
2095        else if (name.equals("name")) {
2096          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.name");
2097        }
2098        else if (name.equals("status")) {
2099          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.status");
2100        }
2101        else if (name.equals("experimental")) {
2102          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.experimental");
2103        }
2104        else if (name.equals("publisher")) {
2105          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.publisher");
2106        }
2107        else if (name.equals("contact")) {
2108          return addContact();
2109        }
2110        else if (name.equals("date")) {
2111          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.date");
2112        }
2113        else if (name.equals("description")) {
2114          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.description");
2115        }
2116        else if (name.equals("useContext")) {
2117          return addUseContext();
2118        }
2119        else if (name.equals("requirements")) {
2120          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.requirements");
2121        }
2122        else if (name.equals("copyright")) {
2123          throw new FHIRException("Cannot call addChild on a primitive type ConceptMap.copyright");
2124        }
2125        else if (name.equals("sourceUri")) {
2126          this.source = new UriType();
2127          return this.source;
2128        }
2129        else if (name.equals("sourceReference")) {
2130          this.source = new Reference();
2131          return this.source;
2132        }
2133        else if (name.equals("targetUri")) {
2134          this.target = new UriType();
2135          return this.target;
2136        }
2137        else if (name.equals("targetReference")) {
2138          this.target = new Reference();
2139          return this.target;
2140        }
2141        else if (name.equals("element")) {
2142          return addElement();
2143        }
2144        else
2145          return super.addChild(name);
2146      }
2147
2148  public String fhirType() {
2149    return "ConceptMap";
2150
2151  }
2152
2153      public ConceptMap copy() {
2154        ConceptMap dst = new ConceptMap();
2155        copyValues(dst);
2156        dst.url = url == null ? null : url.copy();
2157        dst.identifier = identifier == null ? null : identifier.copy();
2158        dst.version = version == null ? null : version.copy();
2159        dst.name = name == null ? null : name.copy();
2160        dst.status = status == null ? null : status.copy();
2161        dst.experimental = experimental == null ? null : experimental.copy();
2162        dst.publisher = publisher == null ? null : publisher.copy();
2163        if (contact != null) {
2164          dst.contact = new ArrayList<ConceptMapContactComponent>();
2165          for (ConceptMapContactComponent i : contact)
2166            dst.contact.add(i.copy());
2167        };
2168        dst.date = date == null ? null : date.copy();
2169        dst.description = description == null ? null : description.copy();
2170        if (useContext != null) {
2171          dst.useContext = new ArrayList<CodeableConcept>();
2172          for (CodeableConcept i : useContext)
2173            dst.useContext.add(i.copy());
2174        };
2175        dst.requirements = requirements == null ? null : requirements.copy();
2176        dst.copyright = copyright == null ? null : copyright.copy();
2177        dst.source = source == null ? null : source.copy();
2178        dst.target = target == null ? null : target.copy();
2179        if (element != null) {
2180          dst.element = new ArrayList<SourceElementComponent>();
2181          for (SourceElementComponent i : element)
2182            dst.element.add(i.copy());
2183        };
2184        return dst;
2185      }
2186
2187      protected ConceptMap typedCopy() {
2188        return copy();
2189      }
2190
2191      @Override
2192      public boolean equalsDeep(Base other) {
2193        if (!super.equalsDeep(other))
2194          return false;
2195        if (!(other instanceof ConceptMap))
2196          return false;
2197        ConceptMap o = (ConceptMap) other;
2198        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
2199           && compareDeep(name, o.name, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
2200           && compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
2201           && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
2202           && compareDeep(requirements, o.requirements, true) && compareDeep(copyright, o.copyright, true)
2203           && compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(element, o.element, true)
2204          ;
2205      }
2206
2207      @Override
2208      public boolean equalsShallow(Base other) {
2209        if (!super.equalsShallow(other))
2210          return false;
2211        if (!(other instanceof ConceptMap))
2212          return false;
2213        ConceptMap o = (ConceptMap) other;
2214        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
2215           && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true) && compareValues(publisher, o.publisher, true)
2216           && compareValues(date, o.date, true) && compareValues(description, o.description, true) && compareValues(requirements, o.requirements, true)
2217           && compareValues(copyright, o.copyright, true);
2218      }
2219
2220      public boolean isEmpty() {
2221        return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
2222           && (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (status == null || status.isEmpty())
2223           && (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
2224           && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty()) && (description == null || description.isEmpty())
2225           && (useContext == null || useContext.isEmpty()) && (requirements == null || requirements.isEmpty())
2226           && (copyright == null || copyright.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty())
2227           && (element == null || element.isEmpty());
2228      }
2229
2230  @Override
2231  public ResourceType getResourceType() {
2232    return ResourceType.ConceptMap;
2233   }
2234
2235  @SearchParamDefinition(name="date", path="ConceptMap.date", description="The concept map publication date", type="date" )
2236  public static final String SP_DATE = "date";
2237  @SearchParamDefinition(name="identifier", path="ConceptMap.identifier", description="Additional identifier for the concept map", type="token" )
2238  public static final String SP_IDENTIFIER = "identifier";
2239  @SearchParamDefinition(name="product", path="ConceptMap.element.target.product.element", description="Reference to element/field/ValueSet mapping depends on", type="uri" )
2240  public static final String SP_PRODUCT = "product";
2241  @SearchParamDefinition(name="dependson", path="ConceptMap.element.target.dependsOn.element", description="Reference to element/field/ValueSet mapping depends on", type="uri" )
2242  public static final String SP_DEPENDSON = "dependson";
2243  @SearchParamDefinition(name="description", path="ConceptMap.description", description="Text search in the description of the concept map", type="string" )
2244  public static final String SP_DESCRIPTION = "description";
2245  @SearchParamDefinition(name="targetsystem", path="ConceptMap.element.target.codeSystem", description="System of the target (if necessary)", type="uri" )
2246  public static final String SP_TARGETSYSTEM = "targetsystem";
2247  @SearchParamDefinition(name="source", path="ConceptMap.sourceReference", description="Identifies the source of the concepts which are being mapped", type="reference" )
2248  public static final String SP_SOURCE = "source";
2249  @SearchParamDefinition(name="version", path="ConceptMap.version", description="The version identifier of the concept map", type="token" )
2250  public static final String SP_VERSION = "version";
2251  @SearchParamDefinition(name="sourcesystem", path="ConceptMap.element.codeSystem", description="Code System (if value set crosses code systems)", type="uri" )
2252  public static final String SP_SOURCESYSTEM = "sourcesystem";
2253  @SearchParamDefinition(name="url", path="ConceptMap.url", description="The URL of the concept map", type="uri" )
2254  public static final String SP_URL = "url";
2255  @SearchParamDefinition(name="target", path="ConceptMap.target[x]", description="Provides context to the mappings", type="reference" )
2256  public static final String SP_TARGET = "target";
2257  @SearchParamDefinition(name="sourcecode", path="ConceptMap.element.code", description="Identifies element being mapped", type="token" )
2258  public static final String SP_SOURCECODE = "sourcecode";
2259  @SearchParamDefinition(name="sourceuri", path="ConceptMap.sourceUri", description="Identifies the source of the concepts which are being mapped", type="reference" )
2260  public static final String SP_SOURCEURI = "sourceuri";
2261  @SearchParamDefinition(name="name", path="ConceptMap.name", description="Name of the concept map", type="string" )
2262  public static final String SP_NAME = "name";
2263  @SearchParamDefinition(name="context", path="ConceptMap.useContext", description="A use context assigned to the concept map", type="token" )
2264  public static final String SP_CONTEXT = "context";
2265  @SearchParamDefinition(name="publisher", path="ConceptMap.publisher", description="Name of the publisher of the concept map", type="string" )
2266  public static final String SP_PUBLISHER = "publisher";
2267  @SearchParamDefinition(name="targetcode", path="ConceptMap.element.target.code", description="Code that identifies the target element", type="token" )
2268  public static final String SP_TARGETCODE = "targetcode";
2269  @SearchParamDefinition(name="status", path="ConceptMap.status", description="Status of the concept map", type="token" )
2270  public static final String SP_STATUS = "status";
2271
2272}
2273