70,6 → 70,33 |
return alias; |
} |
|
public boolean addressExists(User editor, MailAlias alias, String address) |
throws ModelException |
{ |
if(alias.getDomain() == null) |
throw new ModelException("Cannot check unique address for mail alias without domain"); |
|
try { |
if(alias.getId() == null) |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from MailAlias where address = ? and domain = ?", |
new Object[] { address, alias.getDomain() }, |
new Type[] { Hibernate.STRING, Hibernate.entity(InetDomain.class) } ) |
.next()).intValue() > 0; |
else |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from MailAlias a where address = ? and domain = ? and a != ?", |
new Object[] { address, alias.getDomain(), alias }, |
new Type[] { Hibernate.STRING, Hibernate.entity(InetDomain.class), |
Hibernate.entity(MailAlias.class) } ) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
|
protected MailAlias findForName(String name) |
throws ModelException |
{ |