001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017package ca.uhn.fhir.model.dstu2.composite; 018 019import java.net.URI; 020import java.math.BigDecimal; 021import org.apache.commons.lang3.StringUtils; 022import java.util.*; 023import ca.uhn.fhir.model.api.*; 024import ca.uhn.fhir.model.primitive.*; 025import ca.uhn.fhir.model.api.annotation.*; 026import ca.uhn.fhir.model.base.composite.*; 027 028import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum; 029import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum; 030import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum; 031import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum; 032import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; 033import ca.uhn.fhir.model.dstu2.composite.CodingDt; 034import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum; 035import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum; 036import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum; 037import ca.uhn.fhir.model.dstu2.resource.Device; 038import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum; 039import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum; 040import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum; 041import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum; 042import ca.uhn.fhir.model.dstu2.resource.Organization; 043import ca.uhn.fhir.model.dstu2.resource.Patient; 044import ca.uhn.fhir.model.dstu2.composite.PeriodDt; 045import ca.uhn.fhir.model.dstu2.resource.Practitioner; 046import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum; 047import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum; 048import ca.uhn.fhir.model.dstu2.composite.QuantityDt; 049import ca.uhn.fhir.model.dstu2.composite.RangeDt; 050import ca.uhn.fhir.model.dstu2.resource.RelatedPerson; 051import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum; 052import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum; 053import ca.uhn.fhir.model.api.TemporalPrecisionEnum; 054import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum; 055import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum; 056import ca.uhn.fhir.model.dstu2.resource.ValueSet; 057import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt; 058import ca.uhn.fhir.model.dstu2.composite.DurationDt; 059import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; 060import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt; 061import ca.uhn.fhir.model.primitive.Base64BinaryDt; 062import ca.uhn.fhir.model.primitive.BooleanDt; 063import ca.uhn.fhir.model.primitive.BoundCodeDt; 064import ca.uhn.fhir.model.primitive.CodeDt; 065import ca.uhn.fhir.model.primitive.DateTimeDt; 066import ca.uhn.fhir.model.primitive.DecimalDt; 067import ca.uhn.fhir.model.primitive.IdDt; 068import ca.uhn.fhir.model.primitive.InstantDt; 069import ca.uhn.fhir.model.primitive.IntegerDt; 070import ca.uhn.fhir.model.primitive.MarkdownDt; 071import ca.uhn.fhir.model.primitive.PositiveIntDt; 072import ca.uhn.fhir.model.primitive.StringDt; 073import ca.uhn.fhir.model.primitive.UnsignedIntDt; 074import ca.uhn.fhir.model.primitive.UriDt; 075 076/** 077 * HAPI/FHIR <b>SignatureDt</b> Datatype 078 * () 079 * 080 * <p> 081 * <b>Definition:</b> 082 * 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 083 * </p> 084 * 085 * <p> 086 * <b>Requirements:</b> 087 * There are a number of places where content must be signed in healthcare 088 * </p> 089 */ 090@DatatypeDef(name="SignatureDt") 091public class SignatureDt 092 extends BaseIdentifiableElement implements ICompositeDatatype{ 093 094 /** 095 * Constructor 096 */ 097 public SignatureDt() { 098 // nothing 099 } 100 101 102 @Child(name="type", type=CodingDt.class, order=0, min=1, max=Child.MAX_UNLIMITED, summary=true, modifier=false) 103 @Description( 104 shortDefinition="", 105 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." 106 ) 107 private java.util.List<CodingDt> myType; 108 109 @Child(name="when", type=InstantDt.class, order=1, min=1, max=1, summary=true, modifier=false) 110 @Description( 111 shortDefinition="", 112 formalDefinition="When the digital signature was signed." 113 ) 114 private InstantDt myWhen; 115 116 @Child(name="who", order=2, min=1, max=1, summary=true, modifier=false, type={ 117 UriDt.class, Practitioner.class, RelatedPerson.class, Patient.class, Device.class, Organization.class }) 118 @Description( 119 shortDefinition="", 120 formalDefinition="A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key)" 121 ) 122 private IDatatype myWho; 123 124 @Child(name="contentType", type=CodeDt.class, order=3, min=1, max=1, summary=true, modifier=false) 125 @Description( 126 shortDefinition="", 127 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" 128 ) 129 private CodeDt myContentType; 130 131 @Child(name="blob", type=Base64BinaryDt.class, order=4, min=1, max=1, summary=true, modifier=false) 132 @Description( 133 shortDefinition="", 134 formalDefinition="The base64 encoding of the Signature content" 135 ) 136 private Base64BinaryDt myBlob; 137 138 139 @Override 140 public boolean isEmpty() { 141 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myType, myWhen, myWho, myContentType, myBlob); 142 } 143 144 @Override 145 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { 146 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myWhen, myWho, myContentType, myBlob); 147 } 148 149 /** 150 * Gets the value(s) for <b>type</b> (). 151 * creating it if it does 152 * not exist. Will not return <code>null</code>. 153 * 154 * <p> 155 * <b>Definition:</b> 156 * 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. 157 * </p> 158 */ 159 public java.util.List<CodingDt> getType() { 160 if (myType == null) { 161 myType = new java.util.ArrayList<CodingDt>(); 162 } 163 return myType; 164 } 165 166 /** 167 * Sets the value(s) for <b>type</b> () 168 * 169 * <p> 170 * <b>Definition:</b> 171 * 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. 172 * </p> 173 */ 174 public SignatureDt setType(java.util.List<CodingDt> theValue) { 175 myType = theValue; 176 return this; 177 } 178 179 180 181 /** 182 * Adds and returns a new value for <b>type</b> () 183 * 184 * <p> 185 * <b>Definition:</b> 186 * 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. 187 * </p> 188 */ 189 public CodingDt addType() { 190 CodingDt newType = new CodingDt(); 191 getType().add(newType); 192 return newType; 193 } 194 195 /** 196 * Adds a given new value for <b>type</b> () 197 * 198 * <p> 199 * <b>Definition:</b> 200 * 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. 201 * </p> 202 * @param theValue The type to add (must not be <code>null</code>) 203 */ 204 public SignatureDt addType(CodingDt theValue) { 205 if (theValue == null) { 206 throw new NullPointerException("theValue must not be null"); 207 } 208 getType().add(theValue); 209 return this; 210 } 211 212 /** 213 * Gets the first repetition for <b>type</b> (), 214 * creating it if it does not already exist. 215 * 216 * <p> 217 * <b>Definition:</b> 218 * 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. 219 * </p> 220 */ 221 public CodingDt getTypeFirstRep() { 222 if (getType().isEmpty()) { 223 return addType(); 224 } 225 return getType().get(0); 226 } 227 228 /** 229 * Gets the value(s) for <b>when</b> (). 230 * creating it if it does 231 * not exist. Will not return <code>null</code>. 232 * 233 * <p> 234 * <b>Definition:</b> 235 * When the digital signature was signed. 236 * </p> 237 */ 238 public InstantDt getWhenElement() { 239 if (myWhen == null) { 240 myWhen = new InstantDt(); 241 } 242 return myWhen; 243 } 244 245 246 /** 247 * Gets the value(s) for <b>when</b> (). 248 * creating it if it does 249 * not exist. Will not return <code>null</code>. 250 * 251 * <p> 252 * <b>Definition:</b> 253 * When the digital signature was signed. 254 * </p> 255 */ 256 public Date getWhen() { 257 return getWhenElement().getValue(); 258 } 259 260 /** 261 * Sets the value(s) for <b>when</b> () 262 * 263 * <p> 264 * <b>Definition:</b> 265 * When the digital signature was signed. 266 * </p> 267 */ 268 public SignatureDt setWhen(InstantDt theValue) { 269 myWhen = theValue; 270 return this; 271 } 272 273 274 275 /** 276 * Sets the value for <b>when</b> () 277 * 278 * <p> 279 * <b>Definition:</b> 280 * When the digital signature was signed. 281 * </p> 282 */ 283 public SignatureDt setWhenWithMillisPrecision( Date theDate) { 284 myWhen = new InstantDt(theDate); 285 return this; 286 } 287 288 /** 289 * Sets the value for <b>when</b> () 290 * 291 * <p> 292 * <b>Definition:</b> 293 * When the digital signature was signed. 294 * </p> 295 */ 296 public SignatureDt setWhen( Date theDate, TemporalPrecisionEnum thePrecision) { 297 myWhen = new InstantDt(theDate, thePrecision); 298 return this; 299 } 300 301 302 /** 303 * Gets the value(s) for <b>who[x]</b> (). 304 * creating it if it does 305 * not exist. Will not return <code>null</code>. 306 * 307 * <p> 308 * <b>Definition:</b> 309 * A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key) 310 * </p> 311 */ 312 public IDatatype getWho() { 313 return myWho; 314 } 315 316 /** 317 * Sets the value(s) for <b>who[x]</b> () 318 * 319 * <p> 320 * <b>Definition:</b> 321 * A reference to an application-usable description of the person that signed the certificate (e.g. the signature used their private key) 322 * </p> 323 */ 324 public SignatureDt setWho(IDatatype theValue) { 325 myWho = theValue; 326 return this; 327 } 328 329 330 331 332 /** 333 * Gets the value(s) for <b>contentType</b> (). 334 * creating it if it does 335 * not exist. Will not return <code>null</code>. 336 * 337 * <p> 338 * <b>Definition:</b> 339 * 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 340 * </p> 341 */ 342 public CodeDt getContentTypeElement() { 343 if (myContentType == null) { 344 myContentType = new CodeDt(); 345 } 346 return myContentType; 347 } 348 349 350 /** 351 * Gets the value(s) for <b>contentType</b> (). 352 * creating it if it does 353 * not exist. Will not return <code>null</code>. 354 * 355 * <p> 356 * <b>Definition:</b> 357 * 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 358 * </p> 359 */ 360 public String getContentType() { 361 return getContentTypeElement().getValue(); 362 } 363 364 /** 365 * Sets the value(s) for <b>contentType</b> () 366 * 367 * <p> 368 * <b>Definition:</b> 369 * 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 370 * </p> 371 */ 372 public SignatureDt setContentType(CodeDt theValue) { 373 myContentType = theValue; 374 return this; 375 } 376 377 378 379 /** 380 * Sets the value for <b>contentType</b> () 381 * 382 * <p> 383 * <b>Definition:</b> 384 * 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 385 * </p> 386 */ 387 public SignatureDt setContentType( String theCode) { 388 myContentType = new CodeDt(theCode); 389 return this; 390 } 391 392 393 /** 394 * Gets the value(s) for <b>blob</b> (). 395 * creating it if it does 396 * not exist. Will not return <code>null</code>. 397 * 398 * <p> 399 * <b>Definition:</b> 400 * The base64 encoding of the Signature content 401 * </p> 402 */ 403 public Base64BinaryDt getBlobElement() { 404 if (myBlob == null) { 405 myBlob = new Base64BinaryDt(); 406 } 407 return myBlob; 408 } 409 410 411 /** 412 * Gets the value(s) for <b>blob</b> (). 413 * creating it if it does 414 * not exist. Will not return <code>null</code>. 415 * 416 * <p> 417 * <b>Definition:</b> 418 * The base64 encoding of the Signature content 419 * </p> 420 */ 421 public byte[] getBlob() { 422 return getBlobElement().getValue(); 423 } 424 425 /** 426 * Sets the value(s) for <b>blob</b> () 427 * 428 * <p> 429 * <b>Definition:</b> 430 * The base64 encoding of the Signature content 431 * </p> 432 */ 433 public SignatureDt setBlob(Base64BinaryDt theValue) { 434 myBlob = theValue; 435 return this; 436 } 437 438 439 440 /** 441 * Sets the value for <b>blob</b> () 442 * 443 * <p> 444 * <b>Definition:</b> 445 * The base64 encoding of the Signature content 446 * </p> 447 */ 448 public SignatureDt setBlob( byte[] theBytes) { 449 myBlob = new Base64BinaryDt(theBytes); 450 return this; 451 } 452 453 454 455 456}