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 Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.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 = {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 Reference who; 072 073 /** 074 * The actual object that is the target of the reference (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 075 */ 076 protected Resource whoTarget; 077 078 /** 079 * A reference to an application-usable description of the identity that is represented by the signature. 080 */ 081 @Child(name = "onBehalfOf", type = {Practitioner.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true) 082 @Description(shortDefinition="The party represented", formalDefinition="A reference to an application-usable description of the identity that is represented by the signature." ) 083 protected Reference onBehalfOf; 084 085 /** 086 * The actual object that is the target of the reference (A reference to an application-usable description of the identity that is represented by the signature.) 087 */ 088 protected Resource onBehalfOfTarget; 089 090 /** 091 * A mime type that indicates the technical format of the target resources signed by the signature. 092 */ 093 @Child(name = "targetFormat", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false) 094 @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." ) 095 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes") 096 protected CodeType targetFormat; 097 098 /** 099 * 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. 100 */ 101 @Child(name = "sigFormat", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false) 102 @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." ) 103 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes") 104 protected CodeType sigFormat; 105 106 /** 107 * The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 108 */ 109 @Child(name = "data", type = {Base64BinaryType.class}, order=6, min=0, max=1, modifier=false, summary=false) 110 @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." ) 111 protected Base64BinaryType data; 112 113 private static final long serialVersionUID = 1587325823L; 114 115 /** 116 * Constructor 117 */ 118 public Signature() { 119 super(); 120 } 121 122 /** 123 * Constructor 124 */ 125 public Signature(InstantType when, Reference who) { 126 super(); 127 this.when = when; 128 this.who = who; 129 } 130 131 /** 132 * @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.) 133 */ 134 public List<Coding> getType() { 135 if (this.type == null) 136 this.type = new ArrayList<Coding>(); 137 return this.type; 138 } 139 140 /** 141 * @return Returns a reference to <code>this</code> for easy method chaining 142 */ 143 public Signature setType(List<Coding> theType) { 144 this.type = theType; 145 return this; 146 } 147 148 public boolean hasType() { 149 if (this.type == null) 150 return false; 151 for (Coding item : this.type) 152 if (!item.isEmpty()) 153 return true; 154 return false; 155 } 156 157 public Coding addType() { //3 158 Coding t = new Coding(); 159 if (this.type == null) 160 this.type = new ArrayList<Coding>(); 161 this.type.add(t); 162 return t; 163 } 164 165 public Signature addType(Coding t) { //3 166 if (t == null) 167 return this; 168 if (this.type == null) 169 this.type = new ArrayList<Coding>(); 170 this.type.add(t); 171 return this; 172 } 173 174 /** 175 * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist 176 */ 177 public Coding getTypeFirstRep() { 178 if (getType().isEmpty()) { 179 addType(); 180 } 181 return getType().get(0); 182 } 183 184 /** 185 * @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 186 */ 187 public InstantType getWhenElement() { 188 if (this.when == null) 189 if (Configuration.errorOnAutoCreate()) 190 throw new Error("Attempt to auto-create Signature.when"); 191 else if (Configuration.doAutoCreate()) 192 this.when = new InstantType(); // bb 193 return this.when; 194 } 195 196 public boolean hasWhenElement() { 197 return this.when != null && !this.when.isEmpty(); 198 } 199 200 public boolean hasWhen() { 201 return this.when != null && !this.when.isEmpty(); 202 } 203 204 /** 205 * @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 206 */ 207 public Signature setWhenElement(InstantType value) { 208 this.when = value; 209 return this; 210 } 211 212 /** 213 * @return When the digital signature was signed. 214 */ 215 public Date getWhen() { 216 return this.when == null ? null : this.when.getValue(); 217 } 218 219 /** 220 * @param value When the digital signature was signed. 221 */ 222 public Signature setWhen(Date value) { 223 if (this.when == null) 224 this.when = new InstantType(); 225 this.when.setValue(value); 226 return this; 227 } 228 229 /** 230 * @return {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 231 */ 232 public Reference getWho() { 233 if (this.who == null) 234 if (Configuration.errorOnAutoCreate()) 235 throw new Error("Attempt to auto-create Signature.who"); 236 else if (Configuration.doAutoCreate()) 237 this.who = new Reference(); // cc 238 return this.who; 239 } 240 241 public boolean hasWho() { 242 return this.who != null && !this.who.isEmpty(); 243 } 244 245 /** 246 * @param value {@link #who} (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 247 */ 248 public Signature setWho(Reference value) { 249 this.who = value; 250 return this; 251 } 252 253 /** 254 * @return {@link #who} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 255 */ 256 public Resource getWhoTarget() { 257 return this.whoTarget; 258 } 259 260 /** 261 * @param value {@link #who} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that signed (e.g. the signature used their private key).) 262 */ 263 public Signature setWhoTarget(Resource value) { 264 this.whoTarget = 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 Reference getOnBehalfOf() { 272 if (this.onBehalfOf == null) 273 if (Configuration.errorOnAutoCreate()) 274 throw new Error("Attempt to auto-create Signature.onBehalfOf"); 275 else if (Configuration.doAutoCreate()) 276 this.onBehalfOf = new Reference(); // cc 277 return this.onBehalfOf; 278 } 279 280 public boolean hasOnBehalfOf() { 281 return this.onBehalfOf != null && !this.onBehalfOf.isEmpty(); 282 } 283 284 /** 285 * @param value {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.) 286 */ 287 public Signature setOnBehalfOf(Reference value) { 288 this.onBehalfOf = value; 289 return this; 290 } 291 292 /** 293 * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that is represented by the signature.) 294 */ 295 public Resource getOnBehalfOfTarget() { 296 return this.onBehalfOfTarget; 297 } 298 299 /** 300 * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that is represented by the signature.) 301 */ 302 public Signature setOnBehalfOfTarget(Resource value) { 303 this.onBehalfOfTarget = value; 304 return this; 305 } 306 307 /** 308 * @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 309 */ 310 public CodeType getTargetFormatElement() { 311 if (this.targetFormat == null) 312 if (Configuration.errorOnAutoCreate()) 313 throw new Error("Attempt to auto-create Signature.targetFormat"); 314 else if (Configuration.doAutoCreate()) 315 this.targetFormat = new CodeType(); // bb 316 return this.targetFormat; 317 } 318 319 public boolean hasTargetFormatElement() { 320 return this.targetFormat != null && !this.targetFormat.isEmpty(); 321 } 322 323 public boolean hasTargetFormat() { 324 return this.targetFormat != null && !this.targetFormat.isEmpty(); 325 } 326 327 /** 328 * @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 329 */ 330 public Signature setTargetFormatElement(CodeType value) { 331 this.targetFormat = value; 332 return this; 333 } 334 335 /** 336 * @return A mime type that indicates the technical format of the target resources signed by the signature. 337 */ 338 public String getTargetFormat() { 339 return this.targetFormat == null ? null : this.targetFormat.getValue(); 340 } 341 342 /** 343 * @param value A mime type that indicates the technical format of the target resources signed by the signature. 344 */ 345 public Signature setTargetFormat(String value) { 346 if (Utilities.noString(value)) 347 this.targetFormat = null; 348 else { 349 if (this.targetFormat == null) 350 this.targetFormat = new CodeType(); 351 this.targetFormat.setValue(value); 352 } 353 return this; 354 } 355 356 /** 357 * @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 358 */ 359 public CodeType getSigFormatElement() { 360 if (this.sigFormat == null) 361 if (Configuration.errorOnAutoCreate()) 362 throw new Error("Attempt to auto-create Signature.sigFormat"); 363 else if (Configuration.doAutoCreate()) 364 this.sigFormat = new CodeType(); // bb 365 return this.sigFormat; 366 } 367 368 public boolean hasSigFormatElement() { 369 return this.sigFormat != null && !this.sigFormat.isEmpty(); 370 } 371 372 public boolean hasSigFormat() { 373 return this.sigFormat != null && !this.sigFormat.isEmpty(); 374 } 375 376 /** 377 * @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 378 */ 379 public Signature setSigFormatElement(CodeType value) { 380 this.sigFormat = value; 381 return this; 382 } 383 384 /** 385 * @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. 386 */ 387 public String getSigFormat() { 388 return this.sigFormat == null ? null : this.sigFormat.getValue(); 389 } 390 391 /** 392 * @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. 393 */ 394 public Signature setSigFormat(String value) { 395 if (Utilities.noString(value)) 396 this.sigFormat = null; 397 else { 398 if (this.sigFormat == null) 399 this.sigFormat = new CodeType(); 400 this.sigFormat.setValue(value); 401 } 402 return this; 403 } 404 405 /** 406 * @return {@link #data} (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 "getData" gives direct access to the value 407 */ 408 public Base64BinaryType getDataElement() { 409 if (this.data == null) 410 if (Configuration.errorOnAutoCreate()) 411 throw new Error("Attempt to auto-create Signature.data"); 412 else if (Configuration.doAutoCreate()) 413 this.data = new Base64BinaryType(); // bb 414 return this.data; 415 } 416 417 public boolean hasDataElement() { 418 return this.data != null && !this.data.isEmpty(); 419 } 420 421 public boolean hasData() { 422 return this.data != null && !this.data.isEmpty(); 423 } 424 425 /** 426 * @param value {@link #data} (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 "getData" gives direct access to the value 427 */ 428 public Signature setDataElement(Base64BinaryType value) { 429 this.data = value; 430 return this; 431 } 432 433 /** 434 * @return The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 435 */ 436 public byte[] getData() { 437 return this.data == null ? null : this.data.getValue(); 438 } 439 440 /** 441 * @param value The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty. 442 */ 443 public Signature setData(byte[] value) { 444 if (value == null) 445 this.data = null; 446 else { 447 if (this.data == null) 448 this.data = new Base64BinaryType(); 449 this.data.setValue(value); 450 } 451 return this; 452 } 453 454 protected void listChildren(List<Property> children) { 455 super.listChildren(children); 456 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)); 457 children.add(new Property("when", "instant", "When the digital signature was signed.", 0, 1, when)); 458 children.add(new Property("who", "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)); 459 children.add(new Property("onBehalfOf", "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)); 460 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)); 461 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)); 462 children.add(new Property("data", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, data)); 463 } 464 465 @Override 466 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 467 switch (_hash) { 468 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); 469 case 3648314: /*when*/ return new Property("when", "instant", "When the digital signature was signed.", 0, 1, when); 470 case 117694: /*who*/ return new Property("who", "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 case -14402964: /*onBehalfOf*/ return new Property("onBehalfOf", "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 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); 473 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); 474 case 3076010: /*data*/ return new Property("data", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, data); 475 default: return super.getNamedProperty(_hash, _name, _checkValid); 476 } 477 478 } 479 480 @Override 481 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 482 switch (hash) { 483 case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // Coding 484 case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // InstantType 485 case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Reference 486 case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference 487 case -917363480: /*targetFormat*/ return this.targetFormat == null ? new Base[0] : new Base[] {this.targetFormat}; // CodeType 488 case -58720216: /*sigFormat*/ return this.sigFormat == null ? new Base[0] : new Base[] {this.sigFormat}; // CodeType 489 case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // Base64BinaryType 490 default: return super.getProperty(hash, name, checkValid); 491 } 492 493 } 494 495 @Override 496 public Base setProperty(int hash, String name, Base value) throws FHIRException { 497 switch (hash) { 498 case 3575610: // type 499 this.getType().add(castToCoding(value)); // Coding 500 return value; 501 case 3648314: // when 502 this.when = castToInstant(value); // InstantType 503 return value; 504 case 117694: // who 505 this.who = castToReference(value); // Reference 506 return value; 507 case -14402964: // onBehalfOf 508 this.onBehalfOf = castToReference(value); // Reference 509 return value; 510 case -917363480: // targetFormat 511 this.targetFormat = castToCode(value); // CodeType 512 return value; 513 case -58720216: // sigFormat 514 this.sigFormat = castToCode(value); // CodeType 515 return value; 516 case 3076010: // data 517 this.data = castToBase64Binary(value); // Base64BinaryType 518 return value; 519 default: return super.setProperty(hash, name, value); 520 } 521 522 } 523 524 @Override 525 public Base setProperty(String name, Base value) throws FHIRException { 526 if (name.equals("type")) { 527 this.getType().add(castToCoding(value)); 528 } else if (name.equals("when")) { 529 this.when = castToInstant(value); // InstantType 530 } else if (name.equals("who")) { 531 this.who = castToReference(value); // Reference 532 } else if (name.equals("onBehalfOf")) { 533 this.onBehalfOf = castToReference(value); // Reference 534 } else if (name.equals("targetFormat")) { 535 this.targetFormat = castToCode(value); // CodeType 536 } else if (name.equals("sigFormat")) { 537 this.sigFormat = castToCode(value); // CodeType 538 } else if (name.equals("data")) { 539 this.data = castToBase64Binary(value); // Base64BinaryType 540 } else 541 return super.setProperty(name, value); 542 return value; 543 } 544 545 @Override 546 public Base makeProperty(int hash, String name) throws FHIRException { 547 switch (hash) { 548 case 3575610: return addType(); 549 case 3648314: return getWhenElement(); 550 case 117694: return getWho(); 551 case -14402964: return getOnBehalfOf(); 552 case -917363480: return getTargetFormatElement(); 553 case -58720216: return getSigFormatElement(); 554 case 3076010: return getDataElement(); 555 default: return super.makeProperty(hash, name); 556 } 557 558 } 559 560 @Override 561 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 562 switch (hash) { 563 case 3575610: /*type*/ return new String[] {"Coding"}; 564 case 3648314: /*when*/ return new String[] {"instant"}; 565 case 117694: /*who*/ return new String[] {"Reference"}; 566 case -14402964: /*onBehalfOf*/ return new String[] {"Reference"}; 567 case -917363480: /*targetFormat*/ return new String[] {"code"}; 568 case -58720216: /*sigFormat*/ return new String[] {"code"}; 569 case 3076010: /*data*/ return new String[] {"base64Binary"}; 570 default: return super.getTypesForProperty(hash, name); 571 } 572 573 } 574 575 @Override 576 public Base addChild(String name) throws FHIRException { 577 if (name.equals("type")) { 578 return addType(); 579 } 580 else if (name.equals("when")) { 581 throw new FHIRException("Cannot call addChild on a primitive type Signature.when"); 582 } 583 else if (name.equals("who")) { 584 this.who = new Reference(); 585 return this.who; 586 } 587 else if (name.equals("onBehalfOf")) { 588 this.onBehalfOf = new Reference(); 589 return this.onBehalfOf; 590 } 591 else if (name.equals("targetFormat")) { 592 throw new FHIRException("Cannot call addChild on a primitive type Signature.targetFormat"); 593 } 594 else if (name.equals("sigFormat")) { 595 throw new FHIRException("Cannot call addChild on a primitive type Signature.sigFormat"); 596 } 597 else if (name.equals("data")) { 598 throw new FHIRException("Cannot call addChild on a primitive type Signature.data"); 599 } 600 else 601 return super.addChild(name); 602 } 603 604 public String fhirType() { 605 return "Signature"; 606 607 } 608 609 public Signature copy() { 610 Signature dst = new Signature(); 611 copyValues(dst); 612 if (type != null) { 613 dst.type = new ArrayList<Coding>(); 614 for (Coding i : type) 615 dst.type.add(i.copy()); 616 }; 617 dst.when = when == null ? null : when.copy(); 618 dst.who = who == null ? null : who.copy(); 619 dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy(); 620 dst.targetFormat = targetFormat == null ? null : targetFormat.copy(); 621 dst.sigFormat = sigFormat == null ? null : sigFormat.copy(); 622 dst.data = data == null ? null : data.copy(); 623 return dst; 624 } 625 626 protected Signature typedCopy() { 627 return copy(); 628 } 629 630 @Override 631 public boolean equalsDeep(Base other_) { 632 if (!super.equalsDeep(other_)) 633 return false; 634 if (!(other_ instanceof Signature)) 635 return false; 636 Signature o = (Signature) other_; 637 return compareDeep(type, o.type, true) && compareDeep(when, o.when, true) && compareDeep(who, o.who, true) 638 && compareDeep(onBehalfOf, o.onBehalfOf, true) && compareDeep(targetFormat, o.targetFormat, true) 639 && compareDeep(sigFormat, o.sigFormat, true) && compareDeep(data, o.data, true); 640 } 641 642 @Override 643 public boolean equalsShallow(Base other_) { 644 if (!super.equalsShallow(other_)) 645 return false; 646 if (!(other_ instanceof Signature)) 647 return false; 648 Signature o = (Signature) other_; 649 return compareValues(when, o.when, true) && compareValues(targetFormat, o.targetFormat, true) && compareValues(sigFormat, o.sigFormat, true) 650 && compareValues(data, o.data, true); 651 } 652 653 public boolean isEmpty() { 654 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, when, who, onBehalfOf 655 , targetFormat, sigFormat, data); 656 } 657 658 659} 660