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