fix problem detached domainoption
This commit is contained in:
parent
a5527411d8
commit
96675a06eb
@ -91,10 +91,6 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
|||||||
throw new HSAdminException("domain admin required");
|
throw new HSAdminException("domain admin required");
|
||||||
}
|
}
|
||||||
// Standard domainoptions setzen. TODO: Alle defaults über eigene Klasse aus der Datenbank holen.
|
// Standard domainoptions setzen. TODO: Alle defaults über eigene Klasse aus der Datenbank holen.
|
||||||
HashSet<DomainOption> domainOptions = new HashSet<DomainOption>();
|
|
||||||
DomainOption domainOption = new DomainOption();
|
|
||||||
domainOption.setName("greylisting");
|
|
||||||
domainOptions.add(domainOption);
|
|
||||||
EntityManager em = getTransaction().getEntityManager();
|
EntityManager em = getTransaction().getEntityManager();
|
||||||
UnixUser loginUser = getTransaction().getLoginUser();
|
UnixUser loginUser = getTransaction().getLoginUser();
|
||||||
if (!loginUser.hasHostmasterRole()) {
|
if (!loginUser.hasHostmasterRole()) {
|
||||||
@ -130,14 +126,13 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
|||||||
Query q = em.createQuery("SELECT opt FROM " +
|
Query q = em.createQuery("SELECT opt FROM " +
|
||||||
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
||||||
" opt WHERE opt.name=:optName");
|
" opt WHERE opt.name=:optName");
|
||||||
for (DomainOption opt : domainOptions) {
|
HashSet<DomainOption> domainOptions = new HashSet<DomainOption>();
|
||||||
q.setParameter("optName", opt.getName());
|
q.setParameter("optName", "greylisting");
|
||||||
List<?> list = q.getResultList();
|
List<?> list = q.getResultList();
|
||||||
if (list.size() != 1) {
|
if (list.size() != 1) {
|
||||||
throw new HSAdminException("invalid domain option: " + opt.getName());
|
throw new HSAdminException("invalid domain option: " + "greylisting");
|
||||||
} else {
|
} else {
|
||||||
opt.setId(((DomainOption) list.get(0)).getId());
|
domainOptions.add((DomainOption) list.get(0));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dom.setDomainoptions(domainOptions);
|
dom.setDomainoptions(domainOptions);
|
||||||
if (dom.isPacDomain()) {
|
if (dom.isPacDomain()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user