Date now = new Date(System.currentTimeMillis());
if(Boolean.TRUE.equals(f.getOutdatedServices())){
now = null;
}
SmsDbManager smsDbManager = new SmsDbManager(locale, session);
@SuppressWarnings("unused")
String notAllowedString = getResources(req).getMessage(locale, "smssvc.notAllowed");
List<InvocationListForm.DisplayableInvocation> displayableInvocations = new LinkedList<InvocationListForm.DisplayableInvocation>();
List<Invocation> invocations = smsDbManager.getInvocations(groupToDisplay,now);
for (Invocation invocation : invocations) {
Group group = invocation.getGroup();
group.getGroupname(); // fill the cache
Long msisdn = invocation.getMsisdn();
String email = invocation.getEmail();
String keywords = invocation.getKeywords();
String displayableMsisdn = msisdn == null ? "" : msisdn + "";
if (msisdn != null && !smsDbManager.isMsisdnAllowedForAllKeywords(group, msisdn, keywords)){
displayableMsisdn = msisdn + "!";
}
String displayableEmail = email;
if (email != null && !smsDbManager.isEmailAllowedForAllKeywords(group, email, keywords)){
displayableEmail = email + " !";
}
displayableInvocations.add(new InvocationListForm.DisplayableInvocation(invocation,displayableMsisdn,displayableEmail));
}