001package org.hl7.fhir.dstu3.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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import org.hl7.fhir.dstu3.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; 045import org.hl7.fhir.exceptions.FHIRFormatError; 046/** 047 * A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different signature approaches have different utilities. 048 */ 049@DatatypeDef(name="Signature") 050public class Signature extends Type implements ICompositeType { 051 052 /** 053 * 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. 054 */ 055 @Child(name = "type", type = {Coding.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 056 @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." ) 057 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/signature-type") 058 protected List<Coding> type; 059 060 /** 061 * When the digital signature was signed. 062 */ 063 @Child(name = "when", type = {InstantType.class}, order=1, min=1, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="When the signature was created", formalDefinition="When the digital signature was signed." ) 065 protected InstantType when; 066 067 /** 068 * A reference to an application-usable description of the identity that signed (e.g. the signature used their private key). 069 */ 070 @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) 071 @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)." ) 072 protected Type who; 073 074 /** 075 * A reference to an application-usable description of the identity that is represented by the signature. 076 */ 077 @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) 078 @Description(shortDefinition="The party represented", formalDefinition="A reference to an application-usable description of the identity that is represented by the signature." ) 079 protected Type onBehalfOf; 080 081 /** 082 * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc. 083 */ 084 @Child(name = "contentType", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true) 085 @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/jwt for JWT, and image/* for a graphical image of a signature, etc." ) 086 protected CodeType contentType; 087 088 /** 089 * The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 090 */ 091 @Child(name = "blob", type = {Base64BinaryType.class}, order=5, min=0, max=1, modifier=false, summary=false) 092 @Description(shortDefinition="The actual signature content (XML DigSig. JWT, picture, etc.)", formalDefinition="The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty." ) 093 protected Base64BinaryType blob; 094 095 private static final long serialVersionUID = 1133697310L; 096 097 /** 098 * Constructor 099 */ 100 public Signature() { 101 super(); 102 } 103 104 /** 105 * Constructor 106 */ 107 public Signature(InstantType when, Type who) { 108 super(); 109 this.when = when; 110 this.who = who; 111 } 112 113 /** 114 * @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.) 115 */ 116 public List<Coding> getType() { 117 if (this.type == null) 118 this.type = new ArrayList<Coding>(); 119 return this.type; 120 } 121 122 /** 123 * @return Returns a reference to <code>this</code> for easy method chaining 124 */ 125 public Signature setType(List<Coding> theType) { 126 this.type = theType; 127 return this; 128 } 129 130 public boolean hasType() { 131 if (this.type == null) 132 return false; 133 for (Coding item : this.type) 134 if (!item.isEmpty()) 135 return true; 136 return false; 137 } 138 139 public Coding addType() { //3 140 Coding t = new Coding(); 141 if (this.type == null) 142 this.type = new ArrayList<Coding>(); 143 this.type.add(t); 144 return t; 145 } 146 147 public Signature addType(Coding t) { //3 148 if (t == null) 149 return this; 150 if (this.type == null) 151 this.type = new ArrayList<Coding>(); 152 this.type.add(t); 153 return this; 154 } 155 156 /** 157 * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist 158 */ 159 public Coding getTypeFirstRep() { 160 if (getType().isEmpty()) { 161 addType(); 162 } 163 return getType().get(0); 164 } 165 166 /** 167 * @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 168 */ 169 public InstantType getWhenElement() { 170 if (this.when == null) 171 if (Configuration.errorOnAutoCreate()) 172 throw new Error("Attempt to auto-create Signature.when"); 173 else if (Configuration.doAutoCreate()) 174 this.when = new InstantType(); // bb 175 return this.when; 176 } 177 178 public boolean hasWhenElement() { 179 return this.when != null && !this.when.isEmpty(); 180 } 181 182 public boolean hasWhen() { 183 return this.when != null && !this.when.isEmpty(); 184 } 185 186 /** 187 * @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 188 */ 189 public Signature setWhenElement(InstantType value) { 190 this.when = value; 191 return this; 192 } 193 194 /** 195 * @return When the digital signature was signed. 196 */ 197 public Date getWhen() { 198 return this.when == null ? null : this.when.getValue(); 199 } 200 201 /** 202 * @param value When the digital signature was signed. 203 */ 204 public Signature setWhen(Date value) { 205 if (this.when == null) 206 this.when = new InstantType(); 207 this.when.setValue(value); 208 return this; 209 } 210 211 /** 212 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 213 */ 214 public Type getWho() { 215 return this.who; 216 } 217 218 /** 219 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 220 */ 221 public UriType getWhoUriType() throws FHIRException { 222 if (this.who == null) 223 return null; 224 if (!(this.who instanceof UriType)) 225 throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.who.getClass().getName()+" was encountered"); 226 return (UriType) this.who; 227 } 228 229 public boolean hasWhoUriType() { 230 return this != null && this.who instanceof UriType; 231 } 232 233 /** 234 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 235 */ 236 public Reference getWhoReference() throws FHIRException { 237 if (this.who == null) 238 return null; 239 if (!(this.who instanceof Reference)) 240 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.who.getClass().getName()+" was encountered"); 241 return (Reference) this.who; 242 } 243 244 public boolean hasWhoReference() { 245 return this != null && this.who instanceof Reference; 246 } 247 248 public boolean hasWho() { 249 return this.who != null && !this.who.isEmpty(); 250 } 251 252 /** 253 * @param value {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 254 */ 255 public Signature setWho(Type value) throws FHIRFormatError { 256 if (value != null && !(value instanceof UriType || value instanceof Reference)) 257 throw new FHIRFormatError("Not the right type for Signature.who[x]: "+value.fhirType()); 258 this.who = value; 259 return this; 260 } 261 262 /** 263 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 264 */ 265 public Type getOnBehalfOf() { 266 return this.onBehalfOf; 267 } 268 269 /** 270 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 271 */ 272 public UriType getOnBehalfOfUriType() throws FHIRException { 273 if (this.onBehalfOf == null) 274 return null; 275 if (!(this.onBehalfOf instanceof UriType)) 276 throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.onBehalfOf.getClass().getName()+" was encountered"); 277 return (UriType) this.onBehalfOf; 278 } 279 280 public boolean hasOnBehalfOfUriType() { 281 return this != null && this.onBehalfOf instanceof UriType; 282 } 283 284 /** 285 * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 286 */ 287 public Reference getOnBehalfOfReference() throws FHIRException { 288 if (this.onBehalfOf == null) 289 return null; 290 if (!(this.onBehalfOf instanceof Reference)) 291 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.onBehalfOf.getClass().getName()+" was encountered"); 292 return (Reference) this.onBehalfOf; 293 } 294 295 public boolean hasOnBehalfOfReference() { 296 return this != null && this.onBehalfOf instanceof Reference; 297 } 298 299 public boolean hasOnBehalfOf() { 300 return this.onBehalfOf != null && !this.onBehalfOf.isEmpty(); 301 } 302 303 /** 304 * @param value {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 305 */ 306 public Signature setOnBehalfOf(Type value) throws FHIRFormatError { 307 if (value != null && !(value instanceof UriType || value instanceof Reference)) 308 throw new FHIRFormatError("Not the right type for Signature.onBehalfOf[x]: "+value.fhirType()); 309 this.onBehalfOf = value; 310 return this; 311 } 312 313 /** 314 * @return {@link #contentType} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value 315 */ 316 public CodeType getContentTypeElement() { 317 if (this.contentType == null) 318 if (Configuration.errorOnAutoCreate()) 319 throw new Error("Attempt to auto-create Signature.contentType"); 320 else if (Configuration.doAutoCreate()) 321 this.contentType = new CodeType(); // bb 322 return this.contentType; 323 } 324 325 public boolean hasContentTypeElement() { 326 return this.contentType != null && !this.contentType.isEmpty(); 327 } 328 329 public boolean hasContentType() { 330 return this.contentType != null && !this.contentType.isEmpty(); 331 } 332 333 /** 334 * @param value {@link #contentType} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value 335 */ 336 public Signature setContentTypeElement(CodeType value) { 337 this.contentType = value; 338 return this; 339 } 340 341 /** 342 * @return A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc. 343 */ 344 public String getContentType() { 345 return this.contentType == null ? null : this.contentType.getValue(); 346 } 347 348 /** 349 * @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/jwt for JWT, and image/* for a graphical image of a signature, etc. 350 */ 351 public Signature setContentType(String value) { 352 if (Utilities.noString(value)) 353 this.contentType = null; 354 else { 355 if (this.contentType == null) 356 this.contentType = new CodeType(); 357 this.contentType.setValue(value); 358 } 359 return this; 360 } 361 362 /** 363 * @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 364 */ 365 public Base64BinaryType getBlobElement() { 366 if (this.blob == null) 367 if (Configuration.errorOnAutoCreate()) 368 throw new Error("Attempt to auto-create Signature.blob"); 369 else if (Configuration.doAutoCreate()) 370 this.blob = new Base64BinaryType(); // bb 371 return this.blob; 372 } 373 374 public boolean hasBlobElement() { 375 return this.blob != null && !this.blob.isEmpty(); 376 } 377 378 public boolean hasBlob() { 379 return this.blob != null && !this.blob.isEmpty(); 380 } 381 382 /** 383 * @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 384 */ 385 public Signature setBlobElement(Base64BinaryType value) { 386 this.blob = value; 387 return this; 388 } 389 390 /** 391 * @return The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 392 */ 393 public byte[] getBlob() { 394 return this.blob == null ? null : this.blob.getValue(); 395 } 396 397 /** 398 * @param value The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 399 */ 400 public Signature setBlob(byte[] value) { 401 if (value == null) 402 this.blob = null; 403 else { 404 if (this.blob == null) 405 this.blob = new Base64BinaryType(); 406 this.blob.setValue(value); 407 } 408 return this; 409 } 410 411 protected void listChildren(List<Property> children) { 412 super.listChildren(children); 413 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)); 414 children.add(new Property("when", "instant", "When the digital signature was signed.", 0, 1, when)); 415 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)); 416 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)); 417 children.add(new Property("contentType", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc.", 0, 1, contentType)); 418 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)); 419 } 420 421 @Override 422 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 423 switch (_hash) { 424 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); 425 case 3648314: /*when*/ return new Property("when", "instant", "When the digital signature was signed.", 0, 1, when); 426 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); 427 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); 428 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); 429 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); 430 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); 431 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); 432 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); 433 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); 434 case -389131437: /*contentType*/ return new Property("contentType", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jwt for JWT, and image/* for a graphical image of a signature, etc.", 0, 1, contentType); 435 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); 436 default: return super.getNamedProperty(_hash, _name, _checkValid); 437 } 438 439 } 440 441 @Override 442 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 443 switch (hash) { 444 case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // Coding 445 case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // InstantType 446 case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Type 447 case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Type 448 case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType 449 case 3026845: /*blob*/ return this.blob == null ? new Base[0] : new Base[] {this.blob}; // Base64BinaryType 450 default: return super.getProperty(hash, name, checkValid); 451 } 452 453 } 454 455 @Override 456 public Base setProperty(int hash, String name, Base value) throws FHIRException { 457 switch (hash) { 458 case 3575610: // type 459 this.getType().add(castToCoding(value)); // Coding 460 return value; 461 case 3648314: // when 462 this.when = castToInstant(value); // InstantType 463 return value; 464 case 117694: // who 465 this.who = castToType(value); // Type 466 return value; 467 case -14402964: // onBehalfOf 468 this.onBehalfOf = castToType(value); // Type 469 return value; 470 case -389131437: // contentType 471 this.contentType = castToCode(value); // CodeType 472 return value; 473 case 3026845: // blob 474 this.blob = castToBase64Binary(value); // Base64BinaryType 475 return value; 476 default: return super.setProperty(hash, name, value); 477 } 478 479 } 480 481 @Override 482 public Base setProperty(String name, Base value) throws FHIRException { 483 if (name.equals("type")) { 484 this.getType().add(castToCoding(value)); 485 } else if (name.equals("when")) { 486 this.when = castToInstant(value); // InstantType 487 } else if (name.equals("who[x]")) { 488 this.who = castToType(value); // Type 489 } else if (name.equals("onBehalfOf[x]")) { 490 this.onBehalfOf = castToType(value); // Type 491 } else if (name.equals("contentType")) { 492 this.contentType = castToCode(value); // CodeType 493 } else if (name.equals("blob")) { 494 this.blob = castToBase64Binary(value); // Base64BinaryType 495 } else 496 return super.setProperty(name, value); 497 return value; 498 } 499 500 @Override 501 public Base makeProperty(int hash, String name) throws FHIRException { 502 switch (hash) { 503 case 3575610: return addType(); 504 case 3648314: return getWhenElement(); 505 case -788654078: return getWho(); 506 case 117694: return getWho(); 507 case 418120340: return getOnBehalfOf(); 508 case -14402964: return getOnBehalfOf(); 509 case -389131437: return getContentTypeElement(); 510 case 3026845: return getBlobElement(); 511 default: return super.makeProperty(hash, name); 512 } 513 514 } 515 516 @Override 517 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 518 switch (hash) { 519 case 3575610: /*type*/ return new String[] {"Coding"}; 520 case 3648314: /*when*/ return new String[] {"instant"}; 521 case 117694: /*who*/ return new String[] {"uri", "Reference"}; 522 case -14402964: /*onBehalfOf*/ return new String[] {"uri", "Reference"}; 523 case -389131437: /*contentType*/ return new String[] {"code"}; 524 case 3026845: /*blob*/ return new String[] {"base64Binary"}; 525 default: return super.getTypesForProperty(hash, name); 526 } 527 528 } 529 530 @Override 531 public Base addChild(String name) throws FHIRException { 532 if (name.equals("type")) { 533 return addType(); 534 } 535 else if (name.equals("when")) { 536 throw new FHIRException("Cannot call addChild on a primitive type Signature.when"); 537 } 538 else if (name.equals("whoUri")) { 539 this.who = new UriType(); 540 return this.who; 541 } 542 else if (name.equals("whoReference")) { 543 this.who = new Reference(); 544 return this.who; 545 } 546 else if (name.equals("onBehalfOfUri")) { 547 this.onBehalfOf = new UriType(); 548 return this.onBehalfOf; 549 } 550 else if (name.equals("onBehalfOfReference")) { 551 this.onBehalfOf = new Reference(); 552 return this.onBehalfOf; 553 } 554 else if (name.equals("contentType")) { 555 throw new FHIRException("Cannot call addChild on a primitive type Signature.contentType"); 556 } 557 else if (name.equals("blob")) { 558 throw new FHIRException("Cannot call addChild on a primitive type Signature.blob"); 559 } 560 else 561 return super.addChild(name); 562 } 563 564 public String fhirType() { 565 return "Signature"; 566 567 } 568 569 public Signature copy() { 570 Signature dst = new Signature(); 571 copyValues(dst); 572 if (type != null) { 573 dst.type = new ArrayList<Coding>(); 574 for (Coding i : type) 575 dst.type.add(i.copy()); 576 }; 577 dst.when = when == null ? null : when.copy(); 578 dst.who = who == null ? null : who.copy(); 579 dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy(); 580 dst.contentType = contentType == null ? null : contentType.copy(); 581 dst.blob = blob == null ? null : blob.copy(); 582 return dst; 583 } 584 585 protected Signature typedCopy() { 586 return copy(); 587 } 588 589 @Override 590 public boolean equalsDeep(Base other_) { 591 if (!super.equalsDeep(other_)) 592 return false; 593 if (!(other_ instanceof Signature)) 594 return false; 595 Signature o = (Signature) other_; 596 return compareDeep(type, o.type, true) && compareDeep(when, o.when, true) && compareDeep(who, o.who, true) 597 && compareDeep(onBehalfOf, o.onBehalfOf, true) && compareDeep(contentType, o.contentType, true) 598 && compareDeep(blob, o.blob, true); 599 } 600 601 @Override 602 public boolean equalsShallow(Base other_) { 603 if (!super.equalsShallow(other_)) 604 return false; 605 if (!(other_ instanceof Signature)) 606 return false; 607 Signature o = (Signature) other_; 608 return compareValues(when, o.when, true) && compareValues(contentType, o.contentType, true) && compareValues(blob, o.blob, true) 609 ; 610 } 611 612 public boolean isEmpty() { 613 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, when, who, onBehalfOf 614 , contentType, blob); 615 } 616 617 618} 619