mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-631 (The records management team can create a rule to request information about an undeclared record)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@49082 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -481,7 +481,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="broadcastVitalRecordDefinition"
|
||||
<bean id="broadcastVitalRecordDefinition"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.vital.BroadcastVitalRecordDefinitionAction"
|
||||
parent="rmAction">
|
||||
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
|
||||
@@ -725,7 +725,6 @@
|
||||
<property name="allowParameterSubstitutions" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="requestInfo_proxy" parent="rmProxyAction">
|
||||
<property name="target" ref="requestInfo"/>
|
||||
<property name="interceptorNames">
|
||||
@@ -737,7 +736,7 @@
|
||||
|
||||
<bean id="requestInfo" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RequestInfoAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="workflowService" ref="WorkflowService"/>
|
||||
</bean>
|
||||
-->
|
||||
|
||||
</beans>
|
@@ -18,14 +18,24 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.workflow.RMWorkflowModel;
|
||||
import org.apache.axis.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* Request info action for starting a workflow to request more information for an undeclared record
|
||||
@@ -42,13 +52,34 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
|
||||
/** Action name */
|
||||
public static final String NAME = "requestInfo";
|
||||
|
||||
/** Workflow definition name */
|
||||
private static final String REQUEST_INFO_WORKFLOW_DEFINITION_NAME = "activiti$activitiRequestForInformation";
|
||||
|
||||
/** Workflow service */
|
||||
private WorkflowService workflowService;
|
||||
|
||||
/**
|
||||
* @param workflowService workflow service
|
||||
*/
|
||||
public void setWorkflowService(WorkflowService workflowService)
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// FIXME
|
||||
String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId();
|
||||
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
|
||||
|
||||
parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef));
|
||||
parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action));
|
||||
parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action));
|
||||
|
||||
workflowService.startWorkflow(workflowDefinitionId, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,4 +91,50 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO)));
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for creating a workflow package to contain the actioned upon nodeRef
|
||||
*
|
||||
* @param action The request info action
|
||||
* @param actionedUponNodeRef The actioned upon nodeRef
|
||||
* @return Returns a workflow package containing the actioned upon nodeRef
|
||||
*/
|
||||
private NodeRef getWorkflowPackage(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService));
|
||||
workflowPackage = workflowService.createPackage(workflowPackage);
|
||||
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(actionedUponNodeRef);
|
||||
nodeService.addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName());
|
||||
return workflowPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for getting the assignees from the action
|
||||
*
|
||||
* @param action The request info action
|
||||
* @return Returns a list of {@link NodeRef}s each representing the assignee
|
||||
*/
|
||||
private Serializable getAssignees(Action action)
|
||||
{
|
||||
List<NodeRef> assigneesList = new ArrayList<NodeRef>();
|
||||
String assigneesAsString = (String) action.getParameterValue(PARAM_ASSIGNEES);
|
||||
String[] assignees = StringUtils.split(assigneesAsString, ',');
|
||||
for (String assignee : assignees)
|
||||
{
|
||||
assigneesList.add(new NodeRef(assignee));
|
||||
}
|
||||
return (Serializable) assigneesList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for getting the requested information from the action
|
||||
*
|
||||
* @param action The request info action
|
||||
* @return Return the requested information
|
||||
*/
|
||||
private Serializable getRequestedInformation(Action action)
|
||||
{
|
||||
return action.getParameterValue(PARAM_REQUESTED_INFO);
|
||||
}
|
||||
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.workflow;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Workflow Constants for Records Management
|
||||
*
|
||||
* @author Tuna Aksoy
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface RMWorkflowModel
|
||||
{
|
||||
// Namespace URI
|
||||
public static String RM_WORKFLOW_URI = "http://www.alfresco.org/model/rmworkflow/1.0";
|
||||
|
||||
// Namespace prefix
|
||||
public static String RM_WORKFLOW_PREFIX = "rmwf";
|
||||
|
||||
// Mixed Assignees
|
||||
public static QName RM_MIXED_ASSIGNEES = QName.createQName(RM_WORKFLOW_URI, "mixedAssignees");
|
||||
|
||||
// Requested Information
|
||||
public static QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation");
|
||||
}
|
Reference in New Issue
Block a user