From e9254b7ad6731e2345dce1b760a77fc5d790ca23 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 9 Aug 2014 13:54:20 +0200 Subject: [PATCH] =?UTF-8?q?Opraveno=20ukl=C3=A1d=C3=A1n=C3=AD=20po=C5=BEad?= =?UTF-8?q?avk=C5=AF=20pokud=20nejsou=20v=20glob=C3=A1ln=C3=ADm=20nastaven?= =?UTF-8?q?=C3=AD=20nastaveny=20=C5=A1ablony=20e-mail=C5=AF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isspst/mail/EntityMessageBuilder.java | 4 +++ .../RequirementBaseServiceImpl.java | 31 +++++-------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/main/java/info/bukova/isspst/mail/EntityMessageBuilder.java b/src/main/java/info/bukova/isspst/mail/EntityMessageBuilder.java index b8e54ed6..3803624f 100644 --- a/src/main/java/info/bukova/isspst/mail/EntityMessageBuilder.java +++ b/src/main/java/info/bukova/isspst/mail/EntityMessageBuilder.java @@ -27,6 +27,10 @@ public class EntityMessageBuilder implements MessageBuilder { } private String replaceProperties(String src, Object data) { + if (src == null) { + return ""; + } + int current = 0; List properties = new ArrayList(); boolean found = false; diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index e0d79886..d4ade762 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -100,25 +100,7 @@ public abstract class RequirementBaseServiceImpl exte wg = e.getWorkgroup(); } - - try - { - if (wg.getMembers() == null) - { - throw new LazyInitializationException(""); - } - - wg.getMembers().size(); - } - catch (LazyInitializationException ex) - { - Query q = dao.getQuery("from Workgroup where id = :id"); - q.setParameter("id", wg.getId()); - wg = (Workgroup) q.uniqueResult(); - - wg.getMembers().size(); - } - + workgroupService.loadMembers(wg); for (JobMapping jm : wg.getMembers()) { @@ -223,13 +205,16 @@ public abstract class RequirementBaseServiceImpl exte if (e.getOwnedBy().getEmail() != null && !e.getOwnedBy().getEmail().isEmpty() && e.getOwnedBy().isNotify()) { - if (e.getState() == RequirementState.APPROVED) { + if (e.getState() == RequirementState.APPROVED && settings.getConfReqTemplate() != null) { message = messageBuilder.buildMessage(settings.getConfReqTemplate(), e); - } else { + } else if (settings.getAuthReqTemplate() != null) { message = messageBuilder.buildMessage(settings.getAuthReqTemplate(), e); } - message.setTo(e.getOwnedBy().getEmail()); - mailer.send(message); + + if (message != null) { + message.setTo(e.getOwnedBy().getEmail()); + mailer.send(message); + } } }