Java Code Examples for org.activiti.engine.impl.persistence.entity.ExecutionEntity#getProcessDefinition()

The following examples show how to use org.activiti.engine.impl.persistence.entity.ExecutionEntity#getProcessDefinition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JumpActivityCmd.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
public ExecutionEntity execute(CommandContext commandContext) {

        // 查询活动的分支
        ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);

        // 销毁当前分支
        executionEntity.destroyScope(jumpOrigin);

        // 从流程定义中查询目标Activity
        ProcessDefinitionImpl processDefinition = executionEntity.getProcessDefinition();
        ActivityImpl activity = processDefinition.findActivity(activityId);

        // 节点跳转到目标活动
        executionEntity.executeActivity(activity);

        return executionEntity;
    }
 
Example 2
Source File: JumpCmd.java    From lemon with Apache License 2.0 6 votes vote down vote up
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);
    executionEntity.destroyScope(jumpOrigin);

    ProcessDefinitionImpl processDefinition = executionEntity
            .getProcessDefinition();
    ActivityImpl activity = processDefinition.findActivity(activityId);

    executionEntity.executeActivity(activity);

    return null;
}
 
Example 3
Source File: JumpToActivityCmd.java    From lemon with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: ListActivityCmd.java    From lemon with Apache License 2.0 6 votes vote down vote up
public Map<String, String> execute(CommandContext commandContext) {
    ExecutionEntity executionEntity = Context.getCommandContext()
            .getExecutionEntityManager().findExecutionById(executionId);
    ProcessDefinitionImpl processDefinition = executionEntity
            .getProcessDefinition();
    Map<String, String> map = new HashMap<String, String>();

    for (ActivityImpl activity : processDefinition.getActivities()) {
        logger.info("{}", activity.getProperties());

        if ("userTask".equals(activity.getProperty("type"))) {
            map.put(activity.getId(), (String) activity.getProperty("name"));
        }
    }

    return map;
}
 
Example 5
Source File: JumpTaskCmd.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Comment execute(CommandContext commandContext) {

    for (TaskEntity taskEntity : commandContext.getTaskEntityManager().findTasksByExecutionId(executionId)) {
        commandContext.getTaskEntityManager().deleteTask(taskEntity, "jump", false);
    }
    ExecutionEntity executionEntity = Context.getCommandContext().getExecutionEntityManager().findExecutionById(executionId);
    ProcessDefinitionImpl processDefinition = executionEntity.getProcessDefinition();
    ActivityImpl activity = processDefinition.findActivity(activityId);
    executionEntity.executeActivity(activity);

    return null;
}