on domain add use default domainoptions only if no optins are given

This commit is contained in:
Peter Hormanns 2013-01-21 13:33:19 +01:00
parent 21ae1802e3
commit 9910aeb9e0

View File

@ -135,6 +135,7 @@ public class DomainModuleImpl extends AbstractModuleImpl {
dom.setUser((UnixUser) adminQuery.getSingleResult());
needsWriteAccessOn(newEntity, "add");
em.persist(dom);
if (dom.getDomainoptions() == null) { // set default-domainoptions
HashSet<DomainOption> domainOptions = new HashSet<DomainOption>();
for (String domOpt : DEFAULT_DOMOPTS) {
Query q = em.createQuery("SELECT opt FROM " +
@ -149,6 +150,7 @@ public class DomainModuleImpl extends AbstractModuleImpl {
}
}
dom.setDomainoptions(domainOptions);
}
if (dom.isPacDomain()) {
em.persist(new EMailAddress("owner", "", dom, dom.getUser().getPac().getCustomer().getName().substring(6) + "@hostsharing.net"));
em.persist(new EMailAddress("admin", "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));