001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import org.hl7.fhir.r5.model.Enumerations.*;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * Common Ancestor declaration for conformance and knowledge artifact resources.
071 */
072public abstract class MetadataResource extends DomainResource {
073
074    /**
075     * An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers.
076     */
077    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
078    @Description(shortDefinition="Canonical identifier for this metadata resource, represented as a URI (globally unique)", formalDefinition="An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers." )
079    protected UriType url;
080
081    /**
082     * The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
083     */
084    @Child(name = "version", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
085    @Description(shortDefinition="Business version of the metadata resource", formalDefinition="The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence." )
086    protected StringType version;
087
088    /**
089     * A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation.
090     */
091    @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
092    @Description(shortDefinition="Name for this metadata resource (computer friendly)", formalDefinition="A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
093    protected StringType name;
094
095    /**
096     * A short, descriptive, user-friendly title for the metadata resource.
097     */
098    @Child(name = "title", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
099    @Description(shortDefinition="Name for this metadata resource (human friendly)", formalDefinition="A short, descriptive, user-friendly title for the metadata resource." )
100    protected StringType title;
101
102    /**
103     * The status of this metadata resource. Enables tracking the life-cycle of the content.
104     */
105    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
106    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The status of this metadata resource. Enables tracking the life-cycle of the content." )
107    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
108    protected Enumeration<PublicationStatus> status;
109
110    /**
111     * A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
112     */
113    @Child(name = "experimental", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=true)
114    @Description(shortDefinition="For testing purposes, not real usage", formalDefinition="A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage." )
115    protected BooleanType experimental;
116
117    /**
118     * The date  (and optionally time) when the metadata resource 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 metadata resource changes.
119     */
120    @Child(name = "date", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
121    @Description(shortDefinition="Date last changed", formalDefinition="The date  (and optionally time) when the metadata resource 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 metadata resource changes." )
122    protected DateTimeType date;
123
124    /**
125     * The name of the organization or individual that published the metadata resource.
126     */
127    @Child(name = "publisher", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
128    @Description(shortDefinition="Name of the publisher (organization or individual)", formalDefinition="The name of the organization or individual that published the metadata resource." )
129    protected StringType publisher;
130
131    /**
132     * Contact details to assist a user in finding and communicating with the publisher.
133     */
134    @Child(name = "contact", type = {ContactDetail.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
135    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
136    protected List<ContactDetail> contact;
137
138    /**
139     * A free text natural language description of the metadata resource from a consumer's perspective.
140     */
141    @Child(name = "description", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=false)
142    @Description(shortDefinition="Natural language description of the metadata resource", formalDefinition="A free text natural language description of the metadata resource from a consumer's perspective." )
143    protected MarkdownType description;
144
145    /**
146     * 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 metadata resource instances.
147     */
148    @Child(name = "useContext", type = {UsageContext.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
149    @Description(shortDefinition="The context that the content is intended to support", formalDefinition="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 metadata resource instances." )
150    protected List<UsageContext> useContext;
151
152    /**
153     * A legal or geographic region in which the metadata resource is intended to be used.
154     */
155    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
156    @Description(shortDefinition="Intended jurisdiction for metadata resource (if applicable)", formalDefinition="A legal or geographic region in which the metadata resource is intended to be used." )
157    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
158    protected List<CodeableConcept> jurisdiction;
159
160    private static final long serialVersionUID = 1952104592L;
161
162  /**
163   * Constructor
164   */
165    public MetadataResource() {
166      super();
167    }
168
169  /**
170   * Constructor
171   */
172    public MetadataResource(Enumeration<PublicationStatus> status) {
173      super();
174      this.status = status;
175    }
176
177    /**
178     * @return {@link #url} (An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
179     */
180    public UriType getUrlElement() { 
181      if (this.url == null)
182        if (Configuration.errorOnAutoCreate())
183          throw new Error("Attempt to auto-create MetadataResource.url");
184        else if (Configuration.doAutoCreate())
185          this.url = new UriType(); // bb
186      return this.url;
187    }
188
189    public boolean hasUrlElement() { 
190      return this.url != null && !this.url.isEmpty();
191    }
192
193    public boolean hasUrl() { 
194      return this.url != null && !this.url.isEmpty();
195    }
196
197    /**
198     * @param value {@link #url} (An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
199     */
200    public MetadataResource setUrlElement(UriType value) { 
201      this.url = value;
202      return this;
203    }
204
205    /**
206     * @return An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers.
207     */
208    public String getUrl() { 
209      return this.url == null ? null : this.url.getValue();
210    }
211
212    /**
213     * @param value An absolute URI that is used to identify this metadata resource when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this metadata resource is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the metadata resource is stored on different servers.
214     */
215    public MetadataResource setUrl(String value) { 
216      if (Utilities.noString(value))
217        this.url = null;
218      else {
219        if (this.url == null)
220          this.url = new UriType();
221        this.url.setValue(value);
222      }
223      return this;
224    }
225
226    /**
227     * @return {@link #version} (The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
228     */
229    public StringType getVersionElement() { 
230      if (this.version == null)
231        if (Configuration.errorOnAutoCreate())
232          throw new Error("Attempt to auto-create MetadataResource.version");
233        else if (Configuration.doAutoCreate())
234          this.version = new StringType(); // bb
235      return this.version;
236    }
237
238    public boolean hasVersionElement() { 
239      return this.version != null && !this.version.isEmpty();
240    }
241
242    public boolean hasVersion() { 
243      return this.version != null && !this.version.isEmpty();
244    }
245
246    /**
247     * @param value {@link #version} (The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
248     */
249    public MetadataResource setVersionElement(StringType value) { 
250      this.version = value;
251      return this;
252    }
253
254    /**
255     * @return The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
256     */
257    public String getVersion() { 
258      return this.version == null ? null : this.version.getValue();
259    }
260
261    /**
262     * @param value The identifier that is used to identify this version of the metadata resource when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the metadata resource author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
263     */
264    public MetadataResource setVersion(String value) { 
265      if (Utilities.noString(value))
266        this.version = null;
267      else {
268        if (this.version == null)
269          this.version = new StringType();
270        this.version.setValue(value);
271      }
272      return this;
273    }
274
275    /**
276     * @return {@link #name} (A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
277     */
278    public StringType getNameElement() { 
279      if (this.name == null)
280        if (Configuration.errorOnAutoCreate())
281          throw new Error("Attempt to auto-create MetadataResource.name");
282        else if (Configuration.doAutoCreate())
283          this.name = new StringType(); // bb
284      return this.name;
285    }
286
287    public boolean hasNameElement() { 
288      return this.name != null && !this.name.isEmpty();
289    }
290
291    public boolean hasName() { 
292      return this.name != null && !this.name.isEmpty();
293    }
294
295    /**
296     * @param value {@link #name} (A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
297     */
298    public MetadataResource setNameElement(StringType value) { 
299      this.name = value;
300      return this;
301    }
302
303    /**
304     * @return A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation.
305     */
306    public String getName() { 
307      return this.name == null ? null : this.name.getValue();
308    }
309
310    /**
311     * @param value A natural language name identifying the metadata resource. This name should be usable as an identifier for the module by machine processing applications such as code generation.
312     */
313    public MetadataResource setName(String value) { 
314      if (Utilities.noString(value))
315        this.name = null;
316      else {
317        if (this.name == null)
318          this.name = new StringType();
319        this.name.setValue(value);
320      }
321      return this;
322    }
323
324    /**
325     * @return {@link #title} (A short, descriptive, user-friendly title for the metadata resource.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
326     */
327    public StringType getTitleElement() { 
328      if (this.title == null)
329        if (Configuration.errorOnAutoCreate())
330          throw new Error("Attempt to auto-create MetadataResource.title");
331        else if (Configuration.doAutoCreate())
332          this.title = new StringType(); // bb
333      return this.title;
334    }
335
336    public boolean hasTitleElement() { 
337      return this.title != null && !this.title.isEmpty();
338    }
339
340    public boolean hasTitle() { 
341      return this.title != null && !this.title.isEmpty();
342    }
343
344    /**
345     * @param value {@link #title} (A short, descriptive, user-friendly title for the metadata resource.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
346     */
347    public MetadataResource setTitleElement(StringType value) { 
348      this.title = value;
349      return this;
350    }
351
352    /**
353     * @return A short, descriptive, user-friendly title for the metadata resource.
354     */
355    public String getTitle() { 
356      return this.title == null ? null : this.title.getValue();
357    }
358
359    /**
360     * @param value A short, descriptive, user-friendly title for the metadata resource.
361     */
362    public MetadataResource setTitle(String value) { 
363      if (Utilities.noString(value))
364        this.title = null;
365      else {
366        if (this.title == null)
367          this.title = new StringType();
368        this.title.setValue(value);
369      }
370      return this;
371    }
372
373    /**
374     * @return {@link #status} (The status of this metadata resource. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
375     */
376    public Enumeration<PublicationStatus> getStatusElement() { 
377      if (this.status == null)
378        if (Configuration.errorOnAutoCreate())
379          throw new Error("Attempt to auto-create MetadataResource.status");
380        else if (Configuration.doAutoCreate())
381          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
382      return this.status;
383    }
384
385    public boolean hasStatusElement() { 
386      return this.status != null && !this.status.isEmpty();
387    }
388
389    public boolean hasStatus() { 
390      return this.status != null && !this.status.isEmpty();
391    }
392
393    /**
394     * @param value {@link #status} (The status of this metadata resource. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
395     */
396    public MetadataResource setStatusElement(Enumeration<PublicationStatus> value) { 
397      this.status = value;
398      return this;
399    }
400
401    /**
402     * @return The status of this metadata resource. Enables tracking the life-cycle of the content.
403     */
404    public PublicationStatus getStatus() { 
405      return this.status == null ? null : this.status.getValue();
406    }
407
408    /**
409     * @param value The status of this metadata resource. Enables tracking the life-cycle of the content.
410     */
411    public MetadataResource setStatus(PublicationStatus value) { 
412        if (this.status == null)
413          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
414        this.status.setValue(value);
415      return this;
416    }
417
418    /**
419     * @return {@link #experimental} (A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
420     */
421    public BooleanType getExperimentalElement() { 
422      if (this.experimental == null)
423        if (Configuration.errorOnAutoCreate())
424          throw new Error("Attempt to auto-create MetadataResource.experimental");
425        else if (Configuration.doAutoCreate())
426          this.experimental = new BooleanType(); // bb
427      return this.experimental;
428    }
429
430    public boolean hasExperimentalElement() { 
431      return this.experimental != null && !this.experimental.isEmpty();
432    }
433
434    public boolean hasExperimental() { 
435      return this.experimental != null && !this.experimental.isEmpty();
436    }
437
438    /**
439     * @param value {@link #experimental} (A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
440     */
441    public MetadataResource setExperimentalElement(BooleanType value) { 
442      this.experimental = value;
443      return this;
444    }
445
446    /**
447     * @return A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
448     */
449    public boolean getExperimental() { 
450      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
451    }
452
453    /**
454     * @param value A Boolean value to indicate that this metadata resource is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
455     */
456    public MetadataResource setExperimental(boolean value) { 
457        if (this.experimental == null)
458          this.experimental = new BooleanType();
459        this.experimental.setValue(value);
460      return this;
461    }
462
463    /**
464     * @return {@link #date} (The date  (and optionally time) when the metadata resource 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 metadata resource changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
465     */
466    public DateTimeType getDateElement() { 
467      if (this.date == null)
468        if (Configuration.errorOnAutoCreate())
469          throw new Error("Attempt to auto-create MetadataResource.date");
470        else if (Configuration.doAutoCreate())
471          this.date = new DateTimeType(); // bb
472      return this.date;
473    }
474
475    public boolean hasDateElement() { 
476      return this.date != null && !this.date.isEmpty();
477    }
478
479    public boolean hasDate() { 
480      return this.date != null && !this.date.isEmpty();
481    }
482
483    /**
484     * @param value {@link #date} (The date  (and optionally time) when the metadata resource 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 metadata resource changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
485     */
486    public MetadataResource setDateElement(DateTimeType value) { 
487      this.date = value;
488      return this;
489    }
490
491    /**
492     * @return The date  (and optionally time) when the metadata resource 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 metadata resource changes.
493     */
494    public Date getDate() { 
495      return this.date == null ? null : this.date.getValue();
496    }
497
498    /**
499     * @param value The date  (and optionally time) when the metadata resource 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 metadata resource changes.
500     */
501    public MetadataResource setDate(Date value) { 
502      if (value == null)
503        this.date = null;
504      else {
505        if (this.date == null)
506          this.date = new DateTimeType();
507        this.date.setValue(value);
508      }
509      return this;
510    }
511
512    /**
513     * @return {@link #publisher} (The name of the organization or individual that published the metadata resource.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
514     */
515    public StringType getPublisherElement() { 
516      if (this.publisher == null)
517        if (Configuration.errorOnAutoCreate())
518          throw new Error("Attempt to auto-create MetadataResource.publisher");
519        else if (Configuration.doAutoCreate())
520          this.publisher = new StringType(); // bb
521      return this.publisher;
522    }
523
524    public boolean hasPublisherElement() { 
525      return this.publisher != null && !this.publisher.isEmpty();
526    }
527
528    public boolean hasPublisher() { 
529      return this.publisher != null && !this.publisher.isEmpty();
530    }
531
532    /**
533     * @param value {@link #publisher} (The name of the organization or individual that published the metadata resource.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
534     */
535    public MetadataResource setPublisherElement(StringType value) { 
536      this.publisher = value;
537      return this;
538    }
539
540    /**
541     * @return The name of the organization or individual that published the metadata resource.
542     */
543    public String getPublisher() { 
544      return this.publisher == null ? null : this.publisher.getValue();
545    }
546
547    /**
548     * @param value The name of the organization or individual that published the metadata resource.
549     */
550    public MetadataResource setPublisher(String value) { 
551      if (Utilities.noString(value))
552        this.publisher = null;
553      else {
554        if (this.publisher == null)
555          this.publisher = new StringType();
556        this.publisher.setValue(value);
557      }
558      return this;
559    }
560
561    /**
562     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
563     */
564    public List<ContactDetail> getContact() { 
565      if (this.contact == null)
566        this.contact = new ArrayList<ContactDetail>();
567      return this.contact;
568    }
569
570    /**
571     * @return Returns a reference to <code>this</code> for easy method chaining
572     */
573    public MetadataResource setContact(List<ContactDetail> theContact) { 
574      this.contact = theContact;
575      return this;
576    }
577
578    public boolean hasContact() { 
579      if (this.contact == null)
580        return false;
581      for (ContactDetail item : this.contact)
582        if (!item.isEmpty())
583          return true;
584      return false;
585    }
586
587    public ContactDetail addContact() { //3
588      ContactDetail t = new ContactDetail();
589      if (this.contact == null)
590        this.contact = new ArrayList<ContactDetail>();
591      this.contact.add(t);
592      return t;
593    }
594
595    public MetadataResource addContact(ContactDetail t) { //3
596      if (t == null)
597        return this;
598      if (this.contact == null)
599        this.contact = new ArrayList<ContactDetail>();
600      this.contact.add(t);
601      return this;
602    }
603
604    /**
605     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
606     */
607    public ContactDetail getContactFirstRep() { 
608      if (getContact().isEmpty()) {
609        addContact();
610      }
611      return getContact().get(0);
612    }
613
614    /**
615     * @return {@link #description} (A free text natural language description of the metadata resource from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
616     */
617    public MarkdownType getDescriptionElement() { 
618      if (this.description == null)
619        if (Configuration.errorOnAutoCreate())
620          throw new Error("Attempt to auto-create MetadataResource.description");
621        else if (Configuration.doAutoCreate())
622          this.description = new MarkdownType(); // bb
623      return this.description;
624    }
625
626    public boolean hasDescriptionElement() { 
627      return this.description != null && !this.description.isEmpty();
628    }
629
630    public boolean hasDescription() { 
631      return this.description != null && !this.description.isEmpty();
632    }
633
634    /**
635     * @param value {@link #description} (A free text natural language description of the metadata resource from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
636     */
637    public MetadataResource setDescriptionElement(MarkdownType value) { 
638      this.description = value;
639      return this;
640    }
641
642    /**
643     * @return A free text natural language description of the metadata resource from a consumer's perspective.
644     */
645    public String getDescription() { 
646      return this.description == null ? null : this.description.getValue();
647    }
648
649    /**
650     * @param value A free text natural language description of the metadata resource from a consumer's perspective.
651     */
652    public MetadataResource setDescription(String value) { 
653      if (value == null)
654        this.description = null;
655      else {
656        if (this.description == null)
657          this.description = new MarkdownType();
658        this.description.setValue(value);
659      }
660      return this;
661    }
662
663    /**
664     * @return {@link #useContext} (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 metadata resource instances.)
665     */
666    public List<UsageContext> getUseContext() { 
667      if (this.useContext == null)
668        this.useContext = new ArrayList<UsageContext>();
669      return this.useContext;
670    }
671
672    /**
673     * @return Returns a reference to <code>this</code> for easy method chaining
674     */
675    public MetadataResource setUseContext(List<UsageContext> theUseContext) { 
676      this.useContext = theUseContext;
677      return this;
678    }
679
680    public boolean hasUseContext() { 
681      if (this.useContext == null)
682        return false;
683      for (UsageContext item : this.useContext)
684        if (!item.isEmpty())
685          return true;
686      return false;
687    }
688
689    public UsageContext addUseContext() { //3
690      UsageContext t = new UsageContext();
691      if (this.useContext == null)
692        this.useContext = new ArrayList<UsageContext>();
693      this.useContext.add(t);
694      return t;
695    }
696
697    public MetadataResource addUseContext(UsageContext t) { //3
698      if (t == null)
699        return this;
700      if (this.useContext == null)
701        this.useContext = new ArrayList<UsageContext>();
702      this.useContext.add(t);
703      return this;
704    }
705
706    /**
707     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
708     */
709    public UsageContext getUseContextFirstRep() { 
710      if (getUseContext().isEmpty()) {
711        addUseContext();
712      }
713      return getUseContext().get(0);
714    }
715
716    /**
717     * @return {@link #jurisdiction} (A legal or geographic region in which the metadata resource is intended to be used.)
718     */
719    public List<CodeableConcept> getJurisdiction() { 
720      if (this.jurisdiction == null)
721        this.jurisdiction = new ArrayList<CodeableConcept>();
722      return this.jurisdiction;
723    }
724
725    /**
726     * @return Returns a reference to <code>this</code> for easy method chaining
727     */
728    public MetadataResource setJurisdiction(List<CodeableConcept> theJurisdiction) { 
729      this.jurisdiction = theJurisdiction;
730      return this;
731    }
732
733    public boolean hasJurisdiction() { 
734      if (this.jurisdiction == null)
735        return false;
736      for (CodeableConcept item : this.jurisdiction)
737        if (!item.isEmpty())
738          return true;
739      return false;
740    }
741
742    public CodeableConcept addJurisdiction() { //3
743      CodeableConcept t = new CodeableConcept();
744      if (this.jurisdiction == null)
745        this.jurisdiction = new ArrayList<CodeableConcept>();
746      this.jurisdiction.add(t);
747      return t;
748    }
749
750    public MetadataResource addJurisdiction(CodeableConcept t) { //3
751      if (t == null)
752        return this;
753      if (this.jurisdiction == null)
754        this.jurisdiction = new ArrayList<CodeableConcept>();
755      this.jurisdiction.add(t);
756      return this;
757    }
758
759    /**
760     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
761     */
762    public CodeableConcept getJurisdictionFirstRep() { 
763      if (getJurisdiction().isEmpty()) {
764        addJurisdiction();
765      }
766      return getJurisdiction().get(0);
767    }
768
769      protected void listChildren(List<Property> children) {
770     // todo: add a flag to decide whether to do this... super.listChildren(children);
771      }
772
773      @Override
774      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
775        switch (hash) {
776        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
777        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
778        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
779        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
780        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
781        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
782        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
783        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
784        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
785        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
786        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
787        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
788        default: return super.getProperty(hash, name, checkValid);
789        }
790
791      }
792
793      @Override
794      public Base setProperty(int hash, String name, Base value) throws FHIRException {
795        switch (hash) {
796        case 116079: // url
797          this.url = castToUri(value); // UriType
798          return value;
799        case 351608024: // version
800          this.version = castToString(value); // StringType
801          return value;
802        case 3373707: // name
803          this.name = castToString(value); // StringType
804          return value;
805        case 110371416: // title
806          this.title = castToString(value); // StringType
807          return value;
808        case -892481550: // status
809          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
810          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
811          return value;
812        case -404562712: // experimental
813          this.experimental = castToBoolean(value); // BooleanType
814          return value;
815        case 3076014: // date
816          this.date = castToDateTime(value); // DateTimeType
817          return value;
818        case 1447404028: // publisher
819          this.publisher = castToString(value); // StringType
820          return value;
821        case 951526432: // contact
822          this.getContact().add(castToContactDetail(value)); // ContactDetail
823          return value;
824        case -1724546052: // description
825          this.description = castToMarkdown(value); // MarkdownType
826          return value;
827        case -669707736: // useContext
828          this.getUseContext().add(castToUsageContext(value)); // UsageContext
829          return value;
830        case -507075711: // jurisdiction
831          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
832          return value;
833        default: return super.setProperty(hash, name, value);
834        }
835
836      }
837
838      @Override
839      public Base setProperty(String name, Base value) throws FHIRException {
840        if (name.equals("url")) {
841          this.url = castToUri(value); // UriType
842        } else if (name.equals("version")) {
843          this.version = castToString(value); // StringType
844        } else if (name.equals("name")) {
845          this.name = castToString(value); // StringType
846        } else if (name.equals("title")) {
847          this.title = castToString(value); // StringType
848        } else if (name.equals("status")) {
849          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
850          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
851        } else if (name.equals("experimental")) {
852          this.experimental = castToBoolean(value); // BooleanType
853        } else if (name.equals("date")) {
854          this.date = castToDateTime(value); // DateTimeType
855        } else if (name.equals("publisher")) {
856          this.publisher = castToString(value); // StringType
857        } else if (name.equals("contact")) {
858          this.getContact().add(castToContactDetail(value));
859        } else if (name.equals("description")) {
860          this.description = castToMarkdown(value); // MarkdownType
861        } else if (name.equals("useContext")) {
862          this.getUseContext().add(castToUsageContext(value));
863        } else if (name.equals("jurisdiction")) {
864          this.getJurisdiction().add(castToCodeableConcept(value));
865        } else
866          return super.setProperty(name, value);
867        return value;
868      }
869
870      @Override
871      public Base makeProperty(int hash, String name) throws FHIRException {
872        switch (hash) {
873        case 116079:  return getUrlElement();
874        case 351608024:  return getVersionElement();
875        case 3373707:  return getNameElement();
876        case 110371416:  return getTitleElement();
877        case -892481550:  return getStatusElement();
878        case -404562712:  return getExperimentalElement();
879        case 3076014:  return getDateElement();
880        case 1447404028:  return getPublisherElement();
881        case 951526432:  return addContact(); 
882        case -1724546052:  return getDescriptionElement();
883        case -669707736:  return addUseContext(); 
884        case -507075711:  return addJurisdiction(); 
885        default: return super.makeProperty(hash, name);
886        }
887
888      }
889
890      @Override
891      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
892        switch (hash) {
893        case 116079: /*url*/ return new String[] {"uri"};
894        case 351608024: /*version*/ return new String[] {"string"};
895        case 3373707: /*name*/ return new String[] {"string"};
896        case 110371416: /*title*/ return new String[] {"string"};
897        case -892481550: /*status*/ return new String[] {"code"};
898        case -404562712: /*experimental*/ return new String[] {"boolean"};
899        case 3076014: /*date*/ return new String[] {"dateTime"};
900        case 1447404028: /*publisher*/ return new String[] {"string"};
901        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
902        case -1724546052: /*description*/ return new String[] {"markdown"};
903        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
904        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
905        default: return super.getTypesForProperty(hash, name);
906        }
907
908      }
909
910      @Override
911      public Base addChild(String name) throws FHIRException {
912        if (name.equals("url")) {
913          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.url");
914        }
915        else if (name.equals("version")) {
916          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.version");
917        }
918        else if (name.equals("name")) {
919          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.name");
920        }
921        else if (name.equals("title")) {
922          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.title");
923        }
924        else if (name.equals("status")) {
925          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.status");
926        }
927        else if (name.equals("experimental")) {
928          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.experimental");
929        }
930        else if (name.equals("date")) {
931          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.date");
932        }
933        else if (name.equals("publisher")) {
934          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.publisher");
935        }
936        else if (name.equals("contact")) {
937          return addContact();
938        }
939        else if (name.equals("description")) {
940          throw new FHIRException("Cannot call addChild on a primitive type MetadataResource.description");
941        }
942        else if (name.equals("useContext")) {
943          return addUseContext();
944        }
945        else if (name.equals("jurisdiction")) {
946          return addJurisdiction();
947        }
948        else
949          return super.addChild(name);
950      }
951
952  public String fhirType() {
953    return "MetadataResource";
954
955  }
956
957      public abstract MetadataResource copy();
958
959      public void copyValues(MetadataResource dst) {
960        super.copyValues(dst);
961        dst.url = url == null ? null : url.copy();
962        dst.version = version == null ? null : version.copy();
963        dst.name = name == null ? null : name.copy();
964        dst.title = title == null ? null : title.copy();
965        dst.status = status == null ? null : status.copy();
966        dst.experimental = experimental == null ? null : experimental.copy();
967        dst.date = date == null ? null : date.copy();
968        dst.publisher = publisher == null ? null : publisher.copy();
969        if (contact != null) {
970          dst.contact = new ArrayList<ContactDetail>();
971          for (ContactDetail i : contact)
972            dst.contact.add(i.copy());
973        };
974        dst.description = description == null ? null : description.copy();
975        if (useContext != null) {
976          dst.useContext = new ArrayList<UsageContext>();
977          for (UsageContext i : useContext)
978            dst.useContext.add(i.copy());
979        };
980        if (jurisdiction != null) {
981          dst.jurisdiction = new ArrayList<CodeableConcept>();
982          for (CodeableConcept i : jurisdiction)
983            dst.jurisdiction.add(i.copy());
984        };
985      }
986
987      @Override
988      public boolean equalsDeep(Base other_) {
989        if (!super.equalsDeep(other_))
990          return false;
991        if (!(other_ instanceof MetadataResource))
992          return false;
993        MetadataResource o = (MetadataResource) other_;
994        return compareDeep(url, o.url, true) && compareDeep(version, o.version, true) && compareDeep(name, o.name, true)
995           && compareDeep(title, o.title, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
996           && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true)
997           && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
998           && compareDeep(jurisdiction, o.jurisdiction, true);
999      }
1000
1001      @Override
1002      public boolean equalsShallow(Base other_) {
1003        if (!super.equalsShallow(other_))
1004          return false;
1005        if (!(other_ instanceof MetadataResource))
1006          return false;
1007        MetadataResource o = (MetadataResource) other_;
1008        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
1009           && compareValues(title, o.title, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
1010           && compareValues(date, o.date, true) && compareValues(publisher, o.publisher, true) && compareValues(description, o.description, true)
1011          ;
1012      }
1013
1014      public boolean isEmpty() {
1015        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, version, name, title
1016          , status, experimental, date, publisher, contact, description, useContext, jurisdiction
1017          );
1018      }
1019
1020// added from java-adornments.txt:
1021      @Override
1022      public String toString() {
1023        return fhirType()+"["+getUrl()+"]";
1024      }
1025      
1026      public String present() {
1027        if (hasTitle())
1028          return getTitle();
1029        if (hasName())
1030          return getName();
1031        return toString();
1032      }      
1033
1034// end addition
1035
1036}
1037