if (log.isDebugEnabled()) {
log.debug("Revoking entitlementCertificates of : " + e);
}
Entitlement tempE = new Entitlement();
tempE.getCertificates().addAll(e.getCertificates());
e.getCertificates().clear();
// below call creates new certificates and saves it to the backend.
try {
EntitlementCertificate generated = this.generateEntitlementCertificate(
e.getPool(), e, ueberCertificate);
e.setDirty(false);
entitlementCurator.merge(e);
for (EntitlementCertificate ec : tempE.getCertificates()) {
if (log.isDebugEnabled()) {
log.debug("Deleting entitlementCertificate: #" + ec.getId());
}
this.entitlementCertificateCurator.delete(ec);
}
// send entitlement changed event.
this.sink.queueEvent(this.eventFactory.entitlementChanged(e));
if (log.isDebugEnabled()) {
log.debug("Generated entitlementCertificate: #" + generated.getId());
}
}
catch (CertificateSizeException cse) {
e.getCertificates().addAll(tempE.getCertificates());
log.warn("The certificate cannot be regenerated at this time: " +
cse.getMessage());
}
}