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