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.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
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"
};
private static final Logger LOG = Logger.getLogger(DomainProcessorFactory.class.getName());
public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException {
String hiveName = entity.getHiveName();
Domain dom = (Domain) entity;
@ -134,15 +137,16 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
}
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 " +
EMailAddress.class.getAnnotation(javax.persistence.Entity.class).name() + " adr " +
"WHERE adr.domain.name='" + dom.getName() + "'");
"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;

View File

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