create email addresses by generic module
This commit is contained in:
parent
9dd25448d8
commit
66e570cfb2
@ -185,16 +185,27 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
if (dom.getValidsubdomainnames() == null) {
|
||||
dom.setValidsubdomainnames("www");
|
||||
}
|
||||
// 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"));
|
||||
// em.persist(new EMailAddress(dom.getUser().getPac().getName(), "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
|
||||
// } else {
|
||||
// em.persist(new EMailAddress("abuse", "", dom, admin.getName()));
|
||||
// em.persist(new EMailAddress("postmaster", "", dom, admin.getName()));
|
||||
// em.persist(new EMailAddress("webmaster", "", dom, admin.getName()));
|
||||
// }
|
||||
final AbstractEntity newDomain = super.add(dom);
|
||||
final GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
|
||||
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"));
|
||||
em.persist(new EMailAddress(dom.getUser().getPac().getName(), "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
|
||||
helperModule.add(new EMailAddress("owner", "", dom, dom.getUser().getPac().getCustomer().getName().substring(6) + "@hostsharing.net"));
|
||||
helperModule.add(new EMailAddress("admin", "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
|
||||
helperModule.add(new EMailAddress(dom.getUser().getPac().getName(), "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
|
||||
} else {
|
||||
em.persist(new EMailAddress("abuse", "", dom, admin.getName()));
|
||||
em.persist(new EMailAddress("postmaster", "", dom, admin.getName()));
|
||||
em.persist(new EMailAddress("webmaster", "", dom, admin.getName()));
|
||||
helperModule.add(new EMailAddress("abuse", "", dom, admin.getName()));
|
||||
helperModule.add(new EMailAddress("postmaster", "", dom, admin.getName()));
|
||||
helperModule.add(new EMailAddress("webmaster", "", dom, admin.getName()));
|
||||
}
|
||||
return super.add(dom);
|
||||
return newDomain;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,8 +41,9 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
Pac pac = domUser.getPac();
|
||||
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
|
||||
new CompoundProcessor(
|
||||
createHiveDNSSetupProcessor(em, dom),
|
||||
createHiveEMailSetupProcessor(em, dom)
|
||||
createHiveDNSSetupProcessor(em, dom)
|
||||
// ,
|
||||
// createHiveEMailSetupProcessor(em, dom)
|
||||
)
|
||||
);
|
||||
Config config = Config.getInstance();
|
||||
@ -136,21 +137,21 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
" && invoke-rc.d bind9 reload");
|
||||
}
|
||||
|
||||
private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, Domain dom) {
|
||||
LOG.info("createHiveEMailSetupProcessor( " + dom.getName() + " )");
|
||||
final EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
|
||||
final CompoundProcessor emailAdrProcessor = new CompoundProcessor();
|
||||
final Query query = em.createQuery(
|
||||
"SELECT adr FROM EMailAddresses adr WHERE adr.domain.name = :domname");
|
||||
query.setParameter("domname", dom.getName());
|
||||
final List<?> resultList = query.getResultList();
|
||||
for (final Object obj : resultList) {
|
||||
final EMailAddress eMailAddress = (EMailAddress) obj;
|
||||
LOG.info("EMail: " + eMailAddress.getEMailAddress());
|
||||
emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
|
||||
}
|
||||
return emailAdrProcessor;
|
||||
}
|
||||
// private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, Domain dom) {
|
||||
// LOG.info("createHiveEMailSetupProcessor( " + dom.getName() + " )");
|
||||
// final EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
|
||||
// final CompoundProcessor emailAdrProcessor = new CompoundProcessor();
|
||||
// final Query query = em.createQuery(
|
||||
// "SELECT adr FROM EMailAddresses adr WHERE adr.domain.name = :domname");
|
||||
// query.setParameter("domname", dom.getName());
|
||||
// final List<?> resultList = query.getResultList();
|
||||
// for (final Object obj : resultList) {
|
||||
// final EMailAddress eMailAddress = (EMailAddress) obj;
|
||||
// LOG.info("EMail: " + eMailAddress.getEMailAddress());
|
||||
// emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
|
||||
// }
|
||||
// return emailAdrProcessor;
|
||||
// }
|
||||
|
||||
private Processor createMailinSetupProcessor(EntityManager em, Domain dom, Pac pac) throws ProcessorException {
|
||||
final String inetAddr = pac.getCurINetAddr().getInetAddr();
|
||||
|
Loading…
Reference in New Issue
Block a user