mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-10424: Add Task 'Message' text in workflow email notification
* Added missing patch to update templates. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31300 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -433,3 +433,6 @@ patch.nodeTemplatesFolder.description=Patch to create new Data Dictionary folder
|
||||
|
||||
patch.sitesSpacePermissions.description=Patch to remove the EVERYONE Contributor permissions on the Sites Space (parent container of all Sites)
|
||||
patch.sitesSpacePermissions.result=Permissions corrected.
|
||||
|
||||
patch.updateWorkflowNotificationTemplates.description=Patch to update the workflow notification templates.
|
||||
patch.updateWorkflowNotificationTemplates.result=Workflow Notification Templates successfully updated.
|
||||
|
@@ -3063,4 +3063,16 @@
|
||||
<property name="importerBootstrap" ref="spacesBootstrap" />
|
||||
</bean>
|
||||
|
||||
<bean id="patch.updateWorkflowNotificationTemplates" class="org.alfresco.repo.admin.patch.impl.UpdateWorkflowNotificationTemplatesPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.updateWorkflowNotificationTemplates</value></property>
|
||||
<property name="description"><value>patch.updateWorkflowNotificationTemplates.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>5018</value></property>
|
||||
<property name="targetSchema"><value>5019</value></property>
|
||||
<property name="requiresTransaction"><value>true</value></property>
|
||||
<property name="applyToTenants"><value>true</value></property>
|
||||
<property name="contentService" ref="ContentService"/>
|
||||
<property name="fileFolderService" ref="FileFolderService"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
@@ -19,4 +19,4 @@ version.build=@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
version.schema=5018
|
||||
version.schema=5019
|
||||
|
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 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.repo.admin.patch.impl;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.workflow.WorkflowNotificationUtils;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Update workflow notification templates patch
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class UpdateWorkflowNotificationTemplatesPatch extends AbstractPatch
|
||||
{
|
||||
private ContentService contentService;
|
||||
|
||||
private FileFolderService fileFolderService;
|
||||
|
||||
private static final String PATH = "alfresco/bootstrap/notification/";
|
||||
private static final String BASE_FILE = "wf-email.html.ftl";
|
||||
private static final String DE_FILE = "wf-email.html_de.ftl";
|
||||
private static final String ES_FILE = "wf-email.html_es.ftl";
|
||||
private static final String FR_FILE = "wf-email.html_fr.ftl";
|
||||
private static final String IT_FILE = "wf-email.html_it.ftl";
|
||||
private static final String JA_FILE = "wf-email.html_ja.ftl";
|
||||
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
public void setFileFolderService(FileFolderService fileFolderService)
|
||||
{
|
||||
this.fileFolderService = fileFolderService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.admin.patch.AbstractPatch#applyInternal()
|
||||
*/
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
NodeRef baseTemplate = WorkflowNotificationUtils.WF_ASSIGNED_TEMPLATE;
|
||||
if (nodeService.exists(baseTemplate) == true)
|
||||
{
|
||||
updateContent(baseTemplate, PATH, BASE_FILE);
|
||||
updateSiblingContent(baseTemplate, PATH, DE_FILE);
|
||||
updateSiblingContent(baseTemplate, PATH, ES_FILE);
|
||||
updateSiblingContent(baseTemplate, PATH, FR_FILE);
|
||||
updateSiblingContent(baseTemplate, PATH, IT_FILE);
|
||||
updateSiblingContent(baseTemplate, PATH, JA_FILE);
|
||||
}
|
||||
|
||||
return I18NUtil.getMessage("patch.updateWorkflowNotificationTemplates.result");
|
||||
}
|
||||
|
||||
private void updateSiblingContent(NodeRef nodeRef, String path, String fileName)
|
||||
{
|
||||
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
if (parent != null)
|
||||
{
|
||||
NodeRef sibling = fileFolderService.searchSimple(parent, fileName);
|
||||
if (sibling != null)
|
||||
{
|
||||
updateContent(sibling, path, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateContent(NodeRef nodeRef, String path, String fileName)
|
||||
{
|
||||
// Make versionable
|
||||
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
|
||||
|
||||
// Update content
|
||||
InputStream is = this.getClass().getClassLoader().getResourceAsStream(path + fileName);
|
||||
if (is != null)
|
||||
{
|
||||
ContentWriter contentWriter = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter.putContent(is);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -60,7 +60,7 @@ public abstract class WorkflowNotificationUtils
|
||||
public static final String ARG_WF_DOCUMENTS = "workflowDocuments";
|
||||
|
||||
/** Standard workflow assigned template */
|
||||
private static final NodeRef WF_ASSIGNED_TEMPLATE = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "wf-email-html-ftl");
|
||||
public static final NodeRef WF_ASSIGNED_TEMPLATE = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "wf-email-html-ftl");
|
||||
|
||||
/**
|
||||
*
|
||||
|
Reference in New Issue
Block a user