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