001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import ca.uhn.fhir.model.api.annotation.Child; 037import ca.uhn.fhir.model.api.annotation.Description; 038import ca.uhn.fhir.model.api.annotation.ResourceDef; 039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.utilities.Utilities; 042 043/** 044 * A photo, video, or audio recording acquired or used in healthcare. The actual 045 * content may be inline or provided by direct reference. 046 */ 047@ResourceDef(name = "Media", profile = "http://hl7.org/fhir/Profile/Media") 048public class Media extends DomainResource { 049 050 public enum DigitalMediaType { 051 /** 052 * The media consists of one or more unmoving images, including photographs, 053 * computer-generated graphs and charts, and scanned documents 054 */ 055 PHOTO, 056 /** 057 * The media consists of a series of frames that capture a moving image 058 */ 059 VIDEO, 060 /** 061 * The media consists of a sound recording 062 */ 063 AUDIO, 064 /** 065 * added to help the parsers 066 */ 067 NULL; 068 069 public static DigitalMediaType fromCode(String codeString) throws FHIRException { 070 if (codeString == null || "".equals(codeString)) 071 return null; 072 if ("photo".equals(codeString)) 073 return PHOTO; 074 if ("video".equals(codeString)) 075 return VIDEO; 076 if ("audio".equals(codeString)) 077 return AUDIO; 078 throw new FHIRException("Unknown DigitalMediaType code '" + codeString + "'"); 079 } 080 081 public String toCode() { 082 switch (this) { 083 case PHOTO: 084 return "photo"; 085 case VIDEO: 086 return "video"; 087 case AUDIO: 088 return "audio"; 089 case NULL: 090 return null; 091 default: 092 return "?"; 093 } 094 } 095 096 public String getSystem() { 097 switch (this) { 098 case PHOTO: 099 return "http://hl7.org/fhir/digital-media-type"; 100 case VIDEO: 101 return "http://hl7.org/fhir/digital-media-type"; 102 case AUDIO: 103 return "http://hl7.org/fhir/digital-media-type"; 104 case NULL: 105 return null; 106 default: 107 return "?"; 108 } 109 } 110 111 public String getDefinition() { 112 switch (this) { 113 case PHOTO: 114 return "The media consists of one or more unmoving images, including photographs, computer-generated graphs and charts, and scanned documents"; 115 case VIDEO: 116 return "The media consists of a series of frames that capture a moving image"; 117 case AUDIO: 118 return "The media consists of a sound recording"; 119 case NULL: 120 return null; 121 default: 122 return "?"; 123 } 124 } 125 126 public String getDisplay() { 127 switch (this) { 128 case PHOTO: 129 return "Photo"; 130 case VIDEO: 131 return "Video"; 132 case AUDIO: 133 return "Audio"; 134 case NULL: 135 return null; 136 default: 137 return "?"; 138 } 139 } 140 } 141 142 public static class DigitalMediaTypeEnumFactory implements EnumFactory<DigitalMediaType> { 143 public DigitalMediaType fromCode(String codeString) throws IllegalArgumentException { 144 if (codeString == null || "".equals(codeString)) 145 if (codeString == null || "".equals(codeString)) 146 return null; 147 if ("photo".equals(codeString)) 148 return DigitalMediaType.PHOTO; 149 if ("video".equals(codeString)) 150 return DigitalMediaType.VIDEO; 151 if ("audio".equals(codeString)) 152 return DigitalMediaType.AUDIO; 153 throw new IllegalArgumentException("Unknown DigitalMediaType code '" + codeString + "'"); 154 } 155 156 public Enumeration<DigitalMediaType> fromType(Base code) throws FHIRException { 157 if (code == null || code.isEmpty()) 158 return null; 159 String codeString = ((PrimitiveType) code).asStringValue(); 160 if (codeString == null || "".equals(codeString)) 161 return null; 162 if ("photo".equals(codeString)) 163 return new Enumeration<DigitalMediaType>(this, DigitalMediaType.PHOTO); 164 if ("video".equals(codeString)) 165 return new Enumeration<DigitalMediaType>(this, DigitalMediaType.VIDEO); 166 if ("audio".equals(codeString)) 167 return new Enumeration<DigitalMediaType>(this, DigitalMediaType.AUDIO); 168 throw new FHIRException("Unknown DigitalMediaType code '" + codeString + "'"); 169 } 170 171 public String toCode(DigitalMediaType code) { 172 if (code == DigitalMediaType.PHOTO) 173 return "photo"; 174 if (code == DigitalMediaType.VIDEO) 175 return "video"; 176 if (code == DigitalMediaType.AUDIO) 177 return "audio"; 178 return "?"; 179 } 180 } 181 182 /** 183 * Whether the media is a photo (still image), an audio recording, or a video 184 * recording. 185 */ 186 @Child(name = "type", type = { CodeType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true) 187 @Description(shortDefinition = "photo | video | audio", formalDefinition = "Whether the media is a photo (still image), an audio recording, or a video recording.") 188 protected Enumeration<DigitalMediaType> type; 189 190 /** 191 * Details of the type of the media - usually, how it was acquired (what type of 192 * device). If images sourced from a DICOM system, are wrapped in a Media 193 * resource, then this is the modality. 194 */ 195 @Child(name = "subtype", type = { 196 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 197 @Description(shortDefinition = "The type of acquisition equipment/process", formalDefinition = "Details of the type of the media - usually, how it was acquired (what type of device). If images sourced from a DICOM system, are wrapped in a Media resource, then this is the modality.") 198 protected CodeableConcept subtype; 199 200 /** 201 * Identifiers associated with the image - these may include identifiers for the 202 * image itself, identifiers for the context of its collection (e.g. series ids) 203 * and context ids such as accession numbers or other workflow identifiers. 204 */ 205 @Child(name = "identifier", type = { 206 Identifier.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 207 @Description(shortDefinition = "Identifier(s) for the image", formalDefinition = "Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers.") 208 protected List<Identifier> identifier; 209 210 /** 211 * Who/What this Media is a record of. 212 */ 213 @Child(name = "subject", type = { Patient.class, Practitioner.class, Group.class, Device.class, 214 Specimen.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 215 @Description(shortDefinition = "Who/What this Media is a record of", formalDefinition = "Who/What this Media is a record of.") 216 protected Reference subject; 217 218 /** 219 * The actual object that is the target of the reference (Who/What this Media is 220 * a record of.) 221 */ 222 protected Resource subjectTarget; 223 224 /** 225 * The person who administered the collection of the image. 226 */ 227 @Child(name = "operator", type = { 228 Practitioner.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 229 @Description(shortDefinition = "The person who generated the image", formalDefinition = "The person who administered the collection of the image.") 230 protected Reference operator; 231 232 /** 233 * The actual object that is the target of the reference (The person who 234 * administered the collection of the image.) 235 */ 236 protected Practitioner operatorTarget; 237 238 /** 239 * The name of the imaging view e.g. Lateral or Antero-posterior (AP). 240 */ 241 @Child(name = "view", type = { CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 242 @Description(shortDefinition = "Imaging view, e.g. Lateral or Antero-posterior", formalDefinition = "The name of the imaging view e.g. Lateral or Antero-posterior (AP).") 243 protected CodeableConcept view; 244 245 /** 246 * The name of the device / manufacturer of the device that was used to make the 247 * recording. 248 */ 249 @Child(name = "deviceName", type = { 250 StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 251 @Description(shortDefinition = "Name of the device/manufacturer", formalDefinition = "The name of the device / manufacturer of the device that was used to make the recording.") 252 protected StringType deviceName; 253 254 /** 255 * Height of the image in pixels (photo/video). 256 */ 257 @Child(name = "height", type = { 258 PositiveIntType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true) 259 @Description(shortDefinition = "Height of the image in pixels (photo/video)", formalDefinition = "Height of the image in pixels (photo/video).") 260 protected PositiveIntType height; 261 262 /** 263 * Width of the image in pixels (photo/video). 264 */ 265 @Child(name = "width", type = { 266 PositiveIntType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true) 267 @Description(shortDefinition = "Width of the image in pixels (photo/video)", formalDefinition = "Width of the image in pixels (photo/video).") 268 protected PositiveIntType width; 269 270 /** 271 * The number of frames in a photo. This is used with a multi-page fax, or an 272 * imaging acquisition context that takes multiple slices in a single image, or 273 * an animated gif. If there is more than one frame, this SHALL have a value in 274 * order to alert interface software that a multi-frame capable rendering widget 275 * is required. 276 */ 277 @Child(name = "frames", type = { 278 PositiveIntType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true) 279 @Description(shortDefinition = "Number of frames if > 1 (photo)", formalDefinition = "The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.") 280 protected PositiveIntType frames; 281 282 /** 283 * The duration of the recording in seconds - for audio and video. 284 */ 285 @Child(name = "duration", type = { 286 UnsignedIntType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true) 287 @Description(shortDefinition = "Length in seconds (audio / video)", formalDefinition = "The duration of the recording in seconds - for audio and video.") 288 protected UnsignedIntType duration; 289 290 /** 291 * The actual content of the media - inline or by direct reference to the media 292 * source file. 293 */ 294 @Child(name = "content", type = { Attachment.class }, order = 11, min = 1, max = 1, modifier = false, summary = false) 295 @Description(shortDefinition = "Actual Media - reference or data", formalDefinition = "The actual content of the media - inline or by direct reference to the media source file.") 296 protected Attachment content; 297 298 private static final long serialVersionUID = -280764739L; 299 300 /* 301 * Constructor 302 */ 303 public Media() { 304 super(); 305 } 306 307 /* 308 * Constructor 309 */ 310 public Media(Enumeration<DigitalMediaType> type, Attachment content) { 311 super(); 312 this.type = type; 313 this.content = content; 314 } 315 316 /** 317 * @return {@link #type} (Whether the media is a photo (still image), an audio 318 * recording, or a video recording.). This is the underlying object with 319 * id, value and extensions. The accessor "getType" gives direct access 320 * to the value 321 */ 322 public Enumeration<DigitalMediaType> getTypeElement() { 323 if (this.type == null) 324 if (Configuration.errorOnAutoCreate()) 325 throw new Error("Attempt to auto-create Media.type"); 326 else if (Configuration.doAutoCreate()) 327 this.type = new Enumeration<DigitalMediaType>(new DigitalMediaTypeEnumFactory()); // bb 328 return this.type; 329 } 330 331 public boolean hasTypeElement() { 332 return this.type != null && !this.type.isEmpty(); 333 } 334 335 public boolean hasType() { 336 return this.type != null && !this.type.isEmpty(); 337 } 338 339 /** 340 * @param value {@link #type} (Whether the media is a photo (still image), an 341 * audio recording, or a video recording.). This is the underlying 342 * object with id, value and extensions. The accessor "getType" 343 * gives direct access to the value 344 */ 345 public Media setTypeElement(Enumeration<DigitalMediaType> value) { 346 this.type = value; 347 return this; 348 } 349 350 /** 351 * @return Whether the media is a photo (still image), an audio recording, or a 352 * video recording. 353 */ 354 public DigitalMediaType getType() { 355 return this.type == null ? null : this.type.getValue(); 356 } 357 358 /** 359 * @param value Whether the media is a photo (still image), an audio recording, 360 * or a video recording. 361 */ 362 public Media setType(DigitalMediaType value) { 363 if (this.type == null) 364 this.type = new Enumeration<DigitalMediaType>(new DigitalMediaTypeEnumFactory()); 365 this.type.setValue(value); 366 return this; 367 } 368 369 /** 370 * @return {@link #subtype} (Details of the type of the media - usually, how it 371 * was acquired (what type of device). If images sourced from a DICOM 372 * system, are wrapped in a Media resource, then this is the modality.) 373 */ 374 public CodeableConcept getSubtype() { 375 if (this.subtype == null) 376 if (Configuration.errorOnAutoCreate()) 377 throw new Error("Attempt to auto-create Media.subtype"); 378 else if (Configuration.doAutoCreate()) 379 this.subtype = new CodeableConcept(); // cc 380 return this.subtype; 381 } 382 383 public boolean hasSubtype() { 384 return this.subtype != null && !this.subtype.isEmpty(); 385 } 386 387 /** 388 * @param value {@link #subtype} (Details of the type of the media - usually, 389 * how it was acquired (what type of device). If images sourced 390 * from a DICOM system, are wrapped in a Media resource, then this 391 * is the modality.) 392 */ 393 public Media setSubtype(CodeableConcept value) { 394 this.subtype = value; 395 return this; 396 } 397 398 /** 399 * @return {@link #identifier} (Identifiers associated with the image - these 400 * may include identifiers for the image itself, identifiers for the 401 * context of its collection (e.g. series ids) and context ids such as 402 * accession numbers or other workflow identifiers.) 403 */ 404 public List<Identifier> getIdentifier() { 405 if (this.identifier == null) 406 this.identifier = new ArrayList<Identifier>(); 407 return this.identifier; 408 } 409 410 public boolean hasIdentifier() { 411 if (this.identifier == null) 412 return false; 413 for (Identifier item : this.identifier) 414 if (!item.isEmpty()) 415 return true; 416 return false; 417 } 418 419 /** 420 * @return {@link #identifier} (Identifiers associated with the image - these 421 * may include identifiers for the image itself, identifiers for the 422 * context of its collection (e.g. series ids) and context ids such as 423 * accession numbers or other workflow identifiers.) 424 */ 425 // syntactic sugar 426 public Identifier addIdentifier() { // 3 427 Identifier t = new Identifier(); 428 if (this.identifier == null) 429 this.identifier = new ArrayList<Identifier>(); 430 this.identifier.add(t); 431 return t; 432 } 433 434 // syntactic sugar 435 public Media addIdentifier(Identifier t) { // 3 436 if (t == null) 437 return this; 438 if (this.identifier == null) 439 this.identifier = new ArrayList<Identifier>(); 440 this.identifier.add(t); 441 return this; 442 } 443 444 /** 445 * @return {@link #subject} (Who/What this Media is a record of.) 446 */ 447 public Reference getSubject() { 448 if (this.subject == null) 449 if (Configuration.errorOnAutoCreate()) 450 throw new Error("Attempt to auto-create Media.subject"); 451 else if (Configuration.doAutoCreate()) 452 this.subject = new Reference(); // cc 453 return this.subject; 454 } 455 456 public boolean hasSubject() { 457 return this.subject != null && !this.subject.isEmpty(); 458 } 459 460 /** 461 * @param value {@link #subject} (Who/What this Media is a record of.) 462 */ 463 public Media setSubject(Reference value) { 464 this.subject = value; 465 return this; 466 } 467 468 /** 469 * @return {@link #subject} The actual object that is the target of the 470 * reference. The reference library doesn't populate this, but you can 471 * use it to hold the resource if you resolve it. (Who/What this Media 472 * is a record of.) 473 */ 474 public Resource getSubjectTarget() { 475 return this.subjectTarget; 476 } 477 478 /** 479 * @param value {@link #subject} The actual object that is the target of the 480 * reference. The reference library doesn't use these, but you can 481 * use it to hold the resource if you resolve it. (Who/What this 482 * Media is a record of.) 483 */ 484 public Media setSubjectTarget(Resource value) { 485 this.subjectTarget = value; 486 return this; 487 } 488 489 /** 490 * @return {@link #operator} (The person who administered the collection of the 491 * image.) 492 */ 493 public Reference getOperator() { 494 if (this.operator == null) 495 if (Configuration.errorOnAutoCreate()) 496 throw new Error("Attempt to auto-create Media.operator"); 497 else if (Configuration.doAutoCreate()) 498 this.operator = new Reference(); // cc 499 return this.operator; 500 } 501 502 public boolean hasOperator() { 503 return this.operator != null && !this.operator.isEmpty(); 504 } 505 506 /** 507 * @param value {@link #operator} (The person who administered the collection of 508 * the image.) 509 */ 510 public Media setOperator(Reference value) { 511 this.operator = value; 512 return this; 513 } 514 515 /** 516 * @return {@link #operator} The actual object that is the target of the 517 * reference. The reference library doesn't populate this, but you can 518 * use it to hold the resource if you resolve it. (The person who 519 * administered the collection of the image.) 520 */ 521 public Practitioner getOperatorTarget() { 522 if (this.operatorTarget == null) 523 if (Configuration.errorOnAutoCreate()) 524 throw new Error("Attempt to auto-create Media.operator"); 525 else if (Configuration.doAutoCreate()) 526 this.operatorTarget = new Practitioner(); // aa 527 return this.operatorTarget; 528 } 529 530 /** 531 * @param value {@link #operator} The actual object that is the target of the 532 * reference. The reference library doesn't use these, but you can 533 * use it to hold the resource if you resolve it. (The person who 534 * administered the collection of the image.) 535 */ 536 public Media setOperatorTarget(Practitioner value) { 537 this.operatorTarget = value; 538 return this; 539 } 540 541 /** 542 * @return {@link #view} (The name of the imaging view e.g. Lateral or 543 * Antero-posterior (AP).) 544 */ 545 public CodeableConcept getView() { 546 if (this.view == null) 547 if (Configuration.errorOnAutoCreate()) 548 throw new Error("Attempt to auto-create Media.view"); 549 else if (Configuration.doAutoCreate()) 550 this.view = new CodeableConcept(); // cc 551 return this.view; 552 } 553 554 public boolean hasView() { 555 return this.view != null && !this.view.isEmpty(); 556 } 557 558 /** 559 * @param value {@link #view} (The name of the imaging view e.g. Lateral or 560 * Antero-posterior (AP).) 561 */ 562 public Media setView(CodeableConcept value) { 563 this.view = value; 564 return this; 565 } 566 567 /** 568 * @return {@link #deviceName} (The name of the device / manufacturer of the 569 * device that was used to make the recording.). This is the underlying 570 * object with id, value and extensions. The accessor "getDeviceName" 571 * gives direct access to the value 572 */ 573 public StringType getDeviceNameElement() { 574 if (this.deviceName == null) 575 if (Configuration.errorOnAutoCreate()) 576 throw new Error("Attempt to auto-create Media.deviceName"); 577 else if (Configuration.doAutoCreate()) 578 this.deviceName = new StringType(); // bb 579 return this.deviceName; 580 } 581 582 public boolean hasDeviceNameElement() { 583 return this.deviceName != null && !this.deviceName.isEmpty(); 584 } 585 586 public boolean hasDeviceName() { 587 return this.deviceName != null && !this.deviceName.isEmpty(); 588 } 589 590 /** 591 * @param value {@link #deviceName} (The name of the device / manufacturer of 592 * the device that was used to make the recording.). This is the 593 * underlying object with id, value and extensions. The accessor 594 * "getDeviceName" gives direct access to the value 595 */ 596 public Media setDeviceNameElement(StringType value) { 597 this.deviceName = value; 598 return this; 599 } 600 601 /** 602 * @return The name of the device / manufacturer of the device that was used to 603 * make the recording. 604 */ 605 public String getDeviceName() { 606 return this.deviceName == null ? null : this.deviceName.getValue(); 607 } 608 609 /** 610 * @param value The name of the device / manufacturer of the device that was 611 * used to make the recording. 612 */ 613 public Media setDeviceName(String value) { 614 if (Utilities.noString(value)) 615 this.deviceName = null; 616 else { 617 if (this.deviceName == null) 618 this.deviceName = new StringType(); 619 this.deviceName.setValue(value); 620 } 621 return this; 622 } 623 624 /** 625 * @return {@link #height} (Height of the image in pixels (photo/video).). This 626 * is the underlying object with id, value and extensions. The accessor 627 * "getHeight" gives direct access to the value 628 */ 629 public PositiveIntType getHeightElement() { 630 if (this.height == null) 631 if (Configuration.errorOnAutoCreate()) 632 throw new Error("Attempt to auto-create Media.height"); 633 else if (Configuration.doAutoCreate()) 634 this.height = new PositiveIntType(); // bb 635 return this.height; 636 } 637 638 public boolean hasHeightElement() { 639 return this.height != null && !this.height.isEmpty(); 640 } 641 642 public boolean hasHeight() { 643 return this.height != null && !this.height.isEmpty(); 644 } 645 646 /** 647 * @param value {@link #height} (Height of the image in pixels (photo/video).). 648 * This is the underlying object with id, value and extensions. The 649 * accessor "getHeight" gives direct access to the value 650 */ 651 public Media setHeightElement(PositiveIntType value) { 652 this.height = value; 653 return this; 654 } 655 656 /** 657 * @return Height of the image in pixels (photo/video). 658 */ 659 public int getHeight() { 660 return this.height == null || this.height.isEmpty() ? 0 : this.height.getValue(); 661 } 662 663 /** 664 * @param value Height of the image in pixels (photo/video). 665 */ 666 public Media setHeight(int value) { 667 if (this.height == null) 668 this.height = new PositiveIntType(); 669 this.height.setValue(value); 670 return this; 671 } 672 673 /** 674 * @return {@link #width} (Width of the image in pixels (photo/video).). This is 675 * the underlying object with id, value and extensions. The accessor 676 * "getWidth" gives direct access to the value 677 */ 678 public PositiveIntType getWidthElement() { 679 if (this.width == null) 680 if (Configuration.errorOnAutoCreate()) 681 throw new Error("Attempt to auto-create Media.width"); 682 else if (Configuration.doAutoCreate()) 683 this.width = new PositiveIntType(); // bb 684 return this.width; 685 } 686 687 public boolean hasWidthElement() { 688 return this.width != null && !this.width.isEmpty(); 689 } 690 691 public boolean hasWidth() { 692 return this.width != null && !this.width.isEmpty(); 693 } 694 695 /** 696 * @param value {@link #width} (Width of the image in pixels (photo/video).). 697 * This is the underlying object with id, value and extensions. The 698 * accessor "getWidth" gives direct access to the value 699 */ 700 public Media setWidthElement(PositiveIntType value) { 701 this.width = value; 702 return this; 703 } 704 705 /** 706 * @return Width of the image in pixels (photo/video). 707 */ 708 public int getWidth() { 709 return this.width == null || this.width.isEmpty() ? 0 : this.width.getValue(); 710 } 711 712 /** 713 * @param value Width of the image in pixels (photo/video). 714 */ 715 public Media setWidth(int value) { 716 if (this.width == null) 717 this.width = new PositiveIntType(); 718 this.width.setValue(value); 719 return this; 720 } 721 722 /** 723 * @return {@link #frames} (The number of frames in a photo. This is used with a 724 * multi-page fax, or an imaging acquisition context that takes multiple 725 * slices in a single image, or an animated gif. If there is more than 726 * one frame, this SHALL have a value in order to alert interface 727 * software that a multi-frame capable rendering widget is required.). 728 * This is the underlying object with id, value and extensions. The 729 * accessor "getFrames" gives direct access to the value 730 */ 731 public PositiveIntType getFramesElement() { 732 if (this.frames == null) 733 if (Configuration.errorOnAutoCreate()) 734 throw new Error("Attempt to auto-create Media.frames"); 735 else if (Configuration.doAutoCreate()) 736 this.frames = new PositiveIntType(); // bb 737 return this.frames; 738 } 739 740 public boolean hasFramesElement() { 741 return this.frames != null && !this.frames.isEmpty(); 742 } 743 744 public boolean hasFrames() { 745 return this.frames != null && !this.frames.isEmpty(); 746 } 747 748 /** 749 * @param value {@link #frames} (The number of frames in a photo. This is used 750 * with a multi-page fax, or an imaging acquisition context that 751 * takes multiple slices in a single image, or an animated gif. If 752 * there is more than one frame, this SHALL have a value in order 753 * to alert interface software that a multi-frame capable rendering 754 * widget is required.). This is the underlying object with id, 755 * value and extensions. The accessor "getFrames" gives direct 756 * access to the value 757 */ 758 public Media setFramesElement(PositiveIntType value) { 759 this.frames = value; 760 return this; 761 } 762 763 /** 764 * @return The number of frames in a photo. This is used with a multi-page fax, 765 * or an imaging acquisition context that takes multiple slices in a 766 * single image, or an animated gif. If there is more than one frame, 767 * this SHALL have a value in order to alert interface software that a 768 * multi-frame capable rendering widget is required. 769 */ 770 public int getFrames() { 771 return this.frames == null || this.frames.isEmpty() ? 0 : this.frames.getValue(); 772 } 773 774 /** 775 * @param value The number of frames in a photo. This is used with a multi-page 776 * fax, or an imaging acquisition context that takes multiple 777 * slices in a single image, or an animated gif. If there is more 778 * than one frame, this SHALL have a value in order to alert 779 * interface software that a multi-frame capable rendering widget 780 * is required. 781 */ 782 public Media setFrames(int value) { 783 if (this.frames == null) 784 this.frames = new PositiveIntType(); 785 this.frames.setValue(value); 786 return this; 787 } 788 789 /** 790 * @return {@link #duration} (The duration of the recording in seconds - for 791 * audio and video.). This is the underlying object with id, value and 792 * extensions. The accessor "getDuration" gives direct access to the 793 * value 794 */ 795 public UnsignedIntType getDurationElement() { 796 if (this.duration == null) 797 if (Configuration.errorOnAutoCreate()) 798 throw new Error("Attempt to auto-create Media.duration"); 799 else if (Configuration.doAutoCreate()) 800 this.duration = new UnsignedIntType(); // bb 801 return this.duration; 802 } 803 804 public boolean hasDurationElement() { 805 return this.duration != null && !this.duration.isEmpty(); 806 } 807 808 public boolean hasDuration() { 809 return this.duration != null && !this.duration.isEmpty(); 810 } 811 812 /** 813 * @param value {@link #duration} (The duration of the recording in seconds - 814 * for audio and video.). This is the underlying object with id, 815 * value and extensions. The accessor "getDuration" gives direct 816 * access to the value 817 */ 818 public Media setDurationElement(UnsignedIntType value) { 819 this.duration = value; 820 return this; 821 } 822 823 /** 824 * @return The duration of the recording in seconds - for audio and video. 825 */ 826 public int getDuration() { 827 return this.duration == null || this.duration.isEmpty() ? 0 : this.duration.getValue(); 828 } 829 830 /** 831 * @param value The duration of the recording in seconds - for audio and video. 832 */ 833 public Media setDuration(int value) { 834 if (this.duration == null) 835 this.duration = new UnsignedIntType(); 836 this.duration.setValue(value); 837 return this; 838 } 839 840 /** 841 * @return {@link #content} (The actual content of the media - inline or by 842 * direct reference to the media source file.) 843 */ 844 public Attachment getContent() { 845 if (this.content == null) 846 if (Configuration.errorOnAutoCreate()) 847 throw new Error("Attempt to auto-create Media.content"); 848 else if (Configuration.doAutoCreate()) 849 this.content = new Attachment(); // cc 850 return this.content; 851 } 852 853 public boolean hasContent() { 854 return this.content != null && !this.content.isEmpty(); 855 } 856 857 /** 858 * @param value {@link #content} (The actual content of the media - inline or by 859 * direct reference to the media source file.) 860 */ 861 public Media setContent(Attachment value) { 862 this.content = value; 863 return this; 864 } 865 866 protected void listChildren(List<Property> childrenList) { 867 super.listChildren(childrenList); 868 childrenList.add(new Property("type", "code", 869 "Whether the media is a photo (still image), an audio recording, or a video recording.", 0, 870 java.lang.Integer.MAX_VALUE, type)); 871 childrenList.add(new Property("subtype", "CodeableConcept", 872 "Details of the type of the media - usually, how it was acquired (what type of device). If images sourced from a DICOM system, are wrapped in a Media resource, then this is the modality.", 873 0, java.lang.Integer.MAX_VALUE, subtype)); 874 childrenList.add(new Property("identifier", "Identifier", 875 "Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers.", 876 0, java.lang.Integer.MAX_VALUE, identifier)); 877 childrenList.add(new Property("subject", "Reference(Patient|Practitioner|Group|Device|Specimen)", 878 "Who/What this Media is a record of.", 0, java.lang.Integer.MAX_VALUE, subject)); 879 childrenList.add(new Property("operator", "Reference(Practitioner)", 880 "The person who administered the collection of the image.", 0, java.lang.Integer.MAX_VALUE, operator)); 881 childrenList.add(new Property("view", "CodeableConcept", 882 "The name of the imaging view e.g. Lateral or Antero-posterior (AP).", 0, java.lang.Integer.MAX_VALUE, view)); 883 childrenList.add(new Property("deviceName", "string", 884 "The name of the device / manufacturer of the device that was used to make the recording.", 0, 885 java.lang.Integer.MAX_VALUE, deviceName)); 886 childrenList.add(new Property("height", "positiveInt", "Height of the image in pixels (photo/video).", 0, 887 java.lang.Integer.MAX_VALUE, height)); 888 childrenList.add(new Property("width", "positiveInt", "Width of the image in pixels (photo/video).", 0, 889 java.lang.Integer.MAX_VALUE, width)); 890 childrenList.add(new Property("frames", "positiveInt", 891 "The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.", 892 0, java.lang.Integer.MAX_VALUE, frames)); 893 childrenList.add(new Property("duration", "unsignedInt", 894 "The duration of the recording in seconds - for audio and video.", 0, java.lang.Integer.MAX_VALUE, duration)); 895 childrenList.add(new Property("content", "Attachment", 896 "The actual content of the media - inline or by direct reference to the media source file.", 0, 897 java.lang.Integer.MAX_VALUE, content)); 898 } 899 900 @Override 901 public void setProperty(String name, Base value) throws FHIRException { 902 if (name.equals("type")) 903 this.type = new DigitalMediaTypeEnumFactory().fromType(value); // Enumeration<DigitalMediaType> 904 else if (name.equals("subtype")) 905 this.subtype = castToCodeableConcept(value); // CodeableConcept 906 else if (name.equals("identifier")) 907 this.getIdentifier().add(castToIdentifier(value)); 908 else if (name.equals("subject")) 909 this.subject = castToReference(value); // Reference 910 else if (name.equals("operator")) 911 this.operator = castToReference(value); // Reference 912 else if (name.equals("view")) 913 this.view = castToCodeableConcept(value); // CodeableConcept 914 else if (name.equals("deviceName")) 915 this.deviceName = castToString(value); // StringType 916 else if (name.equals("height")) 917 this.height = castToPositiveInt(value); // PositiveIntType 918 else if (name.equals("width")) 919 this.width = castToPositiveInt(value); // PositiveIntType 920 else if (name.equals("frames")) 921 this.frames = castToPositiveInt(value); // PositiveIntType 922 else if (name.equals("duration")) 923 this.duration = castToUnsignedInt(value); // UnsignedIntType 924 else if (name.equals("content")) 925 this.content = castToAttachment(value); // Attachment 926 else 927 super.setProperty(name, value); 928 } 929 930 @Override 931 public Base addChild(String name) throws FHIRException { 932 if (name.equals("type")) { 933 throw new FHIRException("Cannot call addChild on a singleton property Media.type"); 934 } else if (name.equals("subtype")) { 935 this.subtype = new CodeableConcept(); 936 return this.subtype; 937 } else if (name.equals("identifier")) { 938 return addIdentifier(); 939 } else if (name.equals("subject")) { 940 this.subject = new Reference(); 941 return this.subject; 942 } else if (name.equals("operator")) { 943 this.operator = new Reference(); 944 return this.operator; 945 } else if (name.equals("view")) { 946 this.view = new CodeableConcept(); 947 return this.view; 948 } else if (name.equals("deviceName")) { 949 throw new FHIRException("Cannot call addChild on a singleton property Media.deviceName"); 950 } else if (name.equals("height")) { 951 throw new FHIRException("Cannot call addChild on a singleton property Media.height"); 952 } else if (name.equals("width")) { 953 throw new FHIRException("Cannot call addChild on a singleton property Media.width"); 954 } else if (name.equals("frames")) { 955 throw new FHIRException("Cannot call addChild on a singleton property Media.frames"); 956 } else if (name.equals("duration")) { 957 throw new FHIRException("Cannot call addChild on a singleton property Media.duration"); 958 } else if (name.equals("content")) { 959 this.content = new Attachment(); 960 return this.content; 961 } else 962 return super.addChild(name); 963 } 964 965 public String fhirType() { 966 return "Media"; 967 968 } 969 970 public Media copy() { 971 Media dst = new Media(); 972 copyValues(dst); 973 dst.type = type == null ? null : type.copy(); 974 dst.subtype = subtype == null ? null : subtype.copy(); 975 if (identifier != null) { 976 dst.identifier = new ArrayList<Identifier>(); 977 for (Identifier i : identifier) 978 dst.identifier.add(i.copy()); 979 } 980 ; 981 dst.subject = subject == null ? null : subject.copy(); 982 dst.operator = operator == null ? null : operator.copy(); 983 dst.view = view == null ? null : view.copy(); 984 dst.deviceName = deviceName == null ? null : deviceName.copy(); 985 dst.height = height == null ? null : height.copy(); 986 dst.width = width == null ? null : width.copy(); 987 dst.frames = frames == null ? null : frames.copy(); 988 dst.duration = duration == null ? null : duration.copy(); 989 dst.content = content == null ? null : content.copy(); 990 return dst; 991 } 992 993 protected Media typedCopy() { 994 return copy(); 995 } 996 997 @Override 998 public boolean equalsDeep(Base other) { 999 if (!super.equalsDeep(other)) 1000 return false; 1001 if (!(other instanceof Media)) 1002 return false; 1003 Media o = (Media) other; 1004 return compareDeep(type, o.type, true) && compareDeep(subtype, o.subtype, true) 1005 && compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) 1006 && compareDeep(operator, o.operator, true) && compareDeep(view, o.view, true) 1007 && compareDeep(deviceName, o.deviceName, true) && compareDeep(height, o.height, true) 1008 && compareDeep(width, o.width, true) && compareDeep(frames, o.frames, true) 1009 && compareDeep(duration, o.duration, true) && compareDeep(content, o.content, true); 1010 } 1011 1012 @Override 1013 public boolean equalsShallow(Base other) { 1014 if (!super.equalsShallow(other)) 1015 return false; 1016 if (!(other instanceof Media)) 1017 return false; 1018 Media o = (Media) other; 1019 return compareValues(type, o.type, true) && compareValues(deviceName, o.deviceName, true) 1020 && compareValues(height, o.height, true) && compareValues(width, o.width, true) 1021 && compareValues(frames, o.frames, true) && compareValues(duration, o.duration, true); 1022 } 1023 1024 public boolean isEmpty() { 1025 return super.isEmpty() && (type == null || type.isEmpty()) && (subtype == null || subtype.isEmpty()) 1026 && (identifier == null || identifier.isEmpty()) && (subject == null || subject.isEmpty()) 1027 && (operator == null || operator.isEmpty()) && (view == null || view.isEmpty()) 1028 && (deviceName == null || deviceName.isEmpty()) && (height == null || height.isEmpty()) 1029 && (width == null || width.isEmpty()) && (frames == null || frames.isEmpty()) 1030 && (duration == null || duration.isEmpty()) && (content == null || content.isEmpty()); 1031 } 1032 1033 @Override 1034 public ResourceType getResourceType() { 1035 return ResourceType.Media; 1036 } 1037 1038 @SearchParamDefinition(name = "identifier", path = "Media.identifier", description = "Identifier(s) for the image", type = "token") 1039 public static final String SP_IDENTIFIER = "identifier"; 1040 @SearchParamDefinition(name = "view", path = "Media.view", description = "Imaging view, e.g. Lateral or Antero-posterior", type = "token") 1041 public static final String SP_VIEW = "view"; 1042 @SearchParamDefinition(name = "subtype", path = "Media.subtype", description = "The type of acquisition equipment/process", type = "token") 1043 public static final String SP_SUBTYPE = "subtype"; 1044 @SearchParamDefinition(name = "created", path = "Media.content.creation", description = "Date attachment was first created", type = "date") 1045 public static final String SP_CREATED = "created"; 1046 @SearchParamDefinition(name = "subject", path = "Media.subject", description = "Who/What this Media is a record of", type = "reference") 1047 public static final String SP_SUBJECT = "subject"; 1048 @SearchParamDefinition(name = "patient", path = "Media.subject", description = "Who/What this Media is a record of", type = "reference") 1049 public static final String SP_PATIENT = "patient"; 1050 @SearchParamDefinition(name = "type", path = "Media.type", description = "photo | video | audio", type = "token") 1051 public static final String SP_TYPE = "type"; 1052 @SearchParamDefinition(name = "operator", path = "Media.operator", description = "The person who generated the image", type = "reference") 1053 public static final String SP_OPERATOR = "operator"; 1054 1055}