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