本文整理汇总了Java中org.activiti.engine.TaskService.getVariables方法的典型用法代码示例。如果您正苦于以下问题:Java TaskService.getVariables方法的具体用法?Java TaskService.getVariables怎么用?Java TaskService.getVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.TaskService
的用法示例。
在下文中一共展示了TaskService.getVariables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTaskProperties
import org.activiti.engine.TaskService; //导入方法依赖的package包/类
public Map<QName, Serializable> getTaskProperties(Task task)
{
// retrieve type definition for task
TypeDefinition taskDef = typeManager.getFullTaskDefinition(task);
Map<QName, PropertyDefinition> taskProperties = taskDef.getProperties();
Map<QName, AssociationDefinition> taskAssociations = taskDef.getAssociations();
TaskService taskService = activitiUtil.getTaskService();
// Get all task variables including execution vars.
Map<String, Object> variables = taskService.getVariables(task.getId());
Map<String, Object> localVariables = taskService.getVariablesLocal(task.getId());
// Map the arbitrary properties
Map<QName, Serializable> properties =mapArbitraryProperties(variables, localVariables, taskProperties, taskAssociations);
// Map activiti task instance fields to properties
properties.put(WorkflowModel.PROP_TASK_ID, task.getId());
properties.put(WorkflowModel.PROP_DESCRIPTION, task.getDescription());
// Since the task is never started explicitally, we use the create time
properties.put(WorkflowModel.PROP_START_DATE, task.getCreateTime());
// Due date is present on the task
properties.put(WorkflowModel.PROP_DUE_DATE, task.getDueDate());
// Since this is a runtime-task, it's not completed yet
properties.put(WorkflowModel.PROP_COMPLETION_DATE, null);
properties.put(WorkflowModel.PROP_PRIORITY, task.getPriority());
properties.put(ContentModel.PROP_CREATED, task.getCreateTime());
properties.put(ContentModel.PROP_OWNER, task.getAssignee());
// Be sure to fetch the outcome
String outcomeVarName = factory.mapQNameToName(WorkflowModel.PROP_OUTCOME);
if(variables.get(outcomeVarName) != null)
{
properties.put(WorkflowModel.PROP_OUTCOME, (Serializable) variables.get(outcomeVarName));
}
List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
mapPooledActors(links, properties);
return filterTaskProperties(properties);
}