use of se.inera.intyg.webcert.common.sender.exception.PermanentException in project webcert by sklintyg.
the class CertificateRevokeProcessor method process.
public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress, @Header(Constants.INTYGS_TYP) String intygsTyp) throws TemporaryException, PermanentException {
checkArgument(!Strings.isNullOrEmpty(intygsId), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_ID);
checkArgument(!Strings.isNullOrEmpty(logicalAddress), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.LOGICAL_ADDRESS);
checkArgument(!Strings.isNullOrEmpty(intygsTyp), "Message of type %s does not have a %s header.", Constants.REVOKE_MESSAGE, Constants.INTYGS_TYP);
try {
ModuleApi moduleApi = registry.getModuleApi(intygsTyp);
moduleApi.revokeCertificate(xmlBody, logicalAddress);
} catch (ExternalServiceCallException e) {
switch(e.getErroIdEnum()) {
case TECHNICAL_ERROR:
case APPLICATION_ERROR:
throw new TemporaryException(e.getMessage());
default:
throw new PermanentException(e.getMessage());
}
} catch (ModuleException e) {
throw new PermanentException(e.getMessage());
} catch (WebServiceException e) {
throw new TemporaryException(e.getMessage());
} catch (Exception e) {
throw new PermanentException(e.getMessage());
}
}
Aggregations