diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
index 68a6f5465b..f86d0288c7 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties
@@ -29,3 +29,6 @@ fileTo.createRecordFolder.display-label=Create Record Folder
reject.title=Reject
reject.description=Rejects a record and moves the document to its original location
reject.reason.display-label=Reject reason
+# Request Information
+requestInfo.title=Request Information
+requestInfo.description=Starts a workflow for requesting more information for a record
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
index f9f4076d06..6b5daa05a0 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml
@@ -11,23 +11,23 @@
-
+
-
-
-
+
-
+
-
+
@@ -722,4 +722,19 @@
+
+
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml
index 3f3f30d59d..6f843caa09 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml
@@ -18,13 +18,10 @@
alfresco/workflow/rmWorkflowModel.xml
-
-
\ No newline at end of file
diff --git a/rm-server/config/alfresco/workflow/rm-workflow-messages.properties b/rm-server/config/alfresco/workflow/rm-workflow-messages.properties
new file mode 100644
index 0000000000..757f0224bd
--- /dev/null
+++ b/rm-server/config/alfresco/workflow/rm-workflow-messages.properties
@@ -0,0 +1,5 @@
+activitiReviewPooled.workflow.info.requested=Information requested for record
+activitiReviewPooled.workflow.info.provided=Information provided for record
+activitiReviewPooled.workflow.email.subject=Information provided for the record
+activitiReviewPooled.workflow.email.body1=The user
+activitiReviewPooled.workflow.email.body2=has provided the needed information for the record
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java
new file mode 100644
index 0000000000..4a11da5dc5
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java
@@ -0,0 +1,42 @@
+/*
+ * 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 .
+ */
+package org.alfresco.module.org_alfresco_module_rm.action.impl;
+
+import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
+import org.alfresco.service.cmr.action.Action;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * FIXME
+ *
+ * @author Tuna Aksoy
+ * @since 2.1
+ */
+public class RequestInfoAction extends RMActionExecuterAbstractBase
+{
+ /** Action name */
+ public static final String NAME = "requestInfo";
+
+ @Override
+ protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
+ {
+ // FIXME
+ }
+
+}
diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java
index d402d08c26..8d180aee97 100644
--- a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java
+++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java
@@ -24,17 +24,12 @@ import java.util.Map;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
-import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
-import org.activiti.engine.impl.context.Context;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
-import org.alfresco.repo.workflow.activiti.ActivitiConstants;
import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
import org.alfresco.repo.workflow.activiti.ActivitiScriptNodeList;
-import org.alfresco.service.ServiceRegistry;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.ParameterCheck;
+import org.springframework.extensions.surf.util.I18NUtil;
/**
* An assignment handler for the request info workflow.
@@ -56,7 +51,7 @@ public class RequestInfoAssignmentHandler implements TaskListener
ParameterCheck.mandatory("delegateTask", delegateTask);
// Set the workflow description for the task
- delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(delegateTask));
+ delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(RequestInfoUtils.getRecordName(delegateTask)));
// Get the list of user(s) and/or group(s)
ActivitiScriptNodeList usersAndGroups = (ActivitiScriptNodeList) delegateTask.getVariable("rmwf_mixedAssignees");
@@ -115,42 +110,20 @@ public class RequestInfoAssignmentHandler implements TaskListener
}
}
- private String getWorkflowDescription(DelegateTask delegateTask)
- {
- // FIXME: I18N!!!
- return "Information requested for record '" + getRecordName(delegateTask) + "'";
- }
-
- private String getRecordName(DelegateTask delegateTask)
- {
- ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package");
- NodeService nodeService = getServiceRegistry().getNodeService();
- NodeRef docRef= nodeService.getChildAssocs(scriptNode.getNodeRef()).get(0).getChildRef();
- return (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME);
- }
-
- //FIXME: Is there a better way to call services?
-
/**
- * Helper method for getting the service registry in order to call services
+ * Helper method for building the workflow description
*
- * @return Returns the service registry
+ * @param recordName The name of the record
+ * @return Returns the workflow description
*/
- private ServiceRegistry getServiceRegistry()
+ private String getWorkflowDescription(String recordName)
{
- ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
- if (config != null)
- {
- // Fetch the registry that is injected in the activiti spring-configuration
- ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
- if (registry == null)
- {
- throw new RuntimeException(
- "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
- ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
- }
- return registry;
- }
- throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
+ StringBuilder sb = new StringBuilder();
+ sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.requested"));
+ sb.append(" '");
+ sb.append(recordName);
+ sb.append("'");
+ return sb.toString();
}
+
}
diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
index eb3335916b..4e7c575b85 100644
--- a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
+++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
@@ -20,18 +20,11 @@ package org.alfresco.workflow.requestInfo;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
-import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
-import org.activiti.engine.impl.context.Context;
-import org.alfresco.model.ContentModel;
import org.alfresco.repo.notification.EMailNotificationProvider;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.repo.workflow.activiti.ActivitiConstants;
-import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
-import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.notification.NotificationContext;
-import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.ParameterCheck;
+import org.springframework.extensions.surf.util.I18NUtil;
/**
* Request info workflow notifier.
@@ -51,11 +44,14 @@ public class RequestInfoNotifier implements TaskListener
{
ParameterCheck.mandatory("delegateTask", delegateTask);
+ // Get the record name
+ String recordName = RequestInfoUtils.getRecordName(delegateTask);
+
// Set the workflow description for the task
- delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(delegateTask));
+ delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(recordName));
// Assign the task to the initiator
- String initiator = getInitiator(delegateTask);
+ String initiator = RequestInfoUtils.getInitiator(delegateTask);
delegateTask.setAssignee(initiator);
// Create the context and send an email to the initiator
@@ -63,71 +59,62 @@ public class RequestInfoNotifier implements TaskListener
notificationContext.setAsyncNotification(true);
notificationContext.setIgnoreNotificationFailure(true);
notificationContext.addTo(initiator);
- // FIXME: I18N!!! and get the record name and the user name who provided the information
- notificationContext.setSubject("Information provided for the record '" + "" + "'.");
- notificationContext.setBody("The user '" + "' has provided the needed information for the record '" + "" + "'.");
+ notificationContext.setSubject(getEmailSubject(recordName));
+ notificationContext.setBody(getEmailBody(recordName));
// Send the email
- getServiceRegistry().getNotificationService().sendNotification(EMailNotificationProvider.NAME, notificationContext);
+ RequestInfoUtils.getServiceRegistry().getNotificationService().sendNotification(EMailNotificationProvider.NAME, notificationContext);
}
/**
- * Helper method to extract the initiator from the task
+ * Helper method for building the workflow description
*
- * @param delegateTask The delegate task
- * @return Returns the initiator of the workflow. If the initiator does not exist the admin user will be returned.
+ * @param recordName The name of the record
+ * @return Returns the workflow description
*/
- private String getInitiator(DelegateTask delegateTask)
+ private String getWorkflowDescription(String recordName)
{
- String userName = null;
- ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator");
- if (initiator.exists())
- {
- userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString());
- }
- else
- {
- userName = AuthenticationUtil.getAdminUserName();
- }
- return userName;
+ StringBuilder sb = new StringBuilder();
+ sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.provided"));
+ sb.append(" '");
+ sb.append(recordName);
+ sb.append("'");
+ return sb.toString();
}
- private String getWorkflowDescription(DelegateTask delegateTask)
- {
- // FIXME: I18N!!!
- return "Information provided for record '" + getRecordName(delegateTask) + "'";
- }
-
- private String getRecordName(DelegateTask delegateTask)
- {
- ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package");
- NodeService nodeService = getServiceRegistry().getNodeService();
- NodeRef docRef= nodeService.getChildAssocs(scriptNode.getNodeRef()).get(0).getChildRef();
- return (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME);
- }
-
- //FIXME: Is there a better way to call services?
-
/**
- * Helper method for getting the service registry in order to call services
+ * Helper method for building the email subject
*
- * @return Returns the service registry
+ * @param recordName The name of the record
+ * @return Returns the email subject
*/
- private ServiceRegistry getServiceRegistry()
+ private String getEmailSubject(String recordName)
{
- ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
- if (config != null)
- {
- // Fetch the registry that is injected in the activiti spring-configuration
- ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
- if (registry == null)
- {
- throw new RuntimeException(
- "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
- ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
- }
- return registry;
- }
- throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
+ StringBuilder sb = new StringBuilder();
+ sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.subject"));
+ sb.append(" '");
+ sb.append(recordName);
+ sb.append("'");
+ return sb.toString();
+ }
+
+ /**
+ * Helper method for building the email body
+ *
+ * @param recordName The name of the record
+ * @return Returns the email body
+ */
+ private String getEmailBody(String recordName)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.body1"));
+ sb.append(" '");
+ sb.append(AuthenticationUtil.getFullyAuthenticatedUser());
+ sb.append("' ");
+ sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.body2"));
+ sb.append(" '");
+ sb.append(recordName);
+ sb.append("'.");
+ return sb.toString();
}
}
diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java
new file mode 100644
index 0000000000..165a9a993c
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java
@@ -0,0 +1,119 @@
+/*
+ * 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 .
+ */
+package org.alfresco.workflow.requestInfo;
+
+import java.util.List;
+
+import org.activiti.engine.delegate.DelegateTask;
+import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.activiti.engine.impl.context.Context;
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.workflow.activiti.ActivitiConstants;
+import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
+import org.alfresco.service.ServiceRegistry;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.util.ParameterCheck;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Util class for the request info workflow
+ *
+ * @author Tuna Aksoy
+ * @since 2.1
+ */
+public class RequestInfoUtils
+{
+ //FIXME: Is there a better way to call services?
+
+ /**
+ * Helper method to get the service registry in order to call services
+ *
+ * @return Returns the service registry
+ */
+ public static ServiceRegistry getServiceRegistry()
+ {
+ ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
+ if (config != null)
+ {
+ // Fetch the registry that is injected in the activiti spring-configuration
+ ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
+ if (registry == null)
+ {
+ throw new RuntimeException(
+ "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
+ ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
+ }
+ return registry;
+ }
+ throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context");
+ }
+
+ /**
+ * Helper method to extract the record name from the task
+ *
+ * @param delegateTask The delegate task
+ * @return Returns the name of the record or an empty string if the record name could not be found
+ (may be because the record has been deleted in the mean time)
+ */
+ public static String getRecordName(DelegateTask delegateTask)
+ {
+ ParameterCheck.mandatory("delegateTask", delegateTask);
+
+ String recordName = StringUtils.EMPTY;
+
+ NodeService nodeService = getServiceRegistry().getNodeService();
+ ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package");
+ List childAssocs = nodeService.getChildAssocs(scriptNode.getNodeRef());
+
+ if (childAssocs.size() > 0)
+ {
+ NodeRef docRef= childAssocs.get(0).getChildRef();
+ recordName = (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME);
+ }
+
+ return recordName;
+ }
+
+ /**
+ * Helper method to extract the initiator from the task
+ *
+ * @param delegateTask The delegate task
+ * @return Returns the initiator of the workflow. If the initiator does not exist the admin user name will be returned.
+ */
+ public static String getInitiator(DelegateTask delegateTask)
+ {
+ ParameterCheck.mandatory("delegateTask", delegateTask);
+
+ String userName = null;
+ ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator");
+ if (initiator.exists())
+ {
+ userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString());
+ }
+ else
+ {
+ userName = AuthenticationUtil.getAdminUserName();
+ }
+ return userName;
+ }
+
+}