use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareResponseType in project webcert by sklintyg.
the class CertificateStatusUpdateForCareResponderStub method certificateStatusUpdateForCare.
@Override
public CertificateStatusUpdateForCareResponseType certificateStatusUpdateForCare(String logicalAddress, CertificateStatusUpdateForCareType request) {
counter.incrementAndGet();
String utlatandeId = getUtlatandeId(request);
LOG.debug("utlatandeId: " + utlatandeId);
LOG.debug("numberOfReceivedMessages: " + getNumberOfReceivedMessages());
if (utlatandeId.startsWith(FALLERAT_MEDDELANDE)) {
int attempts = increaseAttempts(utlatandeId);
int numberOfRequestedFailedAttempts = Integer.parseInt(utlatandeId.substring(utlatandeId.length() - 1));
LOG.debug("attempts: " + attempts);
LOG.debug("numberOfRequestedFailedAttempts: " + numberOfRequestedFailedAttempts);
if (attempts < numberOfRequestedFailedAttempts + 1) {
throw new RuntimeException("Something went wrong");
}
}
store.add(request);
CertificateStatusUpdateForCareResponseType response = new CertificateStatusUpdateForCareResponseType();
ResultType result = new ResultType();
result.setResultCode(ResultCodeType.OK);
response.setResult(result);
LOG.debug("Request set to 'OK'");
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareResponseType in project webcert by sklintyg.
the class NotificationWSClientTest method buildResponse.
private CertificateStatusUpdateForCareResponseType buildResponse(ResultCodeType code, ErrorIdType errorId, String resultText) {
CertificateStatusUpdateForCareResponseType res = new CertificateStatusUpdateForCareResponseType();
res.setResult(new ResultType());
res.getResult().setResultCode(code);
res.getResult().setErrorId(errorId);
res.getResult().setResultText(resultText);
return res;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareResponseType in project webcert by sklintyg.
the class CertificateStatusUpdateForCareResponderStub method certificateStatusUpdateForCare.
@Override
public CertificateStatusUpdateForCareResponseType certificateStatusUpdateForCare(String logicalAddress, CertificateStatusUpdateForCareType request) {
counter.incrementAndGet();
String utlatandeId = getUtlatandeId(request);
LOG.debug("utlatandeId: " + utlatandeId);
LOG.debug("numberOfReceivedMessages: " + getNumberOfReceivedMessages());
if (utlatandeId.startsWith(FALLERAT_MEDDELANDE)) {
int attempts = increaseAttempts(utlatandeId);
int numberOfRequestedFailedAttempts = Integer.parseInt(utlatandeId.substring(utlatandeId.length() - 1));
LOG.debug("attempts: " + attempts);
LOG.debug("numberOfRequestedFailedAttempts: " + numberOfRequestedFailedAttempts);
if (attempts < numberOfRequestedFailedAttempts + 1) {
throw new RuntimeException("Something went wrong");
}
}
store.add(request);
CertificateStatusUpdateForCareResponseType response = new CertificateStatusUpdateForCareResponseType();
response.setResult(ResultTypeUtil.okResult());
LOG.debug("Request set to 'OK'");
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareResponseType 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;
}
}
Aggregations