Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

105791: Merged 5.0.N (5.0.3) to HEAD-BUG-FIX (5.1/Cloud)
      105689: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.3)
         105571: Merged DEV to V4.2-BUG-FIX (4.2.5)
            103740: MNT-13855: Completing a a workflow on Mobile results in "Approve" being reported as "Rejected" in Alfresco 4.2.3 and 5.0, and no result in 4.2.1
               - Updated sequence of actions to complete a task.
            104919: MNT-13855: Completing a a workflow on Mobile results in "Approve" being reported as "Rejected" in Alfresco 4.2.3 and 5.0, and no result in 4.2.1
               - Implemented unit test.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@105946 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-06-11 13:25:13 +00:00
parent 66a3746065
commit b2885d7349
2 changed files with 34 additions and 5 deletions

View File

@@ -869,11 +869,13 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
}
break;
case COMPLETED:
setOutcome(localVariables, taskId);
if (localVariables.size() > 0)
{
activitiProcessEngine.getTaskService().setVariablesLocal(taskId, localVariables);
}
setOutcome(taskId);
if (globalVariables.size() > 0)
{
activitiProcessEngine.getTaskService().complete(taskId, globalVariables);
@@ -900,11 +902,13 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
}
break;
case RESOLVED:
setOutcome(localVariables, taskId);
if (localVariables.size() > 0)
{
activitiProcessEngine.getTaskService().setVariablesLocal(taskId, localVariables);
}
setOutcome(taskId);
if (globalVariables.size() > 0)
{
activitiProcessEngine.getTaskService().resolveTask(taskId, globalVariables);
@@ -1728,11 +1732,11 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
* @param localVariables The variable, that will be set to the task
* @param taskId The id of the task
*/
private void setOutcome(Map<String, Object> localVariables, String taskId)
private void setOutcome(String taskId)
{
WorkflowQNameConverter qNameConverter = getQNameConverter();
org.activiti.engine.task.Task task = activitiProcessEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult();
String outcomeValue = ActivitiConstants.DEFAULT_TRANSITION_NAME;
HashMap<QName, Serializable> updates = new HashMap<QName, Serializable>();
Map<QName, Serializable> properties = propertyConverter.getTaskProperties(task);
QName outcomePropName = (QName) properties.get(WorkflowModel.PROP_OUTCOME_PROPERTY_NAME);
if (outcomePropName != null)
@@ -1743,6 +1747,7 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
outcomeValue = DefaultTypeConverter.INSTANCE.convert(String.class, rawOutcome);
}
}
localVariables.put(qNameConverter.mapQNameToName(WorkflowModel.PROP_OUTCOME), outcomeValue);
updates.put(WorkflowModel.PROP_OUTCOME, outcomeValue);
propertyConverter.updateTask(task, updates, null, null);
}
}