001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
040import org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.ChildOrder;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049
050/**
051 * A curated namespace that issues unique symbols within that namespace for the
052 * identification of concepts, people, devices, etc. Represents a "System" used
053 * within the Identifier and Coding data types.
054 */
055@ResourceDef(name = "NamingSystem", profile = "http://hl7.org/fhir/StructureDefinition/NamingSystem")
056@ChildOrder(names = { "name", "status", "kind", "date", "publisher", "contact", "responsible", "type", "description",
057    "useContext", "jurisdiction", "usage", "uniqueId" })
058public class NamingSystem extends MetadataResource {
059
060  public enum NamingSystemType {
061    /**
062     * The naming system is used to define concepts and symbols to represent those
063     * concepts; e.g. UCUM, LOINC, NDC code, local lab codes, etc.
064     */
065    CODESYSTEM,
066    /**
067     * The naming system is used to manage identifiers (e.g. license numbers, order
068     * numbers, etc.).
069     */
070    IDENTIFIER,
071    /**
072     * The naming system is used as the root for other identifiers and naming
073     * systems.
074     */
075    ROOT,
076    /**
077     * added to help the parsers with the generic types
078     */
079    NULL;
080
081    public static NamingSystemType fromCode(String codeString) throws FHIRException {
082      if (codeString == null || "".equals(codeString))
083        return null;
084      if ("codesystem".equals(codeString))
085        return CODESYSTEM;
086      if ("identifier".equals(codeString))
087        return IDENTIFIER;
088      if ("root".equals(codeString))
089        return ROOT;
090      if (Configuration.isAcceptInvalidEnums())
091        return null;
092      else
093        throw new FHIRException("Unknown NamingSystemType code '" + codeString + "'");
094    }
095
096    public String toCode() {
097      switch (this) {
098      case CODESYSTEM:
099        return "codesystem";
100      case IDENTIFIER:
101        return "identifier";
102      case ROOT:
103        return "root";
104      case NULL:
105        return null;
106      default:
107        return "?";
108      }
109    }
110
111    public String getSystem() {
112      switch (this) {
113      case CODESYSTEM:
114        return "http://hl7.org/fhir/namingsystem-type";
115      case IDENTIFIER:
116        return "http://hl7.org/fhir/namingsystem-type";
117      case ROOT:
118        return "http://hl7.org/fhir/namingsystem-type";
119      case NULL:
120        return null;
121      default:
122        return "?";
123      }
124    }
125
126    public String getDefinition() {
127      switch (this) {
128      case CODESYSTEM:
129        return "The naming system is used to define concepts and symbols to represent those concepts; e.g. UCUM, LOINC, NDC code, local lab codes, etc.";
130      case IDENTIFIER:
131        return "The naming system is used to manage identifiers (e.g. license numbers, order numbers, etc.).";
132      case ROOT:
133        return "The naming system is used as the root for other identifiers and naming systems.";
134      case NULL:
135        return null;
136      default:
137        return "?";
138      }
139    }
140
141    public String getDisplay() {
142      switch (this) {
143      case CODESYSTEM:
144        return "Code System";
145      case IDENTIFIER:
146        return "Identifier";
147      case ROOT:
148        return "Root";
149      case NULL:
150        return null;
151      default:
152        return "?";
153      }
154    }
155  }
156
157  public static class NamingSystemTypeEnumFactory implements EnumFactory<NamingSystemType> {
158    public NamingSystemType fromCode(String codeString) throws IllegalArgumentException {
159      if (codeString == null || "".equals(codeString))
160        if (codeString == null || "".equals(codeString))
161          return null;
162      if ("codesystem".equals(codeString))
163        return NamingSystemType.CODESYSTEM;
164      if ("identifier".equals(codeString))
165        return NamingSystemType.IDENTIFIER;
166      if ("root".equals(codeString))
167        return NamingSystemType.ROOT;
168      throw new IllegalArgumentException("Unknown NamingSystemType code '" + codeString + "'");
169    }
170
171    public Enumeration<NamingSystemType> fromType(PrimitiveType<?> code) throws FHIRException {
172      if (code == null)
173        return null;
174      if (code.isEmpty())
175        return new Enumeration<NamingSystemType>(this, NamingSystemType.NULL, code);
176      String codeString = code.asStringValue();
177      if (codeString == null || "".equals(codeString))
178        return new Enumeration<NamingSystemType>(this, NamingSystemType.NULL, code);
179      if ("codesystem".equals(codeString))
180        return new Enumeration<NamingSystemType>(this, NamingSystemType.CODESYSTEM, code);
181      if ("identifier".equals(codeString))
182        return new Enumeration<NamingSystemType>(this, NamingSystemType.IDENTIFIER, code);
183      if ("root".equals(codeString))
184        return new Enumeration<NamingSystemType>(this, NamingSystemType.ROOT, code);
185      throw new FHIRException("Unknown NamingSystemType code '" + codeString + "'");
186    }
187
188    public String toCode(NamingSystemType code) {
189      if (code == NamingSystemType.CODESYSTEM)
190        return "codesystem";
191      if (code == NamingSystemType.IDENTIFIER)
192        return "identifier";
193      if (code == NamingSystemType.ROOT)
194        return "root";
195      return "?";
196    }
197
198    public String toSystem(NamingSystemType code) {
199      return code.getSystem();
200    }
201  }
202
203  public enum NamingSystemIdentifierType {
204    /**
205     * An ISO object identifier; e.g. 1.2.3.4.5.
206     */
207    OID,
208    /**
209     * A universally unique identifier of the form
210     * a5afddf4-e880-459b-876e-e4591b0acc11.
211     */
212    UUID,
213    /**
214     * A uniform resource identifier (ideally a URL - uniform resource locator);
215     * e.g. http://unitsofmeasure.org.
216     */
217    URI,
218    /**
219     * Some other type of unique identifier; e.g. HL7-assigned reserved string such
220     * as LN for LOINC.
221     */
222    OTHER,
223    /**
224     * added to help the parsers with the generic types
225     */
226    NULL;
227
228    public static NamingSystemIdentifierType fromCode(String codeString) throws FHIRException {
229      if (codeString == null || "".equals(codeString))
230        return null;
231      if ("oid".equals(codeString))
232        return OID;
233      if ("uuid".equals(codeString))
234        return UUID;
235      if ("uri".equals(codeString))
236        return URI;
237      if ("other".equals(codeString))
238        return OTHER;
239      if (Configuration.isAcceptInvalidEnums())
240        return null;
241      else
242        throw new FHIRException("Unknown NamingSystemIdentifierType code '" + codeString + "'");
243    }
244
245    public String toCode() {
246      switch (this) {
247      case OID:
248        return "oid";
249      case UUID:
250        return "uuid";
251      case URI:
252        return "uri";
253      case OTHER:
254        return "other";
255      case NULL:
256        return null;
257      default:
258        return "?";
259      }
260    }
261
262    public String getSystem() {
263      switch (this) {
264      case OID:
265        return "http://hl7.org/fhir/namingsystem-identifier-type";
266      case UUID:
267        return "http://hl7.org/fhir/namingsystem-identifier-type";
268      case URI:
269        return "http://hl7.org/fhir/namingsystem-identifier-type";
270      case OTHER:
271        return "http://hl7.org/fhir/namingsystem-identifier-type";
272      case NULL:
273        return null;
274      default:
275        return "?";
276      }
277    }
278
279    public String getDefinition() {
280      switch (this) {
281      case OID:
282        return "An ISO object identifier; e.g. 1.2.3.4.5.";
283      case UUID:
284        return "A universally unique identifier of the form a5afddf4-e880-459b-876e-e4591b0acc11.";
285      case URI:
286        return "A uniform resource identifier (ideally a URL - uniform resource locator); e.g. http://unitsofmeasure.org.";
287      case OTHER:
288        return "Some other type of unique identifier; e.g. HL7-assigned reserved string such as LN for LOINC.";
289      case NULL:
290        return null;
291      default:
292        return "?";
293      }
294    }
295
296    public String getDisplay() {
297      switch (this) {
298      case OID:
299        return "OID";
300      case UUID:
301        return "UUID";
302      case URI:
303        return "URI";
304      case OTHER:
305        return "Other";
306      case NULL:
307        return null;
308      default:
309        return "?";
310      }
311    }
312  }
313
314  public static class NamingSystemIdentifierTypeEnumFactory implements EnumFactory<NamingSystemIdentifierType> {
315    public NamingSystemIdentifierType fromCode(String codeString) throws IllegalArgumentException {
316      if (codeString == null || "".equals(codeString))
317        if (codeString == null || "".equals(codeString))
318          return null;
319      if ("oid".equals(codeString))
320        return NamingSystemIdentifierType.OID;
321      if ("uuid".equals(codeString))
322        return NamingSystemIdentifierType.UUID;
323      if ("uri".equals(codeString))
324        return NamingSystemIdentifierType.URI;
325      if ("other".equals(codeString))
326        return NamingSystemIdentifierType.OTHER;
327      throw new IllegalArgumentException("Unknown NamingSystemIdentifierType code '" + codeString + "'");
328    }
329
330    public Enumeration<NamingSystemIdentifierType> fromType(PrimitiveType<?> code) throws FHIRException {
331      if (code == null)
332        return null;
333      if (code.isEmpty())
334        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.NULL, code);
335      String codeString = code.asStringValue();
336      if (codeString == null || "".equals(codeString))
337        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.NULL, code);
338      if ("oid".equals(codeString))
339        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.OID, code);
340      if ("uuid".equals(codeString))
341        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.UUID, code);
342      if ("uri".equals(codeString))
343        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.URI, code);
344      if ("other".equals(codeString))
345        return new Enumeration<NamingSystemIdentifierType>(this, NamingSystemIdentifierType.OTHER, code);
346      throw new FHIRException("Unknown NamingSystemIdentifierType code '" + codeString + "'");
347    }
348
349    public String toCode(NamingSystemIdentifierType code) {
350      if (code == NamingSystemIdentifierType.OID)
351        return "oid";
352      if (code == NamingSystemIdentifierType.UUID)
353        return "uuid";
354      if (code == NamingSystemIdentifierType.URI)
355        return "uri";
356      if (code == NamingSystemIdentifierType.OTHER)
357        return "other";
358      return "?";
359    }
360
361    public String toSystem(NamingSystemIdentifierType code) {
362      return code.getSystem();
363    }
364  }
365
366  @Block()
367  public static class NamingSystemUniqueIdComponent extends BackboneElement implements IBaseBackboneElement {
368    /**
369     * Identifies the unique identifier scheme used for this particular identifier.
370     */
371    @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
372    @Description(shortDefinition = "oid | uuid | uri | other", formalDefinition = "Identifies the unique identifier scheme used for this particular identifier.")
373    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/namingsystem-identifier-type")
374    protected Enumeration<NamingSystemIdentifierType> type;
375
376    /**
377     * The string that should be sent over the wire to identify the code system or
378     * identifier system.
379     */
380    @Child(name = "value", type = { StringType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
381    @Description(shortDefinition = "The unique identifier", formalDefinition = "The string that should be sent over the wire to identify the code system or identifier system.")
382    protected StringType value;
383
384    /**
385     * Indicates whether this identifier is the "preferred" identifier of this type.
386     */
387    @Child(name = "preferred", type = {
388        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
389    @Description(shortDefinition = "Is this the id that should be used for this type", formalDefinition = "Indicates whether this identifier is the \"preferred\" identifier of this type.")
390    protected BooleanType preferred;
391
392    /**
393     * Notes about the past or intended usage of this identifier.
394     */
395    @Child(name = "comment", type = {
396        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
397    @Description(shortDefinition = "Notes about identifier usage", formalDefinition = "Notes about the past or intended usage of this identifier.")
398    protected StringType comment;
399
400    /**
401     * Identifies the period of time over which this identifier is considered
402     * appropriate to refer to the naming system. Outside of this window, the
403     * identifier might be non-deterministic.
404     */
405    @Child(name = "period", type = { Period.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
406    @Description(shortDefinition = "When is identifier valid?", formalDefinition = "Identifies the period of time over which this identifier is considered appropriate to refer to the naming system.  Outside of this window, the identifier might be non-deterministic.")
407    protected Period period;
408
409    private static final long serialVersionUID = -1458889328L;
410
411    /**
412     * Constructor
413     */
414    public NamingSystemUniqueIdComponent() {
415      super();
416    }
417
418    /**
419     * Constructor
420     */
421    public NamingSystemUniqueIdComponent(Enumeration<NamingSystemIdentifierType> type, StringType value) {
422      super();
423      this.type = type;
424      this.value = value;
425    }
426
427    /**
428     * @return {@link #type} (Identifies the unique identifier scheme used for this
429     *         particular identifier.). This is the underlying object with id, value
430     *         and extensions. The accessor "getType" gives direct access to the
431     *         value
432     */
433    public Enumeration<NamingSystemIdentifierType> getTypeElement() {
434      if (this.type == null)
435        if (Configuration.errorOnAutoCreate())
436          throw new Error("Attempt to auto-create NamingSystemUniqueIdComponent.type");
437        else if (Configuration.doAutoCreate())
438          this.type = new Enumeration<NamingSystemIdentifierType>(new NamingSystemIdentifierTypeEnumFactory()); // bb
439      return this.type;
440    }
441
442    public boolean hasTypeElement() {
443      return this.type != null && !this.type.isEmpty();
444    }
445
446    public boolean hasType() {
447      return this.type != null && !this.type.isEmpty();
448    }
449
450    /**
451     * @param value {@link #type} (Identifies the unique identifier scheme used for
452     *              this particular identifier.). This is the underlying object with
453     *              id, value and extensions. The accessor "getType" gives direct
454     *              access to the value
455     */
456    public NamingSystemUniqueIdComponent setTypeElement(Enumeration<NamingSystemIdentifierType> value) {
457      this.type = value;
458      return this;
459    }
460
461    /**
462     * @return Identifies the unique identifier scheme used for this particular
463     *         identifier.
464     */
465    public NamingSystemIdentifierType getType() {
466      return this.type == null ? null : this.type.getValue();
467    }
468
469    /**
470     * @param value Identifies the unique identifier scheme used for this particular
471     *              identifier.
472     */
473    public NamingSystemUniqueIdComponent setType(NamingSystemIdentifierType value) {
474      if (this.type == null)
475        this.type = new Enumeration<NamingSystemIdentifierType>(new NamingSystemIdentifierTypeEnumFactory());
476      this.type.setValue(value);
477      return this;
478    }
479
480    /**
481     * @return {@link #value} (The string that should be sent over the wire to
482     *         identify the code system or identifier system.). This is the
483     *         underlying object with id, value and extensions. The accessor
484     *         "getValue" gives direct access to the value
485     */
486    public StringType getValueElement() {
487      if (this.value == null)
488        if (Configuration.errorOnAutoCreate())
489          throw new Error("Attempt to auto-create NamingSystemUniqueIdComponent.value");
490        else if (Configuration.doAutoCreate())
491          this.value = new StringType(); // bb
492      return this.value;
493    }
494
495    public boolean hasValueElement() {
496      return this.value != null && !this.value.isEmpty();
497    }
498
499    public boolean hasValue() {
500      return this.value != null && !this.value.isEmpty();
501    }
502
503    /**
504     * @param value {@link #value} (The string that should be sent over the wire to
505     *              identify the code system or identifier system.). This is the
506     *              underlying object with id, value and extensions. The accessor
507     *              "getValue" gives direct access to the value
508     */
509    public NamingSystemUniqueIdComponent setValueElement(StringType value) {
510      this.value = value;
511      return this;
512    }
513
514    /**
515     * @return The string that should be sent over the wire to identify the code
516     *         system or identifier system.
517     */
518    public String getValue() {
519      return this.value == null ? null : this.value.getValue();
520    }
521
522    /**
523     * @param value The string that should be sent over the wire to identify the
524     *              code system or identifier system.
525     */
526    public NamingSystemUniqueIdComponent setValue(String value) {
527      if (this.value == null)
528        this.value = new StringType();
529      this.value.setValue(value);
530      return this;
531    }
532
533    /**
534     * @return {@link #preferred} (Indicates whether this identifier is the
535     *         "preferred" identifier of this type.). This is the underlying object
536     *         with id, value and extensions. The accessor "getPreferred" gives
537     *         direct access to the value
538     */
539    public BooleanType getPreferredElement() {
540      if (this.preferred == null)
541        if (Configuration.errorOnAutoCreate())
542          throw new Error("Attempt to auto-create NamingSystemUniqueIdComponent.preferred");
543        else if (Configuration.doAutoCreate())
544          this.preferred = new BooleanType(); // bb
545      return this.preferred;
546    }
547
548    public boolean hasPreferredElement() {
549      return this.preferred != null && !this.preferred.isEmpty();
550    }
551
552    public boolean hasPreferred() {
553      return this.preferred != null && !this.preferred.isEmpty();
554    }
555
556    /**
557     * @param value {@link #preferred} (Indicates whether this identifier is the
558     *              "preferred" identifier of this type.). This is the underlying
559     *              object with id, value and extensions. The accessor
560     *              "getPreferred" gives direct access to the value
561     */
562    public NamingSystemUniqueIdComponent setPreferredElement(BooleanType value) {
563      this.preferred = value;
564      return this;
565    }
566
567    /**
568     * @return Indicates whether this identifier is the "preferred" identifier of
569     *         this type.
570     */
571    public boolean getPreferred() {
572      return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue();
573    }
574
575    /**
576     * @param value Indicates whether this identifier is the "preferred" identifier
577     *              of this type.
578     */
579    public NamingSystemUniqueIdComponent setPreferred(boolean value) {
580      if (this.preferred == null)
581        this.preferred = new BooleanType();
582      this.preferred.setValue(value);
583      return this;
584    }
585
586    /**
587     * @return {@link #comment} (Notes about the past or intended usage of this
588     *         identifier.). This is the underlying object with id, value and
589     *         extensions. The accessor "getComment" gives direct access to the
590     *         value
591     */
592    public StringType getCommentElement() {
593      if (this.comment == null)
594        if (Configuration.errorOnAutoCreate())
595          throw new Error("Attempt to auto-create NamingSystemUniqueIdComponent.comment");
596        else if (Configuration.doAutoCreate())
597          this.comment = new StringType(); // bb
598      return this.comment;
599    }
600
601    public boolean hasCommentElement() {
602      return this.comment != null && !this.comment.isEmpty();
603    }
604
605    public boolean hasComment() {
606      return this.comment != null && !this.comment.isEmpty();
607    }
608
609    /**
610     * @param value {@link #comment} (Notes about the past or intended usage of this
611     *              identifier.). This is the underlying object with id, value and
612     *              extensions. The accessor "getComment" gives direct access to the
613     *              value
614     */
615    public NamingSystemUniqueIdComponent setCommentElement(StringType value) {
616      this.comment = value;
617      return this;
618    }
619
620    /**
621     * @return Notes about the past or intended usage of this identifier.
622     */
623    public String getComment() {
624      return this.comment == null ? null : this.comment.getValue();
625    }
626
627    /**
628     * @param value Notes about the past or intended usage of this identifier.
629     */
630    public NamingSystemUniqueIdComponent setComment(String value) {
631      if (Utilities.noString(value))
632        this.comment = null;
633      else {
634        if (this.comment == null)
635          this.comment = new StringType();
636        this.comment.setValue(value);
637      }
638      return this;
639    }
640
641    /**
642     * @return {@link #period} (Identifies the period of time over which this
643     *         identifier is considered appropriate to refer to the naming system.
644     *         Outside of this window, the identifier might be non-deterministic.)
645     */
646    public Period getPeriod() {
647      if (this.period == null)
648        if (Configuration.errorOnAutoCreate())
649          throw new Error("Attempt to auto-create NamingSystemUniqueIdComponent.period");
650        else if (Configuration.doAutoCreate())
651          this.period = new Period(); // cc
652      return this.period;
653    }
654
655    public boolean hasPeriod() {
656      return this.period != null && !this.period.isEmpty();
657    }
658
659    /**
660     * @param value {@link #period} (Identifies the period of time over which this
661     *              identifier is considered appropriate to refer to the naming
662     *              system. Outside of this window, the identifier might be
663     *              non-deterministic.)
664     */
665    public NamingSystemUniqueIdComponent setPeriod(Period value) {
666      this.period = value;
667      return this;
668    }
669
670    protected void listChildren(List<Property> children) {
671      super.listChildren(children);
672      children.add(new Property("type", "code",
673          "Identifies the unique identifier scheme used for this particular identifier.", 0, 1, type));
674      children.add(new Property("value", "string",
675          "The string that should be sent over the wire to identify the code system or identifier system.", 0, 1,
676          value));
677      children.add(new Property("preferred", "boolean",
678          "Indicates whether this identifier is the \"preferred\" identifier of this type.", 0, 1, preferred));
679      children.add(new Property("comment", "string", "Notes about the past or intended usage of this identifier.", 0, 1,
680          comment));
681      children.add(new Property("period", "Period",
682          "Identifies the period of time over which this identifier is considered appropriate to refer to the naming system.  Outside of this window, the identifier might be non-deterministic.",
683          0, 1, period));
684    }
685
686    @Override
687    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
688      switch (_hash) {
689      case 3575610:
690        /* type */ return new Property("type", "code",
691            "Identifies the unique identifier scheme used for this particular identifier.", 0, 1, type);
692      case 111972721:
693        /* value */ return new Property("value", "string",
694            "The string that should be sent over the wire to identify the code system or identifier system.", 0, 1,
695            value);
696      case -1294005119:
697        /* preferred */ return new Property("preferred", "boolean",
698            "Indicates whether this identifier is the \"preferred\" identifier of this type.", 0, 1, preferred);
699      case 950398559:
700        /* comment */ return new Property("comment", "string",
701            "Notes about the past or intended usage of this identifier.", 0, 1, comment);
702      case -991726143:
703        /* period */ return new Property("period", "Period",
704            "Identifies the period of time over which this identifier is considered appropriate to refer to the naming system.  Outside of this window, the identifier might be non-deterministic.",
705            0, 1, period);
706      default:
707        return super.getNamedProperty(_hash, _name, _checkValid);
708      }
709
710    }
711
712    @Override
713    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
714      switch (hash) {
715      case 3575610:
716        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<NamingSystemIdentifierType>
717      case 111972721:
718        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // StringType
719      case -1294005119:
720        /* preferred */ return this.preferred == null ? new Base[0] : new Base[] { this.preferred }; // BooleanType
721      case 950398559:
722        /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
723      case -991726143:
724        /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
725      default:
726        return super.getProperty(hash, name, checkValid);
727      }
728
729    }
730
731    @Override
732    public Base setProperty(int hash, String name, Base value) throws FHIRException {
733      switch (hash) {
734      case 3575610: // type
735        value = new NamingSystemIdentifierTypeEnumFactory().fromType(castToCode(value));
736        this.type = (Enumeration) value; // Enumeration<NamingSystemIdentifierType>
737        return value;
738      case 111972721: // value
739        this.value = castToString(value); // StringType
740        return value;
741      case -1294005119: // preferred
742        this.preferred = castToBoolean(value); // BooleanType
743        return value;
744      case 950398559: // comment
745        this.comment = castToString(value); // StringType
746        return value;
747      case -991726143: // period
748        this.period = castToPeriod(value); // Period
749        return value;
750      default:
751        return super.setProperty(hash, name, value);
752      }
753
754    }
755
756    @Override
757    public Base setProperty(String name, Base value) throws FHIRException {
758      if (name.equals("type")) {
759        value = new NamingSystemIdentifierTypeEnumFactory().fromType(castToCode(value));
760        this.type = (Enumeration) value; // Enumeration<NamingSystemIdentifierType>
761      } else if (name.equals("value")) {
762        this.value = castToString(value); // StringType
763      } else if (name.equals("preferred")) {
764        this.preferred = castToBoolean(value); // BooleanType
765      } else if (name.equals("comment")) {
766        this.comment = castToString(value); // StringType
767      } else if (name.equals("period")) {
768        this.period = castToPeriod(value); // Period
769      } else
770        return super.setProperty(name, value);
771      return value;
772    }
773
774    @Override
775    public Base makeProperty(int hash, String name) throws FHIRException {
776      switch (hash) {
777      case 3575610:
778        return getTypeElement();
779      case 111972721:
780        return getValueElement();
781      case -1294005119:
782        return getPreferredElement();
783      case 950398559:
784        return getCommentElement();
785      case -991726143:
786        return getPeriod();
787      default:
788        return super.makeProperty(hash, name);
789      }
790
791    }
792
793    @Override
794    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
795      switch (hash) {
796      case 3575610:
797        /* type */ return new String[] { "code" };
798      case 111972721:
799        /* value */ return new String[] { "string" };
800      case -1294005119:
801        /* preferred */ return new String[] { "boolean" };
802      case 950398559:
803        /* comment */ return new String[] { "string" };
804      case -991726143:
805        /* period */ return new String[] { "Period" };
806      default:
807        return super.getTypesForProperty(hash, name);
808      }
809
810    }
811
812    @Override
813    public Base addChild(String name) throws FHIRException {
814      if (name.equals("type")) {
815        throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.type");
816      } else if (name.equals("value")) {
817        throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.value");
818      } else if (name.equals("preferred")) {
819        throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.preferred");
820      } else if (name.equals("comment")) {
821        throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.comment");
822      } else if (name.equals("period")) {
823        this.period = new Period();
824        return this.period;
825      } else
826        return super.addChild(name);
827    }
828
829    public NamingSystemUniqueIdComponent copy() {
830      NamingSystemUniqueIdComponent dst = new NamingSystemUniqueIdComponent();
831      copyValues(dst);
832      return dst;
833    }
834
835    public void copyValues(NamingSystemUniqueIdComponent dst) {
836      super.copyValues(dst);
837      dst.type = type == null ? null : type.copy();
838      dst.value = value == null ? null : value.copy();
839      dst.preferred = preferred == null ? null : preferred.copy();
840      dst.comment = comment == null ? null : comment.copy();
841      dst.period = period == null ? null : period.copy();
842    }
843
844    @Override
845    public boolean equalsDeep(Base other_) {
846      if (!super.equalsDeep(other_))
847        return false;
848      if (!(other_ instanceof NamingSystemUniqueIdComponent))
849        return false;
850      NamingSystemUniqueIdComponent o = (NamingSystemUniqueIdComponent) other_;
851      return compareDeep(type, o.type, true) && compareDeep(value, o.value, true)
852          && compareDeep(preferred, o.preferred, true) && compareDeep(comment, o.comment, true)
853          && compareDeep(period, o.period, true);
854    }
855
856    @Override
857    public boolean equalsShallow(Base other_) {
858      if (!super.equalsShallow(other_))
859        return false;
860      if (!(other_ instanceof NamingSystemUniqueIdComponent))
861        return false;
862      NamingSystemUniqueIdComponent o = (NamingSystemUniqueIdComponent) other_;
863      return compareValues(type, o.type, true) && compareValues(value, o.value, true)
864          && compareValues(preferred, o.preferred, true) && compareValues(comment, o.comment, true);
865    }
866
867    public boolean isEmpty() {
868      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value, preferred, comment, period);
869    }
870
871    public String fhirType() {
872      return "NamingSystem.uniqueId";
873
874    }
875
876  }
877
878  /**
879   * Indicates the purpose for the naming system - what kinds of things does it
880   * make unique?
881   */
882  @Child(name = "kind", type = { CodeType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
883  @Description(shortDefinition = "codesystem | identifier | root", formalDefinition = "Indicates the purpose for the naming system - what kinds of things does it make unique?")
884  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/namingsystem-type")
885  protected Enumeration<NamingSystemType> kind;
886
887  /**
888   * The name of the organization that is responsible for issuing identifiers or
889   * codes for this namespace and ensuring their non-collision.
890   */
891  @Child(name = "responsible", type = {
892      StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
893  @Description(shortDefinition = "Who maintains system namespace?", formalDefinition = "The name of the organization that is responsible for issuing identifiers or codes for this namespace and ensuring their non-collision.")
894  protected StringType responsible;
895
896  /**
897   * Categorizes a naming system for easier search by grouping related naming
898   * systems.
899   */
900  @Child(name = "type", type = {
901      CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
902  @Description(shortDefinition = "e.g. driver,  provider,  patient, bank etc.", formalDefinition = "Categorizes a naming system for easier search by grouping related naming systems.")
903  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/identifier-type")
904  protected CodeableConcept type;
905
906  /**
907   * Provides guidance on the use of the namespace, including the handling of
908   * formatting characters, use of upper vs. lower case, etc.
909   */
910  @Child(name = "usage", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
911  @Description(shortDefinition = "How/where is it used", formalDefinition = "Provides guidance on the use of the namespace, including the handling of formatting characters, use of upper vs. lower case, etc.")
912  protected StringType usage;
913
914  /**
915   * Indicates how the system may be identified when referenced in electronic
916   * exchange.
917   */
918  @Child(name = "uniqueId", type = {}, order = 4, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
919  @Description(shortDefinition = "Unique identifiers used for system", formalDefinition = "Indicates how the system may be identified when referenced in electronic exchange.")
920  protected List<NamingSystemUniqueIdComponent> uniqueId;
921
922  private static final long serialVersionUID = 1686086580L;
923
924  /**
925   * Constructor
926   */
927  public NamingSystem() {
928    super();
929  }
930
931  /**
932   * Constructor
933   */
934  public NamingSystem(StringType name, Enumeration<PublicationStatus> status, Enumeration<NamingSystemType> kind,
935      DateTimeType date) {
936    super();
937    this.name = name;
938    this.status = status;
939    this.kind = kind;
940    this.date = date;
941  }
942
943  /**
944   * @return {@link #name} (A natural language name identifying the naming system.
945   *         This name should be usable as an identifier for the module by machine
946   *         processing applications such as code generation.). This is the
947   *         underlying object with id, value and extensions. The accessor
948   *         "getName" gives direct access to the value
949   */
950  public StringType getNameElement() {
951    if (this.name == null)
952      if (Configuration.errorOnAutoCreate())
953        throw new Error("Attempt to auto-create NamingSystem.name");
954      else if (Configuration.doAutoCreate())
955        this.name = new StringType(); // bb
956    return this.name;
957  }
958
959  public boolean hasNameElement() {
960    return this.name != null && !this.name.isEmpty();
961  }
962
963  public boolean hasName() {
964    return this.name != null && !this.name.isEmpty();
965  }
966
967  /**
968   * @param value {@link #name} (A natural language name identifying the naming
969   *              system. This name should be usable as an identifier for the
970   *              module by machine processing applications such as code
971   *              generation.). This is the underlying object with id, value and
972   *              extensions. The accessor "getName" gives direct access to the
973   *              value
974   */
975  public NamingSystem setNameElement(StringType value) {
976    this.name = value;
977    return this;
978  }
979
980  /**
981   * @return A natural language name identifying the naming system. This name
982   *         should be usable as an identifier for the module by machine
983   *         processing applications such as code generation.
984   */
985  public String getName() {
986    return this.name == null ? null : this.name.getValue();
987  }
988
989  /**
990   * @param value A natural language name identifying the naming system. This name
991   *              should be usable as an identifier for the module by machine
992   *              processing applications such as code generation.
993   */
994  public NamingSystem setName(String value) {
995    if (this.name == null)
996      this.name = new StringType();
997    this.name.setValue(value);
998    return this;
999  }
1000
1001  /**
1002   * @return {@link #status} (The status of this naming system. Enables tracking
1003   *         the life-cycle of the content.). This is the underlying object with
1004   *         id, value and extensions. The accessor "getStatus" gives direct
1005   *         access to the value
1006   */
1007  public Enumeration<PublicationStatus> getStatusElement() {
1008    if (this.status == null)
1009      if (Configuration.errorOnAutoCreate())
1010        throw new Error("Attempt to auto-create NamingSystem.status");
1011      else if (Configuration.doAutoCreate())
1012        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
1013    return this.status;
1014  }
1015
1016  public boolean hasStatusElement() {
1017    return this.status != null && !this.status.isEmpty();
1018  }
1019
1020  public boolean hasStatus() {
1021    return this.status != null && !this.status.isEmpty();
1022  }
1023
1024  /**
1025   * @param value {@link #status} (The status of this naming system. Enables
1026   *              tracking the life-cycle of the content.). This is the underlying
1027   *              object with id, value and extensions. The accessor "getStatus"
1028   *              gives direct access to the value
1029   */
1030  public NamingSystem setStatusElement(Enumeration<PublicationStatus> value) {
1031    this.status = value;
1032    return this;
1033  }
1034
1035  /**
1036   * @return The status of this naming system. Enables tracking the life-cycle of
1037   *         the content.
1038   */
1039  public PublicationStatus getStatus() {
1040    return this.status == null ? null : this.status.getValue();
1041  }
1042
1043  /**
1044   * @param value The status of this naming system. Enables tracking the
1045   *              life-cycle of the content.
1046   */
1047  public NamingSystem setStatus(PublicationStatus value) {
1048    if (this.status == null)
1049      this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
1050    this.status.setValue(value);
1051    return this;
1052  }
1053
1054  /**
1055   * @return {@link #kind} (Indicates the purpose for the naming system - what
1056   *         kinds of things does it make unique?). This is the underlying object
1057   *         with id, value and extensions. The accessor "getKind" gives direct
1058   *         access to the value
1059   */
1060  public Enumeration<NamingSystemType> getKindElement() {
1061    if (this.kind == null)
1062      if (Configuration.errorOnAutoCreate())
1063        throw new Error("Attempt to auto-create NamingSystem.kind");
1064      else if (Configuration.doAutoCreate())
1065        this.kind = new Enumeration<NamingSystemType>(new NamingSystemTypeEnumFactory()); // bb
1066    return this.kind;
1067  }
1068
1069  public boolean hasKindElement() {
1070    return this.kind != null && !this.kind.isEmpty();
1071  }
1072
1073  public boolean hasKind() {
1074    return this.kind != null && !this.kind.isEmpty();
1075  }
1076
1077  /**
1078   * @param value {@link #kind} (Indicates the purpose for the naming system -
1079   *              what kinds of things does it make unique?). This is the
1080   *              underlying object with id, value and extensions. The accessor
1081   *              "getKind" gives direct access to the value
1082   */
1083  public NamingSystem setKindElement(Enumeration<NamingSystemType> value) {
1084    this.kind = value;
1085    return this;
1086  }
1087
1088  /**
1089   * @return Indicates the purpose for the naming system - what kinds of things
1090   *         does it make unique?
1091   */
1092  public NamingSystemType getKind() {
1093    return this.kind == null ? null : this.kind.getValue();
1094  }
1095
1096  /**
1097   * @param value Indicates the purpose for the naming system - what kinds of
1098   *              things does it make unique?
1099   */
1100  public NamingSystem setKind(NamingSystemType value) {
1101    if (this.kind == null)
1102      this.kind = new Enumeration<NamingSystemType>(new NamingSystemTypeEnumFactory());
1103    this.kind.setValue(value);
1104    return this;
1105  }
1106
1107  /**
1108   * @return {@link #date} (The date (and optionally time) when the naming system
1109   *         was published. The date must change when the business version changes
1110   *         and it must change if the status code changes. In addition, it should
1111   *         change when the substantive content of the naming system changes.).
1112   *         This is the underlying object with id, value and extensions. The
1113   *         accessor "getDate" gives direct access to the value
1114   */
1115  public DateTimeType getDateElement() {
1116    if (this.date == null)
1117      if (Configuration.errorOnAutoCreate())
1118        throw new Error("Attempt to auto-create NamingSystem.date");
1119      else if (Configuration.doAutoCreate())
1120        this.date = new DateTimeType(); // bb
1121    return this.date;
1122  }
1123
1124  public boolean hasDateElement() {
1125    return this.date != null && !this.date.isEmpty();
1126  }
1127
1128  public boolean hasDate() {
1129    return this.date != null && !this.date.isEmpty();
1130  }
1131
1132  /**
1133   * @param value {@link #date} (The date (and optionally time) when the naming
1134   *              system was published. The date must change when the business
1135   *              version changes and it must change if the status code changes.
1136   *              In addition, it should change when the substantive content of
1137   *              the naming system changes.). This is the underlying object with
1138   *              id, value and extensions. The accessor "getDate" gives direct
1139   *              access to the value
1140   */
1141  public NamingSystem setDateElement(DateTimeType value) {
1142    this.date = value;
1143    return this;
1144  }
1145
1146  /**
1147   * @return The date (and optionally time) when the naming system was published.
1148   *         The date must change when the business version changes and it must
1149   *         change if the status code changes. In addition, it should change when
1150   *         the substantive content of the naming system changes.
1151   */
1152  public Date getDate() {
1153    return this.date == null ? null : this.date.getValue();
1154  }
1155
1156  /**
1157   * @param value The date (and optionally time) when the naming system was
1158   *              published. The date must change when the business version
1159   *              changes and it must change if the status code changes. In
1160   *              addition, it should change when the substantive content of the
1161   *              naming system changes.
1162   */
1163  public NamingSystem setDate(Date value) {
1164    if (this.date == null)
1165      this.date = new DateTimeType();
1166    this.date.setValue(value);
1167    return this;
1168  }
1169
1170  /**
1171   * @return {@link #publisher} (The name of the organization or individual that
1172   *         published the naming system.). This is the underlying object with id,
1173   *         value and extensions. The accessor "getPublisher" gives direct access
1174   *         to the value
1175   */
1176  public StringType getPublisherElement() {
1177    if (this.publisher == null)
1178      if (Configuration.errorOnAutoCreate())
1179        throw new Error("Attempt to auto-create NamingSystem.publisher");
1180      else if (Configuration.doAutoCreate())
1181        this.publisher = new StringType(); // bb
1182    return this.publisher;
1183  }
1184
1185  public boolean hasPublisherElement() {
1186    return this.publisher != null && !this.publisher.isEmpty();
1187  }
1188
1189  public boolean hasPublisher() {
1190    return this.publisher != null && !this.publisher.isEmpty();
1191  }
1192
1193  /**
1194   * @param value {@link #publisher} (The name of the organization or individual
1195   *              that published the naming system.). This is the underlying
1196   *              object with id, value and extensions. The accessor
1197   *              "getPublisher" gives direct access to the value
1198   */
1199  public NamingSystem setPublisherElement(StringType value) {
1200    this.publisher = value;
1201    return this;
1202  }
1203
1204  /**
1205   * @return The name of the organization or individual that published the naming
1206   *         system.
1207   */
1208  public String getPublisher() {
1209    return this.publisher == null ? null : this.publisher.getValue();
1210  }
1211
1212  /**
1213   * @param value The name of the organization or individual that published the
1214   *              naming system.
1215   */
1216  public NamingSystem setPublisher(String value) {
1217    if (Utilities.noString(value))
1218      this.publisher = null;
1219    else {
1220      if (this.publisher == null)
1221        this.publisher = new StringType();
1222      this.publisher.setValue(value);
1223    }
1224    return this;
1225  }
1226
1227  /**
1228   * @return {@link #contact} (Contact details to assist a user in finding and
1229   *         communicating with the publisher.)
1230   */
1231  public List<ContactDetail> getContact() {
1232    if (this.contact == null)
1233      this.contact = new ArrayList<ContactDetail>();
1234    return this.contact;
1235  }
1236
1237  /**
1238   * @return Returns a reference to <code>this</code> for easy method chaining
1239   */
1240  public NamingSystem setContact(List<ContactDetail> theContact) {
1241    this.contact = theContact;
1242    return this;
1243  }
1244
1245  public boolean hasContact() {
1246    if (this.contact == null)
1247      return false;
1248    for (ContactDetail item : this.contact)
1249      if (!item.isEmpty())
1250        return true;
1251    return false;
1252  }
1253
1254  public ContactDetail addContact() { // 3
1255    ContactDetail t = new ContactDetail();
1256    if (this.contact == null)
1257      this.contact = new ArrayList<ContactDetail>();
1258    this.contact.add(t);
1259    return t;
1260  }
1261
1262  public NamingSystem addContact(ContactDetail t) { // 3
1263    if (t == null)
1264      return this;
1265    if (this.contact == null)
1266      this.contact = new ArrayList<ContactDetail>();
1267    this.contact.add(t);
1268    return this;
1269  }
1270
1271  /**
1272   * @return The first repetition of repeating field {@link #contact}, creating it
1273   *         if it does not already exist
1274   */
1275  public ContactDetail getContactFirstRep() {
1276    if (getContact().isEmpty()) {
1277      addContact();
1278    }
1279    return getContact().get(0);
1280  }
1281
1282  /**
1283   * @return {@link #responsible} (The name of the organization that is
1284   *         responsible for issuing identifiers or codes for this namespace and
1285   *         ensuring their non-collision.). This is the underlying object with
1286   *         id, value and extensions. The accessor "getResponsible" gives direct
1287   *         access to the value
1288   */
1289  public StringType getResponsibleElement() {
1290    if (this.responsible == null)
1291      if (Configuration.errorOnAutoCreate())
1292        throw new Error("Attempt to auto-create NamingSystem.responsible");
1293      else if (Configuration.doAutoCreate())
1294        this.responsible = new StringType(); // bb
1295    return this.responsible;
1296  }
1297
1298  public boolean hasResponsibleElement() {
1299    return this.responsible != null && !this.responsible.isEmpty();
1300  }
1301
1302  public boolean hasResponsible() {
1303    return this.responsible != null && !this.responsible.isEmpty();
1304  }
1305
1306  /**
1307   * @param value {@link #responsible} (The name of the organization that is
1308   *              responsible for issuing identifiers or codes for this namespace
1309   *              and ensuring their non-collision.). This is the underlying
1310   *              object with id, value and extensions. The accessor
1311   *              "getResponsible" gives direct access to the value
1312   */
1313  public NamingSystem setResponsibleElement(StringType value) {
1314    this.responsible = value;
1315    return this;
1316  }
1317
1318  /**
1319   * @return The name of the organization that is responsible for issuing
1320   *         identifiers or codes for this namespace and ensuring their
1321   *         non-collision.
1322   */
1323  public String getResponsible() {
1324    return this.responsible == null ? null : this.responsible.getValue();
1325  }
1326
1327  /**
1328   * @param value The name of the organization that is responsible for issuing
1329   *              identifiers or codes for this namespace and ensuring their
1330   *              non-collision.
1331   */
1332  public NamingSystem setResponsible(String value) {
1333    if (Utilities.noString(value))
1334      this.responsible = null;
1335    else {
1336      if (this.responsible == null)
1337        this.responsible = new StringType();
1338      this.responsible.setValue(value);
1339    }
1340    return this;
1341  }
1342
1343  /**
1344   * @return {@link #type} (Categorizes a naming system for easier search by
1345   *         grouping related naming systems.)
1346   */
1347  public CodeableConcept getType() {
1348    if (this.type == null)
1349      if (Configuration.errorOnAutoCreate())
1350        throw new Error("Attempt to auto-create NamingSystem.type");
1351      else if (Configuration.doAutoCreate())
1352        this.type = new CodeableConcept(); // cc
1353    return this.type;
1354  }
1355
1356  public boolean hasType() {
1357    return this.type != null && !this.type.isEmpty();
1358  }
1359
1360  /**
1361   * @param value {@link #type} (Categorizes a naming system for easier search by
1362   *              grouping related naming systems.)
1363   */
1364  public NamingSystem setType(CodeableConcept value) {
1365    this.type = value;
1366    return this;
1367  }
1368
1369  /**
1370   * @return {@link #description} (A free text natural language description of the
1371   *         naming system from a consumer's perspective. Details about what the
1372   *         namespace identifies including scope, granularity, version labeling,
1373   *         etc.). This is the underlying object with id, value and extensions.
1374   *         The accessor "getDescription" gives direct access to the value
1375   */
1376  public MarkdownType getDescriptionElement() {
1377    if (this.description == null)
1378      if (Configuration.errorOnAutoCreate())
1379        throw new Error("Attempt to auto-create NamingSystem.description");
1380      else if (Configuration.doAutoCreate())
1381        this.description = new MarkdownType(); // bb
1382    return this.description;
1383  }
1384
1385  public boolean hasDescriptionElement() {
1386    return this.description != null && !this.description.isEmpty();
1387  }
1388
1389  public boolean hasDescription() {
1390    return this.description != null && !this.description.isEmpty();
1391  }
1392
1393  /**
1394   * @param value {@link #description} (A free text natural language description
1395   *              of the naming system from a consumer's perspective. Details
1396   *              about what the namespace identifies including scope,
1397   *              granularity, version labeling, etc.). This is the underlying
1398   *              object with id, value and extensions. The accessor
1399   *              "getDescription" gives direct access to the value
1400   */
1401  public NamingSystem setDescriptionElement(MarkdownType value) {
1402    this.description = value;
1403    return this;
1404  }
1405
1406  /**
1407   * @return A free text natural language description of the naming system from a
1408   *         consumer's perspective. Details about what the namespace identifies
1409   *         including scope, granularity, version labeling, etc.
1410   */
1411  public String getDescription() {
1412    return this.description == null ? null : this.description.getValue();
1413  }
1414
1415  /**
1416   * @param value A free text natural language description of the naming system
1417   *              from a consumer's perspective. Details about what the namespace
1418   *              identifies including scope, granularity, version labeling, etc.
1419   */
1420  public NamingSystem setDescription(String value) {
1421    if (value == null)
1422      this.description = null;
1423    else {
1424      if (this.description == null)
1425        this.description = new MarkdownType();
1426      this.description.setValue(value);
1427    }
1428    return this;
1429  }
1430
1431  /**
1432   * @return {@link #useContext} (The content was developed with a focus and
1433   *         intent of supporting the contexts that are listed. These contexts may
1434   *         be general categories (gender, age, ...) or may be references to
1435   *         specific programs (insurance plans, studies, ...) and may be used to
1436   *         assist with indexing and searching for appropriate naming system
1437   *         instances.)
1438   */
1439  public List<UsageContext> getUseContext() {
1440    if (this.useContext == null)
1441      this.useContext = new ArrayList<UsageContext>();
1442    return this.useContext;
1443  }
1444
1445  /**
1446   * @return Returns a reference to <code>this</code> for easy method chaining
1447   */
1448  public NamingSystem setUseContext(List<UsageContext> theUseContext) {
1449    this.useContext = theUseContext;
1450    return this;
1451  }
1452
1453  public boolean hasUseContext() {
1454    if (this.useContext == null)
1455      return false;
1456    for (UsageContext item : this.useContext)
1457      if (!item.isEmpty())
1458        return true;
1459    return false;
1460  }
1461
1462  public UsageContext addUseContext() { // 3
1463    UsageContext t = new UsageContext();
1464    if (this.useContext == null)
1465      this.useContext = new ArrayList<UsageContext>();
1466    this.useContext.add(t);
1467    return t;
1468  }
1469
1470  public NamingSystem addUseContext(UsageContext t) { // 3
1471    if (t == null)
1472      return this;
1473    if (this.useContext == null)
1474      this.useContext = new ArrayList<UsageContext>();
1475    this.useContext.add(t);
1476    return this;
1477  }
1478
1479  /**
1480   * @return The first repetition of repeating field {@link #useContext}, creating
1481   *         it if it does not already exist
1482   */
1483  public UsageContext getUseContextFirstRep() {
1484    if (getUseContext().isEmpty()) {
1485      addUseContext();
1486    }
1487    return getUseContext().get(0);
1488  }
1489
1490  /**
1491   * @return {@link #jurisdiction} (A legal or geographic region in which the
1492   *         naming system is intended to be used.)
1493   */
1494  public List<CodeableConcept> getJurisdiction() {
1495    if (this.jurisdiction == null)
1496      this.jurisdiction = new ArrayList<CodeableConcept>();
1497    return this.jurisdiction;
1498  }
1499
1500  /**
1501   * @return Returns a reference to <code>this</code> for easy method chaining
1502   */
1503  public NamingSystem setJurisdiction(List<CodeableConcept> theJurisdiction) {
1504    this.jurisdiction = theJurisdiction;
1505    return this;
1506  }
1507
1508  public boolean hasJurisdiction() {
1509    if (this.jurisdiction == null)
1510      return false;
1511    for (CodeableConcept item : this.jurisdiction)
1512      if (!item.isEmpty())
1513        return true;
1514    return false;
1515  }
1516
1517  public CodeableConcept addJurisdiction() { // 3
1518    CodeableConcept t = new CodeableConcept();
1519    if (this.jurisdiction == null)
1520      this.jurisdiction = new ArrayList<CodeableConcept>();
1521    this.jurisdiction.add(t);
1522    return t;
1523  }
1524
1525  public NamingSystem addJurisdiction(CodeableConcept t) { // 3
1526    if (t == null)
1527      return this;
1528    if (this.jurisdiction == null)
1529      this.jurisdiction = new ArrayList<CodeableConcept>();
1530    this.jurisdiction.add(t);
1531    return this;
1532  }
1533
1534  /**
1535   * @return The first repetition of repeating field {@link #jurisdiction},
1536   *         creating it if it does not already exist
1537   */
1538  public CodeableConcept getJurisdictionFirstRep() {
1539    if (getJurisdiction().isEmpty()) {
1540      addJurisdiction();
1541    }
1542    return getJurisdiction().get(0);
1543  }
1544
1545  /**
1546   * @return {@link #usage} (Provides guidance on the use of the namespace,
1547   *         including the handling of formatting characters, use of upper vs.
1548   *         lower case, etc.). This is the underlying object with id, value and
1549   *         extensions. The accessor "getUsage" gives direct access to the value
1550   */
1551  public StringType getUsageElement() {
1552    if (this.usage == null)
1553      if (Configuration.errorOnAutoCreate())
1554        throw new Error("Attempt to auto-create NamingSystem.usage");
1555      else if (Configuration.doAutoCreate())
1556        this.usage = new StringType(); // bb
1557    return this.usage;
1558  }
1559
1560  public boolean hasUsageElement() {
1561    return this.usage != null && !this.usage.isEmpty();
1562  }
1563
1564  public boolean hasUsage() {
1565    return this.usage != null && !this.usage.isEmpty();
1566  }
1567
1568  /**
1569   * @param value {@link #usage} (Provides guidance on the use of the namespace,
1570   *              including the handling of formatting characters, use of upper
1571   *              vs. lower case, etc.). This is the underlying object with id,
1572   *              value and extensions. The accessor "getUsage" gives direct
1573   *              access to the value
1574   */
1575  public NamingSystem setUsageElement(StringType value) {
1576    this.usage = value;
1577    return this;
1578  }
1579
1580  /**
1581   * @return Provides guidance on the use of the namespace, including the handling
1582   *         of formatting characters, use of upper vs. lower case, etc.
1583   */
1584  public String getUsage() {
1585    return this.usage == null ? null : this.usage.getValue();
1586  }
1587
1588  /**
1589   * @param value Provides guidance on the use of the namespace, including the
1590   *              handling of formatting characters, use of upper vs. lower case,
1591   *              etc.
1592   */
1593  public NamingSystem setUsage(String value) {
1594    if (Utilities.noString(value))
1595      this.usage = null;
1596    else {
1597      if (this.usage == null)
1598        this.usage = new StringType();
1599      this.usage.setValue(value);
1600    }
1601    return this;
1602  }
1603
1604  /**
1605   * @return {@link #uniqueId} (Indicates how the system may be identified when
1606   *         referenced in electronic exchange.)
1607   */
1608  public List<NamingSystemUniqueIdComponent> getUniqueId() {
1609    if (this.uniqueId == null)
1610      this.uniqueId = new ArrayList<NamingSystemUniqueIdComponent>();
1611    return this.uniqueId;
1612  }
1613
1614  /**
1615   * @return Returns a reference to <code>this</code> for easy method chaining
1616   */
1617  public NamingSystem setUniqueId(List<NamingSystemUniqueIdComponent> theUniqueId) {
1618    this.uniqueId = theUniqueId;
1619    return this;
1620  }
1621
1622  public boolean hasUniqueId() {
1623    if (this.uniqueId == null)
1624      return false;
1625    for (NamingSystemUniqueIdComponent item : this.uniqueId)
1626      if (!item.isEmpty())
1627        return true;
1628    return false;
1629  }
1630
1631  public NamingSystemUniqueIdComponent addUniqueId() { // 3
1632    NamingSystemUniqueIdComponent t = new NamingSystemUniqueIdComponent();
1633    if (this.uniqueId == null)
1634      this.uniqueId = new ArrayList<NamingSystemUniqueIdComponent>();
1635    this.uniqueId.add(t);
1636    return t;
1637  }
1638
1639  public NamingSystem addUniqueId(NamingSystemUniqueIdComponent t) { // 3
1640    if (t == null)
1641      return this;
1642    if (this.uniqueId == null)
1643      this.uniqueId = new ArrayList<NamingSystemUniqueIdComponent>();
1644    this.uniqueId.add(t);
1645    return this;
1646  }
1647
1648  /**
1649   * @return The first repetition of repeating field {@link #uniqueId}, creating
1650   *         it if it does not already exist
1651   */
1652  public NamingSystemUniqueIdComponent getUniqueIdFirstRep() {
1653    if (getUniqueId().isEmpty()) {
1654      addUniqueId();
1655    }
1656    return getUniqueId().get(0);
1657  }
1658
1659  protected void listChildren(List<Property> children) {
1660    super.listChildren(children);
1661    children.add(new Property("name", "string",
1662        "A natural language name identifying the naming system. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
1663        0, 1, name));
1664    children.add(new Property("status", "code",
1665        "The status of this naming system. Enables tracking the life-cycle of the content.", 0, 1, status));
1666    children.add(new Property("kind", "code",
1667        "Indicates the purpose for the naming system - what kinds of things does it make unique?", 0, 1, kind));
1668    children.add(new Property("date", "dateTime",
1669        "The date  (and optionally time) when the naming system was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the naming system changes.",
1670        0, 1, date));
1671    children.add(new Property("publisher", "string",
1672        "The name of the organization or individual that published the naming system.", 0, 1, publisher));
1673    children.add(new Property("contact", "ContactDetail",
1674        "Contact details to assist a user in finding and communicating with the publisher.", 0,
1675        java.lang.Integer.MAX_VALUE, contact));
1676    children.add(new Property("responsible", "string",
1677        "The name of the organization that is responsible for issuing identifiers or codes for this namespace and ensuring their non-collision.",
1678        0, 1, responsible));
1679    children.add(new Property("type", "CodeableConcept",
1680        "Categorizes a naming system for easier search by grouping related naming systems.", 0, 1, type));
1681    children.add(new Property("description", "markdown",
1682        "A free text natural language description of the naming system from a consumer's perspective. Details about what the namespace identifies including scope, granularity, version labeling, etc.",
1683        0, 1, description));
1684    children.add(new Property("useContext", "UsageContext",
1685        "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate naming system instances.",
1686        0, java.lang.Integer.MAX_VALUE, useContext));
1687    children.add(new Property("jurisdiction", "CodeableConcept",
1688        "A legal or geographic region in which the naming system is intended to be used.", 0,
1689        java.lang.Integer.MAX_VALUE, jurisdiction));
1690    children.add(new Property("usage", "string",
1691        "Provides guidance on the use of the namespace, including the handling of formatting characters, use of upper vs. lower case, etc.",
1692        0, 1, usage));
1693    children.add(new Property("uniqueId", "",
1694        "Indicates how the system may be identified when referenced in electronic exchange.", 0,
1695        java.lang.Integer.MAX_VALUE, uniqueId));
1696  }
1697
1698  @Override
1699  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1700    switch (_hash) {
1701    case 3373707:
1702      /* name */ return new Property("name", "string",
1703          "A natural language name identifying the naming system. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
1704          0, 1, name);
1705    case -892481550:
1706      /* status */ return new Property("status", "code",
1707          "The status of this naming system. Enables tracking the life-cycle of the content.", 0, 1, status);
1708    case 3292052:
1709      /* kind */ return new Property("kind", "code",
1710          "Indicates the purpose for the naming system - what kinds of things does it make unique?", 0, 1, kind);
1711    case 3076014:
1712      /* date */ return new Property("date", "dateTime",
1713          "The date  (and optionally time) when the naming system was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the naming system changes.",
1714          0, 1, date);
1715    case 1447404028:
1716      /* publisher */ return new Property("publisher", "string",
1717          "The name of the organization or individual that published the naming system.", 0, 1, publisher);
1718    case 951526432:
1719      /* contact */ return new Property("contact", "ContactDetail",
1720          "Contact details to assist a user in finding and communicating with the publisher.", 0,
1721          java.lang.Integer.MAX_VALUE, contact);
1722    case 1847674614:
1723      /* responsible */ return new Property("responsible", "string",
1724          "The name of the organization that is responsible for issuing identifiers or codes for this namespace and ensuring their non-collision.",
1725          0, 1, responsible);
1726    case 3575610:
1727      /* type */ return new Property("type", "CodeableConcept",
1728          "Categorizes a naming system for easier search by grouping related naming systems.", 0, 1, type);
1729    case -1724546052:
1730      /* description */ return new Property("description", "markdown",
1731          "A free text natural language description of the naming system from a consumer's perspective. Details about what the namespace identifies including scope, granularity, version labeling, etc.",
1732          0, 1, description);
1733    case -669707736:
1734      /* useContext */ return new Property("useContext", "UsageContext",
1735          "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate naming system instances.",
1736          0, java.lang.Integer.MAX_VALUE, useContext);
1737    case -507075711:
1738      /* jurisdiction */ return new Property("jurisdiction", "CodeableConcept",
1739          "A legal or geographic region in which the naming system is intended to be used.", 0,
1740          java.lang.Integer.MAX_VALUE, jurisdiction);
1741    case 111574433:
1742      /* usage */ return new Property("usage", "string",
1743          "Provides guidance on the use of the namespace, including the handling of formatting characters, use of upper vs. lower case, etc.",
1744          0, 1, usage);
1745    case -294460212:
1746      /* uniqueId */ return new Property("uniqueId", "",
1747          "Indicates how the system may be identified when referenced in electronic exchange.", 0,
1748          java.lang.Integer.MAX_VALUE, uniqueId);
1749    default:
1750      return super.getNamedProperty(_hash, _name, _checkValid);
1751    }
1752
1753  }
1754
1755  @Override
1756  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1757    switch (hash) {
1758    case 3373707:
1759      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
1760    case -892481550:
1761      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<PublicationStatus>
1762    case 3292052:
1763      /* kind */ return this.kind == null ? new Base[0] : new Base[] { this.kind }; // Enumeration<NamingSystemType>
1764    case 3076014:
1765      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
1766    case 1447404028:
1767      /* publisher */ return this.publisher == null ? new Base[0] : new Base[] { this.publisher }; // StringType
1768    case 951526432:
1769      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
1770    case 1847674614:
1771      /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // StringType
1772    case 3575610:
1773      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1774    case -1724546052:
1775      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // MarkdownType
1776    case -669707736:
1777      /* useContext */ return this.useContext == null ? new Base[0]
1778          : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
1779    case -507075711:
1780      /* jurisdiction */ return this.jurisdiction == null ? new Base[0]
1781          : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
1782    case 111574433:
1783      /* usage */ return this.usage == null ? new Base[0] : new Base[] { this.usage }; // StringType
1784    case -294460212:
1785      /* uniqueId */ return this.uniqueId == null ? new Base[0] : this.uniqueId.toArray(new Base[this.uniqueId.size()]); // NamingSystemUniqueIdComponent
1786    default:
1787      return super.getProperty(hash, name, checkValid);
1788    }
1789
1790  }
1791
1792  @Override
1793  public Base setProperty(int hash, String name, Base value) throws FHIRException {
1794    switch (hash) {
1795    case 3373707: // name
1796      this.name = castToString(value); // StringType
1797      return value;
1798    case -892481550: // status
1799      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1800      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1801      return value;
1802    case 3292052: // kind
1803      value = new NamingSystemTypeEnumFactory().fromType(castToCode(value));
1804      this.kind = (Enumeration) value; // Enumeration<NamingSystemType>
1805      return value;
1806    case 3076014: // date
1807      this.date = castToDateTime(value); // DateTimeType
1808      return value;
1809    case 1447404028: // publisher
1810      this.publisher = castToString(value); // StringType
1811      return value;
1812    case 951526432: // contact
1813      this.getContact().add(castToContactDetail(value)); // ContactDetail
1814      return value;
1815    case 1847674614: // responsible
1816      this.responsible = castToString(value); // StringType
1817      return value;
1818    case 3575610: // type
1819      this.type = castToCodeableConcept(value); // CodeableConcept
1820      return value;
1821    case -1724546052: // description
1822      this.description = castToMarkdown(value); // MarkdownType
1823      return value;
1824    case -669707736: // useContext
1825      this.getUseContext().add(castToUsageContext(value)); // UsageContext
1826      return value;
1827    case -507075711: // jurisdiction
1828      this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
1829      return value;
1830    case 111574433: // usage
1831      this.usage = castToString(value); // StringType
1832      return value;
1833    case -294460212: // uniqueId
1834      this.getUniqueId().add((NamingSystemUniqueIdComponent) value); // NamingSystemUniqueIdComponent
1835      return value;
1836    default:
1837      return super.setProperty(hash, name, value);
1838    }
1839
1840  }
1841
1842  @Override
1843  public Base setProperty(String name, Base value) throws FHIRException {
1844    if (name.equals("name")) {
1845      this.name = castToString(value); // StringType
1846    } else if (name.equals("status")) {
1847      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
1848      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1849    } else if (name.equals("kind")) {
1850      value = new NamingSystemTypeEnumFactory().fromType(castToCode(value));
1851      this.kind = (Enumeration) value; // Enumeration<NamingSystemType>
1852    } else if (name.equals("date")) {
1853      this.date = castToDateTime(value); // DateTimeType
1854    } else if (name.equals("publisher")) {
1855      this.publisher = castToString(value); // StringType
1856    } else if (name.equals("contact")) {
1857      this.getContact().add(castToContactDetail(value));
1858    } else if (name.equals("responsible")) {
1859      this.responsible = castToString(value); // StringType
1860    } else if (name.equals("type")) {
1861      this.type = castToCodeableConcept(value); // CodeableConcept
1862    } else if (name.equals("description")) {
1863      this.description = castToMarkdown(value); // MarkdownType
1864    } else if (name.equals("useContext")) {
1865      this.getUseContext().add(castToUsageContext(value));
1866    } else if (name.equals("jurisdiction")) {
1867      this.getJurisdiction().add(castToCodeableConcept(value));
1868    } else if (name.equals("usage")) {
1869      this.usage = castToString(value); // StringType
1870    } else if (name.equals("uniqueId")) {
1871      this.getUniqueId().add((NamingSystemUniqueIdComponent) value);
1872    } else
1873      return super.setProperty(name, value);
1874    return value;
1875  }
1876
1877  @Override
1878  public Base makeProperty(int hash, String name) throws FHIRException {
1879    switch (hash) {
1880    case 3373707:
1881      return getNameElement();
1882    case -892481550:
1883      return getStatusElement();
1884    case 3292052:
1885      return getKindElement();
1886    case 3076014:
1887      return getDateElement();
1888    case 1447404028:
1889      return getPublisherElement();
1890    case 951526432:
1891      return addContact();
1892    case 1847674614:
1893      return getResponsibleElement();
1894    case 3575610:
1895      return getType();
1896    case -1724546052:
1897      return getDescriptionElement();
1898    case -669707736:
1899      return addUseContext();
1900    case -507075711:
1901      return addJurisdiction();
1902    case 111574433:
1903      return getUsageElement();
1904    case -294460212:
1905      return addUniqueId();
1906    default:
1907      return super.makeProperty(hash, name);
1908    }
1909
1910  }
1911
1912  @Override
1913  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1914    switch (hash) {
1915    case 3373707:
1916      /* name */ return new String[] { "string" };
1917    case -892481550:
1918      /* status */ return new String[] { "code" };
1919    case 3292052:
1920      /* kind */ return new String[] { "code" };
1921    case 3076014:
1922      /* date */ return new String[] { "dateTime" };
1923    case 1447404028:
1924      /* publisher */ return new String[] { "string" };
1925    case 951526432:
1926      /* contact */ return new String[] { "ContactDetail" };
1927    case 1847674614:
1928      /* responsible */ return new String[] { "string" };
1929    case 3575610:
1930      /* type */ return new String[] { "CodeableConcept" };
1931    case -1724546052:
1932      /* description */ return new String[] { "markdown" };
1933    case -669707736:
1934      /* useContext */ return new String[] { "UsageContext" };
1935    case -507075711:
1936      /* jurisdiction */ return new String[] { "CodeableConcept" };
1937    case 111574433:
1938      /* usage */ return new String[] { "string" };
1939    case -294460212:
1940      /* uniqueId */ return new String[] {};
1941    default:
1942      return super.getTypesForProperty(hash, name);
1943    }
1944
1945  }
1946
1947  @Override
1948  public Base addChild(String name) throws FHIRException {
1949    if (name.equals("name")) {
1950      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.name");
1951    } else if (name.equals("status")) {
1952      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.status");
1953    } else if (name.equals("kind")) {
1954      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.kind");
1955    } else if (name.equals("date")) {
1956      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.date");
1957    } else if (name.equals("publisher")) {
1958      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.publisher");
1959    } else if (name.equals("contact")) {
1960      return addContact();
1961    } else if (name.equals("responsible")) {
1962      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.responsible");
1963    } else if (name.equals("type")) {
1964      this.type = new CodeableConcept();
1965      return this.type;
1966    } else if (name.equals("description")) {
1967      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.description");
1968    } else if (name.equals("useContext")) {
1969      return addUseContext();
1970    } else if (name.equals("jurisdiction")) {
1971      return addJurisdiction();
1972    } else if (name.equals("usage")) {
1973      throw new FHIRException("Cannot call addChild on a singleton property NamingSystem.usage");
1974    } else if (name.equals("uniqueId")) {
1975      return addUniqueId();
1976    } else
1977      return super.addChild(name);
1978  }
1979
1980  public String fhirType() {
1981    return "NamingSystem";
1982
1983  }
1984
1985  public NamingSystem copy() {
1986    NamingSystem dst = new NamingSystem();
1987    copyValues(dst);
1988    return dst;
1989  }
1990
1991  public void copyValues(NamingSystem dst) {
1992    super.copyValues(dst);
1993    dst.name = name == null ? null : name.copy();
1994    dst.status = status == null ? null : status.copy();
1995    dst.kind = kind == null ? null : kind.copy();
1996    dst.date = date == null ? null : date.copy();
1997    dst.publisher = publisher == null ? null : publisher.copy();
1998    if (contact != null) {
1999      dst.contact = new ArrayList<ContactDetail>();
2000      for (ContactDetail i : contact)
2001        dst.contact.add(i.copy());
2002    }
2003    ;
2004    dst.responsible = responsible == null ? null : responsible.copy();
2005    dst.type = type == null ? null : type.copy();
2006    dst.description = description == null ? null : description.copy();
2007    if (useContext != null) {
2008      dst.useContext = new ArrayList<UsageContext>();
2009      for (UsageContext i : useContext)
2010        dst.useContext.add(i.copy());
2011    }
2012    ;
2013    if (jurisdiction != null) {
2014      dst.jurisdiction = new ArrayList<CodeableConcept>();
2015      for (CodeableConcept i : jurisdiction)
2016        dst.jurisdiction.add(i.copy());
2017    }
2018    ;
2019    dst.usage = usage == null ? null : usage.copy();
2020    if (uniqueId != null) {
2021      dst.uniqueId = new ArrayList<NamingSystemUniqueIdComponent>();
2022      for (NamingSystemUniqueIdComponent i : uniqueId)
2023        dst.uniqueId.add(i.copy());
2024    }
2025    ;
2026  }
2027
2028  protected NamingSystem typedCopy() {
2029    return copy();
2030  }
2031
2032  @Override
2033  public boolean equalsDeep(Base other_) {
2034    if (!super.equalsDeep(other_))
2035      return false;
2036    if (!(other_ instanceof NamingSystem))
2037      return false;
2038    NamingSystem o = (NamingSystem) other_;
2039    return compareDeep(kind, o.kind, true) && compareDeep(responsible, o.responsible, true)
2040        && compareDeep(type, o.type, true) && compareDeep(usage, o.usage, true)
2041        && compareDeep(uniqueId, o.uniqueId, true);
2042  }
2043
2044  @Override
2045  public boolean equalsShallow(Base other_) {
2046    if (!super.equalsShallow(other_))
2047      return false;
2048    if (!(other_ instanceof NamingSystem))
2049      return false;
2050    NamingSystem o = (NamingSystem) other_;
2051    return compareValues(kind, o.kind, true) && compareValues(responsible, o.responsible, true)
2052        && compareValues(usage, o.usage, true);
2053  }
2054
2055  public boolean isEmpty() {
2056    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, responsible, type, usage, uniqueId);
2057  }
2058
2059  @Override
2060  public ResourceType getResourceType() {
2061    return ResourceType.NamingSystem;
2062  }
2063
2064  /**
2065   * Search parameter: <b>date</b>
2066   * <p>
2067   * Description: <b>The naming system publication date</b><br>
2068   * Type: <b>date</b><br>
2069   * Path: <b>NamingSystem.date</b><br>
2070   * </p>
2071   */
2072  @SearchParamDefinition(name = "date", path = "NamingSystem.date", description = "The naming system publication date", type = "date")
2073  public static final String SP_DATE = "date";
2074  /**
2075   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2076   * <p>
2077   * Description: <b>The naming system publication date</b><br>
2078   * Type: <b>date</b><br>
2079   * Path: <b>NamingSystem.date</b><br>
2080   * </p>
2081   */
2082  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2083      SP_DATE);
2084
2085  /**
2086   * Search parameter: <b>period</b>
2087   * <p>
2088   * Description: <b>When is identifier valid?</b><br>
2089   * Type: <b>date</b><br>
2090   * Path: <b>NamingSystem.uniqueId.period</b><br>
2091   * </p>
2092   */
2093  @SearchParamDefinition(name = "period", path = "NamingSystem.uniqueId.period", description = "When is identifier valid?", type = "date")
2094  public static final String SP_PERIOD = "period";
2095  /**
2096   * <b>Fluent Client</b> search parameter constant for <b>period</b>
2097   * <p>
2098   * Description: <b>When is identifier valid?</b><br>
2099   * Type: <b>date</b><br>
2100   * Path: <b>NamingSystem.uniqueId.period</b><br>
2101   * </p>
2102   */
2103  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(
2104      SP_PERIOD);
2105
2106  /**
2107   * Search parameter: <b>context-type-value</b>
2108   * <p>
2109   * Description: <b>A use context type and value assigned to the naming
2110   * system</b><br>
2111   * Type: <b>composite</b><br>
2112   * Path: <b></b><br>
2113   * </p>
2114   */
2115  @SearchParamDefinition(name = "context-type-value", path = "NamingSystem.useContext", description = "A use context type and value assigned to the naming system", type = "composite", compositeOf = {
2116      "context-type", "context" })
2117  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
2118  /**
2119   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
2120   * <p>
2121   * Description: <b>A use context type and value assigned to the naming
2122   * system</b><br>
2123   * Type: <b>composite</b><br>
2124   * Path: <b></b><br>
2125   * </p>
2126   */
2127  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(
2128      SP_CONTEXT_TYPE_VALUE);
2129
2130  /**
2131   * Search parameter: <b>kind</b>
2132   * <p>
2133   * Description: <b>codesystem | identifier | root</b><br>
2134   * Type: <b>token</b><br>
2135   * Path: <b>NamingSystem.kind</b><br>
2136   * </p>
2137   */
2138  @SearchParamDefinition(name = "kind", path = "NamingSystem.kind", description = "codesystem | identifier | root", type = "token")
2139  public static final String SP_KIND = "kind";
2140  /**
2141   * <b>Fluent Client</b> search parameter constant for <b>kind</b>
2142   * <p>
2143   * Description: <b>codesystem | identifier | root</b><br>
2144   * Type: <b>token</b><br>
2145   * Path: <b>NamingSystem.kind</b><br>
2146   * </p>
2147   */
2148  public static final ca.uhn.fhir.rest.gclient.TokenClientParam KIND = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2149      SP_KIND);
2150
2151  /**
2152   * Search parameter: <b>jurisdiction</b>
2153   * <p>
2154   * Description: <b>Intended jurisdiction for the naming system</b><br>
2155   * Type: <b>token</b><br>
2156   * Path: <b>NamingSystem.jurisdiction</b><br>
2157   * </p>
2158   */
2159  @SearchParamDefinition(name = "jurisdiction", path = "NamingSystem.jurisdiction", description = "Intended jurisdiction for the naming system", type = "token")
2160  public static final String SP_JURISDICTION = "jurisdiction";
2161  /**
2162   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
2163   * <p>
2164   * Description: <b>Intended jurisdiction for the naming system</b><br>
2165   * Type: <b>token</b><br>
2166   * Path: <b>NamingSystem.jurisdiction</b><br>
2167   * </p>
2168   */
2169  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2170      SP_JURISDICTION);
2171
2172  /**
2173   * Search parameter: <b>description</b>
2174   * <p>
2175   * Description: <b>The description of the naming system</b><br>
2176   * Type: <b>string</b><br>
2177   * Path: <b>NamingSystem.description</b><br>
2178   * </p>
2179   */
2180  @SearchParamDefinition(name = "description", path = "NamingSystem.description", description = "The description of the naming system", type = "string")
2181  public static final String SP_DESCRIPTION = "description";
2182  /**
2183   * <b>Fluent Client</b> search parameter constant for <b>description</b>
2184   * <p>
2185   * Description: <b>The description of the naming system</b><br>
2186   * Type: <b>string</b><br>
2187   * Path: <b>NamingSystem.description</b><br>
2188   * </p>
2189   */
2190  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(
2191      SP_DESCRIPTION);
2192
2193  /**
2194   * Search parameter: <b>context-type</b>
2195   * <p>
2196   * Description: <b>A type of use context assigned to the naming system</b><br>
2197   * Type: <b>token</b><br>
2198   * Path: <b>NamingSystem.useContext.code</b><br>
2199   * </p>
2200   */
2201  @SearchParamDefinition(name = "context-type", path = "NamingSystem.useContext.code", description = "A type of use context assigned to the naming system", type = "token")
2202  public static final String SP_CONTEXT_TYPE = "context-type";
2203  /**
2204   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
2205   * <p>
2206   * Description: <b>A type of use context assigned to the naming system</b><br>
2207   * Type: <b>token</b><br>
2208   * Path: <b>NamingSystem.useContext.code</b><br>
2209   * </p>
2210   */
2211  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2212      SP_CONTEXT_TYPE);
2213
2214  /**
2215   * Search parameter: <b>type</b>
2216   * <p>
2217   * Description: <b>e.g. driver, provider, patient, bank etc.</b><br>
2218   * Type: <b>token</b><br>
2219   * Path: <b>NamingSystem.type</b><br>
2220   * </p>
2221   */
2222  @SearchParamDefinition(name = "type", path = "NamingSystem.type", description = "e.g. driver,  provider,  patient, bank etc.", type = "token")
2223  public static final String SP_TYPE = "type";
2224  /**
2225   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2226   * <p>
2227   * Description: <b>e.g. driver, provider, patient, bank etc.</b><br>
2228   * Type: <b>token</b><br>
2229   * Path: <b>NamingSystem.type</b><br>
2230   * </p>
2231   */
2232  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2233      SP_TYPE);
2234
2235  /**
2236   * Search parameter: <b>id-type</b>
2237   * <p>
2238   * Description: <b>oid | uuid | uri | other</b><br>
2239   * Type: <b>token</b><br>
2240   * Path: <b>NamingSystem.uniqueId.type</b><br>
2241   * </p>
2242   */
2243  @SearchParamDefinition(name = "id-type", path = "NamingSystem.uniqueId.type", description = "oid | uuid | uri | other", type = "token")
2244  public static final String SP_ID_TYPE = "id-type";
2245  /**
2246   * <b>Fluent Client</b> search parameter constant for <b>id-type</b>
2247   * <p>
2248   * Description: <b>oid | uuid | uri | other</b><br>
2249   * Type: <b>token</b><br>
2250   * Path: <b>NamingSystem.uniqueId.type</b><br>
2251   * </p>
2252   */
2253  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ID_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2254      SP_ID_TYPE);
2255
2256  /**
2257   * Search parameter: <b>context-quantity</b>
2258   * <p>
2259   * Description: <b>A quantity- or range-valued use context assigned to the
2260   * naming system</b><br>
2261   * Type: <b>quantity</b><br>
2262   * Path: <b>NamingSystem.useContext.valueQuantity,
2263   * NamingSystem.useContext.valueRange</b><br>
2264   * </p>
2265   */
2266  @SearchParamDefinition(name = "context-quantity", path = "(NamingSystem.useContext.value as Quantity) | (NamingSystem.useContext.value as Range)", description = "A quantity- or range-valued use context assigned to the naming system", type = "quantity")
2267  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
2268  /**
2269   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
2270   * <p>
2271   * Description: <b>A quantity- or range-valued use context assigned to the
2272   * naming system</b><br>
2273   * Type: <b>quantity</b><br>
2274   * Path: <b>NamingSystem.useContext.valueQuantity,
2275   * NamingSystem.useContext.valueRange</b><br>
2276   * </p>
2277   */
2278  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
2279      SP_CONTEXT_QUANTITY);
2280
2281  /**
2282   * Search parameter: <b>responsible</b>
2283   * <p>
2284   * Description: <b>Who maintains system namespace?</b><br>
2285   * Type: <b>string</b><br>
2286   * Path: <b>NamingSystem.responsible</b><br>
2287   * </p>
2288   */
2289  @SearchParamDefinition(name = "responsible", path = "NamingSystem.responsible", description = "Who maintains system namespace?", type = "string")
2290  public static final String SP_RESPONSIBLE = "responsible";
2291  /**
2292   * <b>Fluent Client</b> search parameter constant for <b>responsible</b>
2293   * <p>
2294   * Description: <b>Who maintains system namespace?</b><br>
2295   * Type: <b>string</b><br>
2296   * Path: <b>NamingSystem.responsible</b><br>
2297   * </p>
2298   */
2299  public static final ca.uhn.fhir.rest.gclient.StringClientParam RESPONSIBLE = new ca.uhn.fhir.rest.gclient.StringClientParam(
2300      SP_RESPONSIBLE);
2301
2302  /**
2303   * Search parameter: <b>contact</b>
2304   * <p>
2305   * Description: <b>Name of an individual to contact</b><br>
2306   * Type: <b>string</b><br>
2307   * Path: <b>NamingSystem.contact.name</b><br>
2308   * </p>
2309   */
2310  @SearchParamDefinition(name = "contact", path = "NamingSystem.contact.name", description = "Name of an individual to contact", type = "string")
2311  public static final String SP_CONTACT = "contact";
2312  /**
2313   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
2314   * <p>
2315   * Description: <b>Name of an individual to contact</b><br>
2316   * Type: <b>string</b><br>
2317   * Path: <b>NamingSystem.contact.name</b><br>
2318   * </p>
2319   */
2320  public static final ca.uhn.fhir.rest.gclient.StringClientParam CONTACT = new ca.uhn.fhir.rest.gclient.StringClientParam(
2321      SP_CONTACT);
2322
2323  /**
2324   * Search parameter: <b>name</b>
2325   * <p>
2326   * Description: <b>Computationally friendly name of the naming system</b><br>
2327   * Type: <b>string</b><br>
2328   * Path: <b>NamingSystem.name</b><br>
2329   * </p>
2330   */
2331  @SearchParamDefinition(name = "name", path = "NamingSystem.name", description = "Computationally friendly name of the naming system", type = "string")
2332  public static final String SP_NAME = "name";
2333  /**
2334   * <b>Fluent Client</b> search parameter constant for <b>name</b>
2335   * <p>
2336   * Description: <b>Computationally friendly name of the naming system</b><br>
2337   * Type: <b>string</b><br>
2338   * Path: <b>NamingSystem.name</b><br>
2339   * </p>
2340   */
2341  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
2342      SP_NAME);
2343
2344  /**
2345   * Search parameter: <b>context</b>
2346   * <p>
2347   * Description: <b>A use context assigned to the naming system</b><br>
2348   * Type: <b>token</b><br>
2349   * Path: <b>NamingSystem.useContext.valueCodeableConcept</b><br>
2350   * </p>
2351   */
2352  @SearchParamDefinition(name = "context", path = "(NamingSystem.useContext.value as CodeableConcept)", description = "A use context assigned to the naming system", type = "token")
2353  public static final String SP_CONTEXT = "context";
2354  /**
2355   * <b>Fluent Client</b> search parameter constant for <b>context</b>
2356   * <p>
2357   * Description: <b>A use context assigned to the naming system</b><br>
2358   * Type: <b>token</b><br>
2359   * Path: <b>NamingSystem.useContext.valueCodeableConcept</b><br>
2360   * </p>
2361   */
2362  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2363      SP_CONTEXT);
2364
2365  /**
2366   * Search parameter: <b>publisher</b>
2367   * <p>
2368   * Description: <b>Name of the publisher of the naming system</b><br>
2369   * Type: <b>string</b><br>
2370   * Path: <b>NamingSystem.publisher</b><br>
2371   * </p>
2372   */
2373  @SearchParamDefinition(name = "publisher", path = "NamingSystem.publisher", description = "Name of the publisher of the naming system", type = "string")
2374  public static final String SP_PUBLISHER = "publisher";
2375  /**
2376   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
2377   * <p>
2378   * Description: <b>Name of the publisher of the naming system</b><br>
2379   * Type: <b>string</b><br>
2380   * Path: <b>NamingSystem.publisher</b><br>
2381   * </p>
2382   */
2383  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(
2384      SP_PUBLISHER);
2385
2386  /**
2387   * Search parameter: <b>telecom</b>
2388   * <p>
2389   * Description: <b>Contact details for individual or organization</b><br>
2390   * Type: <b>token</b><br>
2391   * Path: <b>NamingSystem.contact.telecom</b><br>
2392   * </p>
2393   */
2394  @SearchParamDefinition(name = "telecom", path = "NamingSystem.contact.telecom", description = "Contact details for individual or organization", type = "token")
2395  public static final String SP_TELECOM = "telecom";
2396  /**
2397   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
2398   * <p>
2399   * Description: <b>Contact details for individual or organization</b><br>
2400   * Type: <b>token</b><br>
2401   * Path: <b>NamingSystem.contact.telecom</b><br>
2402   * </p>
2403   */
2404  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2405      SP_TELECOM);
2406
2407  /**
2408   * Search parameter: <b>value</b>
2409   * <p>
2410   * Description: <b>The unique identifier</b><br>
2411   * Type: <b>string</b><br>
2412   * Path: <b>NamingSystem.uniqueId.value</b><br>
2413   * </p>
2414   */
2415  @SearchParamDefinition(name = "value", path = "NamingSystem.uniqueId.value", description = "The unique identifier", type = "string")
2416  public static final String SP_VALUE = "value";
2417  /**
2418   * <b>Fluent Client</b> search parameter constant for <b>value</b>
2419   * <p>
2420   * Description: <b>The unique identifier</b><br>
2421   * Type: <b>string</b><br>
2422   * Path: <b>NamingSystem.uniqueId.value</b><br>
2423   * </p>
2424   */
2425  public static final ca.uhn.fhir.rest.gclient.StringClientParam VALUE = new ca.uhn.fhir.rest.gclient.StringClientParam(
2426      SP_VALUE);
2427
2428  /**
2429   * Search parameter: <b>context-type-quantity</b>
2430   * <p>
2431   * Description: <b>A use context type and quantity- or range-based value
2432   * assigned to the naming system</b><br>
2433   * Type: <b>composite</b><br>
2434   * Path: <b></b><br>
2435   * </p>
2436   */
2437  @SearchParamDefinition(name = "context-type-quantity", path = "NamingSystem.useContext", description = "A use context type and quantity- or range-based value assigned to the naming system", type = "composite", compositeOf = {
2438      "context-type", "context-quantity" })
2439  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
2440  /**
2441   * <b>Fluent Client</b> search parameter constant for
2442   * <b>context-type-quantity</b>
2443   * <p>
2444   * Description: <b>A use context type and quantity- or range-based value
2445   * assigned to the naming system</b><br>
2446   * Type: <b>composite</b><br>
2447   * Path: <b></b><br>
2448   * </p>
2449   */
2450  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(
2451      SP_CONTEXT_TYPE_QUANTITY);
2452
2453  /**
2454   * Search parameter: <b>status</b>
2455   * <p>
2456   * Description: <b>The current status of the naming system</b><br>
2457   * Type: <b>token</b><br>
2458   * Path: <b>NamingSystem.status</b><br>
2459   * </p>
2460   */
2461  @SearchParamDefinition(name = "status", path = "NamingSystem.status", description = "The current status of the naming system", type = "token")
2462  public static final String SP_STATUS = "status";
2463  /**
2464   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2465   * <p>
2466   * Description: <b>The current status of the naming system</b><br>
2467   * Type: <b>token</b><br>
2468   * Path: <b>NamingSystem.status</b><br>
2469   * </p>
2470   */
2471  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2472      SP_STATUS);
2473
2474}