mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3651: workaround to skip code execution when first element is not a
record
This commit is contained in:
@@ -244,34 +244,38 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
|
|||||||
ParameterCheck.mandatory("records", records);
|
ParameterCheck.mandatory("records", records);
|
||||||
if (!records.isEmpty())
|
if (!records.isEmpty())
|
||||||
{
|
{
|
||||||
NodeRef root = getRMRoot(records.get(0));
|
if (nodeService.hasAspect(records.get(0), RecordsManagementModel.ASPECT_RECORD))
|
||||||
String groupName = getGroupName(root);
|
|
||||||
|
|
||||||
if (doesGroupContainUsers(groupName))
|
|
||||||
{
|
{
|
||||||
NotificationContext notificationContext = new NotificationContext();
|
NodeRef root = getRMRoot(records.get(0));
|
||||||
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW));
|
String groupName = getGroupName(root);
|
||||||
notificationContext.setAsyncNotification(false);
|
|
||||||
notificationContext.setIgnoreNotificationFailure(true);
|
|
||||||
|
|
||||||
notificationContext.setBodyTemplate(getDueForReviewTemplate().toString());
|
if (doesGroupContainUsers(groupName))
|
||||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
|
||||||
args.put("records", (Serializable)records);
|
|
||||||
args.put("site", getSiteName(root));
|
|
||||||
notificationContext.setTemplateArgs(args);
|
|
||||||
|
|
||||||
notificationContext.addTo(groupName);
|
|
||||||
|
|
||||||
notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (logger.isWarnEnabled())
|
|
||||||
{
|
{
|
||||||
logger.warn("Unable to send record due for review email notification, because notification group was empty.");
|
NotificationContext notificationContext = new NotificationContext();
|
||||||
}
|
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW));
|
||||||
|
notificationContext.setAsyncNotification(false);
|
||||||
|
notificationContext.setIgnoreNotificationFailure(true);
|
||||||
|
|
||||||
throw new AlfrescoRuntimeException("Unable to send record due for review email notification, because notification group was empty.");
|
notificationContext.setBodyTemplate(getDueForReviewTemplate().toString());
|
||||||
|
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||||
|
args.put("records", (Serializable) records);
|
||||||
|
args.put("site", getSiteName(root));
|
||||||
|
notificationContext.setTemplateArgs(args);
|
||||||
|
|
||||||
|
notificationContext.addTo(groupName);
|
||||||
|
|
||||||
|
notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isWarnEnabled())
|
||||||
|
{
|
||||||
|
logger.warn("Unable to send record due for review email notification, because notification group was empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new AlfrescoRuntimeException(
|
||||||
|
"Unable to send record due for review email notification, because notification group was empty.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user