throws SQLException, IOException, SearchServiceException
{
List<CrisSubscription> rpSubscriptions = applicationService
.getList(CrisSubscription.class);
EPerson currentEPerson = null;
List<String> rpkeys = null; // List of rp keys
List<String> relationField = new LinkedList<String>();
for (CrisSubscription rpSubscription : rpSubscriptions)
{
// Does this row relate to the same e-person as the last?
if ((currentEPerson == null)
|| (rpSubscription.getEpersonID() != currentEPerson.getID()))
{
// New e-person. Send mail for previous e-person
if (currentEPerson != null)
{
try
{
relationField = mapRelationFields.get(rpSubscription.getTypeDef());
sendEmail(researcher, context, currentEPerson, rpkeys,
test, relationField);
}
catch (MessagingException me)
{
log.error("Failed to send subscription to eperson_id="
+ currentEPerson.getID());
log.error(me);
}
}
currentEPerson = EPerson.find(context,
rpSubscription.getEpersonID());
rpkeys = new ArrayList<String>();
}
rpkeys.add(ResearcherPageUtils
.getPersistentIdentifier(applicationService
.getEntityByUUID(rpSubscription.getUuid())));
}
// Process the last person
if (currentEPerson != null)
{
try
{
sendEmail(researcher, context, currentEPerson, rpkeys, test,
relationField);
}
catch (MessagingException me)
{
log.error("Failed to send subscription to eperson_id="
+ currentEPerson.getID());
log.error(me);
}
}
}