mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-581 (A user will receive notification of rejected records)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46138 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,11 +49,11 @@
|
|||||||
</view:properties>
|
</view:properties>
|
||||||
</cm:content>
|
</cm:content>
|
||||||
|
|
||||||
<cm:dictionaryModel view:childName="cm:recordsCustomModel.xml">
|
<cm:dictionaryModel view:childName="cm:recordsCustomModel.xml">
|
||||||
<view:aspects>
|
<view:aspects>
|
||||||
<cm:titled></cm:titled>
|
<cm:titled></cm:titled>
|
||||||
</view:aspects>
|
</view:aspects>
|
||||||
<view:properties>
|
<view:properties>
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
<sys:node-uuid>records_management_custom_model</sys:node-uuid>
|
<sys:node-uuid>records_management_custom_model</sys:node-uuid>
|
||||||
@@ -61,115 +61,130 @@
|
|||||||
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8</cm:content>
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8</cm:content>
|
||||||
<cm:title>recordsCustomModel.xml</cm:title>
|
<cm:title>recordsCustomModel.xml</cm:title>
|
||||||
<cm:name>recordsCustomModel.xml</cm:name>
|
<cm:name>recordsCustomModel.xml</cm:name>
|
||||||
<cm:modelName>{http://www.alfresco.org/model/rmcustom/1.0}rmcustom</cm:modelName>
|
<cm:modelName>{http://www.alfresco.org/model/rmcustom/1.0}rmcustom</cm:modelName>
|
||||||
<cm:modelDescription>Records Management Custom Model</cm:modelDescription>
|
<cm:modelDescription>Records Management Custom Model</cm:modelDescription>
|
||||||
<cm:modelAuthor>Alfresco</cm:modelAuthor>
|
<cm:modelAuthor>Alfresco</cm:modelAuthor>
|
||||||
<cm:modelVersion>1.0</cm:modelVersion>
|
<cm:modelVersion>1.0</cm:modelVersion>
|
||||||
<cm:modelActive>true</cm:modelActive>
|
<cm:modelActive>true</cm:modelActive>
|
||||||
|
</view:properties>
|
||||||
|
</cm:dictionaryModel>
|
||||||
|
|
||||||
</view:properties>
|
<cm:folder view:childName="cm:records_management_scripts">
|
||||||
</cm:dictionaryModel>
|
<view:properties>
|
||||||
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
|
<sys:node-uuid>rm_scripts</sys:node-uuid>
|
||||||
|
<cm:name>Records Management Scripts</cm:name>
|
||||||
|
<cm:title>Records Management Scripts</cm:title>
|
||||||
|
<cm:description>Scripts intended for execution in response to RM events.</cm:description>
|
||||||
|
</view:properties>
|
||||||
|
<view:associations>
|
||||||
|
<cm:contains>
|
||||||
|
<!-- TODO Will likely remove this script. Here for test purposes.
|
||||||
|
Or perhaps replace it with a product-ready script -->
|
||||||
|
<cm:content view:childName="cm:rma_isClosed.js">
|
||||||
|
<view:aspects>
|
||||||
|
<cm:titled></cm:titled>
|
||||||
|
</view:aspects>
|
||||||
|
<view:properties>
|
||||||
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
|
<cm:description>Records management sample script.</cm:description>
|
||||||
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js|mimetype=text/javascript|encoding=UTF-8</cm:content>
|
||||||
|
<cm:title>rma_isClosed.js</cm:title>
|
||||||
|
<cm:name>rma_isClosed.js</cm:name>
|
||||||
|
</view:properties>
|
||||||
|
</cm:content>
|
||||||
|
|
||||||
<cm:folder view:childName="cm:records_management_scripts">
|
<cm:content view:childName="cm:onCreate_supersedes.js">
|
||||||
<view:properties>
|
<view:aspects>
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
<cm:titled></cm:titled>
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
</view:aspects>
|
||||||
<sys:node-uuid>rm_scripts</sys:node-uuid>
|
<view:properties>
|
||||||
<cm:name>Records Management Scripts</cm:name>
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
<cm:title>Records Management Scripts</cm:title>
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
<cm:description>Scripts intended for execution in response to RM events.</cm:description>
|
<cm:description>Records management sample script.</cm:description>
|
||||||
</view:properties>
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8</cm:content>
|
||||||
<view:associations>
|
<cm:title>onCreate_supersedes.js</cm:title>
|
||||||
<cm:contains>
|
<cm:name>onCreate_supersedes.js</cm:name>
|
||||||
<!-- TODO Will likely remove this script. Here for test purposes.
|
</view:properties>
|
||||||
Or perhaps replace it with a product-ready script -->
|
</cm:content>
|
||||||
<cm:content view:childName="cm:rma_isClosed.js">
|
</cm:contains>
|
||||||
<view:aspects>
|
</view:associations>
|
||||||
<cm:titled></cm:titled>
|
</cm:folder>
|
||||||
</view:aspects>
|
|
||||||
<view:properties>
|
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
|
||||||
<cm:description>Records management sample script.</cm:description>
|
|
||||||
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js|mimetype=text/javascript|encoding=UTF-8</cm:content>
|
|
||||||
<cm:title>rma_isClosed.js</cm:title>
|
|
||||||
<cm:name>rma_isClosed.js</cm:name>
|
|
||||||
</view:properties>
|
|
||||||
</cm:content>
|
|
||||||
|
|
||||||
<cm:content view:childName="cm:onCreate_supersedes.js">
|
<cm:folder view:childName="cm:records_management_email_templates">
|
||||||
<view:aspects>
|
<view:properties>
|
||||||
<cm:titled></cm:titled>
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
</view:aspects>
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
<view:properties>
|
<sys:node-uuid>records_management_email_templates</sys:node-uuid>
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
<cm:name>Records Management Email Templates</cm:name>
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
<cm:title>Records Management Email Templates</cm:title>
|
||||||
<cm:description>Records management sample script.</cm:description>
|
<cm:description>Email templates for records management.</cm:description>
|
||||||
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8</cm:content>
|
</view:properties>
|
||||||
<cm:title>onCreate_supersedes.js</cm:title>
|
|
||||||
<cm:name>onCreate_supersedes.js</cm:name>
|
|
||||||
</view:properties>
|
|
||||||
</cm:content>
|
|
||||||
</cm:contains>
|
|
||||||
</view:associations>
|
|
||||||
</cm:folder>
|
|
||||||
|
|
||||||
|
<view:associations>
|
||||||
<cm:folder view:childName="cm:records_management_email_templates">
|
<cm:contains>
|
||||||
<view:properties>
|
<cm:content
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
view:childName="cm:notify-records-due-for-review-email.ftl">
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
<view:aspects>
|
||||||
<sys:node-uuid>records_management_email_templates</sys:node-uuid>
|
<cm:titled></cm:titled>
|
||||||
<cm:name>Records Management Email Templates</cm:name>
|
<cm:author></cm:author>
|
||||||
<cm:title>Records Management Email Templates</cm:title>
|
<app:inlineeditable></app:inlineeditable>
|
||||||
<cm:description>Email templates for records management.</cm:description>
|
<cm:versionable></cm:versionable>
|
||||||
</view:properties>
|
</view:aspects>
|
||||||
|
<view:properties>
|
||||||
<view:associations>
|
<app:editInline>
|
||||||
<cm:contains>
|
true
|
||||||
<cm:content
|
</app:editInline>
|
||||||
view:childName="cm:notify-records-due-for-review-email.ftl">
|
<cm:description>Email template for notify records due for review job.</cm:description>
|
||||||
<view:aspects>
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||||
<cm:titled></cm:titled>
|
<cm:title>notify-records-due-for-review-email.ftl</cm:title>
|
||||||
<cm:author></cm:author>
|
<cm:author></cm:author>
|
||||||
<app:inlineeditable></app:inlineeditable>
|
<cm:name>notify-records-due-for-review-email.ftl</cm:name>
|
||||||
<cm:versionable></cm:versionable>
|
<cm:lastPatchUpdate>org_alfresco_module_rm_notificationTemplatePatch</cm:lastPatchUpdate>
|
||||||
</view:aspects>
|
</view:properties>
|
||||||
<view:properties>
|
<view:associations></view:associations>
|
||||||
<app:editInline>
|
</cm:content>
|
||||||
true
|
<cm:content view:childName="cm:record-superseded-email.ftl">
|
||||||
</app:editInline>
|
<view:aspects>
|
||||||
<cm:description>Email template for notify records due for review job.</cm:description>
|
<cm:titled></cm:titled>
|
||||||
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
<cm:author></cm:author>
|
||||||
<cm:title>notify-records-due-for-review-email.ftl</cm:title>
|
<app:inlineeditable></app:inlineeditable>
|
||||||
<cm:author></cm:author>
|
<cm:versionable></cm:versionable>
|
||||||
<cm:name>notify-records-due-for-review-email.ftl</cm:name>
|
</view:aspects>
|
||||||
<cm:lastPatchUpdate>org_alfresco_module_rm_notificationTemplatePatch</cm:lastPatchUpdate>
|
<view:properties>
|
||||||
</view:properties>
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
<view:associations></view:associations>
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
</cm:content>
|
<sys:node-uuid>record_superseded_template</sys:node-uuid>
|
||||||
<cm:content view:childName="cm:record-superseded-email.ftl">
|
<cm:description>Record superseded email template.</cm:description>
|
||||||
<view:aspects>
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8</cm:content>
|
||||||
<cm:titled></cm:titled>
|
<cm:title>record-superseded-email.ftl</cm:title>
|
||||||
<cm:author></cm:author>
|
<cm:name>record-superseded-email.ftl</cm:name>
|
||||||
<app:inlineeditable></app:inlineeditable>
|
<cm:lastPatchUpdate>org_alfresco_module_rm_notificationTemplatePatch</cm:lastPatchUpdate>
|
||||||
<cm:versionable></cm:versionable>
|
</view:properties>
|
||||||
</view:aspects>
|
</cm:content>
|
||||||
<view:properties>
|
<cm:content view:childName="cm:record-rejected-email.ftl">
|
||||||
<sys:store-protocol>workspace</sys:store-protocol>
|
<view:aspects>
|
||||||
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
<cm:titled></cm:titled>
|
||||||
<sys:node-uuid>record_superseded_template</sys:node-uuid>
|
<cm:author></cm:author>
|
||||||
<cm:description>Record superseded email template.</cm:description>
|
<app:inlineeditable></app:inlineeditable>
|
||||||
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8</cm:content>
|
<cm:versionable></cm:versionable>
|
||||||
<cm:title>record-superseded-email.ftl</cm:title>
|
</view:aspects>
|
||||||
<cm:name>record-superseded-email.ftl</cm:name>
|
<view:properties>
|
||||||
<cm:lastPatchUpdate>org_alfresco_module_rm_notificationTemplatePatch</cm:lastPatchUpdate>
|
<sys:store-protocol>workspace</sys:store-protocol>
|
||||||
|
<sys:store-identifier>SpacesStore</sys:store-identifier>
|
||||||
</view:properties>
|
<sys:node-uuid>record_rejected_template</sys:node-uuid>
|
||||||
</cm:content>
|
<cm:description>Record rejected email template.</cm:description>
|
||||||
</cm:contains>
|
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl|mimetype=text/plain|encoding=UTF-8</cm:content>
|
||||||
</view:associations>
|
<cm:title>record-rejected-email.ftl</cm:title>
|
||||||
</cm:folder>
|
<cm:name>record-rejected-email.ftl</cm:name>
|
||||||
|
<cm:lastPatchUpdate>org_alfresco_module_rm_notificationTemplatePatch</cm:lastPatchUpdate>
|
||||||
|
</view:properties>
|
||||||
|
</cm:content>
|
||||||
|
</cm:contains>
|
||||||
|
</view:associations>
|
||||||
|
</cm:folder>
|
||||||
</cm:contains>
|
</cm:contains>
|
||||||
</view:associations>
|
</view:associations>
|
||||||
|
|
||||||
|
@@ -0,0 +1,120 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style type="text/css"><!--
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #4c4c4c;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:visited
|
||||||
|
{
|
||||||
|
color: #0072cf;
|
||||||
|
}
|
||||||
|
--></style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body bgcolor="#dddddd">
|
||||||
|
<table width="100%" cellpadding="20" cellspacing="0" border="0" bgcolor="#dddddd">
|
||||||
|
<tr>
|
||||||
|
<td width="100%" align="center">
|
||||||
|
<table width="70%" cellpadding="0" cellspacing="0" bgcolor="white" style="background-color: white; border: 1px solid #aaaaaa;">
|
||||||
|
<tr>
|
||||||
|
<td width="100%">
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 10px 30px 0px;">
|
||||||
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="${shareUrl}/res/components/images/task-64.png" alt="" width="64" height="64" border="0" style="padding-right: 20px;" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div style="font-size: 22px; padding-bottom: 4px;">
|
||||||
|
Record has been rejected
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 13px;">
|
||||||
|
${args.rejectDate?datetime?string.full}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;">
|
||||||
|
<p>Hello ${args.userName},</p>
|
||||||
|
|
||||||
|
<p>${args.rejectedPerson} has rejected the following record with this reason:</p>
|
||||||
|
|
||||||
|
<p>${args.rejectReason}</p>
|
||||||
|
|
||||||
|
<table cellpadding="0" callspacing="0" border="0" bgcolor="#eeeeee" style="padding:10px; border: 1px solid #aaaaaa;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td valign="top">
|
||||||
|
<img src="${shareUrl}/res/rm/components/documentlibrary/images/record-64.png" alt="" width="64" height="64" border="0" style="padding-right: 10px;" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table cellpadding="2" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td><b>${args.record.properties["rma:identifier"]!} ${args.record.name}</b></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Click on this link to view the record:</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id}">
|
||||||
|
${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td><div style="border-top: 1px solid #aaaaaa; margin:12px;"></div></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>Sincerely,<br />
|
||||||
|
Alfresco ${productName!""}</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div style="border-top: 1px solid #aaaaaa;"> </div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 0px 30px; font-size: 13px;">
|
||||||
|
To find out more about Alfresco ${productName!""} visit <a href="http://www.alfresco.com">http://www.alfresco.com</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div style="border-bottom: 1px solid #aaaaaa;"> </div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 10px 30px;">
|
||||||
|
<img src="${shareUrl}/themes/default/images/app-logo.png" alt="" width="117" height="48" border="0" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,2 +1,3 @@
|
|||||||
notification.dueforreview.subject=Records Due For Review Notification
|
notification.dueforreview.subject=Records Due For Review Notification
|
||||||
notification.superseded.subject=Record Superseded Notification
|
notification.superseded.subject=Record Superseded Notification
|
||||||
|
notification.rejected.subject=Record Rejected Notification
|
@@ -1101,7 +1101,7 @@
|
|||||||
<property name="policyComponent" ref="policyComponent" />
|
<property name="policyComponent" ref="policyComponent" />
|
||||||
<property name="dispositionService" ref="DispositionService" />
|
<property name="dispositionService" ref="DispositionService" />
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
<property name="notificationService" ref="NotificationService"/>
|
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="RecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="RecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.notification;
|
package org.alfresco.module.org_alfresco_module_rm.notification;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -26,6 +27,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
||||||
import org.alfresco.repo.notification.EMailNotificationProvider;
|
import org.alfresco.repo.notification.EMailNotificationProvider;
|
||||||
@@ -46,6 +48,7 @@ import org.alfresco.service.cmr.site.SiteInfo;
|
|||||||
import org.alfresco.service.cmr.site.SiteService;
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
@@ -56,13 +59,14 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class RecordsManagementNotificationHelper
|
public class RecordsManagementNotificationHelper implements RecordsManagementModel
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(RecordsManagementNotificationHelper.class);
|
private static Log logger = LogFactory.getLog(RecordsManagementNotificationHelper.class);
|
||||||
|
|
||||||
/** I18n */
|
/** I18n */
|
||||||
private static final String MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW = "notification.dueforreview.subject";
|
private static final String MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW = "notification.dueforreview.subject";
|
||||||
private static final String MSG_SUBJECT_RECORD_SUPERCEDED = "notification.superseded.subject";
|
private static final String MSG_SUBJECT_RECORD_SUPERCEDED = "notification.superseded.subject";
|
||||||
|
private static final String MSG_SUBJECT_RECORD_REJECTED = "notification.rejected.subject";
|
||||||
|
|
||||||
/** Defaults */
|
/** Defaults */
|
||||||
private static final String DEFAULT_SITE = "rm";
|
private static final String DEFAULT_SITE = "rm";
|
||||||
@@ -84,6 +88,7 @@ public class RecordsManagementNotificationHelper
|
|||||||
/** EMail notification templates */
|
/** EMail notification templates */
|
||||||
private NodeRef supersededTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_superseded_template");
|
private NodeRef supersededTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_superseded_template");
|
||||||
private NodeRef dueForReviewTemplate;
|
private NodeRef dueForReviewTemplate;
|
||||||
|
private NodeRef rejectedTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_rejected_template");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param notificationService notification service
|
* @param notificationService notification service
|
||||||
@@ -173,6 +178,14 @@ public class RecordsManagementNotificationHelper
|
|||||||
return supersededTemplate;
|
return supersededTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return rejected email template
|
||||||
|
*/
|
||||||
|
public NodeRef getRejectedTemplate()
|
||||||
|
{
|
||||||
|
return rejectedTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return due for review email template
|
* @return due for review email template
|
||||||
*/
|
*/
|
||||||
@@ -291,6 +304,55 @@ public class RecordsManagementNotificationHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends record rejected email notification.
|
||||||
|
*
|
||||||
|
* @param record rejected record
|
||||||
|
* @param reason reason for rejection
|
||||||
|
* @param userId the user id who rejected the record
|
||||||
|
*/
|
||||||
|
public void recordRejectedEmailNotification(NodeRef record, String reason, String userId)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatory("record", record);
|
||||||
|
ParameterCheck.mandatoryString("reason", reason);
|
||||||
|
ParameterCheck.mandatoryString("userId", userId);
|
||||||
|
|
||||||
|
String recordCreator = (String) nodeService.getProperty(record, PROP_RECORD_USER_ID);
|
||||||
|
if (StringUtils.isNotBlank(recordCreator) == true)
|
||||||
|
{
|
||||||
|
SiteInfo site = siteService.getSite(record);
|
||||||
|
if (site == null)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Could not find the site which should contain the node '" + record.toString() + "'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
NotificationContext notificationContext = new NotificationContext();
|
||||||
|
|
||||||
|
notificationContext.addTo(recordCreator);
|
||||||
|
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_REJECTED));
|
||||||
|
notificationContext.setBodyTemplate(getRejectedTemplate());
|
||||||
|
|
||||||
|
Map<String, Serializable> args = new HashMap<String, Serializable>(6);
|
||||||
|
args.put("site", site.getShortName());
|
||||||
|
args.put("record", record);
|
||||||
|
args.put("userName", recordCreator);
|
||||||
|
args.put("rejectReason", reason);
|
||||||
|
args.put("rejectDate", new Date());
|
||||||
|
args.put("rejectedPerson", userId);
|
||||||
|
|
||||||
|
notificationContext.setTemplateArgs(args);
|
||||||
|
|
||||||
|
notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isWarnEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.warn("Unable to send record rejected email notification, because notification user was empty.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the rm root given a context node.
|
* Gets the rm root given a context node.
|
||||||
*
|
*
|
||||||
|
@@ -52,6 +52,7 @@ public class NotificationTemplatePatch extends AbstractModuleComponent
|
|||||||
|
|
||||||
private static final String PATH_DUE_FOR_REVIEW = "alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl";
|
private static final String PATH_DUE_FOR_REVIEW = "alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl";
|
||||||
private static final String PATH_SUPERSEDED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl";
|
private static final String PATH_SUPERSEDED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl";
|
||||||
|
private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl";
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(NotificationTemplatePatch.class);
|
private static Log logger = LogFactory.getLog(NotificationTemplatePatch.class);
|
||||||
@@ -139,6 +140,9 @@ public class NotificationTemplatePatch extends AbstractModuleComponent
|
|||||||
|
|
||||||
NodeRef dueForReviewTemplate = notificationHelper.getDueForReviewTemplate();
|
NodeRef dueForReviewTemplate = notificationHelper.getDueForReviewTemplate();
|
||||||
updateTemplate(dueForReviewTemplate, PATH_DUE_FOR_REVIEW);
|
updateTemplate(dueForReviewTemplate, PATH_DUE_FOR_REVIEW);
|
||||||
|
|
||||||
|
NodeRef rejectedTemplate = notificationHelper.getRejectedTemplate();
|
||||||
|
updateTemplate(rejectedTemplate, PATH_REJECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -36,20 +36,18 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.notification.EMailNotificationProvider;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.notification.NotificationContext;
|
|
||||||
import org.alfresco.service.cmr.notification.NotificationService;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -57,11 +55,9 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.mail.MailPreparationException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record service implementation
|
* Record service implementation
|
||||||
@@ -101,8 +97,8 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
/** File plan service */
|
/** File plan service */
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
/** Notification service */
|
/** Records management notification helper */
|
||||||
private NotificationService notificationService;
|
private RecordsManagementNotificationHelper notificationHelper;
|
||||||
|
|
||||||
/** Policy component */
|
/** Policy component */
|
||||||
private PolicyComponent policyComponent;
|
private PolicyComponent policyComponent;
|
||||||
@@ -187,11 +183,11 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param notificationService notification service
|
* @param notificationHelper notification helper
|
||||||
*/
|
*/
|
||||||
public void setNotificationService(NotificationService notificationService)
|
public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper)
|
||||||
{
|
{
|
||||||
this.notificationService = notificationService;
|
this.notificationHelper = notificationHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -455,6 +451,9 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
ParameterCheck.mandatory("NodeRef", nodeRef);
|
ParameterCheck.mandatory("NodeRef", nodeRef);
|
||||||
ParameterCheck.mandatoryString("Reason", reason);
|
ParameterCheck.mandatoryString("Reason", reason);
|
||||||
|
|
||||||
|
// Save the id of the currently logged in user
|
||||||
|
final String userId = AuthenticationUtil.getRunAsUser();
|
||||||
|
|
||||||
// do the work of rejecting the record as the system user
|
// do the work of rejecting the record as the system user
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
{
|
{
|
||||||
@@ -490,23 +489,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
extendedSecurityService.removeAllExtendedReaders(nodeRef);
|
extendedSecurityService.removeAllExtendedReaders(nodeRef);
|
||||||
|
|
||||||
// Send an email to the record creator
|
// Send an email to the record creator
|
||||||
String recordCreator = (String) nodeService.getProperty(nodeRef, PROP_RECORD_USER_ID);
|
notificationHelper.recordRejectedEmailNotification(nodeRef, reason, userId);
|
||||||
if (StringUtils.isNotBlank(recordCreator))
|
|
||||||
{
|
|
||||||
NotificationContext context = new NotificationContext();
|
|
||||||
|
|
||||||
context.addTo(recordCreator);
|
|
||||||
// FIXME: Subject -> i18n
|
|
||||||
context.setSubject("Record rejected");
|
|
||||||
// FIXME: Use email template
|
|
||||||
context.setBody(reason);
|
|
||||||
|
|
||||||
notificationService.sendNotification(EMailNotificationProvider.NAME, context);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new MailPreparationException("The id of the record creator cannot be found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user