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


Java ActivityExecution类代码示例

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


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


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