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 * Abstract concept of a proxy description of a party, including an optional link to data for this party in a demographic or other identity management system. Sub- typed into PARTY_IDENTIFIED and PARTY_SELF.
049 */
050@DatatypeDef(name="PARTY_PROXY")
051public abstract class PARTY_PROXY extends LogicalBase implements ICompositeType {
052
053    /**
054     * Optional reference to more detailed demographic or identification information for this party, in an external system.
055     */
056    @Child(name = "external_ref", type = {PARTY_REF.class}, order=0, min=0, max=1, modifier=false, summary=false)
057    @Description(shortDefinition="Reference to more detailed demographic or identification information for this party", formalDefinition="Optional reference to more detailed demographic or identification information for this party, in an external system." )
058    protected PARTY_REF external_ref;
059
060    private static final long serialVersionUID = 1726641665L;
061
062  /**
063   * Constructor
064   */
065    public PARTY_PROXY() {
066      super();
067    }
068
069    /**
070     * @return {@link #external_ref} (Optional reference to more detailed demographic or identification information for this party, in an external system.)
071     */
072    public PARTY_REF getExternal_ref() { 
073      if (this.external_ref == null)
074        if (Configuration.errorOnAutoCreate())
075          throw new Error("Attempt to auto-create PARTY_PROXY.external_ref");
076        else if (Configuration.doAutoCreate())
077          this.external_ref = new PARTY_REF(); // cc
078      return this.external_ref;
079    }
080
081    public boolean hasExternal_ref() { 
082      return this.external_ref != null && !this.external_ref.isEmpty();
083    }
084
085    /**
086     * @param value {@link #external_ref} (Optional reference to more detailed demographic or identification information for this party, in an external system.)
087     */
088    public PARTY_PROXY setExternal_ref(PARTY_REF value) { 
089      this.external_ref = value;
090      return this;
091    }
092
093      protected void listChildren(List<Property> children) {
094        super.listChildren(children);
095        children.add(new Property("external_ref", "http://openehr.org/fhir/StructureDefinition/PARTY-REF", "Optional reference to more detailed demographic or identification information for this party, in an external system.", 0, 1, external_ref));
096      }
097
098      @Override
099      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
100        switch (_hash) {
101        case -1385599457: /*external_ref*/  return new Property("external_ref", "http://openehr.org/fhir/StructureDefinition/PARTY-REF", "Optional reference to more detailed demographic or identification information for this party, in an external system.", 0, 1, external_ref);
102        default: return super.getNamedProperty(_hash, _name, _checkValid);
103        }
104
105      }
106
107      @Override
108      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
109        switch (hash) {
110        case -1385599457: /*external_ref*/ return this.external_ref == null ? new Base[0] : new Base[] {this.external_ref}; // PARTY_REF
111        default: return super.getProperty(hash, name, checkValid);
112        }
113
114      }
115
116      @Override
117      public Base setProperty(int hash, String name, Base value) throws FHIRException {
118        switch (hash) {
119        case -1385599457: // external_ref
120          this.external_ref = (PARTY_REF) value; // PARTY_REF
121          return value;
122        default: return super.setProperty(hash, name, value);
123        }
124
125      }
126
127      @Override
128      public Base setProperty(String name, Base value) throws FHIRException {
129        if (name.equals("external_ref")) {
130          this.external_ref = (PARTY_REF) value; // PARTY_REF
131        } else
132          return super.setProperty(name, value);
133        return value;
134      }
135
136      @Override
137      public Base makeProperty(int hash, String name) throws FHIRException {
138        switch (hash) {
139        case -1385599457:  return getExternal_ref();
140        default: return super.makeProperty(hash, name);
141        }
142
143      }
144
145      @Override
146      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
147        switch (hash) {
148        case -1385599457: /*external_ref*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/PARTY-REF"};
149        default: return super.getTypesForProperty(hash, name);
150        }
151
152      }
153
154      @Override
155      public Base addChild(String name) throws FHIRException {
156        if (name.equals("external_ref")) {
157          this.external_ref = new PARTY_REF();
158          return this.external_ref;
159        }
160        else
161          return super.addChild(name);
162      }
163
164  public String fhirType() {
165    return "PARTY_PROXY";
166
167  }
168
169      public abstract PARTY_PROXY copy();
170
171      public void copyValues(PARTY_PROXY dst) {
172        super.copyValues(dst);
173        dst.external_ref = external_ref == null ? null : external_ref.copy();
174      }
175
176      @Override
177      public boolean equalsDeep(Base other_) {
178        if (!super.equalsDeep(other_))
179          return false;
180        if (!(other_ instanceof PARTY_PROXY))
181          return false;
182        PARTY_PROXY o = (PARTY_PROXY) other_;
183        return compareDeep(external_ref, o.external_ref, true);
184      }
185
186      @Override
187      public boolean equalsShallow(Base other_) {
188        if (!super.equalsShallow(other_))
189          return false;
190        if (!(other_ instanceof PARTY_PROXY))
191          return false;
192        PARTY_PROXY o = (PARTY_PROXY) other_;
193        return true;
194      }
195
196      public boolean isEmpty() {
197        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(external_ref);
198      }
199
200
201}
202