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


Java TaskQuery.processVariableValueEquals方法代码示例

本文整理汇总了Java中org.activiti.engine.task.TaskQuery.processVariableValueEquals方法的典型用法代码示例。如果您正苦于以下问题:Java TaskQuery.processVariableValueEquals方法的具体用法?Java TaskQuery.processVariableValueEquals怎么用?Java TaskQuery.processVariableValueEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.task.TaskQuery的用法示例。


在下文中一共展示了TaskQuery.processVariableValueEquals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTasksForCandidateGroups

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
private void addTasksForCandidateGroups(List<String> groupNames, Map<String, Task> resultingTasks)
{
    if(groupNames != null && groupNames.size() > 0) {
        
        TaskQuery query = taskService.createTaskQuery().taskCandidateGroupIn(groupNames);
        
        // Additional filtering on the tenant-property in case workflow-definitions are shared across tenants
        if(!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && tenantService.isEnabled()) {
            query.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
        }
        
        List<Task> tasks =query.list();
        for(Task task : tasks)
        {
            resultingTasks.put(task.getId(), task);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ActivitiWorkflowEngine.java

示例2: addProcessPropertiesToQuery

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
private void addProcessPropertiesToQuery(
        Map<QName, Object> processCustomProps, TaskQuery taskQuery) 
{
    for(Entry<QName, Object> customProperty : processCustomProps.entrySet()) 
    {
        String name =factory.mapQNameToName(customProperty.getKey());

        // Exclude the special "VAR_TENANT_DOMAIN" variable, this cannot be queried by users
        if(name != ActivitiConstants.VAR_TENANT_DOMAIN)
        {
            // Perform minimal property conversions
            Object converted = propertyConverter.convertPropertyToValue(customProperty.getValue());
            taskQuery.processVariableValueEquals(name, converted);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:ActivitiWorkflowEngine.java

示例3: getTaskInstance

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public Task getTaskInstance(String taskId)
{
    TaskQuery taskQuery = taskService.createTaskQuery().taskId(taskId);
    if(!deployWorkflowsInTenant) {
    	taskQuery.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
    }
    return taskQuery.singleResult();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ActivitiUtil.java

示例4: addTasksForCandidateUser

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
private void addTasksForCandidateUser(String userName, Map<String, Task> resultingTasks)
{
    TaskQuery query = taskService.createTaskQuery().taskCandidateUser(userName);
    
    // Additional filtering on the tenant-property in case workflow-definitions are shared across tenants
    if(!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && tenantService.isEnabled()) {
        query.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
    }
    
    List<Task> tasks = query.list();
    for(Task task : tasks)
    {
        resultingTasks.put(task.getId(), task);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:ActivitiWorkflowEngine.java

示例5: getValidTask

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
/**
 * Get a valid {@link org.activiti.engine.task.Task} based on the given task id. Checks if current logged
 * in user is assignee/owner/involved with the task. In case true was passed for "validIfClaimable", 
 * the task is also valid if the current logged in user is a candidate for claiming the task.
 *  
 * @throws EntityNotFoundException when the task was not found
 * @throws PermissionDeniedException when the current logged in user isn't allowed to access task.
 */
protected org.activiti.engine.task.Task getValidTask(String taskId)
{
    if (taskId == null)
    {
        throw new InvalidArgumentException("Task id is required.");
    }
    
    TaskQuery query = activitiProcessEngine.getTaskService()
        .createTaskQuery()
        .taskId(taskId);
    
    if (authorityService.isAdminAuthority(AuthenticationUtil.getRunAsUser())) 
    {
        // Admin is allowed to read all tasks in the current tenant
        if (tenantService.isEnabled()) 
        {
            query.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
        }
    }
    else
    {
        // If non-admin user, involvement in the task is required (either owner, assignee or externally involved).
        query.taskInvolvedUser(AuthenticationUtil.getRunAsUser());
    }
    
    org.activiti.engine.task.Task taskInstance =  query.singleResult();
    
    if (taskInstance == null) 
    {
        // Either the task doesn't exist or the user is not involved directly. We can differentiate by
        // checking if the task exists without applying the additional filtering
        taskInstance =  activitiProcessEngine.getTaskService()
            .createTaskQuery()
            .taskId(taskId)
            .singleResult();
        
        if (taskInstance == null) 
        {
            // Full error message will be "Task with id: 'id' was not found" 
            throw new EntityNotFoundException(taskId); 
        }
        else
        {
            // Task is not yet finished, so potentially claimable. If user is part of a "candidateGroup", the task is accessible to the
            // user regardless of not being involved/owner/assignee
            boolean isTaskClaimable = activitiProcessEngine.getTaskService()
                    .createTaskQuery()
                    .taskCandidateGroupIn(new ArrayList<String>(authorityService.getAuthoritiesForUser(AuthenticationUtil.getRunAsUser())))
                    .taskId(taskId)
                    .count() == 1;
            
            if (isTaskClaimable == false)
            {
                throw new PermissionDeniedException();
            }
        }
    }
    return taskInstance;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:68,代码来源:TasksImpl.java

示例6: addProcessvariables

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
protected void addProcessvariables(TaskQuery taskQuery, List<QueryVariable> variables) {

        RestResponseFactory restResponseFactory = new RestResponseFactory();
        for (QueryVariable variable : variables) {
            if (variable.getVariableOperation() == null) {
                throw new ActivitiIllegalArgumentException("Variable operation is missing for variable: " + variable.getName());
            }
            if (variable.getValue() == null) {
                throw new ActivitiIllegalArgumentException("Variable value is missing for variable: " + variable.getName());
            }

            boolean nameLess = variable.getName() == null;

            Object actualValue = restResponseFactory.getVariableValue(variable);

            // A value-only query is only possible using equals-operator
            if (nameLess && variable.getVariableOperation() != QueryVariable.QueryVariableOperation.EQUALS) {
                throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is only supported when using 'equals' operation.");
            }

            switch(variable.getVariableOperation()) {

                case EQUALS:
                    if (nameLess) {
                        taskQuery.processVariableValueEquals(actualValue);
                    } else {
                        taskQuery.processVariableValueEquals(variable.getName(), actualValue);
                    }
                    break;

                case EQUALS_IGNORE_CASE:
                    if (actualValue instanceof String) {
                        taskQuery.processVariableValueEqualsIgnoreCase(variable.getName(), (String)actualValue);
                    } else {
                        throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
                    }
                    break;

                case NOT_EQUALS:
                    taskQuery.processVariableValueNotEquals(variable.getName(), actualValue);
                    break;

                case NOT_EQUALS_IGNORE_CASE:
                    if (actualValue instanceof String) {
                        taskQuery.processVariableValueNotEqualsIgnoreCase(variable.getName(), (String)actualValue);
                    } else {
                        throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
                    }
                    break;

                case GREATER_THAN:
                    taskQuery.processVariableValueGreaterThan(variable.getName(), actualValue);
                    break;

                case GREATER_THAN_OR_EQUALS:
                    taskQuery.processVariableValueGreaterThanOrEqual(variable.getName(), actualValue);
                    break;

                case LESS_THAN:
                    taskQuery.processVariableValueLessThan(variable.getName(), actualValue);
                    break;

                case LESS_THAN_OR_EQUALS:
                    taskQuery.processVariableValueLessThanOrEqual(variable.getName(), actualValue);
                    break;

                case LIKE:
                    if (actualValue instanceof String) {
                        taskQuery.processVariableValueLike(variable.getName(), (String) actualValue);
                    } else {
                        throw new ActivitiIllegalArgumentException("Only string variable values are supported using like, but was: " + actualValue.getClass().getName());
                    }
                    break;

                default:
                    throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
            }
        }
    }
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:80,代码来源:BaseTaskService.java


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