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@46309 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,24 @@
|
|||||||
<property name="auditService" ref="AuditService"/>
|
<property name="auditService" ref="AuditService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="org_alfresco_module_rm_notificationTemplatePatch_v21"
|
||||||
|
parent="module.baseComponent"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.patch.NotificationTemplatePatch_v21">
|
||||||
|
<property name="moduleId" value="org_alfresco_module_rm"/>
|
||||||
|
<property name="name" value="org_alfresco_module_rm_notificationTemplatePatch_v21"/>
|
||||||
|
<property name="description" value="Patches new versions of the notification templates."/>
|
||||||
|
<property name="sinceVersion" value="2.1"/>
|
||||||
|
<property name="appliesFromVersion" value="2.1"/>
|
||||||
|
<property name="dependsOn">
|
||||||
|
<list>
|
||||||
|
<ref bean="org_alfresco_module_rm_bootstrapData" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService" ref="NodeService"/>
|
||||||
|
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
|
||||||
|
<property name="contentService" ref="ContentService"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="org_alfresco_module_rm_RMv2ModelPatch"
|
<bean id="org_alfresco_module_rm_RMv2ModelPatch"
|
||||||
parent="module.baseComponent"
|
parent="module.baseComponent"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.patch.RMv2ModelPatch">
|
class="org.alfresco.module.org_alfresco_module_rm.patch.RMv2ModelPatch">
|
||||||
|
@@ -52,7 +52,6 @@ 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);
|
||||||
@@ -140,9 +139,6 @@ 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.patch;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
|
||||||
|
import org.alfresco.repo.module.AbstractModuleComponent;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.springframework.beans.factory.BeanNameAware;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new email template for rejected records to the existing templates
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since v2.1
|
||||||
|
*/
|
||||||
|
public class NotificationTemplatePatch_v21 extends AbstractModuleComponent
|
||||||
|
implements BeanNameAware
|
||||||
|
{
|
||||||
|
/** Email template path */
|
||||||
|
private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl";
|
||||||
|
|
||||||
|
/** Reject template config node id*/
|
||||||
|
private static final String CONFIG_NODEID = "record_rejected_template";
|
||||||
|
|
||||||
|
/** Records management notification helper */
|
||||||
|
private RecordsManagementNotificationHelper notificationHelper;
|
||||||
|
|
||||||
|
/** Node service */
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
/** Content service */
|
||||||
|
private ContentService contentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param notificationHelper notification helper
|
||||||
|
*/
|
||||||
|
public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper)
|
||||||
|
{
|
||||||
|
this.notificationHelper = notificationHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param nodeService node service
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param contentService content service
|
||||||
|
*/
|
||||||
|
public void setContentService(ContentService contentService)
|
||||||
|
{
|
||||||
|
this.contentService = contentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void executeInternal() throws Throwable
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
|
||||||
|
if (nodeService.exists(nodeRef) == false)
|
||||||
|
{
|
||||||
|
// get the parent node
|
||||||
|
NodeRef supersededTemplate = notificationHelper.getSupersededTemplate();
|
||||||
|
NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef();
|
||||||
|
|
||||||
|
// build the node properties
|
||||||
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
|
||||||
|
props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template.");
|
||||||
|
props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl");
|
||||||
|
props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl");
|
||||||
|
props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template");
|
||||||
|
|
||||||
|
// get the assoc qname
|
||||||
|
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl"));
|
||||||
|
|
||||||
|
// create the node
|
||||||
|
ChildAssociationRef node = nodeService.createNode(parent,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
|
assocQName,
|
||||||
|
ContentModel.TYPE_CONTENT,
|
||||||
|
props);
|
||||||
|
|
||||||
|
// put the content
|
||||||
|
ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true);
|
||||||
|
InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED);
|
||||||
|
writer.putContent(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user