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 * Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].
050 */
051@DatatypeDef(name="VERSION_TREE_ID")
052public class VERSION_TREE_ID extends LogicalBase implements ICompositeType {
053
054    /**
055     * Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].
056     */
057    @Child(name = "value", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=false)
058    @Description(shortDefinition="Version tree identifier for one version", formalDefinition="Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ]." )
059    protected StringType value;
060
061    private static final long serialVersionUID = -301439478L;
062
063  /**
064   * Constructor
065   */
066    public VERSION_TREE_ID() {
067      super();
068    }
069
070  /**
071   * Constructor
072   */
073    public VERSION_TREE_ID(String value) {
074      super();
075      this.setValue(value);
076    }
077
078    /**
079     * @return {@link #value} (Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
080     */
081    public StringType getValueElement() { 
082      if (this.value == null)
083        if (Configuration.errorOnAutoCreate())
084          throw new Error("Attempt to auto-create VERSION_TREE_ID.value");
085        else if (Configuration.doAutoCreate())
086          this.value = new StringType(); // bb
087      return this.value;
088    }
089
090    public boolean hasValueElement() { 
091      return this.value != null && !this.value.isEmpty();
092    }
093
094    public boolean hasValue() { 
095      return this.value != null && !this.value.isEmpty();
096    }
097
098    /**
099     * @param value {@link #value} (Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
100     */
101    public VERSION_TREE_ID setValueElement(StringType value) { 
102      this.value = value;
103      return this;
104    }
105
106    /**
107     * @return Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].
108     */
109    public String getValue() { 
110      return this.value == null ? null : this.value.getValue();
111    }
112
113    /**
114     * @param value Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].
115     */
116    public VERSION_TREE_ID setValue(String value) { 
117        if (this.value == null)
118          this.value = new StringType();
119        this.value.setValue(value);
120      return this;
121    }
122
123      protected void listChildren(List<Property> children) {
124        super.listChildren(children);
125        children.add(new Property("value", "string", "Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].", 0, 1, value));
126      }
127
128      @Override
129      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
130        switch (_hash) {
131        case 111972721: /*value*/  return new Property("value", "string", "Version tree identifier for one version. Lexical form: trunk_version [ '.' branch_number '.' branch_version ].", 0, 1, value);
132        default: return super.getNamedProperty(_hash, _name, _checkValid);
133        }
134
135      }
136
137      @Override
138      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
139        switch (hash) {
140        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
141        default: return super.getProperty(hash, name, checkValid);
142        }
143
144      }
145
146      @Override
147      public Base setProperty(int hash, String name, Base value) throws FHIRException {
148        switch (hash) {
149        case 111972721: // value
150          this.value = TypeConvertor.castToString(value); // StringType
151          return value;
152        default: return super.setProperty(hash, name, value);
153        }
154
155      }
156
157      @Override
158      public Base setProperty(String name, Base value) throws FHIRException {
159        if (name.equals("value")) {
160          this.value = TypeConvertor.castToString(value); // StringType
161        } else
162          return super.setProperty(name, value);
163        return value;
164      }
165
166      @Override
167      public Base makeProperty(int hash, String name) throws FHIRException {
168        switch (hash) {
169        case 111972721:  return getValueElement();
170        default: return super.makeProperty(hash, name);
171        }
172
173      }
174
175      @Override
176      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
177        switch (hash) {
178        case 111972721: /*value*/ return new String[] {"string"};
179        default: return super.getTypesForProperty(hash, name);
180        }
181
182      }
183
184      @Override
185      public Base addChild(String name) throws FHIRException {
186        if (name.equals("value")) {
187          throw new FHIRException("Cannot call addChild on a singleton property VERSION_TREE_ID.value");
188        }
189        else
190          return super.addChild(name);
191      }
192
193  public String fhirType() {
194    return "VERSION_TREE_ID";
195
196  }
197
198      public VERSION_TREE_ID copy() {
199        VERSION_TREE_ID dst = new VERSION_TREE_ID();
200        copyValues(dst);
201        return dst;
202      }
203
204      public void copyValues(VERSION_TREE_ID dst) {
205        super.copyValues(dst);
206        dst.value = value == null ? null : value.copy();
207      }
208
209      protected VERSION_TREE_ID typedCopy() {
210        return copy();
211      }
212
213      @Override
214      public boolean equalsDeep(Base other_) {
215        if (!super.equalsDeep(other_))
216          return false;
217        if (!(other_ instanceof VERSION_TREE_ID))
218          return false;
219        VERSION_TREE_ID o = (VERSION_TREE_ID) other_;
220        return compareDeep(value, o.value, true);
221      }
222
223      @Override
224      public boolean equalsShallow(Base other_) {
225        if (!super.equalsShallow(other_))
226          return false;
227        if (!(other_ instanceof VERSION_TREE_ID))
228          return false;
229        VERSION_TREE_ID o = (VERSION_TREE_ID) other_;
230        return compareValues(value, o.value, true);
231      }
232
233      public boolean isEmpty() {
234        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
235      }
236
237
238}
239