
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 notion of a revision history of audit items, each associated with the version for which that audit was committed. The list is in most-recent-first order. 050 */ 051@DatatypeDef(name="REVISION_HISTORY") 052public class REVISION_HISTORY extends LogicalBase implements ICompositeType { 053 054 /** 055 * The version id of the most recent item, as a String. 056 */ 057 @Child(name = "most_recent_version", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=false) 058 @Description(shortDefinition="The version id of the most recent item, as a String", formalDefinition="The version id of the most recent item, as a String." ) 059 protected StringType most_recent_version; 060 061 /** 062 * The commit date/time of the most recent item, as a String. 063 */ 064 @Child(name = "most_recent_version_time_committed", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 065 @Description(shortDefinition="The commit date/time of the most recent item, as a String", formalDefinition="The commit date/time of the most recent item, as a String." ) 066 protected StringType most_recent_version_time_committed; 067 068 private static final long serialVersionUID = 213309767L; 069 070 /** 071 * Constructor 072 */ 073 public REVISION_HISTORY() { 074 super(); 075 } 076 077 /** 078 * Constructor 079 */ 080 public REVISION_HISTORY(String most_recent_version, String most_recent_version_time_committed) { 081 super(); 082 this.setMost_recent_version(most_recent_version); 083 this.setMost_recent_version_time_committed(most_recent_version_time_committed); 084 } 085 086 /** 087 * @return {@link #most_recent_version} (The version id of the most recent item, as a String.). This is the underlying object with id, value and extensions. The accessor "getMost_recent_version" gives direct access to the value 088 */ 089 public StringType getMost_recent_versionElement() { 090 if (this.most_recent_version == null) 091 if (Configuration.errorOnAutoCreate()) 092 throw new Error("Attempt to auto-create REVISION_HISTORY.most_recent_version"); 093 else if (Configuration.doAutoCreate()) 094 this.most_recent_version = new StringType(); // bb 095 return this.most_recent_version; 096 } 097 098 public boolean hasMost_recent_versionElement() { 099 return this.most_recent_version != null && !this.most_recent_version.isEmpty(); 100 } 101 102 public boolean hasMost_recent_version() { 103 return this.most_recent_version != null && !this.most_recent_version.isEmpty(); 104 } 105 106 /** 107 * @param value {@link #most_recent_version} (The version id of the most recent item, as a String.). This is the underlying object with id, value and extensions. The accessor "getMost_recent_version" gives direct access to the value 108 */ 109 public REVISION_HISTORY setMost_recent_versionElement(StringType value) { 110 this.most_recent_version = value; 111 return this; 112 } 113 114 /** 115 * @return The version id of the most recent item, as a String. 116 */ 117 public String getMost_recent_version() { 118 return this.most_recent_version == null ? null : this.most_recent_version.getValue(); 119 } 120 121 /** 122 * @param value The version id of the most recent item, as a String. 123 */ 124 public REVISION_HISTORY setMost_recent_version(String value) { 125 if (this.most_recent_version == null) 126 this.most_recent_version = new StringType(); 127 this.most_recent_version.setValue(value); 128 return this; 129 } 130 131 /** 132 * @return {@link #most_recent_version_time_committed} (The commit date/time of the most recent item, as a String.). This is the underlying object with id, value and extensions. The accessor "getMost_recent_version_time_committed" gives direct access to the value 133 */ 134 public StringType getMost_recent_version_time_committedElement() { 135 if (this.most_recent_version_time_committed == null) 136 if (Configuration.errorOnAutoCreate()) 137 throw new Error("Attempt to auto-create REVISION_HISTORY.most_recent_version_time_committed"); 138 else if (Configuration.doAutoCreate()) 139 this.most_recent_version_time_committed = new StringType(); // bb 140 return this.most_recent_version_time_committed; 141 } 142 143 public boolean hasMost_recent_version_time_committedElement() { 144 return this.most_recent_version_time_committed != null && !this.most_recent_version_time_committed.isEmpty(); 145 } 146 147 public boolean hasMost_recent_version_time_committed() { 148 return this.most_recent_version_time_committed != null && !this.most_recent_version_time_committed.isEmpty(); 149 } 150 151 /** 152 * @param value {@link #most_recent_version_time_committed} (The commit date/time of the most recent item, as a String.). This is the underlying object with id, value and extensions. The accessor "getMost_recent_version_time_committed" gives direct access to the value 153 */ 154 public REVISION_HISTORY setMost_recent_version_time_committedElement(StringType value) { 155 this.most_recent_version_time_committed = value; 156 return this; 157 } 158 159 /** 160 * @return The commit date/time of the most recent item, as a String. 161 */ 162 public String getMost_recent_version_time_committed() { 163 return this.most_recent_version_time_committed == null ? null : this.most_recent_version_time_committed.getValue(); 164 } 165 166 /** 167 * @param value The commit date/time of the most recent item, as a String. 168 */ 169 public REVISION_HISTORY setMost_recent_version_time_committed(String value) { 170 if (this.most_recent_version_time_committed == null) 171 this.most_recent_version_time_committed = new StringType(); 172 this.most_recent_version_time_committed.setValue(value); 173 return this; 174 } 175 176 protected void listChildren(List<Property> children) { 177 super.listChildren(children); 178 children.add(new Property("most_recent_version", "string", "The version id of the most recent item, as a String.", 0, 1, most_recent_version)); 179 children.add(new Property("most_recent_version_time_committed", "string", "The commit date/time of the most recent item, as a String.", 0, 1, most_recent_version_time_committed)); 180 } 181 182 @Override 183 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 184 switch (_hash) { 185 case -971449552: /*most_recent_version*/ return new Property("most_recent_version", "string", "The version id of the most recent item, as a String.", 0, 1, most_recent_version); 186 case 855029113: /*most_recent_version_time_committed*/ return new Property("most_recent_version_time_committed", "string", "The commit date/time of the most recent item, as a String.", 0, 1, most_recent_version_time_committed); 187 default: return super.getNamedProperty(_hash, _name, _checkValid); 188 } 189 190 } 191 192 @Override 193 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 194 switch (hash) { 195 case -971449552: /*most_recent_version*/ return this.most_recent_version == null ? new Base[0] : new Base[] {this.most_recent_version}; // StringType 196 case 855029113: /*most_recent_version_time_committed*/ return this.most_recent_version_time_committed == null ? new Base[0] : new Base[] {this.most_recent_version_time_committed}; // StringType 197 default: return super.getProperty(hash, name, checkValid); 198 } 199 200 } 201 202 @Override 203 public Base setProperty(int hash, String name, Base value) throws FHIRException { 204 switch (hash) { 205 case -971449552: // most_recent_version 206 this.most_recent_version = TypeConvertor.castToString(value); // StringType 207 return value; 208 case 855029113: // most_recent_version_time_committed 209 this.most_recent_version_time_committed = TypeConvertor.castToString(value); // StringType 210 return value; 211 default: return super.setProperty(hash, name, value); 212 } 213 214 } 215 216 @Override 217 public Base setProperty(String name, Base value) throws FHIRException { 218 if (name.equals("most_recent_version")) { 219 this.most_recent_version = TypeConvertor.castToString(value); // StringType 220 } else if (name.equals("most_recent_version_time_committed")) { 221 this.most_recent_version_time_committed = TypeConvertor.castToString(value); // StringType 222 } else 223 return super.setProperty(name, value); 224 return value; 225 } 226 227 @Override 228 public Base makeProperty(int hash, String name) throws FHIRException { 229 switch (hash) { 230 case -971449552: return getMost_recent_versionElement(); 231 case 855029113: return getMost_recent_version_time_committedElement(); 232 default: return super.makeProperty(hash, name); 233 } 234 235 } 236 237 @Override 238 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 239 switch (hash) { 240 case -971449552: /*most_recent_version*/ return new String[] {"string"}; 241 case 855029113: /*most_recent_version_time_committed*/ return new String[] {"string"}; 242 default: return super.getTypesForProperty(hash, name); 243 } 244 245 } 246 247 @Override 248 public Base addChild(String name) throws FHIRException { 249 if (name.equals("most_recent_version")) { 250 throw new FHIRException("Cannot call addChild on a singleton property REVISION_HISTORY.most_recent_version"); 251 } 252 else if (name.equals("most_recent_version_time_committed")) { 253 throw new FHIRException("Cannot call addChild on a singleton property REVISION_HISTORY.most_recent_version_time_committed"); 254 } 255 else 256 return super.addChild(name); 257 } 258 259 public String fhirType() { 260 return "REVISION_HISTORY"; 261 262 } 263 264 public REVISION_HISTORY copy() { 265 REVISION_HISTORY dst = new REVISION_HISTORY(); 266 copyValues(dst); 267 return dst; 268 } 269 270 public void copyValues(REVISION_HISTORY dst) { 271 super.copyValues(dst); 272 dst.most_recent_version = most_recent_version == null ? null : most_recent_version.copy(); 273 dst.most_recent_version_time_committed = most_recent_version_time_committed == null ? null : most_recent_version_time_committed.copy(); 274 } 275 276 protected REVISION_HISTORY typedCopy() { 277 return copy(); 278 } 279 280 @Override 281 public boolean equalsDeep(Base other_) { 282 if (!super.equalsDeep(other_)) 283 return false; 284 if (!(other_ instanceof REVISION_HISTORY)) 285 return false; 286 REVISION_HISTORY o = (REVISION_HISTORY) other_; 287 return compareDeep(most_recent_version, o.most_recent_version, true) && compareDeep(most_recent_version_time_committed, o.most_recent_version_time_committed, true) 288 ; 289 } 290 291 @Override 292 public boolean equalsShallow(Base other_) { 293 if (!super.equalsShallow(other_)) 294 return false; 295 if (!(other_ instanceof REVISION_HISTORY)) 296 return false; 297 REVISION_HISTORY o = (REVISION_HISTORY) other_; 298 return compareValues(most_recent_version, o.most_recent_version, true) && compareValues(most_recent_version_time_committed, o.most_recent_version_time_committed, true) 299 ; 300 } 301 302 public boolean isEmpty() { 303 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(most_recent_version, most_recent_version_time_committed 304 ); 305 } 306 307 308} 309