001package org.hl7.fhir.dstu3.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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045import org.hl7.fhir.exceptions.FHIRFormatError; 046/** 047 * A collection of error, warning or information messages that result from a system action. 048 */ 049@ResourceDef(name="OperationOutcome", profile="http://hl7.org/fhir/StructureDefinition/OperationOutcome") 050public class OperationOutcome extends DomainResource implements IBaseOperationOutcome { 051 052 public enum IssueSeverity { 053 /** 054 * The issue caused the action to fail, and no further checking could be performed. 055 */ 056 FATAL, 057 /** 058 * The issue is sufficiently important to cause the action to fail. 059 */ 060 ERROR, 061 /** 062 * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired. 063 */ 064 WARNING, 065 /** 066 * The issue has no relation to the degree of success of the action. 067 */ 068 INFORMATION, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 public static IssueSeverity fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("fatal".equals(codeString)) 077 return FATAL; 078 if ("error".equals(codeString)) 079 return ERROR; 080 if ("warning".equals(codeString)) 081 return WARNING; 082 if ("information".equals(codeString)) 083 return INFORMATION; 084 if (Configuration.isAcceptInvalidEnums()) 085 return null; 086 else 087 throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'"); 088 } 089 public String toCode() { 090 switch (this) { 091 case FATAL: return "fatal"; 092 case ERROR: return "error"; 093 case WARNING: return "warning"; 094 case INFORMATION: return "information"; 095 default: return "?"; 096 } 097 } 098 public String getSystem() { 099 switch (this) { 100 case FATAL: return "http://hl7.org/fhir/issue-severity"; 101 case ERROR: return "http://hl7.org/fhir/issue-severity"; 102 case WARNING: return "http://hl7.org/fhir/issue-severity"; 103 case INFORMATION: return "http://hl7.org/fhir/issue-severity"; 104 default: return "?"; 105 } 106 } 107 public String getDefinition() { 108 switch (this) { 109 case FATAL: return "The issue caused the action to fail, and no further checking could be performed."; 110 case ERROR: return "The issue is sufficiently important to cause the action to fail."; 111 case WARNING: return "The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired."; 112 case INFORMATION: return "The issue has no relation to the degree of success of the action."; 113 default: return "?"; 114 } 115 } 116 public String getDisplay() { 117 switch (this) { 118 case FATAL: return "Fatal"; 119 case ERROR: return "Error"; 120 case WARNING: return "Warning"; 121 case INFORMATION: return "Information"; 122 default: return "?"; 123 } 124 } 125 } 126 127 public static class IssueSeverityEnumFactory implements EnumFactory<IssueSeverity> { 128 public IssueSeverity fromCode(String codeString) throws IllegalArgumentException { 129 if (codeString == null || "".equals(codeString)) 130 if (codeString == null || "".equals(codeString)) 131 return null; 132 if ("fatal".equals(codeString)) 133 return IssueSeverity.FATAL; 134 if ("error".equals(codeString)) 135 return IssueSeverity.ERROR; 136 if ("warning".equals(codeString)) 137 return IssueSeverity.WARNING; 138 if ("information".equals(codeString)) 139 return IssueSeverity.INFORMATION; 140 throw new IllegalArgumentException("Unknown IssueSeverity code '"+codeString+"'"); 141 } 142 public Enumeration<IssueSeverity> fromType(Base code) throws FHIRException { 143 if (code == null) 144 return null; 145 if (code.isEmpty()) 146 return new Enumeration<IssueSeverity>(this); 147 String codeString = ((PrimitiveType) code).asStringValue(); 148 if (codeString == null || "".equals(codeString)) 149 return null; 150 if ("fatal".equals(codeString)) 151 return new Enumeration<IssueSeverity>(this, IssueSeverity.FATAL); 152 if ("error".equals(codeString)) 153 return new Enumeration<IssueSeverity>(this, IssueSeverity.ERROR); 154 if ("warning".equals(codeString)) 155 return new Enumeration<IssueSeverity>(this, IssueSeverity.WARNING); 156 if ("information".equals(codeString)) 157 return new Enumeration<IssueSeverity>(this, IssueSeverity.INFORMATION); 158 throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'"); 159 } 160 public String toCode(IssueSeverity code) { 161 if (code == IssueSeverity.FATAL) 162 return "fatal"; 163 if (code == IssueSeverity.ERROR) 164 return "error"; 165 if (code == IssueSeverity.WARNING) 166 return "warning"; 167 if (code == IssueSeverity.INFORMATION) 168 return "information"; 169 return "?"; 170 } 171 public String toSystem(IssueSeverity code) { 172 return code.getSystem(); 173 } 174 } 175 176 public enum IssueType { 177 /** 178 * Content invalid against the specification or a profile. 179 */ 180 INVALID, 181 /** 182 * A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax. 183 */ 184 STRUCTURE, 185 /** 186 * A required element is missing. 187 */ 188 REQUIRED, 189 /** 190 * An element value is invalid. 191 */ 192 VALUE, 193 /** 194 * A content validation rule failed - e.g. a schematron rule. 195 */ 196 INVARIANT, 197 /** 198 * An authentication/authorization/permissions issue of some kind. 199 */ 200 SECURITY, 201 /** 202 * The client needs to initiate an authentication process. 203 */ 204 LOGIN, 205 /** 206 * The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable). 207 */ 208 UNKNOWN, 209 /** 210 * User session expired; a login may be required. 211 */ 212 EXPIRED, 213 /** 214 * The user does not have the rights to perform this action. 215 */ 216 FORBIDDEN, 217 /** 218 * Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes. 219 */ 220 SUPPRESSED, 221 /** 222 * Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged. 223 */ 224 PROCESSING, 225 /** 226 * The resource or profile is not supported. 227 */ 228 NOTSUPPORTED, 229 /** 230 * An attempt was made to create a duplicate record. 231 */ 232 DUPLICATE, 233 /** 234 * The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture. 235 */ 236 NOTFOUND, 237 /** 238 * Provided content is too long (typically, this is a denial of service protection type of error). 239 */ 240 TOOLONG, 241 /** 242 * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code. 243 */ 244 CODEINVALID, 245 /** 246 * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized. 247 */ 248 EXTENSION, 249 /** 250 * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT. 251 */ 252 TOOCOSTLY, 253 /** 254 * The content/operation failed to pass some business rule, and so could not proceed. 255 */ 256 BUSINESSRULE, 257 /** 258 * Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.) 259 */ 260 CONFLICT, 261 /** 262 * Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete. 263 */ 264 INCOMPLETE, 265 /** 266 * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved. 267 */ 268 TRANSIENT, 269 /** 270 * A resource/record locking failure (usually in an underlying database). 271 */ 272 LOCKERROR, 273 /** 274 * The persistent store is unavailable; e.g. the database is down for maintenance or similar action. 275 */ 276 NOSTORE, 277 /** 278 * An unexpected internal error has occurred. 279 */ 280 EXCEPTION, 281 /** 282 * An internal timeout has occurred. 283 */ 284 TIMEOUT, 285 /** 286 * The system is not prepared to handle this request due to load management. 287 */ 288 THROTTLED, 289 /** 290 * A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.). 291 */ 292 INFORMATIONAL, 293 /** 294 * added to help the parsers with the generic types 295 */ 296 NULL; 297 public static IssueType fromCode(String codeString) throws FHIRException { 298 if (codeString == null || "".equals(codeString)) 299 return null; 300 if ("invalid".equals(codeString)) 301 return INVALID; 302 if ("structure".equals(codeString)) 303 return STRUCTURE; 304 if ("required".equals(codeString)) 305 return REQUIRED; 306 if ("value".equals(codeString)) 307 return VALUE; 308 if ("invariant".equals(codeString)) 309 return INVARIANT; 310 if ("security".equals(codeString)) 311 return SECURITY; 312 if ("login".equals(codeString)) 313 return LOGIN; 314 if ("unknown".equals(codeString)) 315 return UNKNOWN; 316 if ("expired".equals(codeString)) 317 return EXPIRED; 318 if ("forbidden".equals(codeString)) 319 return FORBIDDEN; 320 if ("suppressed".equals(codeString)) 321 return SUPPRESSED; 322 if ("processing".equals(codeString)) 323 return PROCESSING; 324 if ("not-supported".equals(codeString)) 325 return NOTSUPPORTED; 326 if ("duplicate".equals(codeString)) 327 return DUPLICATE; 328 if ("not-found".equals(codeString)) 329 return NOTFOUND; 330 if ("too-long".equals(codeString)) 331 return TOOLONG; 332 if ("code-invalid".equals(codeString)) 333 return CODEINVALID; 334 if ("extension".equals(codeString)) 335 return EXTENSION; 336 if ("too-costly".equals(codeString)) 337 return TOOCOSTLY; 338 if ("business-rule".equals(codeString)) 339 return BUSINESSRULE; 340 if ("conflict".equals(codeString)) 341 return CONFLICT; 342 if ("incomplete".equals(codeString)) 343 return INCOMPLETE; 344 if ("transient".equals(codeString)) 345 return TRANSIENT; 346 if ("lock-error".equals(codeString)) 347 return LOCKERROR; 348 if ("no-store".equals(codeString)) 349 return NOSTORE; 350 if ("exception".equals(codeString)) 351 return EXCEPTION; 352 if ("timeout".equals(codeString)) 353 return TIMEOUT; 354 if ("throttled".equals(codeString)) 355 return THROTTLED; 356 if ("informational".equals(codeString)) 357 return INFORMATIONAL; 358 if (Configuration.isAcceptInvalidEnums()) 359 return null; 360 else 361 throw new FHIRException("Unknown IssueType code '"+codeString+"'"); 362 } 363 public String toCode() { 364 switch (this) { 365 case INVALID: return "invalid"; 366 case STRUCTURE: return "structure"; 367 case REQUIRED: return "required"; 368 case VALUE: return "value"; 369 case INVARIANT: return "invariant"; 370 case SECURITY: return "security"; 371 case LOGIN: return "login"; 372 case UNKNOWN: return "unknown"; 373 case EXPIRED: return "expired"; 374 case FORBIDDEN: return "forbidden"; 375 case SUPPRESSED: return "suppressed"; 376 case PROCESSING: return "processing"; 377 case NOTSUPPORTED: return "not-supported"; 378 case DUPLICATE: return "duplicate"; 379 case NOTFOUND: return "not-found"; 380 case TOOLONG: return "too-long"; 381 case CODEINVALID: return "code-invalid"; 382 case EXTENSION: return "extension"; 383 case TOOCOSTLY: return "too-costly"; 384 case BUSINESSRULE: return "business-rule"; 385 case CONFLICT: return "conflict"; 386 case INCOMPLETE: return "incomplete"; 387 case TRANSIENT: return "transient"; 388 case LOCKERROR: return "lock-error"; 389 case NOSTORE: return "no-store"; 390 case EXCEPTION: return "exception"; 391 case TIMEOUT: return "timeout"; 392 case THROTTLED: return "throttled"; 393 case INFORMATIONAL: return "informational"; 394 default: return "?"; 395 } 396 } 397 public String getSystem() { 398 switch (this) { 399 case INVALID: return "http://hl7.org/fhir/issue-type"; 400 case STRUCTURE: return "http://hl7.org/fhir/issue-type"; 401 case REQUIRED: return "http://hl7.org/fhir/issue-type"; 402 case VALUE: return "http://hl7.org/fhir/issue-type"; 403 case INVARIANT: return "http://hl7.org/fhir/issue-type"; 404 case SECURITY: return "http://hl7.org/fhir/issue-type"; 405 case LOGIN: return "http://hl7.org/fhir/issue-type"; 406 case UNKNOWN: return "http://hl7.org/fhir/issue-type"; 407 case EXPIRED: return "http://hl7.org/fhir/issue-type"; 408 case FORBIDDEN: return "http://hl7.org/fhir/issue-type"; 409 case SUPPRESSED: return "http://hl7.org/fhir/issue-type"; 410 case PROCESSING: return "http://hl7.org/fhir/issue-type"; 411 case NOTSUPPORTED: return "http://hl7.org/fhir/issue-type"; 412 case DUPLICATE: return "http://hl7.org/fhir/issue-type"; 413 case NOTFOUND: return "http://hl7.org/fhir/issue-type"; 414 case TOOLONG: return "http://hl7.org/fhir/issue-type"; 415 case CODEINVALID: return "http://hl7.org/fhir/issue-type"; 416 case EXTENSION: return "http://hl7.org/fhir/issue-type"; 417 case TOOCOSTLY: return "http://hl7.org/fhir/issue-type"; 418 case BUSINESSRULE: return "http://hl7.org/fhir/issue-type"; 419 case CONFLICT: return "http://hl7.org/fhir/issue-type"; 420 case INCOMPLETE: return "http://hl7.org/fhir/issue-type"; 421 case TRANSIENT: return "http://hl7.org/fhir/issue-type"; 422 case LOCKERROR: return "http://hl7.org/fhir/issue-type"; 423 case NOSTORE: return "http://hl7.org/fhir/issue-type"; 424 case EXCEPTION: return "http://hl7.org/fhir/issue-type"; 425 case TIMEOUT: return "http://hl7.org/fhir/issue-type"; 426 case THROTTLED: return "http://hl7.org/fhir/issue-type"; 427 case INFORMATIONAL: return "http://hl7.org/fhir/issue-type"; 428 default: return "?"; 429 } 430 } 431 public String getDefinition() { 432 switch (this) { 433 case INVALID: return "Content invalid against the specification or a profile."; 434 case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax."; 435 case REQUIRED: return "A required element is missing."; 436 case VALUE: return "An element value is invalid."; 437 case INVARIANT: return "A content validation rule failed - e.g. a schematron rule."; 438 case SECURITY: return "An authentication/authorization/permissions issue of some kind."; 439 case LOGIN: return "The client needs to initiate an authentication process."; 440 case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable)."; 441 case EXPIRED: return "User session expired; a login may be required."; 442 case FORBIDDEN: return "The user does not have the rights to perform this action."; 443 case SUPPRESSED: return "Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes."; 444 case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged."; 445 case NOTSUPPORTED: return "The resource or profile is not supported."; 446 case DUPLICATE: return "An attempt was made to create a duplicate record."; 447 case NOTFOUND: return "The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture."; 448 case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error)."; 449 case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code."; 450 case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized."; 451 case TOOCOSTLY: return "The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT."; 452 case BUSINESSRULE: return "The content/operation failed to pass some business rule, and so could not proceed."; 453 case CONFLICT: return "Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)"; 454 case INCOMPLETE: return "Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete."; 455 case TRANSIENT: return "Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved."; 456 case LOCKERROR: return "A resource/record locking failure (usually in an underlying database)."; 457 case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action."; 458 case EXCEPTION: return "An unexpected internal error has occurred."; 459 case TIMEOUT: return "An internal timeout has occurred."; 460 case THROTTLED: return "The system is not prepared to handle this request due to load management."; 461 case INFORMATIONAL: return "A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.)."; 462 default: return "?"; 463 } 464 } 465 public String getDisplay() { 466 switch (this) { 467 case INVALID: return "Invalid Content"; 468 case STRUCTURE: return "Structural Issue"; 469 case REQUIRED: return "Required element missing"; 470 case VALUE: return "Element value invalid"; 471 case INVARIANT: return "Validation rule failed"; 472 case SECURITY: return "Security Problem"; 473 case LOGIN: return "Login Required"; 474 case UNKNOWN: return "Unknown User"; 475 case EXPIRED: return "Session Expired"; 476 case FORBIDDEN: return "Forbidden"; 477 case SUPPRESSED: return "Information Suppressed"; 478 case PROCESSING: return "Processing Failure"; 479 case NOTSUPPORTED: return "Content not supported"; 480 case DUPLICATE: return "Duplicate"; 481 case NOTFOUND: return "Not Found"; 482 case TOOLONG: return "Content Too Long"; 483 case CODEINVALID: return "Invalid Code"; 484 case EXTENSION: return "Unacceptable Extension"; 485 case TOOCOSTLY: return "Operation Too Costly"; 486 case BUSINESSRULE: return "Business Rule Violation"; 487 case CONFLICT: return "Edit Version Conflict"; 488 case INCOMPLETE: return "Incomplete Results"; 489 case TRANSIENT: return "Transient Issue"; 490 case LOCKERROR: return "Lock Error"; 491 case NOSTORE: return "No Store Available"; 492 case EXCEPTION: return "Exception"; 493 case TIMEOUT: return "Timeout"; 494 case THROTTLED: return "Throttled"; 495 case INFORMATIONAL: return "Informational Note"; 496 default: return "?"; 497 } 498 } 499 } 500 501 public static class IssueTypeEnumFactory implements EnumFactory<IssueType> { 502 public IssueType fromCode(String codeString) throws IllegalArgumentException { 503 if (codeString == null || "".equals(codeString)) 504 if (codeString == null || "".equals(codeString)) 505 return null; 506 if ("invalid".equals(codeString)) 507 return IssueType.INVALID; 508 if ("structure".equals(codeString)) 509 return IssueType.STRUCTURE; 510 if ("required".equals(codeString)) 511 return IssueType.REQUIRED; 512 if ("value".equals(codeString)) 513 return IssueType.VALUE; 514 if ("invariant".equals(codeString)) 515 return IssueType.INVARIANT; 516 if ("security".equals(codeString)) 517 return IssueType.SECURITY; 518 if ("login".equals(codeString)) 519 return IssueType.LOGIN; 520 if ("unknown".equals(codeString)) 521 return IssueType.UNKNOWN; 522 if ("expired".equals(codeString)) 523 return IssueType.EXPIRED; 524 if ("forbidden".equals(codeString)) 525 return IssueType.FORBIDDEN; 526 if ("suppressed".equals(codeString)) 527 return IssueType.SUPPRESSED; 528 if ("processing".equals(codeString)) 529 return IssueType.PROCESSING; 530 if ("not-supported".equals(codeString)) 531 return IssueType.NOTSUPPORTED; 532 if ("duplicate".equals(codeString)) 533 return IssueType.DUPLICATE; 534 if ("not-found".equals(codeString)) 535 return IssueType.NOTFOUND; 536 if ("too-long".equals(codeString)) 537 return IssueType.TOOLONG; 538 if ("code-invalid".equals(codeString)) 539 return IssueType.CODEINVALID; 540 if ("extension".equals(codeString)) 541 return IssueType.EXTENSION; 542 if ("too-costly".equals(codeString)) 543 return IssueType.TOOCOSTLY; 544 if ("business-rule".equals(codeString)) 545 return IssueType.BUSINESSRULE; 546 if ("conflict".equals(codeString)) 547 return IssueType.CONFLICT; 548 if ("incomplete".equals(codeString)) 549 return IssueType.INCOMPLETE; 550 if ("transient".equals(codeString)) 551 return IssueType.TRANSIENT; 552 if ("lock-error".equals(codeString)) 553 return IssueType.LOCKERROR; 554 if ("no-store".equals(codeString)) 555 return IssueType.NOSTORE; 556 if ("exception".equals(codeString)) 557 return IssueType.EXCEPTION; 558 if ("timeout".equals(codeString)) 559 return IssueType.TIMEOUT; 560 if ("throttled".equals(codeString)) 561 return IssueType.THROTTLED; 562 if ("informational".equals(codeString)) 563 return IssueType.INFORMATIONAL; 564 throw new IllegalArgumentException("Unknown IssueType code '"+codeString+"'"); 565 } 566 public Enumeration<IssueType> fromType(Base code) throws FHIRException { 567 if (code == null) 568 return null; 569 if (code.isEmpty()) 570 return new Enumeration<IssueType>(this); 571 String codeString = ((PrimitiveType) code).asStringValue(); 572 if (codeString == null || "".equals(codeString)) 573 return null; 574 if ("invalid".equals(codeString)) 575 return new Enumeration<IssueType>(this, IssueType.INVALID); 576 if ("structure".equals(codeString)) 577 return new Enumeration<IssueType>(this, IssueType.STRUCTURE); 578 if ("required".equals(codeString)) 579 return new Enumeration<IssueType>(this, IssueType.REQUIRED); 580 if ("value".equals(codeString)) 581 return new Enumeration<IssueType>(this, IssueType.VALUE); 582 if ("invariant".equals(codeString)) 583 return new Enumeration<IssueType>(this, IssueType.INVARIANT); 584 if ("security".equals(codeString)) 585 return new Enumeration<IssueType>(this, IssueType.SECURITY); 586 if ("login".equals(codeString)) 587 return new Enumeration<IssueType>(this, IssueType.LOGIN); 588 if ("unknown".equals(codeString)) 589 return new Enumeration<IssueType>(this, IssueType.UNKNOWN); 590 if ("expired".equals(codeString)) 591 return new Enumeration<IssueType>(this, IssueType.EXPIRED); 592 if ("forbidden".equals(codeString)) 593 return new Enumeration<IssueType>(this, IssueType.FORBIDDEN); 594 if ("suppressed".equals(codeString)) 595 return new Enumeration<IssueType>(this, IssueType.SUPPRESSED); 596 if ("processing".equals(codeString)) 597 return new Enumeration<IssueType>(this, IssueType.PROCESSING); 598 if ("not-supported".equals(codeString)) 599 return new Enumeration<IssueType>(this, IssueType.NOTSUPPORTED); 600 if ("duplicate".equals(codeString)) 601 return new Enumeration<IssueType>(this, IssueType.DUPLICATE); 602 if ("not-found".equals(codeString)) 603 return new Enumeration<IssueType>(this, IssueType.NOTFOUND); 604 if ("too-long".equals(codeString)) 605 return new Enumeration<IssueType>(this, IssueType.TOOLONG); 606 if ("code-invalid".equals(codeString)) 607 return new Enumeration<IssueType>(this, IssueType.CODEINVALID); 608 if ("extension".equals(codeString)) 609 return new Enumeration<IssueType>(this, IssueType.EXTENSION); 610 if ("too-costly".equals(codeString)) 611 return new Enumeration<IssueType>(this, IssueType.TOOCOSTLY); 612 if ("business-rule".equals(codeString)) 613 return new Enumeration<IssueType>(this, IssueType.BUSINESSRULE); 614 if ("conflict".equals(codeString)) 615 return new Enumeration<IssueType>(this, IssueType.CONFLICT); 616 if ("incomplete".equals(codeString)) 617 return new Enumeration<IssueType>(this, IssueType.INCOMPLETE); 618 if ("transient".equals(codeString)) 619 return new Enumeration<IssueType>(this, IssueType.TRANSIENT); 620 if ("lock-error".equals(codeString)) 621 return new Enumeration<IssueType>(this, IssueType.LOCKERROR); 622 if ("no-store".equals(codeString)) 623 return new Enumeration<IssueType>(this, IssueType.NOSTORE); 624 if ("exception".equals(codeString)) 625 return new Enumeration<IssueType>(this, IssueType.EXCEPTION); 626 if ("timeout".equals(codeString)) 627 return new Enumeration<IssueType>(this, IssueType.TIMEOUT); 628 if ("throttled".equals(codeString)) 629 return new Enumeration<IssueType>(this, IssueType.THROTTLED); 630 if ("informational".equals(codeString)) 631 return new Enumeration<IssueType>(this, IssueType.INFORMATIONAL); 632 throw new FHIRException("Unknown IssueType code '"+codeString+"'"); 633 } 634 public String toCode(IssueType code) { 635 if (code == IssueType.INVALID) 636 return "invalid"; 637 if (code == IssueType.STRUCTURE) 638 return "structure"; 639 if (code == IssueType.REQUIRED) 640 return "required"; 641 if (code == IssueType.VALUE) 642 return "value"; 643 if (code == IssueType.INVARIANT) 644 return "invariant"; 645 if (code == IssueType.SECURITY) 646 return "security"; 647 if (code == IssueType.LOGIN) 648 return "login"; 649 if (code == IssueType.UNKNOWN) 650 return "unknown"; 651 if (code == IssueType.EXPIRED) 652 return "expired"; 653 if (code == IssueType.FORBIDDEN) 654 return "forbidden"; 655 if (code == IssueType.SUPPRESSED) 656 return "suppressed"; 657 if (code == IssueType.PROCESSING) 658 return "processing"; 659 if (code == IssueType.NOTSUPPORTED) 660 return "not-supported"; 661 if (code == IssueType.DUPLICATE) 662 return "duplicate"; 663 if (code == IssueType.NOTFOUND) 664 return "not-found"; 665 if (code == IssueType.TOOLONG) 666 return "too-long"; 667 if (code == IssueType.CODEINVALID) 668 return "code-invalid"; 669 if (code == IssueType.EXTENSION) 670 return "extension"; 671 if (code == IssueType.TOOCOSTLY) 672 return "too-costly"; 673 if (code == IssueType.BUSINESSRULE) 674 return "business-rule"; 675 if (code == IssueType.CONFLICT) 676 return "conflict"; 677 if (code == IssueType.INCOMPLETE) 678 return "incomplete"; 679 if (code == IssueType.TRANSIENT) 680 return "transient"; 681 if (code == IssueType.LOCKERROR) 682 return "lock-error"; 683 if (code == IssueType.NOSTORE) 684 return "no-store"; 685 if (code == IssueType.EXCEPTION) 686 return "exception"; 687 if (code == IssueType.TIMEOUT) 688 return "timeout"; 689 if (code == IssueType.THROTTLED) 690 return "throttled"; 691 if (code == IssueType.INFORMATIONAL) 692 return "informational"; 693 return "?"; 694 } 695 public String toSystem(IssueType code) { 696 return code.getSystem(); 697 } 698 } 699 700 @Block() 701 public static class OperationOutcomeIssueComponent extends BackboneElement implements IBaseBackboneElement { 702 /** 703 * Indicates whether the issue indicates a variation from successful processing. 704 */ 705 @Child(name = "severity", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 706 @Description(shortDefinition="fatal | error | warning | information", formalDefinition="Indicates whether the issue indicates a variation from successful processing." ) 707 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-severity") 708 protected Enumeration<IssueSeverity> severity; 709 710 /** 711 * Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element. 712 */ 713 @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true) 714 @Description(shortDefinition="Error or warning code", formalDefinition="Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element." ) 715 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-type") 716 protected Enumeration<IssueType> code; 717 718 /** 719 * Additional details about the error. This may be a text description of the error, or a system code that identifies the error. 720 */ 721 @Child(name = "details", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 722 @Description(shortDefinition="Additional details about the error", formalDefinition="Additional details about the error. This may be a text description of the error, or a system code that identifies the error." ) 723 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/operation-outcome") 724 protected CodeableConcept details; 725 726 /** 727 * Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue. 728 */ 729 @Child(name = "diagnostics", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 730 @Description(shortDefinition="Additional diagnostic information about the issue", formalDefinition="Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue." ) 731 protected StringType diagnostics; 732 733 /** 734 * For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be "http." + the parameter name. 735 */ 736 @Child(name = "location", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 737 @Description(shortDefinition="Path of element(s) related to issue", formalDefinition="For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be \"http.\" + the parameter name." ) 738 protected List<StringType> location; 739 740 /** 741 * A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. 742 */ 743 @Child(name = "expression", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 744 @Description(shortDefinition="FHIRPath of element(s) related to issue", formalDefinition="A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised." ) 745 protected List<StringType> expression; 746 747 private static final long serialVersionUID = -1681095438L; 748 749 /** 750 * Constructor 751 */ 752 public OperationOutcomeIssueComponent() { 753 super(); 754 } 755 756 /** 757 * Constructor 758 */ 759 public OperationOutcomeIssueComponent(Enumeration<IssueSeverity> severity, Enumeration<IssueType> code) { 760 super(); 761 this.severity = severity; 762 this.code = code; 763 } 764 765 /** 766 * @return {@link #severity} (Indicates whether the issue indicates a variation from successful processing.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value 767 */ 768 public Enumeration<IssueSeverity> getSeverityElement() { 769 if (this.severity == null) 770 if (Configuration.errorOnAutoCreate()) 771 throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.severity"); 772 else if (Configuration.doAutoCreate()) 773 this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory()); // bb 774 return this.severity; 775 } 776 777 public boolean hasSeverityElement() { 778 return this.severity != null && !this.severity.isEmpty(); 779 } 780 781 public boolean hasSeverity() { 782 return this.severity != null && !this.severity.isEmpty(); 783 } 784 785 /** 786 * @param value {@link #severity} (Indicates whether the issue indicates a variation from successful processing.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value 787 */ 788 public OperationOutcomeIssueComponent setSeverityElement(Enumeration<IssueSeverity> value) { 789 this.severity = value; 790 return this; 791 } 792 793 /** 794 * @return Indicates whether the issue indicates a variation from successful processing. 795 */ 796 public IssueSeverity getSeverity() { 797 return this.severity == null ? null : this.severity.getValue(); 798 } 799 800 /** 801 * @param value Indicates whether the issue indicates a variation from successful processing. 802 */ 803 public OperationOutcomeIssueComponent setSeverity(IssueSeverity value) { 804 if (this.severity == null) 805 this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory()); 806 this.severity.setValue(value); 807 return this; 808 } 809 810 /** 811 * @return {@link #code} (Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 812 */ 813 public Enumeration<IssueType> getCodeElement() { 814 if (this.code == null) 815 if (Configuration.errorOnAutoCreate()) 816 throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.code"); 817 else if (Configuration.doAutoCreate()) 818 this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory()); // bb 819 return this.code; 820 } 821 822 public boolean hasCodeElement() { 823 return this.code != null && !this.code.isEmpty(); 824 } 825 826 public boolean hasCode() { 827 return this.code != null && !this.code.isEmpty(); 828 } 829 830 /** 831 * @param value {@link #code} (Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 832 */ 833 public OperationOutcomeIssueComponent setCodeElement(Enumeration<IssueType> value) { 834 this.code = value; 835 return this; 836 } 837 838 /** 839 * @return Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element. 840 */ 841 public IssueType getCode() { 842 return this.code == null ? null : this.code.getValue(); 843 } 844 845 /** 846 * @param value Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element. 847 */ 848 public OperationOutcomeIssueComponent setCode(IssueType value) { 849 if (this.code == null) 850 this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory()); 851 this.code.setValue(value); 852 return this; 853 } 854 855 /** 856 * @return {@link #details} (Additional details about the error. This may be a text description of the error, or a system code that identifies the error.) 857 */ 858 public CodeableConcept getDetails() { 859 if (this.details == null) 860 if (Configuration.errorOnAutoCreate()) 861 throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.details"); 862 else if (Configuration.doAutoCreate()) 863 this.details = new CodeableConcept(); // cc 864 return this.details; 865 } 866 867 public boolean hasDetails() { 868 return this.details != null && !this.details.isEmpty(); 869 } 870 871 /** 872 * @param value {@link #details} (Additional details about the error. This may be a text description of the error, or a system code that identifies the error.) 873 */ 874 public OperationOutcomeIssueComponent setDetails(CodeableConcept value) { 875 this.details = value; 876 return this; 877 } 878 879 /** 880 * @return {@link #diagnostics} (Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.). This is the underlying object with id, value and extensions. The accessor "getDiagnostics" gives direct access to the value 881 */ 882 public StringType getDiagnosticsElement() { 883 if (this.diagnostics == null) 884 if (Configuration.errorOnAutoCreate()) 885 throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.diagnostics"); 886 else if (Configuration.doAutoCreate()) 887 this.diagnostics = new StringType(); // bb 888 return this.diagnostics; 889 } 890 891 public boolean hasDiagnosticsElement() { 892 return this.diagnostics != null && !this.diagnostics.isEmpty(); 893 } 894 895 public boolean hasDiagnostics() { 896 return this.diagnostics != null && !this.diagnostics.isEmpty(); 897 } 898 899 /** 900 * @param value {@link #diagnostics} (Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.). This is the underlying object with id, value and extensions. The accessor "getDiagnostics" gives direct access to the value 901 */ 902 public OperationOutcomeIssueComponent setDiagnosticsElement(StringType value) { 903 this.diagnostics = value; 904 return this; 905 } 906 907 /** 908 * @return Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue. 909 */ 910 public String getDiagnostics() { 911 return this.diagnostics == null ? null : this.diagnostics.getValue(); 912 } 913 914 /** 915 * @param value Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue. 916 */ 917 public OperationOutcomeIssueComponent setDiagnostics(String value) { 918 if (Utilities.noString(value)) 919 this.diagnostics = null; 920 else { 921 if (this.diagnostics == null) 922 this.diagnostics = new StringType(); 923 this.diagnostics.setValue(value); 924 } 925 return this; 926 } 927 928 /** 929 * @return {@link #location} (For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be "http." + the parameter name.) 930 */ 931 public List<StringType> getLocation() { 932 if (this.location == null) 933 this.location = new ArrayList<StringType>(); 934 return this.location; 935 } 936 937 /** 938 * @return Returns a reference to <code>this</code> for easy method chaining 939 */ 940 public OperationOutcomeIssueComponent setLocation(List<StringType> theLocation) { 941 this.location = theLocation; 942 return this; 943 } 944 945 public boolean hasLocation() { 946 if (this.location == null) 947 return false; 948 for (StringType item : this.location) 949 if (!item.isEmpty()) 950 return true; 951 return false; 952 } 953 954 /** 955 * @return {@link #location} (For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be "http." + the parameter name.) 956 */ 957 public StringType addLocationElement() {//2 958 StringType t = new StringType(); 959 if (this.location == null) 960 this.location = new ArrayList<StringType>(); 961 this.location.add(t); 962 return t; 963 } 964 965 /** 966 * @param value {@link #location} (For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be "http." + the parameter name.) 967 */ 968 public OperationOutcomeIssueComponent addLocation(String value) { //1 969 StringType t = new StringType(); 970 t.setValue(value); 971 if (this.location == null) 972 this.location = new ArrayList<StringType>(); 973 this.location.add(t); 974 return this; 975 } 976 977 /** 978 * @param value {@link #location} (For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be "http." + the parameter name.) 979 */ 980 public boolean hasLocation(String value) { 981 if (this.location == null) 982 return false; 983 for (StringType v : this.location) 984 if (v.getValue().equals(value)) // string 985 return true; 986 return false; 987 } 988 989 /** 990 * @return {@link #expression} (A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.) 991 */ 992 public List<StringType> getExpression() { 993 if (this.expression == null) 994 this.expression = new ArrayList<StringType>(); 995 return this.expression; 996 } 997 998 /** 999 * @return Returns a reference to <code>this</code> for easy method chaining 1000 */ 1001 public OperationOutcomeIssueComponent setExpression(List<StringType> theExpression) { 1002 this.expression = theExpression; 1003 return this; 1004 } 1005 1006 public boolean hasExpression() { 1007 if (this.expression == null) 1008 return false; 1009 for (StringType item : this.expression) 1010 if (!item.isEmpty()) 1011 return true; 1012 return false; 1013 } 1014 1015 /** 1016 * @return {@link #expression} (A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.) 1017 */ 1018 public StringType addExpressionElement() {//2 1019 StringType t = new StringType(); 1020 if (this.expression == null) 1021 this.expression = new ArrayList<StringType>(); 1022 this.expression.add(t); 1023 return t; 1024 } 1025 1026 /** 1027 * @param value {@link #expression} (A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.) 1028 */ 1029 public OperationOutcomeIssueComponent addExpression(String value) { //1 1030 StringType t = new StringType(); 1031 t.setValue(value); 1032 if (this.expression == null) 1033 this.expression = new ArrayList<StringType>(); 1034 this.expression.add(t); 1035 return this; 1036 } 1037 1038 /** 1039 * @param value {@link #expression} (A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.) 1040 */ 1041 public boolean hasExpression(String value) { 1042 if (this.expression == null) 1043 return false; 1044 for (StringType v : this.expression) 1045 if (v.getValue().equals(value)) // string 1046 return true; 1047 return false; 1048 } 1049 1050 protected void listChildren(List<Property> children) { 1051 super.listChildren(children); 1052 children.add(new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity)); 1053 children.add(new Property("code", "code", "Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.", 0, 1, code)); 1054 children.add(new Property("details", "CodeableConcept", "Additional details about the error. This may be a text description of the error, or a system code that identifies the error.", 0, 1, details)); 1055 children.add(new Property("diagnostics", "string", "Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.", 0, 1, diagnostics)); 1056 children.add(new Property("location", "string", "For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be \"http.\" + the parameter name.", 0, java.lang.Integer.MAX_VALUE, location)); 1057 children.add(new Property("expression", "string", "A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.", 0, java.lang.Integer.MAX_VALUE, expression)); 1058 } 1059 1060 @Override 1061 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1062 switch (_hash) { 1063 case 1478300413: /*severity*/ return new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity); 1064 case 3059181: /*code*/ return new Property("code", "code", "Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.", 0, 1, code); 1065 case 1557721666: /*details*/ return new Property("details", "CodeableConcept", "Additional details about the error. This may be a text description of the error, or a system code that identifies the error.", 0, 1, details); 1066 case -740386388: /*diagnostics*/ return new Property("diagnostics", "string", "Additional diagnostic information about the issue. Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.", 0, 1, diagnostics); 1067 case 1901043637: /*location*/ return new Property("location", "string", "For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised. For HTTP errors, will be \"http.\" + the parameter name.", 0, java.lang.Integer.MAX_VALUE, location); 1068 case -1795452264: /*expression*/ return new Property("expression", "string", "A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.", 0, java.lang.Integer.MAX_VALUE, expression); 1069 default: return super.getNamedProperty(_hash, _name, _checkValid); 1070 } 1071 1072 } 1073 1074 @Override 1075 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1076 switch (hash) { 1077 case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<IssueSeverity> 1078 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<IssueType> 1079 case 1557721666: /*details*/ return this.details == null ? new Base[0] : new Base[] {this.details}; // CodeableConcept 1080 case -740386388: /*diagnostics*/ return this.diagnostics == null ? new Base[0] : new Base[] {this.diagnostics}; // StringType 1081 case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // StringType 1082 case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : this.expression.toArray(new Base[this.expression.size()]); // StringType 1083 default: return super.getProperty(hash, name, checkValid); 1084 } 1085 1086 } 1087 1088 @Override 1089 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1090 switch (hash) { 1091 case 1478300413: // severity 1092 value = new IssueSeverityEnumFactory().fromType(castToCode(value)); 1093 this.severity = (Enumeration) value; // Enumeration<IssueSeverity> 1094 return value; 1095 case 3059181: // code 1096 value = new IssueTypeEnumFactory().fromType(castToCode(value)); 1097 this.code = (Enumeration) value; // Enumeration<IssueType> 1098 return value; 1099 case 1557721666: // details 1100 this.details = castToCodeableConcept(value); // CodeableConcept 1101 return value; 1102 case -740386388: // diagnostics 1103 this.diagnostics = castToString(value); // StringType 1104 return value; 1105 case 1901043637: // location 1106 this.getLocation().add(castToString(value)); // StringType 1107 return value; 1108 case -1795452264: // expression 1109 this.getExpression().add(castToString(value)); // StringType 1110 return value; 1111 default: return super.setProperty(hash, name, value); 1112 } 1113 1114 } 1115 1116 @Override 1117 public Base setProperty(String name, Base value) throws FHIRException { 1118 if (name.equals("severity")) { 1119 value = new IssueSeverityEnumFactory().fromType(castToCode(value)); 1120 this.severity = (Enumeration) value; // Enumeration<IssueSeverity> 1121 } else if (name.equals("code")) { 1122 value = new IssueTypeEnumFactory().fromType(castToCode(value)); 1123 this.code = (Enumeration) value; // Enumeration<IssueType> 1124 } else if (name.equals("details")) { 1125 this.details = castToCodeableConcept(value); // CodeableConcept 1126 } else if (name.equals("diagnostics")) { 1127 this.diagnostics = castToString(value); // StringType 1128 } else if (name.equals("location")) { 1129 this.getLocation().add(castToString(value)); 1130 } else if (name.equals("expression")) { 1131 this.getExpression().add(castToString(value)); 1132 } else 1133 return super.setProperty(name, value); 1134 return value; 1135 } 1136 1137 @Override 1138 public Base makeProperty(int hash, String name) throws FHIRException { 1139 switch (hash) { 1140 case 1478300413: return getSeverityElement(); 1141 case 3059181: return getCodeElement(); 1142 case 1557721666: return getDetails(); 1143 case -740386388: return getDiagnosticsElement(); 1144 case 1901043637: return addLocationElement(); 1145 case -1795452264: return addExpressionElement(); 1146 default: return super.makeProperty(hash, name); 1147 } 1148 1149 } 1150 1151 @Override 1152 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1153 switch (hash) { 1154 case 1478300413: /*severity*/ return new String[] {"code"}; 1155 case 3059181: /*code*/ return new String[] {"code"}; 1156 case 1557721666: /*details*/ return new String[] {"CodeableConcept"}; 1157 case -740386388: /*diagnostics*/ return new String[] {"string"}; 1158 case 1901043637: /*location*/ return new String[] {"string"}; 1159 case -1795452264: /*expression*/ return new String[] {"string"}; 1160 default: return super.getTypesForProperty(hash, name); 1161 } 1162 1163 } 1164 1165 @Override 1166 public Base addChild(String name) throws FHIRException { 1167 if (name.equals("severity")) { 1168 throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.severity"); 1169 } 1170 else if (name.equals("code")) { 1171 throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.code"); 1172 } 1173 else if (name.equals("details")) { 1174 this.details = new CodeableConcept(); 1175 return this.details; 1176 } 1177 else if (name.equals("diagnostics")) { 1178 throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.diagnostics"); 1179 } 1180 else if (name.equals("location")) { 1181 throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.location"); 1182 } 1183 else if (name.equals("expression")) { 1184 throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.expression"); 1185 } 1186 else 1187 return super.addChild(name); 1188 } 1189 1190 public OperationOutcomeIssueComponent copy() { 1191 OperationOutcomeIssueComponent dst = new OperationOutcomeIssueComponent(); 1192 copyValues(dst); 1193 dst.severity = severity == null ? null : severity.copy(); 1194 dst.code = code == null ? null : code.copy(); 1195 dst.details = details == null ? null : details.copy(); 1196 dst.diagnostics = diagnostics == null ? null : diagnostics.copy(); 1197 if (location != null) { 1198 dst.location = new ArrayList<StringType>(); 1199 for (StringType i : location) 1200 dst.location.add(i.copy()); 1201 }; 1202 if (expression != null) { 1203 dst.expression = new ArrayList<StringType>(); 1204 for (StringType i : expression) 1205 dst.expression.add(i.copy()); 1206 }; 1207 return dst; 1208 } 1209 1210 @Override 1211 public boolean equalsDeep(Base other_) { 1212 if (!super.equalsDeep(other_)) 1213 return false; 1214 if (!(other_ instanceof OperationOutcomeIssueComponent)) 1215 return false; 1216 OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_; 1217 return compareDeep(severity, o.severity, true) && compareDeep(code, o.code, true) && compareDeep(details, o.details, true) 1218 && compareDeep(diagnostics, o.diagnostics, true) && compareDeep(location, o.location, true) && compareDeep(expression, o.expression, true) 1219 ; 1220 } 1221 1222 @Override 1223 public boolean equalsShallow(Base other_) { 1224 if (!super.equalsShallow(other_)) 1225 return false; 1226 if (!(other_ instanceof OperationOutcomeIssueComponent)) 1227 return false; 1228 OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_; 1229 return compareValues(severity, o.severity, true) && compareValues(code, o.code, true) && compareValues(diagnostics, o.diagnostics, true) 1230 && compareValues(location, o.location, true) && compareValues(expression, o.expression, true); 1231 } 1232 1233 public boolean isEmpty() { 1234 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(severity, code, details 1235 , diagnostics, location, expression); 1236 } 1237 1238 public String fhirType() { 1239 return "OperationOutcome.issue"; 1240 1241 } 1242 1243 } 1244 1245 /** 1246 * An error, warning or information message that results from a system action. 1247 */ 1248 @Child(name = "issue", type = {}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1249 @Description(shortDefinition="A single issue associated with the action", formalDefinition="An error, warning or information message that results from a system action." ) 1250 protected List<OperationOutcomeIssueComponent> issue; 1251 1252 private static final long serialVersionUID = -152150052L; 1253 1254 /** 1255 * Constructor 1256 */ 1257 public OperationOutcome() { 1258 super(); 1259 } 1260 1261 /** 1262 * @return {@link #issue} (An error, warning or information message that results from a system action.) 1263 */ 1264 public List<OperationOutcomeIssueComponent> getIssue() { 1265 if (this.issue == null) 1266 this.issue = new ArrayList<OperationOutcomeIssueComponent>(); 1267 return this.issue; 1268 } 1269 1270 /** 1271 * @return Returns a reference to <code>this</code> for easy method chaining 1272 */ 1273 public OperationOutcome setIssue(List<OperationOutcomeIssueComponent> theIssue) { 1274 this.issue = theIssue; 1275 return this; 1276 } 1277 1278 public boolean hasIssue() { 1279 if (this.issue == null) 1280 return false; 1281 for (OperationOutcomeIssueComponent item : this.issue) 1282 if (!item.isEmpty()) 1283 return true; 1284 return false; 1285 } 1286 1287 public OperationOutcomeIssueComponent addIssue() { //3 1288 OperationOutcomeIssueComponent t = new OperationOutcomeIssueComponent(); 1289 if (this.issue == null) 1290 this.issue = new ArrayList<OperationOutcomeIssueComponent>(); 1291 this.issue.add(t); 1292 return t; 1293 } 1294 1295 public OperationOutcome addIssue(OperationOutcomeIssueComponent t) { //3 1296 if (t == null) 1297 return this; 1298 if (this.issue == null) 1299 this.issue = new ArrayList<OperationOutcomeIssueComponent>(); 1300 this.issue.add(t); 1301 return this; 1302 } 1303 1304 /** 1305 * @return The first repetition of repeating field {@link #issue}, creating it if it does not already exist 1306 */ 1307 public OperationOutcomeIssueComponent getIssueFirstRep() { 1308 if (getIssue().isEmpty()) { 1309 addIssue(); 1310 } 1311 return getIssue().get(0); 1312 } 1313 1314 protected void listChildren(List<Property> children) { 1315 super.listChildren(children); 1316 children.add(new Property("issue", "", "An error, warning or information message that results from a system action.", 0, java.lang.Integer.MAX_VALUE, issue)); 1317 } 1318 1319 @Override 1320 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1321 switch (_hash) { 1322 case 100509913: /*issue*/ return new Property("issue", "", "An error, warning or information message that results from a system action.", 0, java.lang.Integer.MAX_VALUE, issue); 1323 default: return super.getNamedProperty(_hash, _name, _checkValid); 1324 } 1325 1326 } 1327 1328 @Override 1329 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1330 switch (hash) { 1331 case 100509913: /*issue*/ return this.issue == null ? new Base[0] : this.issue.toArray(new Base[this.issue.size()]); // OperationOutcomeIssueComponent 1332 default: return super.getProperty(hash, name, checkValid); 1333 } 1334 1335 } 1336 1337 @Override 1338 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1339 switch (hash) { 1340 case 100509913: // issue 1341 this.getIssue().add((OperationOutcomeIssueComponent) value); // OperationOutcomeIssueComponent 1342 return value; 1343 default: return super.setProperty(hash, name, value); 1344 } 1345 1346 } 1347 1348 @Override 1349 public Base setProperty(String name, Base value) throws FHIRException { 1350 if (name.equals("issue")) { 1351 this.getIssue().add((OperationOutcomeIssueComponent) value); 1352 } else 1353 return super.setProperty(name, value); 1354 return value; 1355 } 1356 1357 @Override 1358 public Base makeProperty(int hash, String name) throws FHIRException { 1359 switch (hash) { 1360 case 100509913: return addIssue(); 1361 default: return super.makeProperty(hash, name); 1362 } 1363 1364 } 1365 1366 @Override 1367 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1368 switch (hash) { 1369 case 100509913: /*issue*/ return new String[] {}; 1370 default: return super.getTypesForProperty(hash, name); 1371 } 1372 1373 } 1374 1375 @Override 1376 public Base addChild(String name) throws FHIRException { 1377 if (name.equals("issue")) { 1378 return addIssue(); 1379 } 1380 else 1381 return super.addChild(name); 1382 } 1383 1384 public String fhirType() { 1385 return "OperationOutcome"; 1386 1387 } 1388 1389 public OperationOutcome copy() { 1390 OperationOutcome dst = new OperationOutcome(); 1391 copyValues(dst); 1392 if (issue != null) { 1393 dst.issue = new ArrayList<OperationOutcomeIssueComponent>(); 1394 for (OperationOutcomeIssueComponent i : issue) 1395 dst.issue.add(i.copy()); 1396 }; 1397 return dst; 1398 } 1399 1400 protected OperationOutcome typedCopy() { 1401 return copy(); 1402 } 1403 1404 @Override 1405 public boolean equalsDeep(Base other_) { 1406 if (!super.equalsDeep(other_)) 1407 return false; 1408 if (!(other_ instanceof OperationOutcome)) 1409 return false; 1410 OperationOutcome o = (OperationOutcome) other_; 1411 return compareDeep(issue, o.issue, true); 1412 } 1413 1414 @Override 1415 public boolean equalsShallow(Base other_) { 1416 if (!super.equalsShallow(other_)) 1417 return false; 1418 if (!(other_ instanceof OperationOutcome)) 1419 return false; 1420 OperationOutcome o = (OperationOutcome) other_; 1421 return true; 1422 } 1423 1424 public boolean isEmpty() { 1425 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(issue); 1426 } 1427 1428 @Override 1429 public ResourceType getResourceType() { 1430 return ResourceType.OperationOutcome; 1431 } 1432 1433 1434} 1435