
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 * 050 */ 051@DatatypeDef(name="WebTemplate") 052public class WebTemplate extends LogicalBase implements ICompositeType { 053 054 /** 055 * 056 */ 057 @Child(name = "templateId", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=false) 058 @Description(shortDefinition="Operational template ID", formalDefinition="" ) 059 protected StringType templateId; 060 061 /** 062 * 063 */ 064 @Child(name = "version", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 065 @Description(shortDefinition="Web template structure version", formalDefinition="" ) 066 protected StringType version; 067 068 /** 069 * 070 */ 071 @Child(name = "semver", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false) 072 @Description(shortDefinition="The semantic version number of the openEHR template", formalDefinition="" ) 073 protected StringType semver; 074 075 /** 076 * 077 */ 078 @Child(name = "defaultLanguage", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false) 079 @Description(shortDefinition="Default labels for fields will be in this language", formalDefinition="" ) 080 protected StringType defaultLanguage; 081 082 /** 083 * 084 */ 085 @Child(name = "languages", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 086 @Description(shortDefinition="Array of additional languages. Labels for fields and coded texts will also be available in these additional languages, provided that the operational template has them", formalDefinition="" ) 087 protected List<StringType> languagesList; 088 089 /** 090 * 091 */ 092 @Child(name = "tree", type = {WebTemplateItem.class}, order=5, min=1, max=1, modifier=false, summary=false) 093 @Description(shortDefinition="Hierarchical structure of nodes each one potentially having further children", formalDefinition="" ) 094 protected WebTemplateItem tree; 095 096 private static final long serialVersionUID = 1714233507L; 097 098 /** 099 * Constructor 100 */ 101 public WebTemplate() { 102 super(); 103 } 104 105 /** 106 * Constructor 107 */ 108 public WebTemplate(String templateId, String version, String defaultLanguage, WebTemplateItem tree) { 109 super(); 110 this.setTemplateId(templateId); 111 this.setVersion(version); 112 this.setDefaultLanguage(defaultLanguage); 113 this.setTree(tree); 114 } 115 116 /** 117 * @return {@link #templateId} (). This is the underlying object with id, value and extensions. The accessor "getTemplateId" gives direct access to the value 118 */ 119 public StringType getTemplateIdElement() { 120 if (this.templateId == null) 121 if (Configuration.errorOnAutoCreate()) 122 throw new Error("Attempt to auto-create WebTemplate.templateId"); 123 else if (Configuration.doAutoCreate()) 124 this.templateId = new StringType(); // bb 125 return this.templateId; 126 } 127 128 public boolean hasTemplateIdElement() { 129 return this.templateId != null && !this.templateId.isEmpty(); 130 } 131 132 public boolean hasTemplateId() { 133 return this.templateId != null && !this.templateId.isEmpty(); 134 } 135 136 /** 137 * @param value {@link #templateId} (). This is the underlying object with id, value and extensions. The accessor "getTemplateId" gives direct access to the value 138 */ 139 public WebTemplate setTemplateIdElement(StringType value) { 140 this.templateId = value; 141 return this; 142 } 143 144 /** 145 * @return 146 */ 147 public String getTemplateId() { 148 return this.templateId == null ? null : this.templateId.getValue(); 149 } 150 151 /** 152 * @param value 153 */ 154 public WebTemplate setTemplateId(String value) { 155 if (this.templateId == null) 156 this.templateId = new StringType(); 157 this.templateId.setValue(value); 158 return this; 159 } 160 161 /** 162 * @return {@link #version} (). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 163 */ 164 public StringType getVersionElement() { 165 if (this.version == null) 166 if (Configuration.errorOnAutoCreate()) 167 throw new Error("Attempt to auto-create WebTemplate.version"); 168 else if (Configuration.doAutoCreate()) 169 this.version = new StringType(); // bb 170 return this.version; 171 } 172 173 public boolean hasVersionElement() { 174 return this.version != null && !this.version.isEmpty(); 175 } 176 177 public boolean hasVersion() { 178 return this.version != null && !this.version.isEmpty(); 179 } 180 181 /** 182 * @param value {@link #version} (). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 183 */ 184 public WebTemplate setVersionElement(StringType value) { 185 this.version = value; 186 return this; 187 } 188 189 /** 190 * @return 191 */ 192 public String getVersion() { 193 return this.version == null ? null : this.version.getValue(); 194 } 195 196 /** 197 * @param value 198 */ 199 public WebTemplate setVersion(String value) { 200 if (this.version == null) 201 this.version = new StringType(); 202 this.version.setValue(value); 203 return this; 204 } 205 206 /** 207 * @return {@link #semver} (). This is the underlying object with id, value and extensions. The accessor "getSemver" gives direct access to the value 208 */ 209 public StringType getSemverElement() { 210 if (this.semver == null) 211 if (Configuration.errorOnAutoCreate()) 212 throw new Error("Attempt to auto-create WebTemplate.semver"); 213 else if (Configuration.doAutoCreate()) 214 this.semver = new StringType(); // bb 215 return this.semver; 216 } 217 218 public boolean hasSemverElement() { 219 return this.semver != null && !this.semver.isEmpty(); 220 } 221 222 public boolean hasSemver() { 223 return this.semver != null && !this.semver.isEmpty(); 224 } 225 226 /** 227 * @param value {@link #semver} (). This is the underlying object with id, value and extensions. The accessor "getSemver" gives direct access to the value 228 */ 229 public WebTemplate setSemverElement(StringType value) { 230 this.semver = value; 231 return this; 232 } 233 234 /** 235 * @return 236 */ 237 public String getSemver() { 238 return this.semver == null ? null : this.semver.getValue(); 239 } 240 241 /** 242 * @param value 243 */ 244 public WebTemplate setSemver(String value) { 245 if (Utilities.noString(value)) 246 this.semver = null; 247 else { 248 if (this.semver == null) 249 this.semver = new StringType(); 250 this.semver.setValue(value); 251 } 252 return this; 253 } 254 255 /** 256 * @return {@link #defaultLanguage} (). This is the underlying object with id, value and extensions. The accessor "getDefaultLanguage" gives direct access to the value 257 */ 258 public StringType getDefaultLanguageElement() { 259 if (this.defaultLanguage == null) 260 if (Configuration.errorOnAutoCreate()) 261 throw new Error("Attempt to auto-create WebTemplate.defaultLanguage"); 262 else if (Configuration.doAutoCreate()) 263 this.defaultLanguage = new StringType(); // bb 264 return this.defaultLanguage; 265 } 266 267 public boolean hasDefaultLanguageElement() { 268 return this.defaultLanguage != null && !this.defaultLanguage.isEmpty(); 269 } 270 271 public boolean hasDefaultLanguage() { 272 return this.defaultLanguage != null && !this.defaultLanguage.isEmpty(); 273 } 274 275 /** 276 * @param value {@link #defaultLanguage} (). This is the underlying object with id, value and extensions. The accessor "getDefaultLanguage" gives direct access to the value 277 */ 278 public WebTemplate setDefaultLanguageElement(StringType value) { 279 this.defaultLanguage = value; 280 return this; 281 } 282 283 /** 284 * @return 285 */ 286 public String getDefaultLanguage() { 287 return this.defaultLanguage == null ? null : this.defaultLanguage.getValue(); 288 } 289 290 /** 291 * @param value 292 */ 293 public WebTemplate setDefaultLanguage(String value) { 294 if (this.defaultLanguage == null) 295 this.defaultLanguage = new StringType(); 296 this.defaultLanguage.setValue(value); 297 return this; 298 } 299 300 /** 301 * @return {@link #languages} () 302 */ 303 public List<StringType> getLanguagesList() { 304 if (this.languagesList == null) 305 this.languagesList = new ArrayList<StringType>(); 306 return this.languagesList; 307 } 308 309 /** 310 * @return Returns a reference to <code>this</code> for easy method chaining 311 */ 312 public WebTemplate setLanguagesList(List<StringType> theLanguages) { 313 this.languagesList = theLanguages; 314 return this; 315 } 316 317 public boolean hasLanguages() { 318 if (this.languagesList == null) 319 return false; 320 for (StringType item : this.languagesList) 321 if (!item.isEmpty()) 322 return true; 323 return false; 324 } 325 326 /** 327 * @return {@link #languages} () 328 */ 329 public StringType addLanguagesElement() {//2 330 StringType t = new StringType(); 331 if (this.languagesList == null) 332 this.languagesList = new ArrayList<StringType>(); 333 this.languagesList.add(t); 334 return t; 335 } 336 337 /** 338 * @param value {@link #languages} () 339 */ 340 public WebTemplate addLanguages(String value) { //1 341 StringType t = new StringType(); 342 t.setValue(value); 343 if (this.languagesList == null) 344 this.languagesList = new ArrayList<StringType>(); 345 this.languagesList.add(t); 346 return this; 347 } 348 349 /** 350 * @param value {@link #languages} () 351 */ 352 public boolean hasLanguages(String value) { 353 if (this.languagesList == null) 354 return false; 355 for (StringType v : this.languagesList) 356 if (v.getValue().equals(value)) // string 357 return true; 358 return false; 359 } 360 361 /** 362 * @return {@link #tree} () 363 */ 364 public WebTemplateItem getTree() { 365 if (this.tree == null) 366 if (Configuration.errorOnAutoCreate()) 367 throw new Error("Attempt to auto-create WebTemplate.tree"); 368 else if (Configuration.doAutoCreate()) 369 this.tree = new WebTemplateItem(); // cc 370 return this.tree; 371 } 372 373 public boolean hasTree() { 374 return this.tree != null && !this.tree.isEmpty(); 375 } 376 377 /** 378 * @param value {@link #tree} () 379 */ 380 public WebTemplate setTree(WebTemplateItem value) { 381 this.tree = value; 382 return this; 383 } 384 385 protected void listChildren(List<Property> children) { 386 super.listChildren(children); 387 children.add(new Property("templateId", "string", "", 0, 1, templateId)); 388 children.add(new Property("version", "string", "", 0, 1, version)); 389 children.add(new Property("semver", "string", "", 0, 1, semver)); 390 children.add(new Property("defaultLanguage", "string", "", 0, 1, defaultLanguage)); 391 children.add(new Property("languages", "string", "", 0, java.lang.Integer.MAX_VALUE, languagesList)); 392 children.add(new Property("tree", "http://openehr.org/fhir/StructureDefinition/WebTemplateItem", "", 0, 1, tree)); 393 } 394 395 @Override 396 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 397 switch (_hash) { 398 case 1304010549: /*templateId*/ return new Property("templateId", "string", "", 0, 1, templateId); 399 case 351608024: /*version*/ return new Property("version", "string", "", 0, 1, version); 400 case -905975448: /*semver*/ return new Property("semver", "string", "", 0, 1, semver); 401 case 384498873: /*defaultLanguage*/ return new Property("defaultLanguage", "string", "", 0, 1, defaultLanguage); 402 case 1518327835: /*languages*/ return new Property("languages", "string", "", 0, java.lang.Integer.MAX_VALUE, languagesList); 403 case 3568542: /*tree*/ return new Property("tree", "http://openehr.org/fhir/StructureDefinition/WebTemplateItem", "", 0, 1, tree); 404 default: return super.getNamedProperty(_hash, _name, _checkValid); 405 } 406 407 } 408 409 @Override 410 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 411 switch (hash) { 412 case 1304010549: /*templateId*/ return this.templateId == null ? new Base[0] : new Base[] {this.templateId}; // StringType 413 case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType 414 case -905975448: /*semver*/ return this.semver == null ? new Base[0] : new Base[] {this.semver}; // StringType 415 case 384498873: /*defaultLanguage*/ return this.defaultLanguage == null ? new Base[0] : new Base[] {this.defaultLanguage}; // StringType 416 case 1518327835: /*languages*/ return this.languagesList == null ? new Base[0] : this.languagesList.toArray(new Base[this.languagesList.size()]); // StringType 417 case 3568542: /*tree*/ return this.tree == null ? new Base[0] : new Base[] {this.tree}; // WebTemplateItem 418 default: return super.getProperty(hash, name, checkValid); 419 } 420 421 } 422 423 @Override 424 public Base setProperty(int hash, String name, Base value) throws FHIRException { 425 switch (hash) { 426 case 1304010549: // templateId 427 this.templateId = TypeConvertor.castToString(value); // StringType 428 return value; 429 case 351608024: // version 430 this.version = TypeConvertor.castToString(value); // StringType 431 return value; 432 case -905975448: // semver 433 this.semver = TypeConvertor.castToString(value); // StringType 434 return value; 435 case 384498873: // defaultLanguage 436 this.defaultLanguage = TypeConvertor.castToString(value); // StringType 437 return value; 438 case 1518327835: // languages 439 this.getLanguagesList().add(TypeConvertor.castToString(value)); // StringType 440 return value; 441 case 3568542: // tree 442 this.tree = (WebTemplateItem) value; // WebTemplateItem 443 return value; 444 default: return super.setProperty(hash, name, value); 445 } 446 447 } 448 449 @Override 450 public Base setProperty(String name, Base value) throws FHIRException { 451 if (name.equals("templateId")) { 452 this.templateId = TypeConvertor.castToString(value); // StringType 453 } else if (name.equals("version")) { 454 this.version = TypeConvertor.castToString(value); // StringType 455 } else if (name.equals("semver")) { 456 this.semver = TypeConvertor.castToString(value); // StringType 457 } else if (name.equals("defaultLanguage")) { 458 this.defaultLanguage = TypeConvertor.castToString(value); // StringType 459 } else if (name.equals("languages")) { 460 this.getLanguagesList().add(TypeConvertor.castToString(value)); // StringType 461 } else if (name.equals("tree")) { 462 this.tree = (WebTemplateItem) value; // WebTemplateItem 463 } else 464 return super.setProperty(name, value); 465 return value; 466 } 467 468 @Override 469 public Base makeProperty(int hash, String name) throws FHIRException { 470 switch (hash) { 471 case 1304010549: return getTemplateIdElement(); 472 case 351608024: return getVersionElement(); 473 case -905975448: return getSemverElement(); 474 case 384498873: return getDefaultLanguageElement(); 475 case 1518327835: return addLanguagesElement(); 476 case 3568542: return getTree(); 477 default: return super.makeProperty(hash, name); 478 } 479 480 } 481 482 @Override 483 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 484 switch (hash) { 485 case 1304010549: /*templateId*/ return new String[] {"string"}; 486 case 351608024: /*version*/ return new String[] {"string"}; 487 case -905975448: /*semver*/ return new String[] {"string"}; 488 case 384498873: /*defaultLanguage*/ return new String[] {"string"}; 489 case 1518327835: /*languages*/ return new String[] {"string"}; 490 case 3568542: /*tree*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/WebTemplateItem"}; 491 default: return super.getTypesForProperty(hash, name); 492 } 493 494 } 495 496 @Override 497 public Base addChild(String name) throws FHIRException { 498 if (name.equals("templateId")) { 499 throw new FHIRException("Cannot call addChild on a singleton property WebTemplate.templateId"); 500 } 501 else if (name.equals("version")) { 502 throw new FHIRException("Cannot call addChild on a singleton property WebTemplate.version"); 503 } 504 else if (name.equals("semver")) { 505 throw new FHIRException("Cannot call addChild on a singleton property WebTemplate.semver"); 506 } 507 else if (name.equals("defaultLanguage")) { 508 throw new FHIRException("Cannot call addChild on a singleton property WebTemplate.defaultLanguage"); 509 } 510 else if (name.equals("languages")) { 511 throw new FHIRException("Cannot call addChild on a singleton property WebTemplate.languages"); 512 } 513 else if (name.equals("tree")) { 514 this.tree = new WebTemplateItem(); 515 return this.tree; 516 } 517 else 518 return super.addChild(name); 519 } 520 521 public String fhirType() { 522 return "WebTemplate"; 523 524 } 525 526 public WebTemplate copy() { 527 WebTemplate dst = new WebTemplate(); 528 copyValues(dst); 529 return dst; 530 } 531 532 public void copyValues(WebTemplate dst) { 533 super.copyValues(dst); 534 dst.templateId = templateId == null ? null : templateId.copy(); 535 dst.version = version == null ? null : version.copy(); 536 dst.semver = semver == null ? null : semver.copy(); 537 dst.defaultLanguage = defaultLanguage == null ? null : defaultLanguage.copy(); 538 if (languagesList != null) { 539 dst.languagesList = new ArrayList<StringType>(); 540 for (StringType i : languagesList) 541 dst.languagesList.add(i.copy()); 542 }; 543 dst.tree = tree == null ? null : tree.copy(); 544 } 545 546 protected WebTemplate typedCopy() { 547 return copy(); 548 } 549 550 @Override 551 public boolean equalsDeep(Base other_) { 552 if (!super.equalsDeep(other_)) 553 return false; 554 if (!(other_ instanceof WebTemplate)) 555 return false; 556 WebTemplate o = (WebTemplate) other_; 557 return compareDeep(templateId, o.templateId, true) && compareDeep(version, o.version, true) && compareDeep(semver, o.semver, true) 558 && compareDeep(defaultLanguage, o.defaultLanguage, true) && compareDeep(languagesList, o.languagesList, true) 559 && compareDeep(tree, o.tree, true); 560 } 561 562 @Override 563 public boolean equalsShallow(Base other_) { 564 if (!super.equalsShallow(other_)) 565 return false; 566 if (!(other_ instanceof WebTemplate)) 567 return false; 568 WebTemplate o = (WebTemplate) other_; 569 return compareValues(templateId, o.templateId, true) && compareValues(version, o.version, true) && compareValues(semver, o.semver, true) 570 && compareValues(defaultLanguage, o.defaultLanguage, true) && compareValues(languagesList, o.languagesList, true) 571 ; 572 } 573 574 public boolean isEmpty() { 575 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(templateId, version, semver 576 , defaultLanguage, languagesList, tree); 577 } 578 579 580} 581