• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActivityExecution类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
protected Object execute(CommandContext commandContext,
        ExecutionEntity execution) {
    try {
        FlowNodeActivityBehavior activityBehavior = (FlowNodeActivityBehavior) execution
                .getActivity().getActivityBehavior();
        Method method = FlowNodeActivityBehavior.class.getDeclaredMethod(
                "leave", ActivityExecution.class);
        method.setAccessible(true);
        method.invoke(activityBehavior, execution);
        method.setAccessible(false);
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }

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


示例2: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    PvmActivity activity = activityExecution.getActivity();

    List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();

    execution.inactivate();

    List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);

    int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
    int nbrOfExecutionsJoined = joinedExecutions.size();

    if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
        LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
        activityExecution.takeAll(outgoingTransitions, joinedExecutions);

    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:ParallelGateway.java


示例3: lastExecutionEnded

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void lastExecutionEnded(ActivityExecution execution) {

    ActivityExecution outgoingExecution = execution.getParent().createExecution();
    outgoingExecution.setConcurrent(false);
    ((InterpretableExecution) outgoingExecution).setActivity((ActivityImpl) execution.getActivity());

    // eventscope execution
    execution.setConcurrent(false);
    execution.setActive(false);
    ((InterpretableExecution) execution).setEventScope(true);

    List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
    if (outgoingTransitions.isEmpty()) {
        outgoingExecution.end();
    } else {
        outgoingExecution.takeAll(outgoingTransitions, Collections.EMPTY_LIST);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:EventScopeCreatingSubprocess.java


示例4: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    PvmTransition more = activityExecution.getActivity().findOutgoingTransition("more");
    PvmTransition done = activityExecution.getActivity().findOutgoingTransition("done");

    Integer value = (Integer) execution.getVariable(variableName);

    if (value == null) {
        execution.setVariable(variableName, from);
        activityExecution.take(more);

    } else {
        value = value + 1;

        if (value < to) {
            execution.setVariable(variableName, value);
            activityExecution.take(more);

        } else {
            activityExecution.take(done);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:While.java


示例5: propagateError

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
public static void propagateError(String errorCode, ActivityExecution execution) {

        while (execution != null) {
            String eventHandlerId = findLocalErrorEventHandler(execution, errorCode);
            if (eventHandlerId != null) {
                executeCatch(eventHandlerId, execution, errorCode);
                break;
            }

            if (execution.isProcessInstanceType()) {
                // dispatch process completed event
                if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
                    Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                            ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.PROCESS_COMPLETED_WITH_ERROR_END_EVENT, execution));
                }
            }
            execution = getSuperExecution(execution);
        }
        if (execution == null) {
            throw new BpmnError(errorCode, "No catching boundary event found for error with errorCode '"
                    + errorCode + "', neither in same process nor in parent process");
        }
    }
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:ErrorPropagation.java


示例6: findLocalErrorEventHandler

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
private static String findLocalErrorEventHandler(ActivityExecution execution, String errorCode) {
    PvmScope scope = execution.getActivity();
    while (scope != null) {

        @SuppressWarnings("unchecked")
        List<ErrorEventDefinition> definitions = (List<ErrorEventDefinition>) scope.getProperty(BpmnParse.PROPERTYNAME_ERROR_EVENT_DEFINITIONS);
        if (definitions != null) {
            // definitions are sorted by precedence, ie. event subprocesses first.
            for (ErrorEventDefinition errorEventDefinition : definitions) {
                if (errorEventDefinition.catches(errorCode)) {
                    return scope.findActivity(errorEventDefinition.getHandlerActivityId()).getId();
                }
            }
        }

        // search for error handlers in parent scopes
        if (scope instanceof PvmActivity) {
            scope = ((PvmActivity) scope).getParent();
        } else {
            scope = null;
        }
    }
    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:25,代码来源:ErrorPropagation.java


示例7: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    if (getLocalLoopVariable(activityExecution, getCollectionElementIndexVariable()) == null) {
        try {
            createInstances(activityExecution);
        } catch (BpmnError error) {
            ErrorPropagation.propagateError(error, activityExecution);
        }

        if (resolveNrOfInstances(activityExecution) == 0) {
            leave(activityExecution);
        }
    } else {
        innerActivityBehavior.execute(execution);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:18,代码来源:MultiInstanceActivityBehavior.java


示例8: completionConditionSatisfied

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
protected boolean completionConditionSatisfied(ActivityExecution execution) {
    if (completionConditionExpression != null) {
        Object value = completionConditionExpression.getValue(execution);
        if (!(value instanceof Boolean)) {
            throw new ActivitiIllegalArgumentException("completionCondition '"
                    + completionConditionExpression.getExpressionText()
                    + "' does not evaluate to a boolean value");
        }
        Boolean booleanValue = (Boolean) value;
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Completion condition of multi-instance satisfied: {}", booleanValue);
        }
        return booleanValue;
    }
    return false;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:17,代码来源:MultiInstanceActivityBehavior.java


示例9: callCustomActivityStartListeners

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
/**
 * Since the first loop of the multi instance is not executed as a regular activity, it is needed to call the start listeners yourself.
 */
protected void callCustomActivityStartListeners(ActivityExecution execution) {
    List<ExecutionListener> listeners = activity.getExecutionListeners(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START);

    if (listeners != null) {
        List<ExecutionListener> filteredExecutionListeners = new ArrayList<>(listeners.size());
        // Sad that we have to do this, but it's the only way I could find (which is also safe for backwards compatibility)

        for (ExecutionListener executionListener : listeners) {
            if (!(executionListener instanceof ActivityInstanceStartHandler)) {
                filteredExecutionListeners.add(executionListener);
            }
        }

        CallActivityListenersOperation atomicOperation = new CallActivityListenersOperation(filteredExecutionListeners);
        Context.getCommandContext().performOperation(atomicOperation, (InterpretableExecution) execution);
    }

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


示例10: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    // Join
    PvmActivity activity = activityExecution.getActivity();
    List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();
    execution.inactivate();
    lockConcurrentRoot(activityExecution);

    List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
    int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
    int nbrOfExecutionsJoined = joinedExecutions.size();
    Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution);
    if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {

        // Fork
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
        }
        activityExecution.takeAll(outgoingTransitions, joinedExecutions);

    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:26,代码来源:ParallelGatewayActivityBehavior.java


示例11: readFields

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
private void readFields(ActivityExecution execution) {
    commandStr = getStringFromField(command, execution);
    arg1Str = getStringFromField(arg1, execution);
    arg2Str = getStringFromField(arg2, execution);
    arg3Str = getStringFromField(arg3, execution);
    arg4Str = getStringFromField(arg4, execution);
    arg5Str = getStringFromField(arg5, execution);
    waitStr = getStringFromField(wait, execution);
    resultVariableStr = getStringFromField(outputVariable, execution);
    errorCodeVariableStr = getStringFromField(errorCodeVariable, execution);

    String redirectErrorStr = getStringFromField(redirectError, execution);
    String cleanEnvStr = getStringFromField(cleanEnv, execution);

    waitFlag = waitStr == null || waitStr.equals("true");
    redirectErrorFlag = "true".equals(redirectErrorStr);
    cleanEnvBoolan = "true".equals(cleanEnvStr);
    directoryStr = getStringFromField(directory, execution);

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


示例12: createInstances

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
/**
 * Handles the sequential case of spawning the instances. Will only create one instance, since at most one instance can be active.
 */
@Override
protected void createInstances(ActivityExecution execution) {
    int nrOfInstances = resolveNrOfInstances(execution);
    if (nrOfInstances < 0) {
        throw new ActivitiIllegalArgumentException("Invalid number of instances: must be a non-negative integer value"
                + ", but was " + nrOfInstances);
    }

    setLoopVariable(execution, NUMBER_OF_INSTANCES, nrOfInstances);
    setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, 0);
    setLoopVariable(execution, getCollectionElementIndexVariable(), 0);
    setLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES, 1);
    logLoopDetails(execution, "initialized", 0, 0, 1, nrOfInstances);

    if (nrOfInstances > 0) {
        executeOriginalBehavior(execution, 0);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:SequentialMultiInstanceBehavior.java


示例13: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    InterpretableExecution interpretableExecution = (InterpretableExecution) execution;
    ActivityImpl activity = interpretableExecution.getProcessDefinition().findActivity(activityId);

    ActivityExecution outgoingExecution = activityExecution;

    if (isInterrupting) {
        activityExecution.destroyScope("Event subprocess triggered using activity " + activityId);
    } else {
        outgoingExecution = activityExecution.createExecution();
        outgoingExecution.setActive(true);
        outgoingExecution.setScope(false);
        outgoingExecution.setConcurrent(true);
    }

    // set the outgoing execution to this activity
    ((InterpretableExecution) outgoingExecution).setActivity(activity);

    // continue execution
    outgoingExecution.takeAll(activity.getOutgoingTransitions(), Collections.EMPTY_LIST);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:EventSubProcessStartEventActivityBehavior.java


示例14: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    // find cancel boundary event:
    ActivityImpl cancelBoundaryEvent = ScopeUtil
            .findInParentScopesByBehaviorType((ActivityImpl) activityExecution.getActivity(), CancelBoundaryEventActivityBehavior.class);

    if (cancelBoundaryEvent == null) {
        throw new ActivitiException("Could not find cancel boundary event for cancel end event " + activityExecution.getActivity());
    }

    ActivityExecution scopeExecution = ScopeUtil.findScopeExecutionForScope((ExecutionEntity) execution, cancelBoundaryEvent.getParentActivity());

    // end all executions and process instances in the scope of the transaction
    scopeExecution.destroyScope("cancel end event fired");

    // the scope execution executes the boundary event
    InterpretableExecution outgoingExecution = (InterpretableExecution) scopeExecution;
    outgoingExecution.setActivity(cancelBoundaryEvent);
    outgoingExecution.setActive(true);

    // execute the boundary
    cancelBoundaryEvent
            .getActivityBehavior()
            .execute(outgoingExecution);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:CancelEndEventActivityBehavior.java


示例15: signalCompensationDone

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
protected void signalCompensationDone(ActivityExecution execution, Object signalData) {
    // default behavior is to join compensating executions and propagate the signal if all executions
    // have compensated

    // join compensating executions
    if (execution.getExecutions().isEmpty()) {
        if (execution.getParent() != null) {
            ActivityExecution parent = execution.getParent();
            ((InterpretableExecution) execution).remove();
            ((InterpretableExecution) parent).signal("compensationDone", signalData);
        }
    } else {
        ((ExecutionEntity) execution).forceUpdate();
    }

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


示例16: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
@Override
public void execute(DelegateExecution delegateExecution) {
    ActivityExecution execution = (ActivityExecution) delegateExecution;
    ActivityImpl terminateEndEventActivity = (ActivityImpl) execution.getActivity();

    if (terminateAll) {
        ActivityExecution processInstanceExecution = findRootProcessInstanceExecution((ExecutionEntity) execution);
        terminateProcessInstanceExecution(execution, terminateEndEventActivity, processInstanceExecution);
    } else {
        ActivityExecution scopeExecution = ScopeUtil.findScopeExecution(execution);
        if (scopeExecution != null) {
            terminateExecution(execution, terminateEndEventActivity, scopeExecution);
        }
    }

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


示例17: terminateExecution

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
protected void terminateExecution(ActivityExecution execution, ActivityImpl terminateEndEventActivity, ActivityExecution scopeExecution) {
    // send cancelled event
    sendCancelledEvent(execution, terminateEndEventActivity, scopeExecution);

    // destroy the scope
    scopeExecution.destroyScope("terminate end event fired");

    // set the scope execution to the terminate end event and make it end here.
    // (the history should reflect that the execution ended here and we want an 'end time' for the
    // historic activity instance.)
    ((InterpretableExecution) scopeExecution).setActivity(terminateEndEventActivity);
    // end the scope execution
    scopeExecution.end();

    // Scope execution can already have been ended (for example when multiple seq flow arrive in the same terminate end event)
    // in that case, we need to make sure the activity instance is ended
    if (scopeExecution.isEnded()) {
        Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution);
    }

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


示例18: dispatchExecutionCancelled

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
private void dispatchExecutionCancelled(ActivityExecution execution, ActivityImpl causeActivity) {
    // subprocesses
    for (ActivityExecution subExecution : execution.getExecutions()) {
        dispatchExecutionCancelled(subExecution, causeActivity);
    }

    // call activities
    ExecutionEntity subProcessInstance = Context.getCommandContext().getExecutionEntityManager().findSubProcessInstanceBySuperExecutionId(execution.getId());
    if (subProcessInstance != null) {
        dispatchExecutionCancelled(subProcessInstance, causeActivity);
    }

    // activity with message/signal boundary events
    ActivityImpl activity = (ActivityImpl) execution.getActivity();
    if (activity != null && activity.getActivityBehavior() != null && activity != causeActivity) {
        dispatchActivityCancelled(execution, activity, causeActivity);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:19,代码来源:TerminateEndEventActivityBehavior.java


示例19: execute

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
    log.info("{}:{} begin execute", execution.getCurrentActivityId(),
            execution.getCurrentActivityName());
    super.execute(execution);
    log.info("{}:{} after execute", execution.getCurrentActivityId(),
            execution.getCurrentActivityName());
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:8,代码来源:CustomUserTaskActivityBehavior.java


示例20: findTransition

import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入依赖的package包/类
protected PvmTransition findTransition(ActivityExecution execution, String signalName) {
    for (PvmTransition transition : execution.getActivity().getOutgoingTransitions()) {
        if (signalName == null) {
            if (transition.getId() == null) {
                return transition;
            }
        } else {
            if (signalName.equals(transition.getId())) {
                return transition;
            }
        }
    }
    throw new RuntimeException("no transition for signalName '" + signalName + "' in WaitState '" + execution.getActivity().getId() + "'");
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:15,代码来源:WaitState.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NativePreviewHandler类代码示例发布时间:2022-05-21
下一篇:
Java StepScope类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap