• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RuntimeServiceImpl类的典型用法和代码示例

java 2次浏览

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

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

示例1: jumpTask

点赞 2

import org.activiti.engine.impl.RuntimeServiceImpl; //导入依赖的package包/类
/**
 * 流程跳跃到任意节点
 *
 * @param currentTaskEntity       当前任务实例
 * @param targetTaskDefinitionKey 任务定义节点key(目标节点)
 * @throws Exception
 */
public void jumpTask(final TaskEntity currentTaskEntity, String targetTaskDefinitionKey) throws Exception {
    ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition
            (currentTaskEntity.getProcessDefinitionId());
    final ActivityImpl activity = processDefinition.findActivity(targetTaskDefinitionKey);

    final ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId
            (currentTaskEntity.getExecutionId()).singleResult();

    //包装一个Command对象
    ((RuntimeServiceImpl) runtimeService).getCommandExecutor().execute(
            new Command<Void>() {
                @Override
                public Void execute(CommandContext commandContext) {
                    //创建新任务
                    //execution.setActivity(activity);
                    execution.executeActivity(activity);


                    //删除当前的任务
                    //不能删除当前正在执行的任务,所以要先清除掉关联
                    currentTaskEntity.setExecutionId(null);
                    taskService.saveTask(currentTaskEntity);
                    taskService.deleteTask(currentTaskEntity.getId(), true);

                    return null;
                }
            });

}
 

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

示例2: isTargetTask

点赞 2

import org.activiti.engine.impl.RuntimeServiceImpl; //导入依赖的package包/类
/**
 * TODO 局部变量判断
 * 判断当前是否是合适的路径
 *
 * @param expressionText    表达式
 * @param processInstanceId 实例ID
 * @return true符合条件条件的路径
 */
public boolean isTargetTask(final String expressionText, String processInstanceId, final PvmTransition transition) {

    final ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(processInstanceId)
            .singleResult();
    Boolean result = ((RuntimeServiceImpl) runtimeService).getCommandExecutor().execute(
            new Command<Boolean>() {
                @Override
                public Boolean execute(CommandContext commandContext) {
                    UelExpressionCondition flowCondition = (UelExpressionCondition) transition.getProperty("condition");
                    boolean evel_ret = flowCondition.evaluate(transition.getId(), execution);
                    return evel_ret;
                }
            });
    return result;
    //TODO 另一种写法 自定义juel解析
    /*ExpressionFactory factory = new ExpressionFactoryImpl();
    SimpleContext context = new SimpleContext();
    Map<String, Object> variables = runtimeService.getVariables(processInstanceId);
    for (String key : variables.keySet()) {
        context.setVariable(key, factory.createValueExpression(variables.get(key), variables.get(key).getClass()));
    }
    try {
        ValueExpression e = factory.createValueExpression(context, expressionText, boolean.class);
        return (boolean) e.getValue(context);
    } catch (Exception ex) {
        return false;
    }*/
}
 

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

示例3: testCompetingSignalsWithRetry

点赞 2

import org.activiti.engine.impl.RuntimeServiceImpl; //导入依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/concurrency/CompetingSignalsTest.testCompetingSignals.bpmn20.xml"})
public void testCompetingSignalsWithRetry() throws Exception {
  RuntimeServiceImpl runtimeServiceImpl = (RuntimeServiceImpl)runtimeService;        
  CommandExecutor before = runtimeServiceImpl.getCommandExecutor();
  try {
    CommandInterceptor retryInterceptor = new RetryInterceptor();
    retryInterceptor.setNext(before);
    runtimeServiceImpl.setCommandExecutor(retryInterceptor);
    
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CompetingSignalsProcess");
    String processInstanceId = processInstance.getId();

    log.fine("test thread starts thread one");
    SignalThread threadOne = new SignalThread(processInstanceId);
    threadOne.startAndWaitUntilControlIsReturned();
    
    log.fine("test thread continues to start thread two");
    SignalThread threadTwo = new SignalThread(processInstanceId);
    threadTwo.startAndWaitUntilControlIsReturned();

    log.fine("test thread notifies thread 1");
    threadOne.proceedAndWaitTillDone();
    assertNull(threadOne.exception);

    log.fine("test thread notifies thread 2");
    threadTwo.proceedAndWaitTillDone();
    assertNull(threadTwo.exception);
  } finally {
    // reset the command executor
    runtimeServiceImpl.setCommandExecutor(before);
  }
  
}
 

开发者ID:logicalhacking,
项目名称:SecureBPMN,
代码行数:34,
代码来源:CompetingSignalsTest.java

示例4: testCompetingSignalsWithRetry

点赞 2

import org.activiti.engine.impl.RuntimeServiceImpl; //导入依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/concurrency/CompetingSignalsTest.testCompetingSignals.bpmn20.xml"})
public void testCompetingSignalsWithRetry() throws Exception {
  RuntimeServiceImpl runtimeServiceImpl = (RuntimeServiceImpl)runtimeService;        
  CommandExecutorImpl before = (CommandExecutorImpl) runtimeServiceImpl.getCommandExecutor();
  try {
    CommandInterceptor retryInterceptor = new RetryInterceptor();
    retryInterceptor.setNext(before.getFirst());

    runtimeServiceImpl.setCommandExecutor(new CommandExecutorImpl(before.getDefaultConfig(), retryInterceptor));
    
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CompetingSignalsProcess");
    String processInstanceId = processInstance.getId();

    log.debug("test thread starts thread one");
    SignalThread threadOne = new SignalThread(processInstanceId);
    threadOne.startAndWaitUntilControlIsReturned();
    
    log.debug("test thread continues to start thread two");
    SignalThread threadTwo = new SignalThread(processInstanceId);
    threadTwo.startAndWaitUntilControlIsReturned();

    log.debug("test thread notifies thread 1");
    threadOne.proceedAndWaitTillDone();
    assertNull(threadOne.exception);

    log.debug("test thread notifies thread 2");
    threadTwo.proceedAndWaitTillDone();
    assertNull(threadTwo.exception);
  } finally {
    // restore the command executor
    runtimeServiceImpl.setCommandExecutor(before);
  }
  
}
 

开发者ID:springvelocity,
项目名称:xbpm5,
代码行数:35,
代码来源:CompetingSignalsTest.java

示例5: ProcessInstanceBuilderImpl

点赞 2

import org.activiti.engine.impl.RuntimeServiceImpl; //导入依赖的package包/类
public ProcessInstanceBuilderImpl(RuntimeServiceImpl runtimeService) {
    this.runtimeService = runtimeService;
}
 

开发者ID:flowable,
项目名称:flowable-engine,
代码行数:4,
代码来源:ProcessInstanceBuilderImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)