001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import org.hl7.fhir.r4.model.Enumerations.*; 038import ca.uhn.fhir.model.api.annotation.Child; 039import ca.uhn.fhir.model.api.annotation.ChildOrder; 040import ca.uhn.fhir.model.api.annotation.Description; 041import ca.uhn.fhir.model.api.annotation.DatatypeDef; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * A signature along with supporting context. The signature may be a digital signature that is cryptographic in nature, or some other signature acceptable to the domain. This other signature may be as simple as a graphical image representing a hand-written signature, or a signature ceremony Different signature approaches have different utilities. 047 */ 048@DatatypeDef(name="Signature") 049public class Signature extends Type implements ICompositeType { 050 051 /** 052 * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document. 053 */ 054 @Child(name = "type", type = {Coding.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 055 @Description(shortDefinition="Indication of the reason the entity signed the object(s)", formalDefinition="An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document." ) 056 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/signature-type") 057 protected List<Coding> type; 058 059 /** 060 * When the digital signature was signed. 061 */ 062 @Child(name = "when", type = {InstantType.class}, order=1, min=1, max=1, modifier=false, summary=true) 063 @Description(shortDefinition="When the signature was created", formalDefinition="When the digital signature was signed." ) 064 protected InstantType when; 065 066 /** 067 * A reference to an application-usable description of the identity that signed (e.g. the signature used their private key). 068 */ 069 @Child(name = "who", type = {UriType.class, Practitioner.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=true) 070 @Description(shortDefinition="Who signed", formalDefinition="A reference to an application-usable description of the identity that signed (e.g. the signature used their private key)." ) 071 protected Type who; 072 073 /** 074 * A reference to an application-usable description of the identity that is represented by the signature. 075 */ 076 @Child(name = "onBehalfOf", type = {UriType.class, Practitioner.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true) 077 @Description(shortDefinition="The party represented", formalDefinition="A reference to an application-usable description of the identity that is represented by the signature." ) 078 protected Type onBehalfOf; 079 080 /** 081 * A mime type that indicates the technical format of the target resources signed by the signature. 082 */ 083 @Child(name = "targetFormat", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false) 084 @Description(shortDefinition="The technical format of the signed resources", formalDefinition="A mime type that indicates the technical format of the target resources signed by the signature." ) 085 protected CodeType targetFormat; 086 087 /** 088 * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc. 089 */ 090 @Child(name = "sigFormat", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false) 091 @Description(shortDefinition="The technical format of the signature", formalDefinition="A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc." ) 092 protected CodeType sigFormat; 093 094 /** 095 * The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 096 */ 097 @Child(name = "blob", type = {Base64BinaryType.class}, order=6, min=0, max=1, modifier=false, summary=false) 098 @Description(shortDefinition="The actual signature content (XML DigSig. JWS, picture, etc.)", formalDefinition="The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty." ) 099 protected Base64BinaryType blob; 100 101 private static final long serialVersionUID = 691965984L; 102 103 /** 104 * Constructor 105 */ 106 public Signature() { 107 super(); 108 } 109 110 /** 111 * Constructor 112 */ 113 public Signature(InstantType when, Type who) { 114 super(); 115 this.when = when; 116 this.who = who; 117 } 118 119 /** 120 * @return {@link #type} (An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.) 121 */ 122 public List<Coding> getType() { 123 if (this.type == null) 124 this.type = new ArrayList<Coding>(); 125 return this.type; 126 } 127 128 /** 129 * @return Returns a reference to <code>this</code> for easy method chaining 130 */ 131 public Signature setType(List<Coding> theType) { 132 this.type = theType; 133 return this; 134 } 135 136 public boolean hasType() { 137 if (this.type == null) 138 return false; 139 for (Coding item : this.type) 140 if (!item.isEmpty()) 141 return true; 142 return false; 143 } 144 145 public Coding addType() { //3 146 Coding t = new Coding(); 147 if (this.type == null) 148 this.type = new ArrayList<Coding>(); 149 this.type.add(t); 150 return t; 151 } 152 153 public Signature addType(Coding t) { //3 154 if (t == null) 155 return this; 156 if (this.type == null) 157 this.type = new ArrayList<Coding>(); 158 this.type.add(t); 159 return this; 160 } 161 162 /** 163 * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist 164 */ 165 public Coding getTypeFirstRep() { 166 if (getType().isEmpty()) { 167 addType(); 168 } 169 return getType().get(0); 170 } 171 172 /** 173 * @return {@link #when} (When the digital signature was signed.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value 174 */ 175 public InstantType getWhenElement() { 176 if (this.when == null) 177 if (Configuration.errorOnAutoCreate()) 178 throw new Error("Attempt to auto-create Signature.when"); 179 else if (Configuration.doAutoCreate()) 180 this.when = new InstantType(); // bb 181 return this.when; 182 } 183 184 public boolean hasWhenElement() { 185 return this.when != null && !this.when.isEmpty(); 186 } 187 188 public boolean hasWhen() { 189 return this.when != null && !this.when.isEmpty(); 190 } 191 192 /** 193 * @param value {@link #when} (When the digital signature was signed.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value 194 */ 195 public Signature setWhenElement(InstantType value) { 196 this.when = value; 197 return this; 198 } 199 200 /** 201 * @return When the digital signature was signed. 202 */ 203 public Date getWhen() { 204 return this.when == null ? null : this.when.getValue(); 205 } 206 207 /** 208 * @param value When the digital signature was signed. 209 */ 210 public Signature setWhen(Date value) { 211 if (this.when == null) 212 this.when = new InstantType(); 213 this.when.setValue(value); 214 return this; 215 } 216 217 /** 218 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 219 */ 220 public Type getWho() { 221 return this.who; 222 } 223 224 /** 225 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 226 */ 227 public UriType getWhoUriType() throws FHIRException { 228 if (this.who == null) 229 return null; 230 if (!(this.who instanceof UriType)) 231 throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.who.getClass().getName()+" was encountered"); 232 return (UriType) this.who; 233 } 234 235 public boolean hasWhoUriType() { 236 return this != null && this.who instanceof UriType; 237 } 238 239 /** 240 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 241 */ 242 public Reference getWhoReference() throws FHIRException { 243 if (this.who == null) 244 return null; 245 if (!(this.who instanceof Reference)) 246 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.who.getClass().getName()+" was encountered"); 247 return (Reference) this.who; 248 } 249 250 public boolean hasWhoReference() { 251 return this != null && this.who instanceof Reference; 252 } 253 254 public boolean hasWho() { 255 return this.who != null && !this.who.isEmpty(); 256 } 257 258 /** 259 * @param value {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 260 */ 261 public Signature setWho(Type value) { 262 if (value != null && !(value instanceof UriType || value instanceof Reference)) 263 throw new Error("Not the right type for Signature.who[x]: "+value.fhirType()); 264 this.who = value; 265 return this; 266 } 267 268 /** 269 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 270 */ 271 public Type getOnBehalfOf() { 272 return this.onBehalfOf; 273 } 274 275 /** 276 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 277 */ 278 public UriType getOnBehalfOfUriType() throws FHIRException { 279 if (this.onBehalfOf == null) 280 return null; 281 if (!(this.onBehalfOf instanceof UriType)) 282 throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.onBehalfOf.getClass().getName()+" was encountered"); 283 return (UriType) this.onBehalfOf; 284 } 285 286 public boolean hasOnBehalfOfUriType() { 287 return this != null && this.onBehalfOf instanceof UriType; 288 } 289 290 /** 291 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 292 */ 293 public Reference getOnBehalfOfReference() throws FHIRException { 294 if (this.onBehalfOf == null) 295 return null; 296 if (!(this.onBehalfOf instanceof Reference)) 297 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.onBehalfOf.getClass().getName()+" was encountered"); 298 return (Reference) this.onBehalfOf; 299 } 300 301 public boolean hasOnBehalfOfReference() { 302 return this != null && this.onBehalfOf instanceof Reference; 303 } 304 305 public boolean hasOnBehalfOf() { 306 return this.onBehalfOf != null && !this.onBehalfOf.isEmpty(); 307 } 308 309 /** 310 * @param value {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 311 */ 312 public Signature setOnBehalfOf(Type value) { 313 if (value != null && !(value instanceof UriType || value instanceof Reference)) 314 throw new Error("Not the right type for Signature.onBehalfOf[x]: "+value.fhirType()); 315 this.onBehalfOf = value; 316 return this; 317 } 318 319 /** 320 * @return {@link #targetFormat} (A mime type that indicates the technical format of the target resources signed by the signature.). This is the underlying object with id, value and extensions. The accessor "getTargetFormat" gives direct access to the value 321 */ 322 public CodeType getTargetFormatElement() { 323 if (this.targetFormat == null) 324 if (Configuration.errorOnAutoCreate()) 325 throw new Error("Attempt to auto-create Signature.targetFormat"); 326 else if (Configuration.doAutoCreate()) 327 this.targetFormat = new CodeType(); // bb 328 return this.targetFormat; 329 } 330 331 public boolean hasTargetFormatElement() { 332 return this.targetFormat != null && !this.targetFormat.isEmpty(); 333 } 334 335 public boolean hasTargetFormat() { 336 return this.targetFormat != null && !this.targetFormat.isEmpty(); 337 } 338 339 /** 340 * @param value {@link #targetFormat} (A mime type that indicates the technical format of the target resources signed by the signature.). This is the underlying object with id, value and extensions. The accessor "getTargetFormat" gives direct access to the value 341 */ 342 public Signature setTargetFormatElement(CodeType value) { 343 this.targetFormat = value; 344 return this; 345 } 346 347 /** 348 * @return A mime type that indicates the technical format of the target resources signed by the signature. 349 */ 350 public String getTargetFormat() { 351 return this.targetFormat == null ? null : this.targetFormat.getValue(); 352 } 353 354 /** 355 * @param value A mime type that indicates the technical format of the target resources signed by the signature. 356 */ 357 public Signature setTargetFormat(String value) { 358 if (Utilities.noString(value)) 359 this.targetFormat = null; 360 else { 361 if (this.targetFormat == null) 362 this.targetFormat = new CodeType(); 363 this.targetFormat.setValue(value); 364 } 365 return this; 366 } 367 368 /** 369 * @return {@link #sigFormat} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getSigFormat" gives direct access to the value 370 */ 371 public CodeType getSigFormatElement() { 372 if (this.sigFormat == null) 373 if (Configuration.errorOnAutoCreate()) 374 throw new Error("Attempt to auto-create Signature.sigFormat"); 375 else if (Configuration.doAutoCreate()) 376 this.sigFormat = new CodeType(); // bb 377 return this.sigFormat; 378 } 379 380 public boolean hasSigFormatElement() { 381 return this.sigFormat != null && !this.sigFormat.isEmpty(); 382 } 383 384 public boolean hasSigFormat() { 385 return this.sigFormat != null && !this.sigFormat.isEmpty(); 386 } 387 388 /** 389 * @param value {@link #sigFormat} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getSigFormat" gives direct access to the value 390 */ 391 public Signature setSigFormatElement(CodeType value) { 392 this.sigFormat = value; 393 return this; 394 } 395 396 /** 397 * @return A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc. 398 */ 399 public String getSigFormat() { 400 return this.sigFormat == null ? null : this.sigFormat.getValue(); 401 } 402 403 /** 404 * @param value A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc. 405 */ 406 public Signature setSigFormat(String value) { 407 if (Utilities.noString(value)) 408 this.sigFormat = null; 409 else { 410 if (this.sigFormat == null) 411 this.sigFormat = new CodeType(); 412 this.sigFormat.setValue(value); 413 } 414 return this; 415 } 416 417 /** 418 * @return {@link #blob} (The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.). This is the underlying object with id, value and extensions. The accessor "getBlob" gives direct access to the value 419 */ 420 public Base64BinaryType getBlobElement() { 421 if (this.blob == null) 422 if (Configuration.errorOnAutoCreate()) 423 throw new Error("Attempt to auto-create Signature.blob"); 424 else if (Configuration.doAutoCreate()) 425 this.blob = new Base64BinaryType(); // bb 426 return this.blob; 427 } 428 429 public boolean hasBlobElement() { 430 return this.blob != null && !this.blob.isEmpty(); 431 } 432 433 public boolean hasBlob() { 434 return this.blob != null && !this.blob.isEmpty(); 435 } 436 437 /** 438 * @param value {@link #blob} (The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.). This is the underlying object with id, value and extensions. The accessor "getBlob" gives direct access to the value 439 */ 440 public Signature setBlobElement(Base64BinaryType value) { 441 this.blob = value; 442 return this; 443 } 444 445 /** 446 * @return The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 447 */ 448 public byte[] getBlob() { 449 return this.blob == null ? null : this.blob.getValue(); 450 } 451 452 /** 453 * @param value The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 454 */ 455 public Signature setBlob(byte[] value) { 456 if (value == null) 457 this.blob = null; 458 else { 459 if (this.blob == null) 460 this.blob = new Base64BinaryType(); 461 this.blob.setValue(value); 462 } 463 return this; 464 } 465 466 protected void listChildren(List<Property> children) { 467 super.listChildren(children); 468 children.add(new Property("type", "Coding", "An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.", 0, java.lang.Integer.MAX_VALUE, type)); 469 children.add(new Property("when", "instant", "When the digital signature was signed.", 0, 1, when)); 470 children.add(new Property("who[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).", 0, 1, who)); 471 children.add(new Property("onBehalfOf[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf)); 472 children.add(new Property("targetFormat", "code", "A mime type that indicates the technical format of the target resources signed by the signature.", 0, 1, targetFormat)); 473 children.add(new Property("sigFormat", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.", 0, 1, sigFormat)); 474 children.add(new Property("blob", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, blob)); 475 } 476 477 @Override 478 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 479 switch (_hash) { 480 case 3575610: /*type*/ return new Property("type", "Coding", "An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.", 0, java.lang.Integer.MAX_VALUE, type); 481 case 3648314: /*when*/ return new Property("when", "instant", "When the digital signature was signed.", 0, 1, when); 482 case -788654078: /*who[x]*/ return new Property("who[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).", 0, 1, who); 483 case 117694: /*who*/ return new Property("who[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).", 0, 1, who); 484 case -788660018: /*whoUri*/ return new Property("who[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).", 0, 1, who); 485 case 1017243949: /*whoReference*/ return new Property("who[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).", 0, 1, who); 486 case 418120340: /*onBehalfOf[x]*/ return new Property("onBehalfOf[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf); 487 case -14402964: /*onBehalfOf*/ return new Property("onBehalfOf[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf); 488 case 418114400: /*onBehalfOfUri*/ return new Property("onBehalfOf[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf); 489 case -1136255425: /*onBehalfOfReference*/ return new Property("onBehalfOf[x]", "uri|Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf); 490 case -917363480: /*targetFormat*/ return new Property("targetFormat", "code", "A mime type that indicates the technical format of the target resources signed by the signature.", 0, 1, targetFormat); 491 case -58720216: /*sigFormat*/ return new Property("sigFormat", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.", 0, 1, sigFormat); 492 case 3026845: /*blob*/ return new Property("blob", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, blob); 493 default: return super.getNamedProperty(_hash, _name, _checkValid); 494 } 495 496 } 497 498 @Override 499 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 500 switch (hash) { 501 case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // Coding 502 case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // InstantType 503 case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Type 504 case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Type 505 case -917363480: /*targetFormat*/ return this.targetFormat == null ? new Base[0] : new Base[] {this.targetFormat}; // CodeType 506 case -58720216: /*sigFormat*/ return this.sigFormat == null ? new Base[0] : new Base[] {this.sigFormat}; // CodeType 507 case 3026845: /*blob*/ return this.blob == null ? new Base[0] : new Base[] {this.blob}; // Base64BinaryType 508 default: return super.getProperty(hash, name, checkValid); 509 } 510 511 } 512 513 @Override 514 public Base setProperty(int hash, String name, Base value) throws FHIRException { 515 switch (hash) { 516 case 3575610: // type 517 this.getType().add(castToCoding(value)); // Coding 518 return value; 519 case 3648314: // when 520 this.when = castToInstant(value); // InstantType 521 return value; 522 case 117694: // who 523 this.who = castToType(value); // Type 524 return value; 525 case -14402964: // onBehalfOf 526 this.onBehalfOf = castToType(value); // Type 527 return value; 528 case -917363480: // targetFormat 529 this.targetFormat = castToCode(value); // CodeType 530 return value; 531 case -58720216: // sigFormat 532 this.sigFormat = castToCode(value); // CodeType 533 return value; 534 case 3026845: // blob 535 this.blob = castToBase64Binary(value); // Base64BinaryType 536 return value; 537 default: return super.setProperty(hash, name, value); 538 } 539 540 } 541 542 @Override 543 public Base setProperty(String name, Base value) throws FHIRException { 544 if (name.equals("type")) { 545 this.getType().add(castToCoding(value)); 546 } else if (name.equals("when")) { 547 this.when = castToInstant(value); // InstantType 548 } else if (name.equals("who[x]")) { 549 this.who = castToType(value); // Type 550 } else if (name.equals("onBehalfOf[x]")) { 551 this.onBehalfOf = castToType(value); // Type 552 } else if (name.equals("targetFormat")) { 553 this.targetFormat = castToCode(value); // CodeType 554 } else if (name.equals("sigFormat")) { 555 this.sigFormat = castToCode(value); // CodeType 556 } else if (name.equals("blob")) { 557 this.blob = castToBase64Binary(value); // Base64BinaryType 558 } else 559 return super.setProperty(name, value); 560 return value; 561 } 562 563 @Override 564 public Base makeProperty(int hash, String name) throws FHIRException { 565 switch (hash) { 566 case 3575610: return addType(); 567 case 3648314: return getWhenElement(); 568 case -788654078: return getWho(); 569 case 117694: return getWho(); 570 case 418120340: return getOnBehalfOf(); 571 case -14402964: return getOnBehalfOf(); 572 case -917363480: return getTargetFormatElement(); 573 case -58720216: return getSigFormatElement(); 574 case 3026845: return getBlobElement(); 575 default: return super.makeProperty(hash, name); 576 } 577 578 } 579 580 @Override 581 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 582 switch (hash) { 583 case 3575610: /*type*/ return new String[] {"Coding"}; 584 case 3648314: /*when*/ return new String[] {"instant"}; 585 case 117694: /*who*/ return new String[] {"uri", "Reference"}; 586 case -14402964: /*onBehalfOf*/ return new String[] {"uri", "Reference"}; 587 case -917363480: /*targetFormat*/ return new String[] {"code"}; 588 case -58720216: /*sigFormat*/ return new String[] {"code"}; 589 case 3026845: /*blob*/ return new String[] {"base64Binary"}; 590 default: return super.getTypesForProperty(hash, name); 591 } 592 593 } 594 595 @Override 596 public Base addChild(String name) throws FHIRException { 597 if (name.equals("type")) { 598 return addType(); 599 } 600 else if (name.equals("when")) { 601 throw new FHIRException("Cannot call addChild on a primitive type Signature.when"); 602 } 603 else if (name.equals("whoUri")) { 604 this.who = new UriType(); 605 return this.who; 606 } 607 else if (name.equals("whoReference")) { 608 this.who = new Reference(); 609 return this.who; 610 } 611 else if (name.equals("onBehalfOfUri")) { 612 this.onBehalfOf = new UriType(); 613 return this.onBehalfOf; 614 } 615 else if (name.equals("onBehalfOfReference")) { 616 this.onBehalfOf = new Reference(); 617 return this.onBehalfOf; 618 } 619 else if (name.equals("targetFormat")) { 620 throw new FHIRException("Cannot call addChild on a primitive type Signature.targetFormat"); 621 } 622 else if (name.equals("sigFormat")) { 623 throw new FHIRException("Cannot call addChild on a primitive type Signature.sigFormat"); 624 } 625 else if (name.equals("blob")) { 626 throw new FHIRException("Cannot call addChild on a primitive type Signature.blob"); 627 } 628 else 629 return super.addChild(name); 630 } 631 632 public String fhirType() { 633 return "Signature"; 634 635 } 636 637 public Signature copy() { 638 Signature dst = new Signature(); 639 copyValues(dst); 640 if (type != null) { 641 dst.type = new ArrayList<Coding>(); 642 for (Coding i : type) 643 dst.type.add(i.copy()); 644 }; 645 dst.when = when == null ? null : when.copy(); 646 dst.who = who == null ? null : who.copy(); 647 dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy(); 648 dst.targetFormat = targetFormat == null ? null : targetFormat.copy(); 649 dst.sigFormat = sigFormat == null ? null : sigFormat.copy(); 650 dst.blob = blob == null ? null : blob.copy(); 651 return dst; 652 } 653 654 protected Signature typedCopy() { 655 return copy(); 656 } 657 658 @Override 659 public boolean equalsDeep(Base other_) { 660 if (!super.equalsDeep(other_)) 661 return false; 662 if (!(other_ instanceof Signature)) 663 return false; 664 Signature o = (Signature) other_; 665 return compareDeep(type, o.type, true) && compareDeep(when, o.when, true) && compareDeep(who, o.who, true) 666 && compareDeep(onBehalfOf, o.onBehalfOf, true) && compareDeep(targetFormat, o.targetFormat, true) 667 && compareDeep(sigFormat, o.sigFormat, true) && compareDeep(blob, o.blob, true); 668 } 669 670 @Override 671 public boolean equalsShallow(Base other_) { 672 if (!super.equalsShallow(other_)) 673 return false; 674 if (!(other_ instanceof Signature)) 675 return false; 676 Signature o = (Signature) other_; 677 return compareValues(when, o.when, true) && compareValues(targetFormat, o.targetFormat, true) && compareValues(sigFormat, o.sigFormat, true) 678 && compareValues(blob, o.blob, true); 679 } 680 681 public boolean isEmpty() { 682 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, when, who, onBehalfOf 683 , targetFormat, sigFormat, blob); 684 } 685 686 687} 688