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


Java TaskEntity类代码示例

本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.TaskEntity的典型用法代码示例。如果您正苦于以下问题:Java TaskEntity类的具体用法?Java TaskEntity怎么用?Java TaskEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TaskEntity类属于org.activiti.engine.impl.persistence.entity包,在下文中一共展示了TaskEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
@Override
public Boolean execute(CommandContext commandContext) {
    if (taskId == null) {
        throw new ActivitiIllegalArgumentException("taskId is null");
    }
    if (variableName == null) {
        throw new ActivitiIllegalArgumentException("variableName is null");
    }

    TaskEntity task = commandContext
            .getTaskEntityManager()
            .findTaskById(taskId);

    if (task == null) {
        throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
    }
    boolean hasVariable = false;

    if (isLocal) {
        hasVariable = task.hasVariableLocal(variableName);
    } else {
        hasVariable = task.hasVariable(variableName);
    }

    return hasVariable;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:HasTaskVariableCmd.java

示例2: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
@Override
public T execute(CommandContext commandContext) {

    if (taskId == null) {
        throw new ActivitiIllegalArgumentException("taskId is null");
    }

    TaskEntity task = commandContext
            .getTaskEntityManager()
            .findTaskById(taskId);

    if (task == null) {
        throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class);
    }

    if (task.isSuspended()) {
        throw new ActivitiException(getSuspendedTaskException());
    }

    return execute(commandContext, task);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:NeedsActiveTaskCmd.java

示例3: withdrawTask

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * 流程撤回  TODO MESSAGE 流程撤回需要给相关人员发送消息提醒
 *
 * @param instanceId 历史流程实例ID
 * @param userId     用户ID
 * @return
 */
@Override
public Result withdrawTask(String instanceId, String userId) {
    HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId
            (instanceId).singleResult();
    Result result = this.canWithdraw(processInstance, userId);
    if (!result.isSuccess()) {
        return new Result(false, "不可撤回", "该任务已经被签收或者办理,无法撤回,请查看流程明细");
    } else {
        HistoricTaskInstance taskInstance = (HistoricTaskInstance) result.getData();
        final TaskEntity task = (TaskEntity) taskService.createTaskQuery().processInstanceId(instanceId).singleResult();
        try {
            this.jumpTask(task, taskInstance.getTaskDefinitionKey());
            //删除历史记录,填充签收人
            this.deleteCurrentTaskInstance(task.getId(), taskInstance);
            return new Result(true);
        } catch (Exception ex) {
            return new Result(false, "撤回异常", "任务撤回发生异常,异常原因:" + ex.getMessage());
        }

    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:29,代码来源:TaskPageServiceImpl.java

示例4: addPooledActorsAsVariable

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
private void addPooledActorsAsVariable(DelegateTask task,
            Map<String, Object> variables) 
{
    List<IdentityLinkEntity> links = ((TaskEntity)task).getIdentityLinks();
    if (links.size() > 0)
    {
        // Add to list of IdentityLink
        List<IdentityLink> identityLinks = new ArrayList<IdentityLink>();
        identityLinks.addAll(links);
        
        List<NodeRef> pooledActorRefs = propertyConverter.getPooledActorsReference(identityLinks);
        
        // Save references as a variable
        List<String> nodeIds = new ArrayList<String>();
        for (NodeRef ref : pooledActorRefs)
        {
            nodeIds.add(ref.toString());
        }
        variables.put(ActivitiConstants.PROP_POOLED_ACTORS_HISTORY, nodeIds);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:TaskCompleteListener.java

示例5: onEvent

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
    if (!(event instanceof ActivitiEntityEventImpl)) {
        return;
    }

    ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
    Object entity = activitiEntityEventImpl.getEntity();

    if (!(entity instanceof TaskEntity)) {
        return;
    }

    TaskEntity taskEntity = (TaskEntity) entity;

    try {
        switch (event.getType()) {
        case TASK_CREATED:
            logger.debug("create : {}", taskEntity.getId());
            this.onCreate(taskEntity);

            break;
        }
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:27,代码来源:SkipEventListener.java

示例6: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
    TaskEntity taskEntity = commandContext.getTaskEntityManager()
            .findTaskById(taskId);

    // taskEntity.fireEvent(TaskListener.EVENTNAME_COMPLETE);
    if ((Authentication.getAuthenticatedUserId() != null)
            && (taskEntity.getProcessInstanceId() != null)) {
        taskEntity.getProcessInstance().involveUser(
                Authentication.getAuthenticatedUserId(),
                IdentityLinkType.PARTICIPANT);
    }

    Context.getCommandContext().getTaskEntityManager()
            .deleteTask(taskEntity, comment, false);

    if (taskEntity.getExecutionId() != null) {
        ExecutionEntity execution = taskEntity.getExecution();
        execution.removeTask(taskEntity);

        // execution.signal(null, null);
    }

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:25,代码来源:DeleteTaskWithCommentCmd.java

示例7: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
    this.commandContext = commandContext;

    if (this.taskId != null) {
        TaskEntity taskEntity = commandContext.getTaskEntityManager()
                .findTaskById(taskId);
        activityId = taskEntity.getExecution().getActivityId();
        processInstanceId = taskEntity.getProcessInstanceId();
        this.collectionVariableName = "countersignUsers";
        this.collectionElementVariableName = "countersignUser";
    }

    if (operateType.equalsIgnoreCase("add")) {
        addInstance();
    } else if (operateType.equalsIgnoreCase("remove")) {
        removeInstance();
    }

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:CounterSignCmd.java

示例8: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * 退回流程.
 * 
 * @return 0-退回成功 1-流程结束 2-下一结点已经通过,不能退回
 */
public Integer execute(CommandContext commandContext) {
    // 获得任务
    TaskEntity taskEntity = this.findTask(commandContext);

    // 找到想要回退到的节点
    ActivityImpl targetActivity = this.findTargetActivity(commandContext,
            taskEntity);
    logger.info("rollback to {}", this.activityId);
    logger.info("{}", targetActivity.getProperties());

    String type = (String) targetActivity.getProperty("type");

    if ("userTask".equals(type)) {
        logger.info("rollback to userTask");
        this.rollbackUserTask(commandContext);
    } else if ("startEvent".equals(type)) {
        logger.info("rollback to startEvent");
        this.rollbackStartEvent(commandContext);
    } else {
        throw new IllegalStateException("cannot rollback " + type);
    }

    return 0;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:30,代码来源:RollbackTaskCmd.java

示例9: findTargetActivity

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * 查找回退的目的节点.
 */
public ActivityImpl findTargetActivity(CommandContext commandContext,
        TaskEntity taskEntity) {
    if (activityId == null) {
        String historyTaskId = this.findNearestUserTask(commandContext);
        HistoricTaskInstanceEntity historicTaskInstanceEntity = commandContext
                .getHistoricTaskInstanceEntityManager()
                .findHistoricTaskInstanceById(historyTaskId);
        this.activityId = historicTaskInstanceEntity.getTaskDefinitionKey();
    }

    String processDefinitionId = taskEntity.getProcessDefinitionId();
    ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId).execute(commandContext);

    return processDefinitionEntity.findActivity(activityId);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:20,代码来源:RollbackTaskCmd.java

示例10: findTargetHistoricActivity

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * 找到想要回退对应的节点历史.
 */
public HistoricActivityInstanceEntity findTargetHistoricActivity(
        CommandContext commandContext, TaskEntity taskEntity,
        ActivityImpl activityImpl) {
    HistoricActivityInstanceQueryImpl historicActivityInstanceQueryImpl = new HistoricActivityInstanceQueryImpl();
    historicActivityInstanceQueryImpl.activityId(activityImpl.getId());
    historicActivityInstanceQueryImpl.processInstanceId(taskEntity
            .getProcessInstanceId());
    historicActivityInstanceQueryImpl
            .orderByHistoricActivityInstanceEndTime().desc();

    HistoricActivityInstanceEntity historicActivityInstanceEntity = (HistoricActivityInstanceEntity) commandContext
            .getHistoricActivityInstanceEntityManager()
            .findHistoricActivityInstancesByQueryCriteria(
                    historicActivityInstanceQueryImpl, new Page(0, 1))
            .get(0);

    return historicActivityInstanceEntity;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:22,代码来源:RollbackTaskCmd.java

示例11: findTargetHistoricTask

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * 找到想要回退对应的任务历史.
 */
public HistoricTaskInstanceEntity findTargetHistoricTask(
        CommandContext commandContext, TaskEntity taskEntity,
        ActivityImpl activityImpl) {
    HistoricTaskInstanceQueryImpl historicTaskInstanceQueryImpl = new HistoricTaskInstanceQueryImpl();
    historicTaskInstanceQueryImpl.taskDefinitionKey(activityImpl.getId());
    historicTaskInstanceQueryImpl.processInstanceId(taskEntity
            .getProcessInstanceId());
    historicTaskInstanceQueryImpl.setFirstResult(0);
    historicTaskInstanceQueryImpl.setMaxResults(1);
    historicTaskInstanceQueryImpl.orderByTaskCreateTime().desc();

    HistoricTaskInstanceEntity historicTaskInstanceEntity = (HistoricTaskInstanceEntity) commandContext
            .getHistoricTaskInstanceEntityManager()
            .findHistoricTaskInstancesByQueryCriteria(
                    historicTaskInstanceQueryImpl).get(0);

    return historicTaskInstanceEntity;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:22,代码来源:RollbackTaskCmd.java

示例12: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
    for (TaskEntity taskEntity : commandContext.getTaskEntityManager()
            .findTasksByExecutionId(executionId)) {
        taskEntity.setVariableLocal("跳转原因", jumpOrigin);
        commandContext.getTaskEntityManager().deleteTask(taskEntity,
                jumpOrigin, false);
    }

    ExecutionEntity executionEntity = commandContext
            .getExecutionEntityManager().findExecutionById(executionId);
    ProcessDefinitionImpl processDefinition = executionEntity
            .getProcessDefinition();
    ActivityImpl activity = processDefinition.findActivity(activityId);

    executionEntity.executeActivity(activity);

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:19,代码来源:JumpToActivityCmd.java

示例13: createSubTask

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public void createSubTask(TaskEntity parentTask, String assignee) {
    TaskEntity task = TaskEntity.create(new Date());
    task.setProcessDefinitionId(parentTask.getProcessDefinitionId());
    // task.setId(historicTaskInstanceEntity.getId());
    task.setAssigneeWithoutCascade(assignee);
    task.setParentTaskIdWithoutCascade(parentTask.getId());
    task.setNameWithoutCascade(parentTask.getName());
    task.setTaskDefinitionKey(parentTask.getTaskDefinitionKey());
    task.setExecutionId(parentTask.getExecutionId());
    task.setPriority(parentTask.getPriority());
    task.setProcessInstanceId(parentTask.getProcessInstanceId());
    task.setDescriptionWithoutCascade(parentTask.getDescription());
    task.setCategory("subtask");

    Context.getCommandContext().getTaskEntityManager().insert(task);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:17,代码来源:ChangeSubTaskCmd.java

示例14: initSource

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
public void initSource() {
    // source task
    this.jumpInfo.setSourceTaskId(this.taskId);

    TaskEntity sourceTask = Context.getCommandContext()
            .getTaskEntityManager().findTaskById(this.taskId);
    this.jumpInfo.setSourceTask(sourceTask);

    ProcessDefinitionEntity processDefinitionEntity = Context
            .getProcessEngineConfiguration()
            .getDeploymentManager()
            .findDeployedProcessDefinitionById(
                    sourceTask.getProcessDefinitionId());
    // source activity
    this.jumpInfo.setSourceActivityId(sourceTask.getTaskDefinitionKey());
    this.jumpInfo.setSourceActivity(processDefinitionEntity
            .findActivity(this.jumpInfo.getSourceActivityId()));

    HistoricTaskInstanceEntity sourceHistoryTask = Context
            .getCommandContext().getHistoricTaskInstanceEntityManager()
            .findHistoricTaskInstanceById(this.jumpInfo.getSourceTaskId());
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:23,代码来源:RollbackCmd.java

示例15: addAndRemoveEventListenerTypedNullType

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入依赖的package包/类
/**
 * Test that adding a listener with a null-type is never called.
 */
public void addAndRemoveEventListenerTypedNullType() throws Exception {

    // Create a listener that just adds the events to a list
    TestFlowableEventListener newListener = new TestFlowableEventListener();

    // Add event-listener to dispatcher
    dispatcher.addEventListener(newListener, (FlowableEngineEventType) null);

    ActivitiEntityEventImpl event1 = new ActivitiEntityEventImpl(new TaskEntity(), FlowableEngineEventType.ENTITY_CREATED);
    ActivitiEntityEventImpl event2 = new ActivitiEntityEventImpl(new TaskEntity(), FlowableEngineEventType.ENTITY_DELETED);

    // Dispatch events, all should have entered the listener
    dispatcher.dispatchEvent(event1);
    dispatcher.dispatchEvent(event2);

    assertTrue(newListener.getEventsReceived().isEmpty());
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:21,代码来源:FlowableEventDispatcherTest.java


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