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