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