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;
}
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");
}
Aggregations