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 FEEDER_AUDIT class defines the semantics of an audit trail which is constructed to describe the origin of data that have been transformed into openEHR form and committed to the system.
049 */
050@DatatypeDef(name="FEEDER_AUDIT")
051public class FEEDER_AUDIT extends LogicalBase implements ICompositeType {
052
053    /**
054     * Identifiers used for the item in the originating system, e.g. filler and placer ids.
055     */
056    @Child(name = "originating_system_item_ids", type = {DV_IDENTIFIER.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
057    @Description(shortDefinition="Identifiers used for the item in the originating system", formalDefinition="Identifiers used for the item in the originating system, e.g. filler and placer ids." )
058    protected List<DV_IDENTIFIER> originating_system_item_idsList;
059
060    /**
061     * Identifiers used for the item in the feeder system, where the feeder system is distinct from the originating system.
062     */
063    @Child(name = "feeder_system_item_ids", type = {DV_IDENTIFIER.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
064    @Description(shortDefinition="Identifiers used for the item in the feeder system", formalDefinition="Identifiers used for the item in the feeder system, where the feeder system is distinct from the originating system." )
065    protected List<DV_IDENTIFIER> feeder_system_item_idsList;
066
067    /**
068     * Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR.
069     */
070    @Child(name = "original_content", type = {DV_ENCAPSULATED.class}, order=2, min=0, max=1, modifier=false, summary=false)
071    @Description(shortDefinition="Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node", formalDefinition="Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR." )
072    protected DV_ENCAPSULATED original_content;
073
074    /**
075     * Any audit information for the information item from the originating system.
076     */
077    @Child(name = "originating_system_audit", type = {FEEDER_AUDIT_DETAILS.class}, order=3, min=1, max=1, modifier=false, summary=false)
078    @Description(shortDefinition="Any audit information for the information item from the originating system", formalDefinition="Any audit information for the information item from the originating system." )
079    protected FEEDER_AUDIT_DETAILS originating_system_audit;
080
081    /**
082     * Any audit information for the information item from the feeder system, if different from the originating system.
083     */
084    @Child(name = "feeder_system_audit", type = {FEEDER_AUDIT_DETAILS.class}, order=4, min=0, max=1, modifier=false, summary=false)
085    @Description(shortDefinition="Any audit information for the information item from the feeder system", formalDefinition="Any audit information for the information item from the feeder system, if different from the originating system." )
086    protected FEEDER_AUDIT_DETAILS feeder_system_audit;
087
088    private static final long serialVersionUID = -345281835L;
089
090  /**
091   * Constructor
092   */
093    public FEEDER_AUDIT() {
094      super();
095    }
096
097  /**
098   * Constructor
099   */
100    public FEEDER_AUDIT(FEEDER_AUDIT_DETAILS originating_system_audit) {
101      super();
102      this.setOriginating_system_audit(originating_system_audit);
103    }
104
105    /**
106     * @return {@link #originating_system_item_ids} (Identifiers used for the item in the originating system, e.g. filler and placer ids.)
107     */
108    public List<DV_IDENTIFIER> getOriginating_system_item_idsList() { 
109      if (this.originating_system_item_idsList == null)
110        this.originating_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
111      return this.originating_system_item_idsList;
112    }
113
114    /**
115     * @return Returns a reference to <code>this</code> for easy method chaining
116     */
117    public FEEDER_AUDIT setOriginating_system_item_idsList(List<DV_IDENTIFIER> theOriginating_system_item_ids) { 
118      this.originating_system_item_idsList = theOriginating_system_item_ids;
119      return this;
120    }
121
122    public boolean hasOriginating_system_item_ids() { 
123      if (this.originating_system_item_idsList == null)
124        return false;
125      for (DV_IDENTIFIER item : this.originating_system_item_idsList)
126        if (!item.isEmpty())
127          return true;
128      return false;
129    }
130
131    public DV_IDENTIFIER addOriginating_system_item_ids() { //3a
132      DV_IDENTIFIER t = new DV_IDENTIFIER();
133      if (this.originating_system_item_idsList == null)
134        this.originating_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
135      this.originating_system_item_idsList.add(t);
136      return t;
137    }
138
139    public FEEDER_AUDIT addOriginating_system_item_ids(DV_IDENTIFIER t) { //3b
140      if (t == null)
141        return this;
142      if (this.originating_system_item_idsList == null)
143        this.originating_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
144      this.originating_system_item_idsList.add(t);
145      return this;
146    }
147
148    /**
149     * @return The first repetition of repeating field {@link #originating_system_item_ids}, creating it if it does not already exist {3}
150     */
151    public DV_IDENTIFIER getOriginating_system_item_idsFirstRep() { 
152      if (getOriginating_system_item_idsList().isEmpty()) {
153        addOriginating_system_item_ids();
154      }
155      return getOriginating_system_item_idsList().get(0);
156    }
157
158    /**
159     * @return {@link #feeder_system_item_ids} (Identifiers used for the item in the feeder system, where the feeder system is distinct from the originating system.)
160     */
161    public List<DV_IDENTIFIER> getFeeder_system_item_idsList() { 
162      if (this.feeder_system_item_idsList == null)
163        this.feeder_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
164      return this.feeder_system_item_idsList;
165    }
166
167    /**
168     * @return Returns a reference to <code>this</code> for easy method chaining
169     */
170    public FEEDER_AUDIT setFeeder_system_item_idsList(List<DV_IDENTIFIER> theFeeder_system_item_ids) { 
171      this.feeder_system_item_idsList = theFeeder_system_item_ids;
172      return this;
173    }
174
175    public boolean hasFeeder_system_item_ids() { 
176      if (this.feeder_system_item_idsList == null)
177        return false;
178      for (DV_IDENTIFIER item : this.feeder_system_item_idsList)
179        if (!item.isEmpty())
180          return true;
181      return false;
182    }
183
184    public DV_IDENTIFIER addFeeder_system_item_ids() { //3a
185      DV_IDENTIFIER t = new DV_IDENTIFIER();
186      if (this.feeder_system_item_idsList == null)
187        this.feeder_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
188      this.feeder_system_item_idsList.add(t);
189      return t;
190    }
191
192    public FEEDER_AUDIT addFeeder_system_item_ids(DV_IDENTIFIER t) { //3b
193      if (t == null)
194        return this;
195      if (this.feeder_system_item_idsList == null)
196        this.feeder_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
197      this.feeder_system_item_idsList.add(t);
198      return this;
199    }
200
201    /**
202     * @return The first repetition of repeating field {@link #feeder_system_item_ids}, creating it if it does not already exist {3}
203     */
204    public DV_IDENTIFIER getFeeder_system_item_idsFirstRep() { 
205      if (getFeeder_system_item_idsList().isEmpty()) {
206        addFeeder_system_item_ids();
207      }
208      return getFeeder_system_item_idsList().get(0);
209    }
210
211    /**
212     * @return {@link #original_content} (Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR.)
213     */
214    public DV_ENCAPSULATED getOriginal_content() { 
215      return this.original_content;
216    }
217
218    public boolean hasOriginal_content() { 
219      return this.original_content != null && !this.original_content.isEmpty();
220    }
221
222    /**
223     * @param value {@link #original_content} (Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR.)
224     */
225    public FEEDER_AUDIT setOriginal_content(DV_ENCAPSULATED value) { 
226      this.original_content = value;
227      return this;
228    }
229
230    /**
231     * @return {@link #originating_system_audit} (Any audit information for the information item from the originating system.)
232     */
233    public FEEDER_AUDIT_DETAILS getOriginating_system_audit() { 
234      if (this.originating_system_audit == null)
235        if (Configuration.errorOnAutoCreate())
236          throw new Error("Attempt to auto-create FEEDER_AUDIT.originating_system_audit");
237        else if (Configuration.doAutoCreate())
238          this.originating_system_audit = new FEEDER_AUDIT_DETAILS(); // cc
239      return this.originating_system_audit;
240    }
241
242    public boolean hasOriginating_system_audit() { 
243      return this.originating_system_audit != null && !this.originating_system_audit.isEmpty();
244    }
245
246    /**
247     * @param value {@link #originating_system_audit} (Any audit information for the information item from the originating system.)
248     */
249    public FEEDER_AUDIT setOriginating_system_audit(FEEDER_AUDIT_DETAILS value) { 
250      this.originating_system_audit = value;
251      return this;
252    }
253
254    /**
255     * @return {@link #feeder_system_audit} (Any audit information for the information item from the feeder system, if different from the originating system.)
256     */
257    public FEEDER_AUDIT_DETAILS getFeeder_system_audit() { 
258      if (this.feeder_system_audit == null)
259        if (Configuration.errorOnAutoCreate())
260          throw new Error("Attempt to auto-create FEEDER_AUDIT.feeder_system_audit");
261        else if (Configuration.doAutoCreate())
262          this.feeder_system_audit = new FEEDER_AUDIT_DETAILS(); // cc
263      return this.feeder_system_audit;
264    }
265
266    public boolean hasFeeder_system_audit() { 
267      return this.feeder_system_audit != null && !this.feeder_system_audit.isEmpty();
268    }
269
270    /**
271     * @param value {@link #feeder_system_audit} (Any audit information for the information item from the feeder system, if different from the originating system.)
272     */
273    public FEEDER_AUDIT setFeeder_system_audit(FEEDER_AUDIT_DETAILS value) { 
274      this.feeder_system_audit = value;
275      return this;
276    }
277
278      protected void listChildren(List<Property> children) {
279        super.listChildren(children);
280        children.add(new Property("originating_system_item_ids", "http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER", "Identifiers used for the item in the originating system, e.g. filler and placer ids.", 0, java.lang.Integer.MAX_VALUE, originating_system_item_idsList));
281        children.add(new Property("feeder_system_item_ids", "http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER", "Identifiers used for the item in the feeder system, where the feeder system is distinct from the originating system.", 0, java.lang.Integer.MAX_VALUE, feeder_system_item_idsList));
282        children.add(new Property("original_content", "http://openehr.org/fhir/StructureDefinition/DV-ENCAPSULATED", "Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR.", 0, 1, original_content));
283        children.add(new Property("originating_system_audit", "http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS", "Any audit information for the information item from the originating system.", 0, 1, originating_system_audit));
284        children.add(new Property("feeder_system_audit", "http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS", "Any audit information for the information item from the feeder system, if different from the originating system.", 0, 1, feeder_system_audit));
285      }
286
287      @Override
288      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
289        switch (_hash) {
290        case 156875462: /*originating_system_item_ids*/  return new Property("originating_system_item_ids", "http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER", "Identifiers used for the item in the originating system, e.g. filler and placer ids.", 0, java.lang.Integer.MAX_VALUE, originating_system_item_idsList);
291        case 1194763816: /*feeder_system_item_ids*/  return new Property("feeder_system_item_ids", "http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER", "Identifiers used for the item in the feeder system, where the feeder system is distinct from the originating system.", 0, java.lang.Integer.MAX_VALUE, feeder_system_item_idsList);
292        case 1891566603: /*original_content*/  return new Property("original_content", "http://openehr.org/fhir/StructureDefinition/DV-ENCAPSULATED", "Optional inline inclusion of or reference to original content corresponding to the openEHR content at this node. Typically a URI reference to a document or message in a persistent store associated with the EHR.", 0, 1, original_content);
293        case 1684191969: /*originating_system_audit*/  return new Property("originating_system_audit", "http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS", "Any audit information for the information item from the originating system.", 0, 1, originating_system_audit);
294        case -455976257: /*feeder_system_audit*/  return new Property("feeder_system_audit", "http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS", "Any audit information for the information item from the feeder system, if different from the originating system.", 0, 1, feeder_system_audit);
295        default: return super.getNamedProperty(_hash, _name, _checkValid);
296        }
297
298      }
299
300      @Override
301      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
302        switch (hash) {
303        case 156875462: /*originating_system_item_ids*/ return this.originating_system_item_idsList == null ? new Base[0] : this.originating_system_item_idsList.toArray(new Base[this.originating_system_item_idsList.size()]); // DV_IDENTIFIER
304        case 1194763816: /*feeder_system_item_ids*/ return this.feeder_system_item_idsList == null ? new Base[0] : this.feeder_system_item_idsList.toArray(new Base[this.feeder_system_item_idsList.size()]); // DV_IDENTIFIER
305        case 1891566603: /*original_content*/ return this.original_content == null ? new Base[0] : new Base[] {this.original_content}; // DV_ENCAPSULATED
306        case 1684191969: /*originating_system_audit*/ return this.originating_system_audit == null ? new Base[0] : new Base[] {this.originating_system_audit}; // FEEDER_AUDIT_DETAILS
307        case -455976257: /*feeder_system_audit*/ return this.feeder_system_audit == null ? new Base[0] : new Base[] {this.feeder_system_audit}; // FEEDER_AUDIT_DETAILS
308        default: return super.getProperty(hash, name, checkValid);
309        }
310
311      }
312
313      @Override
314      public Base setProperty(int hash, String name, Base value) throws FHIRException {
315        switch (hash) {
316        case 156875462: // originating_system_item_ids
317          this.getOriginating_system_item_idsList().add((DV_IDENTIFIER) value); // DV_IDENTIFIER
318          return value;
319        case 1194763816: // feeder_system_item_ids
320          this.getFeeder_system_item_idsList().add((DV_IDENTIFIER) value); // DV_IDENTIFIER
321          return value;
322        case 1891566603: // original_content
323          this.original_content = (DV_ENCAPSULATED) value; // DV_ENCAPSULATED
324          return value;
325        case 1684191969: // originating_system_audit
326          this.originating_system_audit = (FEEDER_AUDIT_DETAILS) value; // FEEDER_AUDIT_DETAILS
327          return value;
328        case -455976257: // feeder_system_audit
329          this.feeder_system_audit = (FEEDER_AUDIT_DETAILS) value; // FEEDER_AUDIT_DETAILS
330          return value;
331        default: return super.setProperty(hash, name, value);
332        }
333
334      }
335
336      @Override
337      public Base setProperty(String name, Base value) throws FHIRException {
338        if (name.equals("originating_system_item_ids")) {
339          this.getOriginating_system_item_idsList().add((DV_IDENTIFIER) value); // DV_IDENTIFIER
340        } else if (name.equals("feeder_system_item_ids")) {
341          this.getFeeder_system_item_idsList().add((DV_IDENTIFIER) value); // DV_IDENTIFIER
342        } else if (name.equals("original_content")) {
343          this.original_content = (DV_ENCAPSULATED) value; // DV_ENCAPSULATED
344        } else if (name.equals("originating_system_audit")) {
345          this.originating_system_audit = (FEEDER_AUDIT_DETAILS) value; // FEEDER_AUDIT_DETAILS
346        } else if (name.equals("feeder_system_audit")) {
347          this.feeder_system_audit = (FEEDER_AUDIT_DETAILS) value; // FEEDER_AUDIT_DETAILS
348        } else
349          return super.setProperty(name, value);
350        return value;
351      }
352
353      @Override
354      public Base makeProperty(int hash, String name) throws FHIRException {
355        switch (hash) {
356        case 156875462:  return addOriginating_system_item_ids(); 
357        case 1194763816:  return addFeeder_system_item_ids(); 
358        case 1891566603: /*div*/
359          throw new Error("Unable to make an instance of the abstract property 'original_content'");
360        case 1684191969:  return getOriginating_system_audit();
361        case -455976257:  return getFeeder_system_audit();
362        default: return super.makeProperty(hash, name);
363        }
364
365      }
366
367      @Override
368      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
369        switch (hash) {
370        case 156875462: /*originating_system_item_ids*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER"};
371        case 1194763816: /*feeder_system_item_ids*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-IDENTIFIER"};
372        case 1891566603: /*original_content*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-ENCAPSULATED"};
373        case 1684191969: /*originating_system_audit*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS"};
374        case -455976257: /*feeder_system_audit*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/FEEDER-AUDIT-DETAILS"};
375        default: return super.getTypesForProperty(hash, name);
376        }
377
378      }
379
380      @Override
381      public Base addChild(String name) throws FHIRException {
382        if (name.equals("originating_system_item_ids")) {
383          return addOriginating_system_item_ids();
384        }
385        else if (name.equals("feeder_system_item_ids")) {
386          return addFeeder_system_item_ids();
387        }
388        else if (name.equals("original_content")) {
389          throw new FHIRException("Cannot call addChild on an abstract type FEEDER_AUDIT.original_content");
390        }
391        else if (name.equals("originating_system_audit")) {
392          this.originating_system_audit = new FEEDER_AUDIT_DETAILS();
393          return this.originating_system_audit;
394        }
395        else if (name.equals("feeder_system_audit")) {
396          this.feeder_system_audit = new FEEDER_AUDIT_DETAILS();
397          return this.feeder_system_audit;
398        }
399        else
400          return super.addChild(name);
401      }
402
403  public String fhirType() {
404    return "FEEDER_AUDIT";
405
406  }
407
408      public FEEDER_AUDIT copy() {
409        FEEDER_AUDIT dst = new FEEDER_AUDIT();
410        copyValues(dst);
411        return dst;
412      }
413
414      public void copyValues(FEEDER_AUDIT dst) {
415        super.copyValues(dst);
416        if (originating_system_item_idsList != null) {
417          dst.originating_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
418          for (DV_IDENTIFIER i : originating_system_item_idsList)
419            dst.originating_system_item_idsList.add(i.copy());
420        };
421        if (feeder_system_item_idsList != null) {
422          dst.feeder_system_item_idsList = new ArrayList<DV_IDENTIFIER>();
423          for (DV_IDENTIFIER i : feeder_system_item_idsList)
424            dst.feeder_system_item_idsList.add(i.copy());
425        };
426        dst.original_content = original_content == null ? null : original_content.copy();
427        dst.originating_system_audit = originating_system_audit == null ? null : originating_system_audit.copy();
428        dst.feeder_system_audit = feeder_system_audit == null ? null : feeder_system_audit.copy();
429      }
430
431      protected FEEDER_AUDIT typedCopy() {
432        return copy();
433      }
434
435      @Override
436      public boolean equalsDeep(Base other_) {
437        if (!super.equalsDeep(other_))
438          return false;
439        if (!(other_ instanceof FEEDER_AUDIT))
440          return false;
441        FEEDER_AUDIT o = (FEEDER_AUDIT) other_;
442        return compareDeep(originating_system_item_idsList, o.originating_system_item_idsList, true)
443           && compareDeep(feeder_system_item_idsList, o.feeder_system_item_idsList, true) && compareDeep(original_content, o.original_content, true)
444           && compareDeep(originating_system_audit, o.originating_system_audit, true) && compareDeep(feeder_system_audit, o.feeder_system_audit, true)
445          ;
446      }
447
448      @Override
449      public boolean equalsShallow(Base other_) {
450        if (!super.equalsShallow(other_))
451          return false;
452        if (!(other_ instanceof FEEDER_AUDIT))
453          return false;
454        FEEDER_AUDIT o = (FEEDER_AUDIT) other_;
455        return true;
456      }
457
458      public boolean isEmpty() {
459        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(originating_system_item_idsList
460          , feeder_system_item_idsList, original_content, originating_system_audit, feeder_system_audit
461          );
462      }
463
464
465}
466