Package ca.uhn.fhir.model.dstu.resource

Examples of ca.uhn.fhir.model.dstu.resource.OperationOutcome


  }

  public UnprocessableEntityException(String theMessage) {
    super(422, theMessage);

    myOperationOutcome = new OperationOutcome();
    myOperationOutcome.addIssue().setDetails(theMessage);
  }
View Full Code Here


  }

  public UnprocessableEntityException(String... theMessage) {
    super(422, theMessage != null && theMessage.length > 0 ? theMessage[0] : "");

    myOperationOutcome = new OperationOutcome();
    if (theMessage != null) {
      for (String next : theMessage) {
        myOperationOutcome.addIssue().setDetails(next);
      }
    }
View Full Code Here

    case Constants.STATUS_HTTP_412_PRECONDITION_FAILED:
      ex = new ResourceVersionNotSpecifiedException("Server responded with HTTP 412");
      break;
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      ex = new UnprocessableEntityException(operationOutcome);
      break;
    default:
      ex = new UnclassifiedServerFailureException(theStatusCode, "Server responded with HTTP " + theStatusCode);
      break;
View Full Code Here

  /**
   * Constructor which accepts an {@link OperationOutcome} resource which will be supplied in the response
   */
  public UnprocessableEntityException(OperationOutcome theOperationOutcome) {
    super(STATUS_CODE, DEFAULT_MESSAGE, theOperationOutcome == null ? new OperationOutcome() : theOperationOutcome);
  }
View Full Code Here

  public UnprocessableEntityException(String... theMessage) {
    super(STATUS_CODE, DEFAULT_MESSAGE, toOperationOutcome(theMessage));
  }

  private static OperationOutcome toOperationOutcome(String... theMessage) {
    OperationOutcome operationOutcome = new OperationOutcome();
    if (theMessage != null) {
      for (String next : theMessage) {
        operationOutcome.addIssue().setDetails(next);
      }
    }
    return operationOutcome;
  }
View Full Code Here

      theResponse.setCharacterEncoding("UTF-8");
      theResponse.getWriter().write(e.getMessage());

    } catch (Throwable e) {

      OperationOutcome oo = new OperationOutcome();
      Issue issue = oo.addIssue();
      issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR);

      int statusCode = 500;
      if (e instanceof InternalErrorException) {
        ourLog.error("Failure during REST processing", e);
View Full Code Here

        } else {
          EncodingEnum enc = EncodingEnum.forContentType(mimeType);
          if (enc != null) {
            IParser p = enc.newParser(theContext);
            try {
              OperationOutcome oo = p.parseResource(OperationOutcome.class, body);
              if (oo.getIssueFirstRep().getDetails().isEmpty()==false) {
                message = message + ": " + oo.getIssueFirstRep().getDetails().getValue();
              }
            } catch (Exception e) {
              ourLog.debug("Failed to process OperationOutcome response");
            }
          }
View Full Code Here

      EncodingEnum respType = EncodingEnum.forContentType(theResponseMimeType);
      if (respType == null) {
        return null;
      }
      IParser parser = respType.newParser(myContext);
      OperationOutcome retVal;
      try {
        retVal = parser.parseResource(OperationOutcome.class, theResponseReader);
      } catch (DataFormatException e) {
        ourLog.warn("Failed to parse OperationOutcome response", e);
        return null;
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.dstu.resource.OperationOutcome

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.