Skip to content
Snippets Groups Projects
Commit e4849088 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Avoiding recreating named query

parent 5c193ced
No related branches found
No related tags found
No related merge requests found
...@@ -233,9 +233,11 @@ public class MessagingBean { ...@@ -233,9 +233,11 @@ public class MessagingBean {
ForecastEvent toRed = em.find(ForecastEvent.class, ForecastEvent.TO_RED); ForecastEvent toRed = em.find(ForecastEvent.class, ForecastEvent.TO_RED);
ForecastEvent greenToYellow = em.find(ForecastEvent.class, ForecastEvent.GREEN_TO_YELLOW); ForecastEvent greenToYellow = em.find(ForecastEvent.class, ForecastEvent.GREEN_TO_YELLOW);
ForecastEvent currentEvent = null; ForecastEvent currentEvent = null;
Query findConfQ = em.createNamedQuery("ForecastResult.findByForecastConfigurationId", ForecastResult.class);
for(ForecastConfiguration conf:forecastConfigurations) for(ForecastConfiguration conf:forecastConfigurations)
{ {
List<ForecastResult> results = em.createNamedQuery("ForecastResult.findByForecastConfigurationId", ForecastResult.class) LOGGER.debug("Now working with forecastConfiguration with id=" + conf.getForecastConfigurationId());
List<ForecastResult> results = findConfQ
.setParameter("forecastConfigurationId", conf.getForecastConfigurationId()) .setParameter("forecastConfigurationId", conf.getForecastConfigurationId())
.getResultList(); .getResultList();
...@@ -332,7 +334,12 @@ public class MessagingBean { ...@@ -332,7 +334,12 @@ public class MessagingBean {
uMessage.addMessageLocalVersion(locale, headingTemplate, "",MessageFormat.format(bodyTemplate, templateParts),detailsUrl); uMessage.addMessageLocalVersion(locale, headingTemplate, "",MessageFormat.format(bodyTemplate, templateParts),detailsUrl);
} }
uMessage.setDistributionList(this.getForecastEventNotificationSubscribers(fConf)); List<MessageRecipient> distributionList = this.getForecastEventNotificationSubscribers(fConf);
if(distributionList == null || distributionList.isEmpty())
{
em.remove(newNotification);
}
uMessage.setDistributionList(distributionList);
cal.setTime(systemTime); cal.setTime(systemTime);
cal.add(Calendar.DATE, 1); cal.add(Calendar.DATE, 1);
uMessage.setExpiresAt(cal.getTime()); uMessage.setExpiresAt(cal.getTime());
......
...@@ -139,6 +139,7 @@ public class SmsMsgDeliveryHandler implements IDeliveryMsgHandler { ...@@ -139,6 +139,7 @@ public class SmsMsgDeliveryHandler implements IDeliveryMsgHandler {
+ (vm.getIncludeNotificationSettingsLink() ? "\n\n" + MessageFormat.format(msgToSend.getNotificationSettingsLinkTpl(), msgReceiver.recipientId): "\n"); + (vm.getIncludeNotificationSettingsLink() ? "\n\n" + MessageFormat.format(msgToSend.getNotificationSettingsLinkTpl(), msgReceiver.recipientId): "\n");
LOGGER.debug(smsText); LOGGER.debug(smsText);
LOGGER.debug("Teksten er på " + smsText.length() + " tegn."); LOGGER.debug("Teksten er på " + smsText.length() + " tegn.");
LOGGER.debug("Mottaker: " + msgReceiver.msgDeliveryAddress);
try { try {
// TODO: Make the price part of VipsMessage // TODO: Make the price part of VipsMessage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment