use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.
the class CreateDraftCertificateResponderImpl method createErrorResponse.
/**
* The response sent back to caller when an error is raised.
*/
private CreateDraftCertificateResponseType createErrorResponse(String errorMsg, ErrorIdType errorType) {
ResultType result = ResultTypeUtil.errorResult(errorType, errorMsg);
CreateDraftCertificateResponseType response = new CreateDraftCertificateResponseType();
response.setResult(result);
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.
the class SendMessageToCareResponderImpl method sendMessageToCare.
@Override
public SendMessageToCareResponseType sendMessageToCare(String logicalAddress, SendMessageToCareType request) {
LOG.debug("Received new message to care");
SendMessageToCareResponseType response = new SendMessageToCareResponseType();
ResultType result = new ResultType();
try {
arendeService.processIncomingMessage(ArendeConverter.convert(request));
result.setResultCode(ResultCodeType.OK);
} catch (WebCertServiceException e) {
result.setResultCode(ResultCodeType.ERROR);
switch(e.getErrorCode()) {
case INVALID_STATE:
case DATA_NOT_FOUND:
case EXTERNAL_SYSTEM_PROBLEM:
result.setErrorId(ErrorIdType.VALIDATION_ERROR);
result.setResultText(e.getMessage());
LOG.warn("{}: {}", e.getErrorCode().name(), e.getMessage());
break;
default:
result.setErrorId(ErrorIdType.APPLICATION_ERROR);
result.setResultText(e.getMessage());
LOG.error("Could not process incoming message to care. Cause is: {}", e.getMessage());
break;
}
}
response.setResult(result);
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.
the class NotificationWSClient method sendStatusUpdate.
public void sendStatusUpdate(CertificateStatusUpdateForCareType request, @Header(NotificationRouteHeaders.LOGISK_ADRESS) String logicalAddress) throws TemporaryException, PermanentException {
LOG.debug("Sending status update with version 2 to '{}' for intyg '{}'", logicalAddress, request.getIntyg().getIntygsId().getExtension());
CertificateStatusUpdateForCareResponseType response = null;
try {
response = statusUpdateForCareClient.certificateStatusUpdateForCare(logicalAddress, request);
} catch (Exception e) {
LOG.warn("Exception occured when sending status update: {}", e.getMessage());
throw new TemporaryException(e);
}
ResultType result = response.getResult();
switch(result.getResultCode()) {
case ERROR:
if (ErrorIdType.TECHNICAL_ERROR.equals(result.getErrorId())) {
throw new TemporaryException(String.format("NotificationWSClient failed with error code: %s and message %s", result.getErrorId(), result.getResultText()));
} else {
throw new PermanentException(String.format("NotificationWSClient failed with non-recoverable error code: %s and message %s", result.getErrorId(), result.getResultText()));
}
case INFO:
LOG.info("NotificationWSClient got message:" + result.getResultText());
break;
case OK:
break;
}
}
use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.
the class CertificateSendProcessorTest method createResponse.
private SendCertificateToRecipientResponseType createResponse(ResultCodeType resultCodeType, ErrorIdType errorType) {
ResultType resultType = new ResultType();
resultType.setResultCode(resultCodeType);
if (errorType != null) {
resultType.setErrorId(errorType);
}
SendCertificateToRecipientResponseType responseType = new SendCertificateToRecipientResponseType();
responseType.setResult(resultType);
return responseType;
}
use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.
the class CertificateSendProcessor method process.
public void process(@Body String skickatAv, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.PERSON_ID) String personId, @Header(Constants.RECIPIENT) String recipient, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress) throws TemporaryException, PermanentException {
SendCertificateToRecipientResponseType response;
try {
response = sendServiceClient.sendCertificate(intygsId, personId, skickatAv, recipient, logicalAddress);
final ResultType result = response.getResult();
final String resultText = result.getResultText();
if (ResultCodeType.ERROR == result.getResultCode()) {
LOG.warn("Error occured when trying to send intyg '{}'; {}", intygsId, resultText);
switch(result.getErrorId()) {
case APPLICATION_ERROR:
case TECHNICAL_ERROR:
throw new TemporaryException(resultText);
case REVOKED:
case VALIDATION_ERROR:
throw new PermanentException(resultText);
}
} else {
if (ResultCodeType.INFO.equals(result.getResultCode())) {
LOG.warn("Warning occured when trying to send intyg '{}'; {}. Will not requeue.", intygsId, resultText);
}
}
} catch (WebServiceException e) {
LOG.warn("Call to send intyg {} caused an error: {}. Will retry", intygsId, e.getMessage());
throw new TemporaryException(e.getMessage());
}
}
Aggregations