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