Search in sources :

Example 11 with Address

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

the class AddressDaoImpl method get.

/* 
     * (non-Javadoc)
     * 
     * @see org.nhindirect.config.store.dao.AddressDao#get(java.lang.String)
     */
@Transactional(readOnly = true)
public Address get(String name) {
    if (log.isDebugEnabled())
        log.debug("Enter");
    Address result = null;
    try {
        if (name != null) {
            Query select = entityManager.createQuery("SELECT DISTINCT a from Address a WHERE UPPER(a.emailAddress) = ?1");
            result = (Address) select.setParameter(1, name.toUpperCase(Locale.getDefault())).getSingleResult();
        }
    } catch (NoResultException e) {
        return null;
    }
    if (log.isDebugEnabled())
        log.debug("Exit");
    return result;
}
Also used : Address(org.nhindirect.config.store.Address) Query(javax.persistence.Query) NoResultException(javax.persistence.NoResultException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with Address

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

the class AddressDaoImpl method update.

/*
     * (non-Javadoc)
     * 
     * @see org.nhindirect.config.store.dao.AddressDao#update(org.nhindirect.config.store.Address)
     */
@Transactional(readOnly = false)
public void update(Address item) {
    if (log.isDebugEnabled())
        log.debug("Enter");
    if (item != null) {
        Address inDb = entityManager.find(Address.class, item.getId());
        inDb.setDisplayName(item.getDisplayName());
        inDb.setEndpoint(item.getEndpoint());
        inDb.setDomain(item.getDomain());
        inDb.setEmailAddress(item.getEmailAddress());
        inDb.setType(item.getType());
        inDb.setStatus(item.getStatus());
        inDb.setUpdateTime(Calendar.getInstance());
        entityManager.merge(inDb);
    }
    if (log.isDebugEnabled())
        log.debug("Exit");
}
Also used : Address(org.nhindirect.config.store.Address) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Address (org.nhindirect.config.store.Address)12 Transactional (org.springframework.transaction.annotation.Transactional)6 Domain (org.nhindirect.config.store.Domain)5 ArrayList (java.util.ArrayList)4 Expectations (org.jmock.Expectations)4 AddressDao (org.nhindirect.config.store.dao.AddressDao)4 Query (javax.persistence.Query)3 List (java.util.List)2 AddressServiceImpl (org.nhindirect.config.service.impl.AddressServiceImpl)2 ConfigurationServiceImpl (org.nhindirect.config.service.impl.ConfigurationServiceImpl)2 Anchor (org.nhindirect.config.store.Anchor)2 CertPolicy (org.nhindirect.config.store.CertPolicy)2 CertPolicyGroup (org.nhindirect.config.store.CertPolicyGroup)2 Certificate (org.nhindirect.config.store.Certificate)2 DNSRecord (org.nhindirect.config.store.DNSRecord)2 Setting (org.nhindirect.config.store.Setting)2 TrustBundle (org.nhindirect.config.store.TrustBundle)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