Search in sources :

Example 6 with CertificateDAO

use of com.intel.mtwilson.tag.dao.jdbi.CertificateDAO 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);
    }
}
Also used : RepositoryDeleteException(com.intel.mtwilson.tag.repository.RepositoryDeleteException) CertificateDAO(com.intel.mtwilson.tag.dao.jdbi.CertificateDAO) RepositoryCreateException(com.intel.mtwilson.tag.repository.RepositoryCreateException) RepositoryDeleteException(com.intel.mtwilson.tag.repository.RepositoryDeleteException) RepositoryStoreException(com.intel.mtwilson.tag.repository.RepositoryStoreException) RepositoryStoreConflictException(com.intel.mtwilson.tag.repository.RepositoryStoreConflictException) RepositoryRetrieveException(com.intel.mtwilson.tag.repository.RepositoryRetrieveException) RepositoryException(com.intel.mtwilson.tag.repository.RepositoryException) RepositorySearchException(com.intel.mtwilson.tag.repository.RepositorySearchException) RepositoryCreateConflictException(com.intel.mtwilson.tag.repository.RepositoryCreateConflictException) Certificate(com.intel.mtwilson.datatypes.Certificate) X509AttributeCertificate(com.intel.mtwilson.datatypes.X509AttributeCertificate)

Aggregations

Certificate (com.intel.mtwilson.datatypes.Certificate)6 CertificateDAO (com.intel.mtwilson.tag.dao.jdbi.CertificateDAO)6 RepositoryException (com.intel.mtwilson.tag.repository.RepositoryException)6 CertificateLocator (com.intel.mtwilson.datatypes.CertificateLocator)4 X509AttributeCertificate (com.intel.mtwilson.datatypes.X509AttributeCertificate)4 RepositoryCreateConflictException (com.intel.mtwilson.tag.repository.RepositoryCreateConflictException)4 RepositoryCreateException (com.intel.mtwilson.tag.repository.RepositoryCreateException)4 RepositoryDeleteException (com.intel.mtwilson.tag.repository.RepositoryDeleteException)4 RepositoryRetrieveException (com.intel.mtwilson.tag.repository.RepositoryRetrieveException)4 RepositorySearchException (com.intel.mtwilson.tag.repository.RepositorySearchException)4 RepositoryStoreConflictException (com.intel.mtwilson.tag.repository.RepositoryStoreConflictException)4 RepositoryStoreException (com.intel.mtwilson.tag.repository.RepositoryStoreException)4 RepositoryInvalidInputException (com.intel.mtwilson.tag.repository.RepositoryInvalidInputException)2 ApiClient (com.intel.mtwilson.ApiClient)1 AssetTagCertCreateRequest (com.intel.mtwilson.datatypes.AssetTagCertCreateRequest)1 AssetTagCertRevokeRequest (com.intel.mtwilson.datatypes.AssetTagCertRevokeRequest)1 KvAttribute (com.intel.mtwilson.datatypes.KvAttribute)1 KvAttributeCollection (com.intel.mtwilson.datatypes.KvAttributeCollection)1 KvAttributeFilterCriteria (com.intel.mtwilson.datatypes.KvAttributeFilterCriteria)1 UTF8NameValueMicroformat (com.intel.mtwilson.datatypes.UTF8NameValueMicroformat)1