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