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.r5.openehr.Enumerations.*;
038import org.hl7.fhir.exceptions.FHIRException;
039import org.hl7.fhir.r5.model.*;
040import org.hl7.fhir.instance.model.api.ICompositeType;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046
047/**
048 * The EHR object is the root object and access point of an EHR for a subject of care.
049 */
050@DatatypeDef(name="EHR")
051public class EHR extends Any implements ICompositeType {
052
053    /**
054     * The identifier of the logical EHR management system in which this EHR was created.
055     */
056    @Child(name = "system_id", type = {HIER_OBJECT_ID.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
057    @Description(shortDefinition="The identifier of the logical EHR management system in which this EHR was created", formalDefinition="The identifier of the logical EHR management system in which this EHR was created." )
058    protected List<HIER_OBJECT_ID> system_idList;
059
060    /**
061     * The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field.
062     */
063    @Child(name = "ehr_id", type = {HIER_OBJECT_ID.class}, order=1, min=1, max=1, modifier=false, summary=false)
064    @Description(shortDefinition="The unique identifier of this EHR", formalDefinition="The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field." )
065    protected HIER_OBJECT_ID ehr_id;
066
067    /**
068     * List of contributions causing changes to this EHR. Each contribution contains a list of versions, which may include references to any number of VERSION instances, i.e. items of type VERSIONED_COMPOSITION and VERSIONED_FOLDER.
069     */
070    @Child(name = "contributions", type = {OBJECT_REF.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
071    @Description(shortDefinition="List of contributions causing changes to this EHR", formalDefinition="List of contributions causing changes to this EHR. Each contribution contains a list of versions, which may include references to any number of VERSION instances, i.e. items of type VERSIONED_COMPOSITION and VERSIONED_FOLDER." )
072    protected List<OBJECT_REF> contributionsList;
073
074    /**
075     * Reference to EHR_STATUS object for this EHR.
076     */
077    @Child(name = "ehr_status", type = {OBJECT_REF.class}, order=3, min=1, max=1, modifier=false, summary=false)
078    @Description(shortDefinition="Reference to EHR_STATUS object for this EHR", formalDefinition="Reference to EHR_STATUS object for this EHR." )
079    protected OBJECT_REF ehr_status;
080
081    /**
082     * Reference to EHR_ACCESS object for this EHR.
083     */
084    @Child(name = "ehr_access", type = {OBJECT_REF.class}, order=4, min=1, max=1, modifier=false, summary=false)
085    @Description(shortDefinition="Reference to EHR_ACCESS object for this EH", formalDefinition="Reference to EHR_ACCESS object for this EHR." )
086    protected OBJECT_REF ehr_access;
087
088    /**
089     * Master list of all Versioned Composition references in this EHR.
090     */
091    @Child(name = "compositions", type = {OBJECT_REF.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
092    @Description(shortDefinition="Master list of all Versioned Composition references in this EHR", formalDefinition="Master list of all Versioned Composition references in this EHR." )
093    protected List<OBJECT_REF> compositionsList;
094
095    /**
096     * Optional directory structure for this EHR. If present, this is a reference to the first member of folders.
097     */
098    @Child(name = "directory", type = {OBJECT_REF.class}, order=6, min=0, max=1, modifier=false, summary=false)
099    @Description(shortDefinition="Optional directory structure for this EHR. If present, this is a reference to the first member of folders", formalDefinition="Optional directory structure for this EHR. If present, this is a reference to the first member of folders." )
100    protected OBJECT_REF directory;
101
102    /**
103     * Time of creation of the EHR.
104     */
105    @Child(name = "time_created", type = {DV_DATE_TIME.class}, order=7, min=1, max=1, modifier=false, summary=false)
106    @Description(shortDefinition="Time of creation of the EHR", formalDefinition="Time of creation of the EHR." )
107    protected DV_DATE_TIME time_created;
108
109    /**
110     * Optional additional Folder structures for this EHR. If set, the directory attribute refers to the first member
111     */
112    @Child(name = "folders", type = {OBJECT_REF.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
113    @Description(shortDefinition="Optional additional Folder structures for this EHR", formalDefinition="Optional additional Folder structures for this EHR. If set, the directory attribute refers to the first member" )
114    protected List<OBJECT_REF> foldersList;
115
116    /**
117     * Optional list of tags associated with this EHR. Tag target values can only be within the same EHR.
118     */
119    @Child(name = "tags", type = {OBJECT_REF.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
120    @Description(shortDefinition="Optional list of tags associated with this EHR", formalDefinition="Optional list of tags associated with this EHR. Tag target values can only be within the same EHR." )
121    protected List<OBJECT_REF> tagsList;
122
123    private static final long serialVersionUID = 1319457127L;
124
125  /**
126   * Constructor
127   */
128    public EHR() {
129      super();
130    }
131
132  /**
133   * Constructor
134   */
135    public EHR(HIER_OBJECT_ID system_id, HIER_OBJECT_ID ehr_id, OBJECT_REF ehr_status, OBJECT_REF ehr_access, DV_DATE_TIME time_created) {
136      super();
137      this.addSystem_id(system_id);
138      this.setEhr_id(ehr_id);
139      this.setEhr_status(ehr_status);
140      this.setEhr_access(ehr_access);
141      this.setTime_created(time_created);
142    }
143
144    /**
145     * @return {@link #system_id} (The identifier of the logical EHR management system in which this EHR was created.)
146     */
147    public List<HIER_OBJECT_ID> getSystem_idList() { 
148      if (this.system_idList == null)
149        this.system_idList = new ArrayList<HIER_OBJECT_ID>();
150      return this.system_idList;
151    }
152
153    /**
154     * @return Returns a reference to <code>this</code> for easy method chaining
155     */
156    public EHR setSystem_idList(List<HIER_OBJECT_ID> theSystem_id) { 
157      this.system_idList = theSystem_id;
158      return this;
159    }
160
161    public boolean hasSystem_id() { 
162      if (this.system_idList == null)
163        return false;
164      for (HIER_OBJECT_ID item : this.system_idList)
165        if (!item.isEmpty())
166          return true;
167      return false;
168    }
169
170    public HIER_OBJECT_ID addSystem_id() { //3a
171      HIER_OBJECT_ID t = new HIER_OBJECT_ID();
172      if (this.system_idList == null)
173        this.system_idList = new ArrayList<HIER_OBJECT_ID>();
174      this.system_idList.add(t);
175      return t;
176    }
177
178    public EHR addSystem_id(HIER_OBJECT_ID t) { //3b
179      if (t == null)
180        return this;
181      if (this.system_idList == null)
182        this.system_idList = new ArrayList<HIER_OBJECT_ID>();
183      this.system_idList.add(t);
184      return this;
185    }
186
187    /**
188     * @return The first repetition of repeating field {@link #system_id}, creating it if it does not already exist {3}
189     */
190    public HIER_OBJECT_ID getSystem_idFirstRep() { 
191      if (getSystem_idList().isEmpty()) {
192        addSystem_id();
193      }
194      return getSystem_idList().get(0);
195    }
196
197    /**
198     * @return {@link #ehr_id} (The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field.)
199     */
200    public HIER_OBJECT_ID getEhr_id() { 
201      if (this.ehr_id == null)
202        if (Configuration.errorOnAutoCreate())
203          throw new Error("Attempt to auto-create EHR.ehr_id");
204        else if (Configuration.doAutoCreate())
205          this.ehr_id = new HIER_OBJECT_ID(); // cc
206      return this.ehr_id;
207    }
208
209    public boolean hasEhr_id() { 
210      return this.ehr_id != null && !this.ehr_id.isEmpty();
211    }
212
213    /**
214     * @param value {@link #ehr_id} (The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field.)
215     */
216    public EHR setEhr_id(HIER_OBJECT_ID value) { 
217      this.ehr_id = value;
218      return this;
219    }
220
221    /**
222     * @return {@link #contributions} (List of contributions causing changes to this EHR. Each contribution contains a list of versions, which may include references to any number of VERSION instances, i.e. items of type VERSIONED_COMPOSITION and VERSIONED_FOLDER.)
223     */
224    public List<OBJECT_REF> getContributionsList() { 
225      if (this.contributionsList == null)
226        this.contributionsList = new ArrayList<OBJECT_REF>();
227      return this.contributionsList;
228    }
229
230    /**
231     * @return Returns a reference to <code>this</code> for easy method chaining
232     */
233    public EHR setContributionsList(List<OBJECT_REF> theContributions) { 
234      this.contributionsList = theContributions;
235      return this;
236    }
237
238    public boolean hasContributions() { 
239      if (this.contributionsList == null)
240        return false;
241      for (OBJECT_REF item : this.contributionsList)
242        if (!item.isEmpty())
243          return true;
244      return false;
245    }
246
247    public OBJECT_REF addContributions() { //3a
248      OBJECT_REF t = new OBJECT_REF();
249      if (this.contributionsList == null)
250        this.contributionsList = new ArrayList<OBJECT_REF>();
251      this.contributionsList.add(t);
252      return t;
253    }
254
255    public EHR addContributions(OBJECT_REF t) { //3b
256      if (t == null)
257        return this;
258      if (this.contributionsList == null)
259        this.contributionsList = new ArrayList<OBJECT_REF>();
260      this.contributionsList.add(t);
261      return this;
262    }
263
264    /**
265     * @return The first repetition of repeating field {@link #contributions}, creating it if it does not already exist {3}
266     */
267    public OBJECT_REF getContributionsFirstRep() { 
268      if (getContributionsList().isEmpty()) {
269        addContributions();
270      }
271      return getContributionsList().get(0);
272    }
273
274    /**
275     * @return {@link #ehr_status} (Reference to EHR_STATUS object for this EHR.)
276     */
277    public OBJECT_REF getEhr_status() { 
278      if (this.ehr_status == null)
279        if (Configuration.errorOnAutoCreate())
280          throw new Error("Attempt to auto-create EHR.ehr_status");
281        else if (Configuration.doAutoCreate())
282          this.ehr_status = new OBJECT_REF(); // cc
283      return this.ehr_status;
284    }
285
286    public boolean hasEhr_status() { 
287      return this.ehr_status != null && !this.ehr_status.isEmpty();
288    }
289
290    /**
291     * @param value {@link #ehr_status} (Reference to EHR_STATUS object for this EHR.)
292     */
293    public EHR setEhr_status(OBJECT_REF value) { 
294      this.ehr_status = value;
295      return this;
296    }
297
298    /**
299     * @return {@link #ehr_access} (Reference to EHR_ACCESS object for this EHR.)
300     */
301    public OBJECT_REF getEhr_access() { 
302      if (this.ehr_access == null)
303        if (Configuration.errorOnAutoCreate())
304          throw new Error("Attempt to auto-create EHR.ehr_access");
305        else if (Configuration.doAutoCreate())
306          this.ehr_access = new OBJECT_REF(); // cc
307      return this.ehr_access;
308    }
309
310    public boolean hasEhr_access() { 
311      return this.ehr_access != null && !this.ehr_access.isEmpty();
312    }
313
314    /**
315     * @param value {@link #ehr_access} (Reference to EHR_ACCESS object for this EHR.)
316     */
317    public EHR setEhr_access(OBJECT_REF value) { 
318      this.ehr_access = value;
319      return this;
320    }
321
322    /**
323     * @return {@link #compositions} (Master list of all Versioned Composition references in this EHR.)
324     */
325    public List<OBJECT_REF> getCompositionsList() { 
326      if (this.compositionsList == null)
327        this.compositionsList = new ArrayList<OBJECT_REF>();
328      return this.compositionsList;
329    }
330
331    /**
332     * @return Returns a reference to <code>this</code> for easy method chaining
333     */
334    public EHR setCompositionsList(List<OBJECT_REF> theCompositions) { 
335      this.compositionsList = theCompositions;
336      return this;
337    }
338
339    public boolean hasCompositions() { 
340      if (this.compositionsList == null)
341        return false;
342      for (OBJECT_REF item : this.compositionsList)
343        if (!item.isEmpty())
344          return true;
345      return false;
346    }
347
348    public OBJECT_REF addCompositions() { //3a
349      OBJECT_REF t = new OBJECT_REF();
350      if (this.compositionsList == null)
351        this.compositionsList = new ArrayList<OBJECT_REF>();
352      this.compositionsList.add(t);
353      return t;
354    }
355
356    public EHR addCompositions(OBJECT_REF t) { //3b
357      if (t == null)
358        return this;
359      if (this.compositionsList == null)
360        this.compositionsList = new ArrayList<OBJECT_REF>();
361      this.compositionsList.add(t);
362      return this;
363    }
364
365    /**
366     * @return The first repetition of repeating field {@link #compositions}, creating it if it does not already exist {3}
367     */
368    public OBJECT_REF getCompositionsFirstRep() { 
369      if (getCompositionsList().isEmpty()) {
370        addCompositions();
371      }
372      return getCompositionsList().get(0);
373    }
374
375    /**
376     * @return {@link #directory} (Optional directory structure for this EHR. If present, this is a reference to the first member of folders.)
377     */
378    public OBJECT_REF getDirectory() { 
379      if (this.directory == null)
380        if (Configuration.errorOnAutoCreate())
381          throw new Error("Attempt to auto-create EHR.directory");
382        else if (Configuration.doAutoCreate())
383          this.directory = new OBJECT_REF(); // cc
384      return this.directory;
385    }
386
387    public boolean hasDirectory() { 
388      return this.directory != null && !this.directory.isEmpty();
389    }
390
391    /**
392     * @param value {@link #directory} (Optional directory structure for this EHR. If present, this is a reference to the first member of folders.)
393     */
394    public EHR setDirectory(OBJECT_REF value) { 
395      this.directory = value;
396      return this;
397    }
398
399    /**
400     * @return {@link #time_created} (Time of creation of the EHR.)
401     */
402    public DV_DATE_TIME getTime_created() { 
403      if (this.time_created == null)
404        if (Configuration.errorOnAutoCreate())
405          throw new Error("Attempt to auto-create EHR.time_created");
406        else if (Configuration.doAutoCreate())
407          this.time_created = new DV_DATE_TIME(); // cc
408      return this.time_created;
409    }
410
411    public boolean hasTime_created() { 
412      return this.time_created != null && !this.time_created.isEmpty();
413    }
414
415    /**
416     * @param value {@link #time_created} (Time of creation of the EHR.)
417     */
418    public EHR setTime_created(DV_DATE_TIME value) { 
419      this.time_created = value;
420      return this;
421    }
422
423    /**
424     * @return {@link #folders} (Optional additional Folder structures for this EHR. If set, the directory attribute refers to the first member)
425     */
426    public List<OBJECT_REF> getFoldersList() { 
427      if (this.foldersList == null)
428        this.foldersList = new ArrayList<OBJECT_REF>();
429      return this.foldersList;
430    }
431
432    /**
433     * @return Returns a reference to <code>this</code> for easy method chaining
434     */
435    public EHR setFoldersList(List<OBJECT_REF> theFolders) { 
436      this.foldersList = theFolders;
437      return this;
438    }
439
440    public boolean hasFolders() { 
441      if (this.foldersList == null)
442        return false;
443      for (OBJECT_REF item : this.foldersList)
444        if (!item.isEmpty())
445          return true;
446      return false;
447    }
448
449    public OBJECT_REF addFolders() { //3a
450      OBJECT_REF t = new OBJECT_REF();
451      if (this.foldersList == null)
452        this.foldersList = new ArrayList<OBJECT_REF>();
453      this.foldersList.add(t);
454      return t;
455    }
456
457    public EHR addFolders(OBJECT_REF t) { //3b
458      if (t == null)
459        return this;
460      if (this.foldersList == null)
461        this.foldersList = new ArrayList<OBJECT_REF>();
462      this.foldersList.add(t);
463      return this;
464    }
465
466    /**
467     * @return The first repetition of repeating field {@link #folders}, creating it if it does not already exist {3}
468     */
469    public OBJECT_REF getFoldersFirstRep() { 
470      if (getFoldersList().isEmpty()) {
471        addFolders();
472      }
473      return getFoldersList().get(0);
474    }
475
476    /**
477     * @return {@link #tags} (Optional list of tags associated with this EHR. Tag target values can only be within the same EHR.)
478     */
479    public List<OBJECT_REF> getTagsList() { 
480      if (this.tagsList == null)
481        this.tagsList = new ArrayList<OBJECT_REF>();
482      return this.tagsList;
483    }
484
485    /**
486     * @return Returns a reference to <code>this</code> for easy method chaining
487     */
488    public EHR setTagsList(List<OBJECT_REF> theTags) { 
489      this.tagsList = theTags;
490      return this;
491    }
492
493    public boolean hasTags() { 
494      if (this.tagsList == null)
495        return false;
496      for (OBJECT_REF item : this.tagsList)
497        if (!item.isEmpty())
498          return true;
499      return false;
500    }
501
502    public OBJECT_REF addTags() { //3a
503      OBJECT_REF t = new OBJECT_REF();
504      if (this.tagsList == null)
505        this.tagsList = new ArrayList<OBJECT_REF>();
506      this.tagsList.add(t);
507      return t;
508    }
509
510    public EHR addTags(OBJECT_REF t) { //3b
511      if (t == null)
512        return this;
513      if (this.tagsList == null)
514        this.tagsList = new ArrayList<OBJECT_REF>();
515      this.tagsList.add(t);
516      return this;
517    }
518
519    /**
520     * @return The first repetition of repeating field {@link #tags}, creating it if it does not already exist {3}
521     */
522    public OBJECT_REF getTagsFirstRep() { 
523      if (getTagsList().isEmpty()) {
524        addTags();
525      }
526      return getTagsList().get(0);
527    }
528
529      protected void listChildren(List<Property> children) {
530        super.listChildren(children);
531        children.add(new Property("system_id", "http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID", "The identifier of the logical EHR management system in which this EHR was created.", 0, java.lang.Integer.MAX_VALUE, system_idList));
532        children.add(new Property("ehr_id", "http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID", "The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field.", 0, 1, ehr_id));
533        children.add(new Property("contributions", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "List of contributions causing changes to this EHR. Each contribution contains a list of versions, which may include references to any number of VERSION instances, i.e. items of type VERSIONED_COMPOSITION and VERSIONED_FOLDER.", 0, java.lang.Integer.MAX_VALUE, contributionsList));
534        children.add(new Property("ehr_status", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Reference to EHR_STATUS object for this EHR.", 0, 1, ehr_status));
535        children.add(new Property("ehr_access", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Reference to EHR_ACCESS object for this EHR.", 0, 1, ehr_access));
536        children.add(new Property("compositions", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Master list of all Versioned Composition references in this EHR.", 0, java.lang.Integer.MAX_VALUE, compositionsList));
537        children.add(new Property("directory", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional directory structure for this EHR. If present, this is a reference to the first member of folders.", 0, 1, directory));
538        children.add(new Property("time_created", "http://openehr.org/fhir/StructureDefinition/DV-DATE-TIME", "Time of creation of the EHR.", 0, 1, time_created));
539        children.add(new Property("folders", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional additional Folder structures for this EHR. If set, the directory attribute refers to the first member", 0, java.lang.Integer.MAX_VALUE, foldersList));
540        children.add(new Property("tags", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional list of tags associated with this EHR. Tag target values can only be within the same EHR.", 0, java.lang.Integer.MAX_VALUE, tagsList));
541      }
542
543      @Override
544      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
545        switch (_hash) {
546        case 1129127211: /*system_id*/  return new Property("system_id", "http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID", "The identifier of the logical EHR management system in which this EHR was created.", 0, java.lang.Integer.MAX_VALUE, system_idList);
547        case -1303886037: /*ehr_id*/  return new Property("ehr_id", "http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID", "The unique identifier of this EHR. NOTE: it is strongly recommended that a UUID always be used for this field.", 0, 1, ehr_id);
548        case -294592925: /*contributions*/  return new Property("contributions", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "List of contributions causing changes to this EHR. Each contribution contains a list of versions, which may include references to any number of VERSION instances, i.e. items of type VERSIONED_COMPOSITION and VERSIONED_FOLDER.", 0, java.lang.Integer.MAX_VALUE, contributionsList);
549        case 1263174146: /*ehr_status*/  return new Property("ehr_status", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Reference to EHR_STATUS object for this EHR.", 0, 1, ehr_status);
550        case 732194676: /*ehr_access*/  return new Property("ehr_access", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Reference to EHR_ACCESS object for this EHR.", 0, 1, ehr_access);
551        case -236835831: /*compositions*/  return new Property("compositions", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Master list of all Versioned Composition references in this EHR.", 0, java.lang.Integer.MAX_VALUE, compositionsList);
552        case -962584979: /*directory*/  return new Property("directory", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional directory structure for this EHR. If present, this is a reference to the first member of folders.", 0, 1, directory);
553        case -630236298: /*time_created*/  return new Property("time_created", "http://openehr.org/fhir/StructureDefinition/DV-DATE-TIME", "Time of creation of the EHR.", 0, 1, time_created);
554        case -683249211: /*folders*/  return new Property("folders", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional additional Folder structures for this EHR. If set, the directory attribute refers to the first member", 0, java.lang.Integer.MAX_VALUE, foldersList);
555        case 3552281: /*tags*/  return new Property("tags", "http://openehr.org/fhir/StructureDefinition/OBJECT-REF", "Optional list of tags associated with this EHR. Tag target values can only be within the same EHR.", 0, java.lang.Integer.MAX_VALUE, tagsList);
556        default: return super.getNamedProperty(_hash, _name, _checkValid);
557        }
558
559      }
560
561      @Override
562      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
563        switch (hash) {
564        case 1129127211: /*system_id*/ return this.system_idList == null ? new Base[0] : this.system_idList.toArray(new Base[this.system_idList.size()]); // HIER_OBJECT_ID
565        case -1303886037: /*ehr_id*/ return this.ehr_id == null ? new Base[0] : new Base[] {this.ehr_id}; // HIER_OBJECT_ID
566        case -294592925: /*contributions*/ return this.contributionsList == null ? new Base[0] : this.contributionsList.toArray(new Base[this.contributionsList.size()]); // OBJECT_REF
567        case 1263174146: /*ehr_status*/ return this.ehr_status == null ? new Base[0] : new Base[] {this.ehr_status}; // OBJECT_REF
568        case 732194676: /*ehr_access*/ return this.ehr_access == null ? new Base[0] : new Base[] {this.ehr_access}; // OBJECT_REF
569        case -236835831: /*compositions*/ return this.compositionsList == null ? new Base[0] : this.compositionsList.toArray(new Base[this.compositionsList.size()]); // OBJECT_REF
570        case -962584979: /*directory*/ return this.directory == null ? new Base[0] : new Base[] {this.directory}; // OBJECT_REF
571        case -630236298: /*time_created*/ return this.time_created == null ? new Base[0] : new Base[] {this.time_created}; // DV_DATE_TIME
572        case -683249211: /*folders*/ return this.foldersList == null ? new Base[0] : this.foldersList.toArray(new Base[this.foldersList.size()]); // OBJECT_REF
573        case 3552281: /*tags*/ return this.tagsList == null ? new Base[0] : this.tagsList.toArray(new Base[this.tagsList.size()]); // OBJECT_REF
574        default: return super.getProperty(hash, name, checkValid);
575        }
576
577      }
578
579      @Override
580      public Base setProperty(int hash, String name, Base value) throws FHIRException {
581        switch (hash) {
582        case 1129127211: // system_id
583          this.getSystem_idList().add((HIER_OBJECT_ID) value); // HIER_OBJECT_ID
584          return value;
585        case -1303886037: // ehr_id
586          this.ehr_id = (HIER_OBJECT_ID) value; // HIER_OBJECT_ID
587          return value;
588        case -294592925: // contributions
589          this.getContributionsList().add((OBJECT_REF) value); // OBJECT_REF
590          return value;
591        case 1263174146: // ehr_status
592          this.ehr_status = (OBJECT_REF) value; // OBJECT_REF
593          return value;
594        case 732194676: // ehr_access
595          this.ehr_access = (OBJECT_REF) value; // OBJECT_REF
596          return value;
597        case -236835831: // compositions
598          this.getCompositionsList().add((OBJECT_REF) value); // OBJECT_REF
599          return value;
600        case -962584979: // directory
601          this.directory = (OBJECT_REF) value; // OBJECT_REF
602          return value;
603        case -630236298: // time_created
604          this.time_created = (DV_DATE_TIME) value; // DV_DATE_TIME
605          return value;
606        case -683249211: // folders
607          this.getFoldersList().add((OBJECT_REF) value); // OBJECT_REF
608          return value;
609        case 3552281: // tags
610          this.getTagsList().add((OBJECT_REF) value); // OBJECT_REF
611          return value;
612        default: return super.setProperty(hash, name, value);
613        }
614
615      }
616
617      @Override
618      public Base setProperty(String name, Base value) throws FHIRException {
619        if (name.equals("system_id")) {
620          this.getSystem_idList().add((HIER_OBJECT_ID) value); // HIER_OBJECT_ID
621        } else if (name.equals("ehr_id")) {
622          this.ehr_id = (HIER_OBJECT_ID) value; // HIER_OBJECT_ID
623        } else if (name.equals("contributions")) {
624          this.getContributionsList().add((OBJECT_REF) value); // OBJECT_REF
625        } else if (name.equals("ehr_status")) {
626          this.ehr_status = (OBJECT_REF) value; // OBJECT_REF
627        } else if (name.equals("ehr_access")) {
628          this.ehr_access = (OBJECT_REF) value; // OBJECT_REF
629        } else if (name.equals("compositions")) {
630          this.getCompositionsList().add((OBJECT_REF) value); // OBJECT_REF
631        } else if (name.equals("directory")) {
632          this.directory = (OBJECT_REF) value; // OBJECT_REF
633        } else if (name.equals("time_created")) {
634          this.time_created = (DV_DATE_TIME) value; // DV_DATE_TIME
635        } else if (name.equals("folders")) {
636          this.getFoldersList().add((OBJECT_REF) value); // OBJECT_REF
637        } else if (name.equals("tags")) {
638          this.getTagsList().add((OBJECT_REF) value); // OBJECT_REF
639        } else
640          return super.setProperty(name, value);
641        return value;
642      }
643
644      @Override
645      public Base makeProperty(int hash, String name) throws FHIRException {
646        switch (hash) {
647        case 1129127211:  return addSystem_id(); 
648        case -1303886037:  return getEhr_id();
649        case -294592925:  return addContributions(); 
650        case 1263174146:  return getEhr_status();
651        case 732194676:  return getEhr_access();
652        case -236835831:  return addCompositions(); 
653        case -962584979:  return getDirectory();
654        case -630236298:  return getTime_created();
655        case -683249211:  return addFolders(); 
656        case 3552281:  return addTags(); 
657        default: return super.makeProperty(hash, name);
658        }
659
660      }
661
662      @Override
663      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
664        switch (hash) {
665        case 1129127211: /*system_id*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID"};
666        case -1303886037: /*ehr_id*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/HIER-OBJECT-ID"};
667        case -294592925: /*contributions*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
668        case 1263174146: /*ehr_status*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
669        case 732194676: /*ehr_access*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
670        case -236835831: /*compositions*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
671        case -962584979: /*directory*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
672        case -630236298: /*time_created*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-DATE-TIME"};
673        case -683249211: /*folders*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
674        case 3552281: /*tags*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/OBJECT-REF"};
675        default: return super.getTypesForProperty(hash, name);
676        }
677
678      }
679
680      @Override
681      public Base addChild(String name) throws FHIRException {
682        if (name.equals("system_id")) {
683          return addSystem_id();
684        }
685        else if (name.equals("ehr_id")) {
686          this.ehr_id = new HIER_OBJECT_ID();
687          return this.ehr_id;
688        }
689        else if (name.equals("contributions")) {
690          return addContributions();
691        }
692        else if (name.equals("ehr_status")) {
693          this.ehr_status = new OBJECT_REF();
694          return this.ehr_status;
695        }
696        else if (name.equals("ehr_access")) {
697          this.ehr_access = new OBJECT_REF();
698          return this.ehr_access;
699        }
700        else if (name.equals("compositions")) {
701          return addCompositions();
702        }
703        else if (name.equals("directory")) {
704          this.directory = new OBJECT_REF();
705          return this.directory;
706        }
707        else if (name.equals("time_created")) {
708          this.time_created = new DV_DATE_TIME();
709          return this.time_created;
710        }
711        else if (name.equals("folders")) {
712          return addFolders();
713        }
714        else if (name.equals("tags")) {
715          return addTags();
716        }
717        else
718          return super.addChild(name);
719      }
720
721  public String fhirType() {
722    return "EHR";
723
724  }
725
726      public EHR copy() {
727        EHR dst = new EHR();
728        copyValues(dst);
729        return dst;
730      }
731
732      public void copyValues(EHR dst) {
733        super.copyValues(dst);
734        if (system_idList != null) {
735          dst.system_idList = new ArrayList<HIER_OBJECT_ID>();
736          for (HIER_OBJECT_ID i : system_idList)
737            dst.system_idList.add(i.copy());
738        };
739        dst.ehr_id = ehr_id == null ? null : ehr_id.copy();
740        if (contributionsList != null) {
741          dst.contributionsList = new ArrayList<OBJECT_REF>();
742          for (OBJECT_REF i : contributionsList)
743            dst.contributionsList.add(i.copy());
744        };
745        dst.ehr_status = ehr_status == null ? null : ehr_status.copy();
746        dst.ehr_access = ehr_access == null ? null : ehr_access.copy();
747        if (compositionsList != null) {
748          dst.compositionsList = new ArrayList<OBJECT_REF>();
749          for (OBJECT_REF i : compositionsList)
750            dst.compositionsList.add(i.copy());
751        };
752        dst.directory = directory == null ? null : directory.copy();
753        dst.time_created = time_created == null ? null : time_created.copy();
754        if (foldersList != null) {
755          dst.foldersList = new ArrayList<OBJECT_REF>();
756          for (OBJECT_REF i : foldersList)
757            dst.foldersList.add(i.copy());
758        };
759        if (tagsList != null) {
760          dst.tagsList = new ArrayList<OBJECT_REF>();
761          for (OBJECT_REF i : tagsList)
762            dst.tagsList.add(i.copy());
763        };
764      }
765
766      protected EHR typedCopy() {
767        return copy();
768      }
769
770      @Override
771      public boolean equalsDeep(Base other_) {
772        if (!super.equalsDeep(other_))
773          return false;
774        if (!(other_ instanceof EHR))
775          return false;
776        EHR o = (EHR) other_;
777        return compareDeep(system_idList, o.system_idList, true) && compareDeep(ehr_id, o.ehr_id, true)
778           && compareDeep(contributionsList, o.contributionsList, true) && compareDeep(ehr_status, o.ehr_status, true)
779           && compareDeep(ehr_access, o.ehr_access, true) && compareDeep(compositionsList, o.compositionsList, true)
780           && compareDeep(directory, o.directory, true) && compareDeep(time_created, o.time_created, true)
781           && compareDeep(foldersList, o.foldersList, true) && compareDeep(tagsList, o.tagsList, true);
782      }
783
784      @Override
785      public boolean equalsShallow(Base other_) {
786        if (!super.equalsShallow(other_))
787          return false;
788        if (!(other_ instanceof EHR))
789          return false;
790        EHR o = (EHR) other_;
791        return true;
792      }
793
794      public boolean isEmpty() {
795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(system_idList, ehr_id, contributionsList
796          , ehr_status, ehr_access, compositionsList, directory, time_created, foldersList
797          , tagsList);
798      }
799
800
801}
802