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.instance.model.api.IBaseMetaType;
059import org.hl7.fhir.utilities.Utilities;
060
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.DatatypeDef;
063import ca.uhn.fhir.model.api.annotation.Description;
064/**
065 * The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
066 */
067@DatatypeDef(name="Meta")
068public class Meta extends Type implements IBaseMetaType {
069
070    /**
071     * The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
072     */
073    @Child(name = "versionId", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=true)
074    @Description(shortDefinition="Version specific identifier", formalDefinition="The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted." )
075    protected IdType versionId;
076
077    /**
078     * When the resource last changed - e.g. when the version changed.
079     */
080    @Child(name = "lastUpdated", type = {InstantType.class}, order=1, min=0, max=1, modifier=false, summary=true)
081    @Description(shortDefinition="When the resource version last changed", formalDefinition="When the resource last changed - e.g. when the version changed." )
082    protected InstantType lastUpdated;
083
084    /**
085     * A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
086     */
087    @Child(name = "source", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
088    @Description(shortDefinition="Identifies where the resource comes from", formalDefinition="A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc." )
089    protected UriType source;
090
091    /**
092     * A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].
093     */
094    @Child(name = "profile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
095    @Description(shortDefinition="Profiles this resource claims to conform to", formalDefinition="A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]." )
096    protected List<CanonicalType> profile;
097
098    /**
099     * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.
100     */
101    @Child(name = "security", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
102    @Description(shortDefinition="Security Labels applied to this resource", formalDefinition="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure." )
103    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
104    protected List<Coding> security;
105
106    /**
107     * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.
108     */
109    @Child(name = "tag", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
110    @Description(shortDefinition="Tags applied to this resource", formalDefinition="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource." )
111    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/common-tags")
112    protected List<Coding> tag;
113
114    private static final long serialVersionUID = -1386695622L;
115
116  /**
117   * Constructor
118   */
119    public Meta() {
120      super();
121    }
122
123    /**
124     * @return {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
125     */
126    public IdType getVersionIdElement() { 
127      if (this.versionId == null)
128        if (Configuration.errorOnAutoCreate())
129          throw new Error("Attempt to auto-create Meta.versionId");
130        else if (Configuration.doAutoCreate())
131          this.versionId = new IdType(); // bb
132      return this.versionId;
133    }
134
135    public boolean hasVersionIdElement() { 
136      return this.versionId != null && !this.versionId.isEmpty();
137    }
138
139    public boolean hasVersionId() { 
140      return this.versionId != null && !this.versionId.isEmpty();
141    }
142
143    /**
144     * @param value {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
145     */
146    public Meta setVersionIdElement(IdType value) { 
147      this.versionId = value;
148      return this;
149    }
150
151    /**
152     * @return The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
153     */
154    public String getVersionId() { 
155      return this.versionId == null ? null : this.versionId.getValue();
156    }
157
158    /**
159     * @param value The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
160     */
161    public Meta setVersionId(String value) { 
162      if (Utilities.noString(value))
163        this.versionId = null;
164      else {
165        if (this.versionId == null)
166          this.versionId = new IdType();
167        this.versionId.setValue(value);
168      }
169      return this;
170    }
171
172    /**
173     * @return {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
174     */
175    public InstantType getLastUpdatedElement() { 
176      if (this.lastUpdated == null)
177        if (Configuration.errorOnAutoCreate())
178          throw new Error("Attempt to auto-create Meta.lastUpdated");
179        else if (Configuration.doAutoCreate())
180          this.lastUpdated = new InstantType(); // bb
181      return this.lastUpdated;
182    }
183
184    public boolean hasLastUpdatedElement() { 
185      return this.lastUpdated != null && !this.lastUpdated.isEmpty();
186    }
187
188    public boolean hasLastUpdated() { 
189      return this.lastUpdated != null && !this.lastUpdated.isEmpty();
190    }
191
192    /**
193     * @param value {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
194     */
195    public Meta setLastUpdatedElement(InstantType value) { 
196      this.lastUpdated = value;
197      return this;
198    }
199
200    /**
201     * @return When the resource last changed - e.g. when the version changed.
202     */
203    public Date getLastUpdated() { 
204      return this.lastUpdated == null ? null : this.lastUpdated.getValue();
205    }
206
207    /**
208     * @param value When the resource last changed - e.g. when the version changed.
209     */
210    public Meta setLastUpdated(Date value) { 
211      if (value == null)
212        this.lastUpdated = null;
213      else {
214        if (this.lastUpdated == null)
215          this.lastUpdated = new InstantType();
216        this.lastUpdated.setValue(value);
217      }
218      return this;
219    }
220
221    /**
222     * @return {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
223     */
224    public UriType getSourceElement() { 
225      if (this.source == null)
226        if (Configuration.errorOnAutoCreate())
227          throw new Error("Attempt to auto-create Meta.source");
228        else if (Configuration.doAutoCreate())
229          this.source = new UriType(); // bb
230      return this.source;
231    }
232
233    public boolean hasSourceElement() { 
234      return this.source != null && !this.source.isEmpty();
235    }
236
237    public boolean hasSource() { 
238      return this.source != null && !this.source.isEmpty();
239    }
240
241    /**
242     * @param value {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
243     */
244    public Meta setSourceElement(UriType value) { 
245      this.source = value;
246      return this;
247    }
248
249    /**
250     * @return A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
251     */
252    public String getSource() { 
253      return this.source == null ? null : this.source.getValue();
254    }
255
256    /**
257     * @param value A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
258     */
259    public Meta setSource(String value) { 
260      if (Utilities.noString(value))
261        this.source = null;
262      else {
263        if (this.source == null)
264          this.source = new UriType();
265        this.source.setValue(value);
266      }
267      return this;
268    }
269
270    /**
271     * @return {@link #profile} (A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].)
272     */
273    public List<CanonicalType> getProfile() { 
274      if (this.profile == null)
275        this.profile = new ArrayList<CanonicalType>();
276      return this.profile;
277    }
278
279    /**
280     * @return Returns a reference to <code>this</code> for easy method chaining
281     */
282    public Meta setProfile(List<CanonicalType> theProfile) { 
283      this.profile = theProfile;
284      return this;
285    }
286
287    public boolean hasProfile() { 
288      if (this.profile == null)
289        return false;
290      for (CanonicalType item : this.profile)
291        if (!item.isEmpty())
292          return true;
293      return false;
294    }
295
296    /**
297     * @return {@link #profile} (A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].)
298     */
299    public CanonicalType addProfileElement() {//2 
300      CanonicalType t = new CanonicalType();
301      if (this.profile == null)
302        this.profile = new ArrayList<CanonicalType>();
303      this.profile.add(t);
304      return t;
305    }
306
307    /**
308     * @param value {@link #profile} (A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].)
309     */
310    public Meta addProfile(String value) { //1
311      CanonicalType t = new CanonicalType();
312      t.setValue(value);
313      if (this.profile == null)
314        this.profile = new ArrayList<CanonicalType>();
315      this.profile.add(t);
316      return this;
317    }
318
319    /**
320     * @param value {@link #profile} (A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].)
321     */
322    public boolean hasProfile(String value) { 
323      if (this.profile == null)
324        return false;
325      for (CanonicalType v : this.profile)
326        if (v.getValue().equals(value)) // canonical(StructureDefinition)
327          return true;
328      return false;
329    }
330
331    /**
332     * @return {@link #security} (Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.)
333     */
334    public List<Coding> getSecurity() { 
335      if (this.security == null)
336        this.security = new ArrayList<Coding>();
337      return this.security;
338    }
339
340    /**
341     * @return Returns a reference to <code>this</code> for easy method chaining
342     */
343    public Meta setSecurity(List<Coding> theSecurity) { 
344      this.security = theSecurity;
345      return this;
346    }
347
348    public boolean hasSecurity() { 
349      if (this.security == null)
350        return false;
351      for (Coding item : this.security)
352        if (!item.isEmpty())
353          return true;
354      return false;
355    }
356
357    public Coding addSecurity() { //3
358      Coding t = new Coding();
359      if (this.security == null)
360        this.security = new ArrayList<Coding>();
361      this.security.add(t);
362      return t;
363    }
364
365    public Meta addSecurity(Coding t) { //3
366      if (t == null)
367        return this;
368      if (this.security == null)
369        this.security = new ArrayList<Coding>();
370      this.security.add(t);
371      return this;
372    }
373
374    /**
375     * @return The first repetition of repeating field {@link #security}, creating it if it does not already exist
376     */
377    public Coding getSecurityFirstRep() { 
378      if (getSecurity().isEmpty()) {
379        addSecurity();
380      }
381      return getSecurity().get(0);
382    }
383
384    /**
385     * @return {@link #tag} (Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.)
386     */
387    public List<Coding> getTag() { 
388      if (this.tag == null)
389        this.tag = new ArrayList<Coding>();
390      return this.tag;
391    }
392
393    /**
394     * @return Returns a reference to <code>this</code> for easy method chaining
395     */
396    public Meta setTag(List<Coding> theTag) { 
397      this.tag = theTag;
398      return this;
399    }
400
401    public boolean hasTag() { 
402      if (this.tag == null)
403        return false;
404      for (Coding item : this.tag)
405        if (!item.isEmpty())
406          return true;
407      return false;
408    }
409
410    public Coding addTag() { //3
411      Coding t = new Coding();
412      if (this.tag == null)
413        this.tag = new ArrayList<Coding>();
414      this.tag.add(t);
415      return t;
416    }
417
418    public Meta addTag(Coding t) { //3
419      if (t == null)
420        return this;
421      if (this.tag == null)
422        this.tag = new ArrayList<Coding>();
423      this.tag.add(t);
424      return this;
425    }
426
427    /**
428     * @return The first repetition of repeating field {@link #tag}, creating it if it does not already exist
429     */
430    public Coding getTagFirstRep() { 
431      if (getTag().isEmpty()) {
432        addTag();
433      }
434      return getTag().get(0);
435    }
436
437    /**
438     * Convenience method which adds a tag
439     * 
440     * @param theSystem The code system
441     * @param theCode The code
442     * @param theDisplay The display name
443     * @return Returns a reference to <code>this</code> for easy chaining
444     */
445    public Meta addTag(String theSystem, String theCode, String theDisplay) {
446     addTag().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay);
447     return this;
448    }
449    /**
450     * Convenience method which adds a security tag
451     * 
452     * @param theSystem The code system
453     * @param theCode The code
454     * @param theDisplay The display name
455     * @return Returns a reference to <code>this</code> for easy chaining
456     */
457    public Meta addSecurity(String theSystem, String theCode, String theDisplay) {
458     addSecurity().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay);
459     return this;
460    }
461   /**
462   * Returns the first tag (if any) that has the given system and code, or returns
463   * <code>null</code> if none
464   */
465  public Coding getTag(String theSystem, String theCode) {
466    for (Coding next : getTag()) {
467      if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
468        return next;
469      }
470    }
471    return null;
472  }
473
474  /**
475   * Returns the first security label (if any) that has the given system and code, or returns
476   * <code>null</code> if none
477   */
478  public Coding getSecurity(String theSystem, String theCode) {
479    for (Coding next : getTag()) {
480      if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
481        return next;
482      }
483    }
484    return null;
485  }
486      protected void listChildren(List<Property> children) {
487        super.listChildren(children);
488        children.add(new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId));
489        children.add(new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated));
490        children.add(new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source));
491        children.add(new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].", 0, java.lang.Integer.MAX_VALUE, profile));
492        children.add(new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security));
493        children.add(new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag));
494      }
495
496      @Override
497      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
498        switch (_hash) {
499        case -1407102957: /*versionId*/  return new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId);
500        case 1649733957: /*lastUpdated*/  return new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated);
501        case -896505829: /*source*/  return new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source);
502        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]].", 0, java.lang.Integer.MAX_VALUE, profile);
503        case 949122880: /*security*/  return new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security);
504        case 114586: /*tag*/  return new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag);
505        default: return super.getNamedProperty(_hash, _name, _checkValid);
506        }
507
508      }
509
510      @Override
511      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
512        switch (hash) {
513        case -1407102957: /*versionId*/ return this.versionId == null ? new Base[0] : new Base[] {this.versionId}; // IdType
514        case 1649733957: /*lastUpdated*/ return this.lastUpdated == null ? new Base[0] : new Base[] {this.lastUpdated}; // InstantType
515        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // UriType
516        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
517        case 949122880: /*security*/ return this.security == null ? new Base[0] : this.security.toArray(new Base[this.security.size()]); // Coding
518        case 114586: /*tag*/ return this.tag == null ? new Base[0] : this.tag.toArray(new Base[this.tag.size()]); // Coding
519        default: return super.getProperty(hash, name, checkValid);
520        }
521
522      }
523
524      @Override
525      public Base setProperty(int hash, String name, Base value) throws FHIRException {
526        switch (hash) {
527        case -1407102957: // versionId
528          this.versionId = castToId(value); // IdType
529          return value;
530        case 1649733957: // lastUpdated
531          this.lastUpdated = castToInstant(value); // InstantType
532          return value;
533        case -896505829: // source
534          this.source = castToUri(value); // UriType
535          return value;
536        case -309425751: // profile
537          this.getProfile().add(castToCanonical(value)); // CanonicalType
538          return value;
539        case 949122880: // security
540          this.getSecurity().add(castToCoding(value)); // Coding
541          return value;
542        case 114586: // tag
543          this.getTag().add(castToCoding(value)); // Coding
544          return value;
545        default: return super.setProperty(hash, name, value);
546        }
547
548      }
549
550      @Override
551      public Base setProperty(String name, Base value) throws FHIRException {
552        if (name.equals("versionId")) {
553          this.versionId = castToId(value); // IdType
554        } else if (name.equals("lastUpdated")) {
555          this.lastUpdated = castToInstant(value); // InstantType
556        } else if (name.equals("source")) {
557          this.source = castToUri(value); // UriType
558        } else if (name.equals("profile")) {
559          this.getProfile().add(castToCanonical(value));
560        } else if (name.equals("security")) {
561          this.getSecurity().add(castToCoding(value));
562        } else if (name.equals("tag")) {
563          this.getTag().add(castToCoding(value));
564        } else
565          return super.setProperty(name, value);
566        return value;
567      }
568
569      @Override
570      public Base makeProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case -1407102957:  return getVersionIdElement();
573        case 1649733957:  return getLastUpdatedElement();
574        case -896505829:  return getSourceElement();
575        case -309425751:  return addProfileElement();
576        case 949122880:  return addSecurity(); 
577        case 114586:  return addTag(); 
578        default: return super.makeProperty(hash, name);
579        }
580
581      }
582
583      @Override
584      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
585        switch (hash) {
586        case -1407102957: /*versionId*/ return new String[] {"id"};
587        case 1649733957: /*lastUpdated*/ return new String[] {"instant"};
588        case -896505829: /*source*/ return new String[] {"uri"};
589        case -309425751: /*profile*/ return new String[] {"canonical"};
590        case 949122880: /*security*/ return new String[] {"Coding"};
591        case 114586: /*tag*/ return new String[] {"Coding"};
592        default: return super.getTypesForProperty(hash, name);
593        }
594
595      }
596
597      @Override
598      public Base addChild(String name) throws FHIRException {
599        if (name.equals("versionId")) {
600          throw new FHIRException("Cannot call addChild on a primitive type Meta.versionId");
601        }
602        else if (name.equals("lastUpdated")) {
603          throw new FHIRException("Cannot call addChild on a primitive type Meta.lastUpdated");
604        }
605        else if (name.equals("source")) {
606          throw new FHIRException("Cannot call addChild on a primitive type Meta.source");
607        }
608        else if (name.equals("profile")) {
609          throw new FHIRException("Cannot call addChild on a primitive type Meta.profile");
610        }
611        else if (name.equals("security")) {
612          return addSecurity();
613        }
614        else if (name.equals("tag")) {
615          return addTag();
616        }
617        else
618          return super.addChild(name);
619      }
620
621  public String fhirType() {
622    return "Meta";
623
624  }
625
626      public Meta copy() {
627        Meta dst = new Meta();
628        copyValues(dst);
629        dst.versionId = versionId == null ? null : versionId.copy();
630        dst.lastUpdated = lastUpdated == null ? null : lastUpdated.copy();
631        dst.source = source == null ? null : source.copy();
632        if (profile != null) {
633          dst.profile = new ArrayList<CanonicalType>();
634          for (CanonicalType i : profile)
635            dst.profile.add(i.copy());
636        };
637        if (security != null) {
638          dst.security = new ArrayList<Coding>();
639          for (Coding i : security)
640            dst.security.add(i.copy());
641        };
642        if (tag != null) {
643          dst.tag = new ArrayList<Coding>();
644          for (Coding i : tag)
645            dst.tag.add(i.copy());
646        };
647        return dst;
648      }
649
650      protected Meta typedCopy() {
651        return copy();
652      }
653
654      @Override
655      public boolean equalsDeep(Base other_) {
656        if (!super.equalsDeep(other_))
657          return false;
658        if (!(other_ instanceof Meta))
659          return false;
660        Meta o = (Meta) other_;
661        return compareDeep(versionId, o.versionId, true) && compareDeep(lastUpdated, o.lastUpdated, true)
662           && compareDeep(source, o.source, true) && compareDeep(profile, o.profile, true) && compareDeep(security, o.security, true)
663           && compareDeep(tag, o.tag, true);
664      }
665
666      @Override
667      public boolean equalsShallow(Base other_) {
668        if (!super.equalsShallow(other_))
669          return false;
670        if (!(other_ instanceof Meta))
671          return false;
672        Meta o = (Meta) other_;
673        return compareValues(versionId, o.versionId, true) && compareValues(lastUpdated, o.lastUpdated, true)
674           && compareValues(source, o.source, true);
675      }
676
677      public boolean isEmpty() {
678        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(versionId, lastUpdated, source
679          , profile, security, tag);
680      }
681
682
683}
684