some logging

This commit is contained in:
Peter Hormanns 2017-10-02 17:02:44 +02:00
parent 5c452385b9
commit b34d706e36
2 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.Query; import javax.persistence.Query;
@ -31,6 +32,8 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
"htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "app", "app-ssl", "etc", "var" "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "app", "app-ssl", "etc", "var"
}; };
private static final Logger LOG = Logger.getLogger(DomainProcessorFactory.class.getName());
public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException { public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException {
String hiveName = entity.getHiveName(); String hiveName = entity.getHiveName();
Domain dom = (Domain) entity; Domain dom = (Domain) entity;
@ -134,15 +137,16 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
} }
private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, Domain dom) { private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, Domain dom) {
LOG.info("createHiveEMailSetupProcessor( " + dom.getName() + " )");
final EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory(); final EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
final CompoundProcessor emailAdrProcessor = new CompoundProcessor(); final CompoundProcessor emailAdrProcessor = new CompoundProcessor();
final Query query = em.createQuery( final Query query = em.createQuery(
"SELECT adr FROM " + "SELECT adr FROM EMailAddresses adr WHERE adr.domain.name = :domname");
EMailAddress.class.getAnnotation(javax.persistence.Entity.class).name() + " adr " + query.setParameter("domname", dom.getName());
"WHERE adr.domain.name='" + dom.getName() + "'");
final List<?> resultList = query.getResultList(); final List<?> resultList = query.getResultList();
for (final Object obj : resultList) { for (final Object obj : resultList) {
final EMailAddress eMailAddress = (EMailAddress) obj; final EMailAddress eMailAddress = (EMailAddress) obj;
LOG.info("EMail: " + eMailAddress.getEMailAddress());
emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress)); emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
} }
return emailAdrProcessor; return emailAdrProcessor;

View File

@ -29,7 +29,7 @@ import de.hsadmin.mods.user.UnixUser;
* Entity class for email aliases. * Entity class for email aliases.
* *
*/ */
@javax.persistence.Entity(name = "EMailAliases") @Entity(name = "EMailAliases")
@Table(name = "emailalias") @Table(name = "emailalias")
@SequenceGenerator(name = "EMailAliasesSeqGen", sequenceName = "emailalias_emailalias_id_seq") @SequenceGenerator(name = "EMailAliasesSeqGen", sequenceName = "emailalias_emailalias_id_seq")
@SearchFilter("obj.pac = :loginUserPac OR obj.pac.customer.name = :loginUserName") @SearchFilter("obj.pac = :loginUserPac OR obj.pac.customer.name = :loginUserName")