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>AttachmentDt</b> Datatype 078 * () 079 * 080 * <p> 081 * <b>Definition:</b> 082 * For referring to data content defined in other formats. 083 * </p> 084 * 085 * <p> 086 * <b>Requirements:</b> 087 * Many models need to include data defined in other specifications that is complex and opaque to the healthcare model. This includes documents, media recordings, structured data, etc. 088 * </p> 089 */ 090@DatatypeDef(name="Attachment") 091public class AttachmentDt 092 extends BaseIdentifiableElement implements ICompositeDatatype{ 093 094 /** 095 * Constructor 096 */ 097 public AttachmentDt() { 098 // nothing 099 } 100 101 102 @Child(name="contentType", type=CodeDt.class, order=0, min=0, max=1, summary=true, modifier=false) 103 @Description( 104 shortDefinition="", 105 formalDefinition="Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate" 106 ) 107 private CodeDt myContentType; 108 109 @Child(name="language", type=CodeDt.class, order=1, min=0, max=1, summary=true, modifier=false) 110 @Description( 111 shortDefinition="", 112 formalDefinition="The human language of the content. The value can be any valid value according to BCP 47" 113 ) 114 private CodeDt myLanguage; 115 116 @Child(name="data", type=Base64BinaryDt.class, order=2, min=0, max=1, summary=true, modifier=false) 117 @Description( 118 shortDefinition="", 119 formalDefinition="The actual data of the attachment - a sequence of bytes. In XML, represented using base64" 120 ) 121 private Base64BinaryDt myData; 122 123 @Child(name="url", type=UriDt.class, order=3, min=0, max=1, summary=true, modifier=false) 124 @Description( 125 shortDefinition="", 126 formalDefinition="An alternative location where the data can be accessed" 127 ) 128 private UriDt myUrl; 129 130 @Child(name="size", type=UnsignedIntDt.class, order=4, min=0, max=1, summary=true, modifier=false) 131 @Description( 132 shortDefinition="", 133 formalDefinition="The number of bytes of data that make up this attachment." 134 ) 135 private UnsignedIntDt mySize; 136 137 @Child(name="hash", type=Base64BinaryDt.class, order=5, min=0, max=1, summary=true, modifier=false) 138 @Description( 139 shortDefinition="", 140 formalDefinition="The calculated hash of the data using SHA-1. Represented using base64" 141 ) 142 private Base64BinaryDt myHash; 143 144 @Child(name="title", type=StringDt.class, order=6, min=0, max=1, summary=true, modifier=false) 145 @Description( 146 shortDefinition="", 147 formalDefinition="A label or set of text to display in place of the data" 148 ) 149 private StringDt myTitle; 150 151 @Child(name="creation", type=DateTimeDt.class, order=7, min=0, max=1, summary=true, modifier=false) 152 @Description( 153 shortDefinition="", 154 formalDefinition="The date that the attachment was first created" 155 ) 156 private DateTimeDt myCreation; 157 158 159 @Override 160 public boolean isEmpty() { 161 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myContentType, myLanguage, myData, myUrl, mySize, myHash, myTitle, myCreation); 162 } 163 164 @Override 165 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { 166 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myContentType, myLanguage, myData, myUrl, mySize, myHash, myTitle, myCreation); 167 } 168 169 /** 170 * Gets the value(s) for <b>contentType</b> (). 171 * creating it if it does 172 * not exist. Will not return <code>null</code>. 173 * 174 * <p> 175 * <b>Definition:</b> 176 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate 177 * </p> 178 */ 179 public CodeDt getContentTypeElement() { 180 if (myContentType == null) { 181 myContentType = new CodeDt(); 182 } 183 return myContentType; 184 } 185 186 187 /** 188 * Gets the value(s) for <b>contentType</b> (). 189 * creating it if it does 190 * not exist. This method may return <code>null</code>. 191 * 192 * <p> 193 * <b>Definition:</b> 194 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate 195 * </p> 196 */ 197 public String getContentType() { 198 return getContentTypeElement().getValue(); 199 } 200 201 /** 202 * Sets the value(s) for <b>contentType</b> () 203 * 204 * <p> 205 * <b>Definition:</b> 206 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate 207 * </p> 208 */ 209 public AttachmentDt setContentType(CodeDt theValue) { 210 myContentType = theValue; 211 return this; 212 } 213 214 215 216 /** 217 * Sets the value for <b>contentType</b> () 218 * 219 * <p> 220 * <b>Definition:</b> 221 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate 222 * </p> 223 */ 224 public AttachmentDt setContentType( String theCode) { 225 myContentType = new CodeDt(theCode); 226 return this; 227 } 228 229 230 /** 231 * Gets the value(s) for <b>language</b> (). 232 * creating it if it does 233 * not exist. Will not return <code>null</code>. 234 * 235 * <p> 236 * <b>Definition:</b> 237 * The human language of the content. The value can be any valid value according to BCP 47 238 * </p> 239 */ 240 public CodeDt getLanguageElement() { 241 if (myLanguage == null) { 242 myLanguage = new CodeDt(); 243 } 244 return myLanguage; 245 } 246 247 248 /** 249 * Gets the value(s) for <b>language</b> (). 250 * creating it if it does 251 * not exist. This method may return <code>null</code>. 252 * 253 * <p> 254 * <b>Definition:</b> 255 * The human language of the content. The value can be any valid value according to BCP 47 256 * </p> 257 */ 258 public String getLanguage() { 259 return getLanguageElement().getValue(); 260 } 261 262 /** 263 * Sets the value(s) for <b>language</b> () 264 * 265 * <p> 266 * <b>Definition:</b> 267 * The human language of the content. The value can be any valid value according to BCP 47 268 * </p> 269 */ 270 public AttachmentDt setLanguage(CodeDt theValue) { 271 myLanguage = theValue; 272 return this; 273 } 274 275 276 277 /** 278 * Sets the value for <b>language</b> () 279 * 280 * <p> 281 * <b>Definition:</b> 282 * The human language of the content. The value can be any valid value according to BCP 47 283 * </p> 284 */ 285 public AttachmentDt setLanguage( String theCode) { 286 myLanguage = new CodeDt(theCode); 287 return this; 288 } 289 290 291 /** 292 * Gets the value(s) for <b>data</b> (). 293 * creating it if it does 294 * not exist. Will not return <code>null</code>. 295 * 296 * <p> 297 * <b>Definition:</b> 298 * The actual data of the attachment - a sequence of bytes. In XML, represented using base64 299 * </p> 300 */ 301 public Base64BinaryDt getDataElement() { 302 if (myData == null) { 303 myData = new Base64BinaryDt(); 304 } 305 return myData; 306 } 307 308 309 /** 310 * Gets the value(s) for <b>data</b> (). 311 * creating it if it does 312 * not exist. This method may return <code>null</code>. 313 * 314 * <p> 315 * <b>Definition:</b> 316 * The actual data of the attachment - a sequence of bytes. In XML, represented using base64 317 * </p> 318 */ 319 public byte[] getData() { 320 return getDataElement().getValue(); 321 } 322 323 /** 324 * Sets the value(s) for <b>data</b> () 325 * 326 * <p> 327 * <b>Definition:</b> 328 * The actual data of the attachment - a sequence of bytes. In XML, represented using base64 329 * </p> 330 */ 331 public AttachmentDt setData(Base64BinaryDt theValue) { 332 myData = theValue; 333 return this; 334 } 335 336 337 338 /** 339 * Sets the value for <b>data</b> () 340 * 341 * <p> 342 * <b>Definition:</b> 343 * The actual data of the attachment - a sequence of bytes. In XML, represented using base64 344 * </p> 345 */ 346 public AttachmentDt setData( byte[] theBytes) { 347 myData = new Base64BinaryDt(theBytes); 348 return this; 349 } 350 351 352 /** 353 * Gets the value(s) for <b>url</b> (). 354 * creating it if it does 355 * not exist. Will not return <code>null</code>. 356 * 357 * <p> 358 * <b>Definition:</b> 359 * An alternative location where the data can be accessed 360 * </p> 361 */ 362 public UriDt getUrlElement() { 363 if (myUrl == null) { 364 myUrl = new UriDt(); 365 } 366 return myUrl; 367 } 368 369 370 /** 371 * Gets the value(s) for <b>url</b> (). 372 * creating it if it does 373 * not exist. This method may return <code>null</code>. 374 * 375 * <p> 376 * <b>Definition:</b> 377 * An alternative location where the data can be accessed 378 * </p> 379 */ 380 public String getUrl() { 381 return getUrlElement().getValue(); 382 } 383 384 /** 385 * Sets the value(s) for <b>url</b> () 386 * 387 * <p> 388 * <b>Definition:</b> 389 * An alternative location where the data can be accessed 390 * </p> 391 */ 392 public AttachmentDt setUrl(UriDt theValue) { 393 myUrl = theValue; 394 return this; 395 } 396 397 398 399 /** 400 * Sets the value for <b>url</b> () 401 * 402 * <p> 403 * <b>Definition:</b> 404 * An alternative location where the data can be accessed 405 * </p> 406 */ 407 public AttachmentDt setUrl( String theUri) { 408 myUrl = new UriDt(theUri); 409 return this; 410 } 411 412 413 /** 414 * Gets the value(s) for <b>size</b> (). 415 * creating it if it does 416 * not exist. Will not return <code>null</code>. 417 * 418 * <p> 419 * <b>Definition:</b> 420 * The number of bytes of data that make up this attachment. 421 * </p> 422 */ 423 public UnsignedIntDt getSizeElement() { 424 if (mySize == null) { 425 mySize = new UnsignedIntDt(); 426 } 427 return mySize; 428 } 429 430 431 /** 432 * Gets the value(s) for <b>size</b> (). 433 * creating it if it does 434 * not exist. This method may return <code>null</code>. 435 * 436 * <p> 437 * <b>Definition:</b> 438 * The number of bytes of data that make up this attachment. 439 * </p> 440 */ 441 public Integer getSize() { 442 return getSizeElement().getValue(); 443 } 444 445 /** 446 * Sets the value(s) for <b>size</b> () 447 * 448 * <p> 449 * <b>Definition:</b> 450 * The number of bytes of data that make up this attachment. 451 * </p> 452 */ 453 public AttachmentDt setSize(UnsignedIntDt theValue) { 454 mySize = theValue; 455 return this; 456 } 457 458 459 460 /** 461 * Sets the value for <b>size</b> () 462 * 463 * <p> 464 * <b>Definition:</b> 465 * The number of bytes of data that make up this attachment. 466 * </p> 467 */ 468 public AttachmentDt setSize( int theInteger) { 469 mySize = new UnsignedIntDt(theInteger); 470 return this; 471 } 472 473 474 /** 475 * Gets the value(s) for <b>hash</b> (). 476 * creating it if it does 477 * not exist. Will not return <code>null</code>. 478 * 479 * <p> 480 * <b>Definition:</b> 481 * The calculated hash of the data using SHA-1. Represented using base64 482 * </p> 483 */ 484 public Base64BinaryDt getHashElement() { 485 if (myHash == null) { 486 myHash = new Base64BinaryDt(); 487 } 488 return myHash; 489 } 490 491 492 /** 493 * Gets the value(s) for <b>hash</b> (). 494 * creating it if it does 495 * not exist. This method may return <code>null</code>. 496 * 497 * <p> 498 * <b>Definition:</b> 499 * The calculated hash of the data using SHA-1. Represented using base64 500 * </p> 501 */ 502 public byte[] getHash() { 503 return getHashElement().getValue(); 504 } 505 506 /** 507 * Sets the value(s) for <b>hash</b> () 508 * 509 * <p> 510 * <b>Definition:</b> 511 * The calculated hash of the data using SHA-1. Represented using base64 512 * </p> 513 */ 514 public AttachmentDt setHash(Base64BinaryDt theValue) { 515 myHash = theValue; 516 return this; 517 } 518 519 520 521 /** 522 * Sets the value for <b>hash</b> () 523 * 524 * <p> 525 * <b>Definition:</b> 526 * The calculated hash of the data using SHA-1. Represented using base64 527 * </p> 528 */ 529 public AttachmentDt setHash( byte[] theBytes) { 530 myHash = new Base64BinaryDt(theBytes); 531 return this; 532 } 533 534 535 /** 536 * Gets the value(s) for <b>title</b> (). 537 * creating it if it does 538 * not exist. Will not return <code>null</code>. 539 * 540 * <p> 541 * <b>Definition:</b> 542 * A label or set of text to display in place of the data 543 * </p> 544 */ 545 public StringDt getTitleElement() { 546 if (myTitle == null) { 547 myTitle = new StringDt(); 548 } 549 return myTitle; 550 } 551 552 553 /** 554 * Gets the value(s) for <b>title</b> (). 555 * creating it if it does 556 * not exist. This method may return <code>null</code>. 557 * 558 * <p> 559 * <b>Definition:</b> 560 * A label or set of text to display in place of the data 561 * </p> 562 */ 563 public String getTitle() { 564 return getTitleElement().getValue(); 565 } 566 567 /** 568 * Sets the value(s) for <b>title</b> () 569 * 570 * <p> 571 * <b>Definition:</b> 572 * A label or set of text to display in place of the data 573 * </p> 574 */ 575 public AttachmentDt setTitle(StringDt theValue) { 576 myTitle = theValue; 577 return this; 578 } 579 580 581 582 /** 583 * Sets the value for <b>title</b> () 584 * 585 * <p> 586 * <b>Definition:</b> 587 * A label or set of text to display in place of the data 588 * </p> 589 */ 590 public AttachmentDt setTitle( String theString) { 591 myTitle = new StringDt(theString); 592 return this; 593 } 594 595 596 /** 597 * Gets the value(s) for <b>creation</b> (). 598 * creating it if it does 599 * not exist. Will not return <code>null</code>. 600 * 601 * <p> 602 * <b>Definition:</b> 603 * The date that the attachment was first created 604 * </p> 605 */ 606 public DateTimeDt getCreationElement() { 607 if (myCreation == null) { 608 myCreation = new DateTimeDt(); 609 } 610 return myCreation; 611 } 612 613 614 /** 615 * Gets the value(s) for <b>creation</b> (). 616 * creating it if it does 617 * not exist. This method may return <code>null</code>. 618 * 619 * <p> 620 * <b>Definition:</b> 621 * The date that the attachment was first created 622 * </p> 623 */ 624 public Date getCreation() { 625 return getCreationElement().getValue(); 626 } 627 628 /** 629 * Sets the value(s) for <b>creation</b> () 630 * 631 * <p> 632 * <b>Definition:</b> 633 * The date that the attachment was first created 634 * </p> 635 */ 636 public AttachmentDt setCreation(DateTimeDt theValue) { 637 myCreation = theValue; 638 return this; 639 } 640 641 642 643 /** 644 * Sets the value for <b>creation</b> () 645 * 646 * <p> 647 * <b>Definition:</b> 648 * The date that the attachment was first created 649 * </p> 650 */ 651 public AttachmentDt setCreation( Date theDate, TemporalPrecisionEnum thePrecision) { 652 myCreation = new DateTimeDt(theDate, thePrecision); 653 return this; 654 } 655 656 /** 657 * Sets the value for <b>creation</b> () 658 * 659 * <p> 660 * <b>Definition:</b> 661 * The date that the attachment was first created 662 * </p> 663 */ 664 public AttachmentDt setCreationWithSecondsPrecision( Date theDate) { 665 myCreation = new DateTimeDt(theDate); 666 return this; 667 } 668 669 670 671 672}