当前位置: 首页>>代码示例>>Java>>正文


Java TaskService.getVariables方法代码示例

本文整理汇总了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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:ActivitiPropertyConverter.java


注:本文中的org.activiti.engine.TaskService.getVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。