use of com.intel.mtwilson.tag.repository.RepositoryDeleteException in project OpenAttestation by OpenAttestation.
the class CertificateRepository method delete.
@Override
public // @RequiresPermissions("tag_certificates:delete,search")
void delete(CertificateFilterCriteria criteria) {
log.debug("Certificate:Delete - Got request to delete certificate by search criteria.");
CertificateCollection objCollection = search(criteria);
try {
for (Certificate obj : objCollection.getCertificates()) {
CertificateLocator locator = new CertificateLocator();
locator.id = obj.getId();
delete(locator);
}
} catch (RepositoryException re) {
throw re;
} catch (Exception ex) {
log.error("Certificate:Delete - Error during Certificate deletion.", ex);
throw new RepositoryDeleteException(ex);
}
}
use of com.intel.mtwilson.tag.repository.RepositoryDeleteException in project OpenAttestation by OpenAttestation.
the class CertificateRepository method delete.
@Override
public // @RequiresPermissions("tag_certificates:delete")
void delete(CertificateLocator locator) {
if (locator == null || locator.id == null) {
return;
}
log.debug("Certificate:Delete - Got request to delete Certificate with id {}.", locator.id.toString());
try (CertificateDAO dao = TagJdbi.certificateDao()) {
Certificate obj = dao.findById(locator.id);
if (obj != null) {
dao.delete(locator.id);
log.debug("Certificate:Delete - Deleted the Certificate {} successfully.", locator.id.toString());
} else {
log.info("Certificate:Delete - Certificate does not exist in the system.");
}
} catch (Exception ex) {
log.error("Certificate:Delete - Error during certificate deletion.", ex);
throw new RepositoryDeleteException(ex, locator);
}
}
Aggregations