Search in sources :

Example 11 with CertPolicy

use of org.nhindirect.config.store.CertPolicy in project nhin-d by DirectProject.

the class CertPolicyDaoImpl method updatePolicyAttributes.

@Override
@Transactional(readOnly = false)
public void updatePolicyAttributes(long id, String policyName, PolicyLexicon lexicon, byte[] policyData) throws ConfigurationStoreException {
    validateState();
    try {
        final CertPolicy existingPolicy = this.getPolicyById(id);
        if (existingPolicy == null)
            throw new ConfigurationStoreException("Policy does not exist");
        if (policyData != null && policyData.length > 0)
            existingPolicy.setPolicyData(policyData);
        if (policyName != null && !policyName.isEmpty())
            existingPolicy.setPolicyName(policyName);
        if (lexicon != null)
            existingPolicy.setLexicon(lexicon);
        entityManager.persist(existingPolicy);
        entityManager.flush();
    } catch (ConfigurationStoreException cse) {
        throw cse;
    }///CLOVER:OFF
     catch (Exception e) {
        throw new ConfigurationStoreException("Failed to update certificate policy attributes.", e);
    }
///CLOVER:ON
}
Also used : CertPolicy(org.nhindirect.config.store.CertPolicy) ConfigurationStoreException(org.nhindirect.config.store.ConfigurationStoreException) NoResultException(javax.persistence.NoResultException) ConfigurationStoreException(org.nhindirect.config.store.ConfigurationStoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

CertPolicy (org.nhindirect.config.store.CertPolicy)11 ConfigurationStoreException (org.nhindirect.config.store.ConfigurationStoreException)8 Transactional (org.springframework.transaction.annotation.Transactional)8 NoResultException (javax.persistence.NoResultException)7 Query (javax.persistence.Query)4 CertPolicyGroup (org.nhindirect.config.store.CertPolicyGroup)3 ArrayList (java.util.ArrayList)2 Address (org.nhindirect.config.store.Address)2 Anchor (org.nhindirect.config.store.Anchor)2 Certificate (org.nhindirect.config.store.Certificate)2 DNSRecord (org.nhindirect.config.store.DNSRecord)2 Domain (org.nhindirect.config.store.Domain)2 Setting (org.nhindirect.config.store.Setting)2 TrustBundle (org.nhindirect.config.store.TrustBundle)2 AddressDao (org.nhindirect.config.store.dao.AddressDao)2 AnchorDao (org.nhindirect.config.store.dao.AnchorDao)2 CertPolicyDao (org.nhindirect.config.store.dao.CertPolicyDao)2 CertificateDao (org.nhindirect.config.store.dao.CertificateDao)2 DNSDao (org.nhindirect.config.store.dao.DNSDao)2 DomainDao (org.nhindirect.config.store.dao.DomainDao)2