001package org.hl7.fhir.r5.openehr;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.openehr.Enumerations.*;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.r5.model.*;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * Defines the descriptive meta-data of a resource.
050 */
051@DatatypeDef(name="RESOURCE_DESCRIPTION")
052public class RESOURCE_DESCRIPTION extends LogicalBase implements ICompositeType {
053
054    /**
055     * Original author of this resource, with all relevant details, including organisation.
056     */
057    @Child(name = "original_author", type = {StringType.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
058    @Description(shortDefinition="Original author of this resource, with all relevant details, including organisation", formalDefinition="Original author of this resource, with all relevant details, including organisation." )
059    protected List<StringType> original_authorList;
060
061    /**
062     * Other contributors to the resource, probably listed in 'name <email>' form.
063     */
064    @Child(name = "other_contributors", type = {StringType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
065    @Description(shortDefinition="Other contributors to the resource, probably listed in 'name <email>' form", formalDefinition="Other contributors to the resource, probably listed in 'name <email>' form." )
066    protected List<StringType> other_contributorsList;
067
068    /**
069     * Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.
070     */
071    @Child(name = "lifecycle_state", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
072    @Description(shortDefinition="E.g. initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete", formalDefinition="Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete." )
073    protected StringType lifecycle_state;
074
075    /**
076     * URI of package to which this resource belongs..
077     */
078    @Child(name = "resource_package_uri", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
079    @Description(shortDefinition="URI of package to which this resource belongs", formalDefinition="URI of package to which this resource belongs.." )
080    protected StringType resource_package_uri;
081
082    /**
083     * Additional non language-senstive resource meta-data, as a list of name/value pairs.
084     */
085    @Child(name = "other_details", type = {OBJECT_REF.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
086    @Description(shortDefinition="Additional non language-senstive resource meta-data, as a list of name/value pairs", formalDefinition="Additional non language-senstive resource meta-data, as a list of name/value pairs." )
087    protected List<OBJECT_REF> other_detailsList;
088
089    /**
090     * Reference to owning resource.
091     */
092    @Child(name = "parent_resource", type = {AUTHORED_RESOURCE.class}, order=5, min=1, max=1, modifier=false, summary=false)
093    @Description(shortDefinition="Reference to owning resource", formalDefinition="Reference to owning resource." )
094    protected AUTHORED_RESOURCE parent_resource;
095
096    /**
097     * Details of all parts of resource description that are natural language-dependent, keyed by language code.
098     */
099    @Child(name = "details", type = {RESOURCE_DESCRIPTION_ITEM.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
100    @Description(shortDefinition="Details of all parts of resource description that are natural language-dependent, keyed by language code", formalDefinition="Details of all parts of resource description that are natural language-dependent, keyed by language code." )
101    protected List<RESOURCE_DESCRIPTION_ITEM> detailsList;
102
103    private static final long serialVersionUID = 1426214531L;
104
105  /**
106   * Constructor
107   */
108    public RESOURCE_DESCRIPTION() {
109      super();
110    }
111
112  /**
113   * Constructor
114   */
115    public RESOURCE_DESCRIPTION(String lifecycle_state, AUTHORED_RESOURCE parent_resource) {
116      super();
117      this.setLifecycle_state(lifecycle_state);
118      this.setParent_resource(parent_resource);
119    }
120
121    /**
122     * @return {@link #original_author} (Original author of this resource, with all relevant details, including organisation.)
123     */
124    public List<StringType> getOriginal_authorList() { 
125      if (this.original_authorList == null)
126        this.original_authorList = new ArrayList<StringType>();
127      return this.original_authorList;
128    }
129
130    /**
131     * @return Returns a reference to <code>this</code> for easy method chaining
132     */
133    public RESOURCE_DESCRIPTION setOriginal_authorList(List<StringType> theOriginal_author) { 
134      this.original_authorList = theOriginal_author;
135      return this;
136    }
137
138    public boolean hasOriginal_author() { 
139      if (this.original_authorList == null)
140        return false;
141      for (StringType item : this.original_authorList)
142        if (!item.isEmpty())
143          return true;
144      return false;
145    }
146
147    /**
148     * @return {@link #original_author} (Original author of this resource, with all relevant details, including organisation.)
149     */
150    public StringType addOriginal_authorElement() {//2 
151      StringType t = new StringType();
152      if (this.original_authorList == null)
153        this.original_authorList = new ArrayList<StringType>();
154      this.original_authorList.add(t);
155      return t;
156    }
157
158    /**
159     * @param value {@link #original_author} (Original author of this resource, with all relevant details, including organisation.)
160     */
161    public RESOURCE_DESCRIPTION addOriginal_author(String value) { //1
162      StringType t = new StringType();
163      t.setValue(value);
164      if (this.original_authorList == null)
165        this.original_authorList = new ArrayList<StringType>();
166      this.original_authorList.add(t);
167      return this;
168    }
169
170    /**
171     * @param value {@link #original_author} (Original author of this resource, with all relevant details, including organisation.)
172     */
173    public boolean hasOriginal_author(String value) { 
174      if (this.original_authorList == null)
175        return false;
176      for (StringType v : this.original_authorList)
177        if (v.getValue().equals(value)) // string
178          return true;
179      return false;
180    }
181
182    /**
183     * @return {@link #other_contributors} (Other contributors to the resource, probably listed in 'name <email>' form.)
184     */
185    public List<StringType> getOther_contributorsList() { 
186      if (this.other_contributorsList == null)
187        this.other_contributorsList = new ArrayList<StringType>();
188      return this.other_contributorsList;
189    }
190
191    /**
192     * @return Returns a reference to <code>this</code> for easy method chaining
193     */
194    public RESOURCE_DESCRIPTION setOther_contributorsList(List<StringType> theOther_contributors) { 
195      this.other_contributorsList = theOther_contributors;
196      return this;
197    }
198
199    public boolean hasOther_contributors() { 
200      if (this.other_contributorsList == null)
201        return false;
202      for (StringType item : this.other_contributorsList)
203        if (!item.isEmpty())
204          return true;
205      return false;
206    }
207
208    /**
209     * @return {@link #other_contributors} (Other contributors to the resource, probably listed in 'name <email>' form.)
210     */
211    public StringType addOther_contributorsElement() {//2 
212      StringType t = new StringType();
213      if (this.other_contributorsList == null)
214        this.other_contributorsList = new ArrayList<StringType>();
215      this.other_contributorsList.add(t);
216      return t;
217    }
218
219    /**
220     * @param value {@link #other_contributors} (Other contributors to the resource, probably listed in 'name <email>' form.)
221     */
222    public RESOURCE_DESCRIPTION addOther_contributors(String value) { //1
223      StringType t = new StringType();
224      t.setValue(value);
225      if (this.other_contributorsList == null)
226        this.other_contributorsList = new ArrayList<StringType>();
227      this.other_contributorsList.add(t);
228      return this;
229    }
230
231    /**
232     * @param value {@link #other_contributors} (Other contributors to the resource, probably listed in 'name <email>' form.)
233     */
234    public boolean hasOther_contributors(String value) { 
235      if (this.other_contributorsList == null)
236        return false;
237      for (StringType v : this.other_contributorsList)
238        if (v.getValue().equals(value)) // string
239          return true;
240      return false;
241    }
242
243    /**
244     * @return {@link #lifecycle_state} (Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.). This is the underlying object with id, value and extensions. The accessor "getLifecycle_state" gives direct access to the value
245     */
246    public StringType getLifecycle_stateElement() { 
247      if (this.lifecycle_state == null)
248        if (Configuration.errorOnAutoCreate())
249          throw new Error("Attempt to auto-create RESOURCE_DESCRIPTION.lifecycle_state");
250        else if (Configuration.doAutoCreate())
251          this.lifecycle_state = new StringType(); // bb
252      return this.lifecycle_state;
253    }
254
255    public boolean hasLifecycle_stateElement() { 
256      return this.lifecycle_state != null && !this.lifecycle_state.isEmpty();
257    }
258
259    public boolean hasLifecycle_state() { 
260      return this.lifecycle_state != null && !this.lifecycle_state.isEmpty();
261    }
262
263    /**
264     * @param value {@link #lifecycle_state} (Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.). This is the underlying object with id, value and extensions. The accessor "getLifecycle_state" gives direct access to the value
265     */
266    public RESOURCE_DESCRIPTION setLifecycle_stateElement(StringType value) { 
267      this.lifecycle_state = value;
268      return this;
269    }
270
271    /**
272     * @return Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.
273     */
274    public String getLifecycle_state() { 
275      return this.lifecycle_state == null ? null : this.lifecycle_state.getValue();
276    }
277
278    /**
279     * @param value Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.
280     */
281    public RESOURCE_DESCRIPTION setLifecycle_state(String value) { 
282        if (this.lifecycle_state == null)
283          this.lifecycle_state = new StringType();
284        this.lifecycle_state.setValue(value);
285      return this;
286    }
287
288    /**
289     * @return {@link #resource_package_uri} (URI of package to which this resource belongs..). This is the underlying object with id, value and extensions. The accessor "getResource_package_uri" gives direct access to the value
290     */
291    public StringType getResource_package_uriElement() { 
292      if (this.resource_package_uri == null)
293        if (Configuration.errorOnAutoCreate())
294          throw new Error("Attempt to auto-create RESOURCE_DESCRIPTION.resource_package_uri");
295        else if (Configuration.doAutoCreate())
296          this.resource_package_uri = new StringType(); // bb
297      return this.resource_package_uri;
298    }
299
300    public boolean hasResource_package_uriElement() { 
301      return this.resource_package_uri != null && !this.resource_package_uri.isEmpty();
302    }
303
304    public boolean hasResource_package_uri() { 
305      return this.resource_package_uri != null && !this.resource_package_uri.isEmpty();
306    }
307
308    /**
309     * @param value {@link #resource_package_uri} (URI of package to which this resource belongs..). This is the underlying object with id, value and extensions. The accessor "getResource_package_uri" gives direct access to the value
310     */
311    public RESOURCE_DESCRIPTION setResource_package_uriElement(StringType value) { 
312      this.resource_package_uri = value;
313      return this;
314    }
315
316    /**
317     * @return URI of package to which this resource belongs..
318     */
319    public String getResource_package_uri() { 
320      return this.resource_package_uri == null ? null : this.resource_package_uri.getValue();
321    }
322
323    /**
324     * @param value URI of package to which this resource belongs..
325     */
326    public RESOURCE_DESCRIPTION setResource_package_uri(String value) { 
327      if (Utilities.noString(value))
328        this.resource_package_uri = null;
329      else {
330        if (this.resource_package_uri == null)
331          this.resource_package_uri = new StringType();
332        this.resource_package_uri.setValue(value);
333      }
334      return this;
335    }
336
337    /**
338     * @return {@link #other_details} (Additional non language-senstive resource meta-data, as a list of name/value pairs.)
339     */
340    public List<OBJECT_REF> getOther_detailsList() { 
341      if (this.other_detailsList == null)
342        this.other_detailsList = new ArrayList<OBJECT_REF>();
343      return this.other_detailsList;
344    }
345
346    /**
347     * @return Returns a reference to <code>this</code> for easy method chaining
348     */
349    public RESOURCE_DESCRIPTION setOther_detailsList(List<OBJECT_REF> theOther_details) { 
350      this.other_detailsList = theOther_details;
351      return this;
352    }
353
354    public boolean hasOther_details() { 
355      if (this.other_detailsList == null)
356        return false;
357      for (OBJECT_REF item : this.other_detailsList)
358        if (!item.isEmpty())
359          return true;
360      return false;
361    }
362
363    public OBJECT_REF addOther_details() { //3a
364      OBJECT_REF t = new OBJECT_REF();
365      if (this.other_detailsList == null)
366        this.other_detailsList = new ArrayList<OBJECT_REF>();
367      this.other_detailsList.add(t);
368      return t;
369    }
370
371    public RESOURCE_DESCRIPTION addOther_details(OBJECT_REF t) { //3b
372      if (t == null)
373        return this;
374      if (this.other_detailsList == null)
375        this.other_detailsList = new ArrayList<OBJECT_REF>();
376      this.other_detailsList.add(t);
377      return this;
378    }
379
380    /**
381     * @return The first repetition of repeating field {@link #other_details}, creating it if it does not already exist {3}
382     */
383    public OBJECT_REF getOther_detailsFirstRep() { 
384      if (getOther_detailsList().isEmpty()) {
385        addOther_details();
386      }
387      return getOther_detailsList().get(0);
388    }
389
390    /**
391     * @return {@link #parent_resource} (Reference to owning resource.)
392     */
393    public AUTHORED_RESOURCE getParent_resource() { 
394      return this.parent_resource;
395    }
396
397    public boolean hasParent_resource() { 
398      return this.parent_resource != null && !this.parent_resource.isEmpty();
399    }
400
401    /**
402     * @param value {@link #parent_resource} (Reference to owning resource.)
403     */
404    public RESOURCE_DESCRIPTION setParent_resource(AUTHORED_RESOURCE value) { 
405      this.parent_resource = value;
406      return this;
407    }
408
409    /**
410     * @return {@link #details} (Details of all parts of resource description that are natural language-dependent, keyed by language code.)
411     */
412    public List<RESOURCE_DESCRIPTION_ITEM> getDetailsList() { 
413      if (this.detailsList == null)
414        this.detailsList = new ArrayList<RESOURCE_DESCRIPTION_ITEM>();
415      return this.detailsList;
416    }
417
418    /**
419     * @return Returns a reference to <code>this</code> for easy method chaining
420     */
421    public RESOURCE_DESCRIPTION setDetailsList(List<RESOURCE_DESCRIPTION_ITEM> theDetails) { 
422      this.detailsList = theDetails;
423      return this;
424    }
425
426    public boolean hasDetails() { 
427      if (this.detailsList == null)
428        return false;
429      for (RESOURCE_DESCRIPTION_ITEM item : this.detailsList)
430        if (!item.isEmpty())
431          return true;
432      return false;
433    }
434
435    public RESOURCE_DESCRIPTION_ITEM addDetails() { //3a
436      RESOURCE_DESCRIPTION_ITEM t = new RESOURCE_DESCRIPTION_ITEM();
437      if (this.detailsList == null)
438        this.detailsList = new ArrayList<RESOURCE_DESCRIPTION_ITEM>();
439      this.detailsList.add(t);
440      return t;
441    }
442
443    public RESOURCE_DESCRIPTION addDetails(RESOURCE_DESCRIPTION_ITEM t) { //3b
444      if (t == null)
445        return this;
446      if (this.detailsList == null)
447        this.detailsList = new ArrayList<RESOURCE_DESCRIPTION_ITEM>();
448      this.detailsList.add(t);
449      return this;
450    }
451
452    /**
453     * @return The first repetition of repeating field {@link #details}, creating it if it does not already exist {3}
454     */
455    public RESOURCE_DESCRIPTION_ITEM getDetailsFirstRep() { 
456      if (getDetailsList().isEmpty()) {
457        addDetails();
458      }
459      return getDetailsList().get(0);
460    }
461
462      protected void listChildren(List<Property> children) {
463        super.listChildren(children);
464        children.add(new Property("original_author", "string", "Original author of this resource, with all relevant details, including organisation.", 0, java.lang.Integer.MAX_VALUE, original_authorList));
465        children.add(new Property("other_contributors", "string", "Other contributors to the resource, probably listed in 'name <email>' form.", 0, java.lang.Integer.MAX_VALUE, other_contributorsList));
466        children.add(new Property("lifecycle_state", "string", "Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.", 0, 1, lifecycle_state));
467        children.add(new Property("resource_package_uri", "string", "URI of package to which this resource belongs..", 0, 1, resource_package_uri));
468        children.add(new Property("other_details", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Additional non language-senstive resource meta-data, as a list of name/value pairs.", 0, java.lang.Integer.MAX_VALUE, other_detailsList));
469        children.add(new Property("parent_resource", "http://openehr.org/fhir/StructureDefinition/AUTHORED-RESOURCE", "Reference to owning resource.", 0, 1, parent_resource));
470        children.add(new Property("details", "http://openehr.org/fhir/StructureDefinition/RESOURCE-DESCRIPTION-ITEM", "Details of all parts of resource description that are natural language-dependent, keyed by language code.", 0, java.lang.Integer.MAX_VALUE, detailsList));
471      }
472
473      @Override
474      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
475        switch (_hash) {
476        case -821815367: /*original_author*/  return new Property("original_author", "string", "Original author of this resource, with all relevant details, including organisation.", 0, java.lang.Integer.MAX_VALUE, original_authorList);
477        case 1215537095: /*other_contributors*/  return new Property("other_contributors", "string", "Other contributors to the resource, probably listed in 'name <email>' form.", 0, java.lang.Integer.MAX_VALUE, other_contributorsList);
478        case 1508726652: /*lifecycle_state*/  return new Property("lifecycle_state", "string", "Lifecycle state of the resource, typically including states such as: initial | submitted | experimental | awaiting_approval | approved | superseded | obsolete.", 0, 1, lifecycle_state);
479        case 812585794: /*resource_package_uri*/  return new Property("resource_package_uri", "string", "URI of package to which this resource belongs..", 0, 1, resource_package_uri);
480        case -1257043949: /*other_details*/  return new Property("other_details", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Additional non language-senstive resource meta-data, as a list of name/value pairs.", 0, java.lang.Integer.MAX_VALUE, other_detailsList);
481        case -1055650813: /*parent_resource*/  return new Property("parent_resource", "http://openehr.org/fhir/StructureDefinition/AUTHORED-RESOURCE", "Reference to owning resource.", 0, 1, parent_resource);
482        case 1557721666: /*details*/  return new Property("details", "http://openehr.org/fhir/StructureDefinition/RESOURCE-DESCRIPTION-ITEM", "Details of all parts of resource description that are natural language-dependent, keyed by language code.", 0, java.lang.Integer.MAX_VALUE, detailsList);
483        default: return super.getNamedProperty(_hash, _name, _checkValid);
484        }
485
486      }
487
488      @Override
489      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
490        switch (hash) {
491        case -821815367: /*original_author*/ return this.original_authorList == null ? new Base[0] : this.original_authorList.toArray(new Base[this.original_authorList.size()]); // StringType
492        case 1215537095: /*other_contributors*/ return this.other_contributorsList == null ? new Base[0] : this.other_contributorsList.toArray(new Base[this.other_contributorsList.size()]); // StringType
493        case 1508726652: /*lifecycle_state*/ return this.lifecycle_state == null ? new Base[0] : new Base[] {this.lifecycle_state}; // StringType
494        case 812585794: /*resource_package_uri*/ return this.resource_package_uri == null ? new Base[0] : new Base[] {this.resource_package_uri}; // StringType
495        case -1257043949: /*other_details*/ return this.other_detailsList == null ? new Base[0] : this.other_detailsList.toArray(new Base[this.other_detailsList.size()]); // OBJECT_REF
496        case -1055650813: /*parent_resource*/ return this.parent_resource == null ? new Base[0] : new Base[] {this.parent_resource}; // AUTHORED_RESOURCE
497        case 1557721666: /*details*/ return this.detailsList == null ? new Base[0] : this.detailsList.toArray(new Base[this.detailsList.size()]); // RESOURCE_DESCRIPTION_ITEM
498        default: return super.getProperty(hash, name, checkValid);
499        }
500
501      }
502
503      @Override
504      public Base setProperty(int hash, String name, Base value) throws FHIRException {
505        switch (hash) {
506        case -821815367: // original_author
507          this.getOriginal_authorList().add(TypeConvertor.castToString(value)); // StringType
508          return value;
509        case 1215537095: // other_contributors
510          this.getOther_contributorsList().add(TypeConvertor.castToString(value)); // StringType
511          return value;
512        case 1508726652: // lifecycle_state
513          this.lifecycle_state = TypeConvertor.castToString(value); // StringType
514          return value;
515        case 812585794: // resource_package_uri
516          this.resource_package_uri = TypeConvertor.castToString(value); // StringType
517          return value;
518        case -1257043949: // other_details
519          this.getOther_detailsList().add((OBJECT_REF) value); // OBJECT_REF
520          return value;
521        case -1055650813: // parent_resource
522          this.parent_resource = (AUTHORED_RESOURCE) value; // AUTHORED_RESOURCE
523          return value;
524        case 1557721666: // details
525          this.getDetailsList().add((RESOURCE_DESCRIPTION_ITEM) value); // RESOURCE_DESCRIPTION_ITEM
526          return value;
527        default: return super.setProperty(hash, name, value);
528        }
529
530      }
531
532      @Override
533      public Base setProperty(String name, Base value) throws FHIRException {
534        if (name.equals("original_author")) {
535          this.getOriginal_authorList().add(TypeConvertor.castToString(value)); // StringType
536        } else if (name.equals("other_contributors")) {
537          this.getOther_contributorsList().add(TypeConvertor.castToString(value)); // StringType
538        } else if (name.equals("lifecycle_state")) {
539          this.lifecycle_state = TypeConvertor.castToString(value); // StringType
540        } else if (name.equals("resource_package_uri")) {
541          this.resource_package_uri = TypeConvertor.castToString(value); // StringType
542        } else if (name.equals("other_details")) {
543          this.getOther_detailsList().add((OBJECT_REF) value); // OBJECT_REF
544        } else if (name.equals("parent_resource")) {
545          this.parent_resource = (AUTHORED_RESOURCE) value; // AUTHORED_RESOURCE
546        } else if (name.equals("details")) {
547          this.getDetailsList().add((RESOURCE_DESCRIPTION_ITEM) value); // RESOURCE_DESCRIPTION_ITEM
548        } else
549          return super.setProperty(name, value);
550        return value;
551      }
552
553      @Override
554      public Base makeProperty(int hash, String name) throws FHIRException {
555        switch (hash) {
556        case -821815367:  return addOriginal_authorElement();
557        case 1215537095:  return addOther_contributorsElement();
558        case 1508726652:  return getLifecycle_stateElement();
559        case 812585794:  return getResource_package_uriElement();
560        case -1257043949:  return addOther_details(); 
561        case -1055650813: /*div*/
562          throw new Error("Unable to make an instance of the abstract property 'parent_resource'");
563        case 1557721666:  return addDetails(); 
564        default: return super.makeProperty(hash, name);
565        }
566
567      }
568
569      @Override
570      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case -821815367: /*original_author*/ return new String[] {"string"};
573        case 1215537095: /*other_contributors*/ return new String[] {"string"};
574        case 1508726652: /*lifecycle_state*/ return new String[] {"string"};
575        case 812585794: /*resource_package_uri*/ return new String[] {"string"};
576        case -1257043949: /*other_details*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
577        case -1055650813: /*parent_resource*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/AUTHORED-RESOURCE"};
578        case 1557721666: /*details*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/RESOURCE-DESCRIPTION-ITEM"};
579        default: return super.getTypesForProperty(hash, name);
580        }
581
582      }
583
584      @Override
585      public Base addChild(String name) throws FHIRException {
586        if (name.equals("original_author")) {
587          throw new FHIRException("Cannot call addChild on a singleton property RESOURCE_DESCRIPTION.original_author");
588        }
589        else if (name.equals("other_contributors")) {
590          throw new FHIRException("Cannot call addChild on a singleton property RESOURCE_DESCRIPTION.other_contributors");
591        }
592        else if (name.equals("lifecycle_state")) {
593          throw new FHIRException("Cannot call addChild on a singleton property RESOURCE_DESCRIPTION.lifecycle_state");
594        }
595        else if (name.equals("resource_package_uri")) {
596          throw new FHIRException("Cannot call addChild on a singleton property RESOURCE_DESCRIPTION.resource_package_uri");
597        }
598        else if (name.equals("other_details")) {
599          return addOther_details();
600        }
601        else if (name.equals("parent_resource")) {
602          throw new FHIRException("Cannot call addChild on an abstract type RESOURCE_DESCRIPTION.parent_resource");
603        }
604        else if (name.equals("details")) {
605          return addDetails();
606        }
607        else
608          return super.addChild(name);
609      }
610
611  public String fhirType() {
612    return "RESOURCE_DESCRIPTION";
613
614  }
615
616      public RESOURCE_DESCRIPTION copy() {
617        RESOURCE_DESCRIPTION dst = new RESOURCE_DESCRIPTION();
618        copyValues(dst);
619        return dst;
620      }
621
622      public void copyValues(RESOURCE_DESCRIPTION dst) {
623        super.copyValues(dst);
624        if (original_authorList != null) {
625          dst.original_authorList = new ArrayList<StringType>();
626          for (StringType i : original_authorList)
627            dst.original_authorList.add(i.copy());
628        };
629        if (other_contributorsList != null) {
630          dst.other_contributorsList = new ArrayList<StringType>();
631          for (StringType i : other_contributorsList)
632            dst.other_contributorsList.add(i.copy());
633        };
634        dst.lifecycle_state = lifecycle_state == null ? null : lifecycle_state.copy();
635        dst.resource_package_uri = resource_package_uri == null ? null : resource_package_uri.copy();
636        if (other_detailsList != null) {
637          dst.other_detailsList = new ArrayList<OBJECT_REF>();
638          for (OBJECT_REF i : other_detailsList)
639            dst.other_detailsList.add(i.copy());
640        };
641        dst.parent_resource = parent_resource == null ? null : parent_resource.copy();
642        if (detailsList != null) {
643          dst.detailsList = new ArrayList<RESOURCE_DESCRIPTION_ITEM>();
644          for (RESOURCE_DESCRIPTION_ITEM i : detailsList)
645            dst.detailsList.add(i.copy());
646        };
647      }
648
649      protected RESOURCE_DESCRIPTION typedCopy() {
650        return copy();
651      }
652
653      @Override
654      public boolean equalsDeep(Base other_) {
655        if (!super.equalsDeep(other_))
656          return false;
657        if (!(other_ instanceof RESOURCE_DESCRIPTION))
658          return false;
659        RESOURCE_DESCRIPTION o = (RESOURCE_DESCRIPTION) other_;
660        return compareDeep(original_authorList, o.original_authorList, true) && compareDeep(other_contributorsList, o.other_contributorsList, true)
661           && compareDeep(lifecycle_state, o.lifecycle_state, true) && compareDeep(resource_package_uri, o.resource_package_uri, true)
662           && compareDeep(other_detailsList, o.other_detailsList, true) && compareDeep(parent_resource, o.parent_resource, true)
663           && compareDeep(detailsList, o.detailsList, true);
664      }
665
666      @Override
667      public boolean equalsShallow(Base other_) {
668        if (!super.equalsShallow(other_))
669          return false;
670        if (!(other_ instanceof RESOURCE_DESCRIPTION))
671          return false;
672        RESOURCE_DESCRIPTION o = (RESOURCE_DESCRIPTION) other_;
673        return compareValues(original_authorList, o.original_authorList, true) && compareValues(other_contributorsList, o.other_contributorsList, true)
674           && compareValues(lifecycle_state, o.lifecycle_state, true) && compareValues(resource_package_uri, o.resource_package_uri, true)
675          ;
676      }
677
678      public boolean isEmpty() {
679        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(original_authorList, other_contributorsList
680          , lifecycle_state, resource_package_uri, other_detailsList, parent_resource, detailsList
681          );
682      }
683
684
685}
686