本文整理汇总了Java中org.activiti.engine.impl.pvm.delegate.ActivityExecution.getActivity方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityExecution.getActivity方法的具体用法?Java ActivityExecution.getActivity怎么用?Java ActivityExecution.getActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.delegate.ActivityExecution
的用法示例。
在下文中一共展示了ActivityExecution.getActivity方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: 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);
}
}
示例4: execute
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
PvmActivity activity = activityExecution.getActivity();
ActivityImpl initialActivity = (ActivityImpl) activity.getProperty(BpmnParse.PROPERTYNAME_INITIAL);
if (initialActivity == null) {
throw new ActivitiException("No initial activity found for subprocess "
+ activityExecution.getActivity().getId());
}
// initialize the template-defined data objects as variables
initializeDataObjects(activityExecution, activity);
if (initialActivity.getActivityBehavior() != null
&& initialActivity.getActivityBehavior() instanceof NoneStartEventActivityBehavior) { // embedded subprocess: only none start allowed
((ExecutionEntity) execution).setActivity(initialActivity);
Context.getCommandContext().getHistoryManager().recordActivityStart((ExecutionEntity) execution);
}
activityExecution.executeActivity(initialActivity);
}
示例5: 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);
}
}
}
示例6: 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);
}
}
示例7: 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);
}
示例8: timerFires
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void timerFires(ActivityExecution execution, String signalName, Object signalData) throws Exception {
PvmActivity timerActivity = execution.getActivity();
boolean isInterrupting = (Boolean) timerActivity.getProperty("isInterrupting");
List<ActivityExecution> recyclableExecutions;
if (isInterrupting) {
recyclableExecutions = removeAllExecutions(execution);
} else {
recyclableExecutions = Collections.EMPTY_LIST;
}
execution.takeAll(timerActivity.getOutgoingTransitions(), recyclableExecutions);
}
示例9: findInactiveConcurrentExecutions
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public List<ActivityExecution> findInactiveConcurrentExecutions(PvmActivity activity) {
List<ActivityExecution> inactiveConcurrentExecutionsInActivity = new ArrayList<>();
List<ActivityExecution> otherConcurrentExecutions = new ArrayList<>();
if (isConcurrent()) {
List<? extends ActivityExecution> concurrentExecutions = getParent().getExecutions();
for (ActivityExecution concurrentExecution : concurrentExecutions) {
if (concurrentExecution.getActivity() != null && concurrentExecution.getActivity().getId().equals(activity.getId())) {
if (concurrentExecution.isActive()) {
throw new PvmException("didn't expect active execution in " + activity + ". bug?");
}
inactiveConcurrentExecutionsInActivity.add(concurrentExecution);
} else {
otherConcurrentExecutions.add(concurrentExecution);
}
}
} else {
if (!isActive()) {
inactiveConcurrentExecutionsInActivity.add(this);
} else {
otherConcurrentExecutions.add(this);
}
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("inactive concurrent executions in '{}': {}", activity, inactiveConcurrentExecutionsInActivity);
LOGGER.debug("other concurrent executions: {}", otherConcurrentExecutions);
}
return inactiveConcurrentExecutionsInActivity;
}
示例10: findInactiveConcurrentExecutions
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public List<ActivityExecution> findInactiveConcurrentExecutions(PvmActivity activity) {
List<ActivityExecution> inactiveConcurrentExecutionsInActivity = new ArrayList<>();
List<ActivityExecution> otherConcurrentExecutions = new ArrayList<>();
if (isConcurrent()) {
List<? extends ActivityExecution> concurrentExecutions = getParent().getAllChildExecutions();
for (ActivityExecution concurrentExecution : concurrentExecutions) {
if (concurrentExecution.getActivity() != null && concurrentExecution.getActivity().getId().equals(activity.getId())) {
if (!concurrentExecution.isActive()) {
inactiveConcurrentExecutionsInActivity.add(concurrentExecution);
}
} else {
otherConcurrentExecutions.add(concurrentExecution);
}
}
} else {
if (!isActive()) {
inactiveConcurrentExecutionsInActivity.add(this);
} else {
otherConcurrentExecutions.add(this);
}
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("inactive concurrent executions in '{}': {}", activity, inactiveConcurrentExecutionsInActivity);
LOGGER.debug("other concurrent executions: {}", otherConcurrentExecutions);
}
return inactiveConcurrentExecutionsInActivity;
}
示例11: activeConcurrentExecutionsExist
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
public boolean activeConcurrentExecutionsExist(ActivityExecution execution) {
PvmActivity activity = execution.getActivity();
if (execution.isConcurrent()) {
for (ActivityExecution concurrentExecution : getLeaveExecutions(execution.getParent())) {
if (concurrentExecution.isActive() && !concurrentExecution.getId().equals(execution.getId())) {
// TODO: when is transitionBeingTaken cleared? Should we clear it?
boolean reachable = false;
PvmTransition pvmTransition = ((ExecutionEntity) concurrentExecution).getTransitionBeingTaken();
if (pvmTransition != null) {
reachable = isReachable(pvmTransition.getDestination(), activity, new HashSet<PvmActivity>());
} else {
reachable = isReachable(concurrentExecution.getActivity(), activity, new HashSet<PvmActivity>());
}
if (reachable) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("an active concurrent execution found: '{}'", concurrentExecution.getActivity());
}
return true;
}
}
}
} else if (execution.isActive()) { // is this ever true?
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("an active concurrent execution found: '{}'", execution.getActivity());
}
return true;
}
return false;
}
示例12: execute
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
CommandContext commandContext = Context.getCommandContext();
List<SignalEventSubscriptionEntity> subscriptionEntities = null;
if (processInstanceScope) {
subscriptionEntities = commandContext
.getEventSubscriptionEntityManager()
.findSignalEventSubscriptionsByProcessInstanceAndEventName(execution.getProcessInstanceId(), signalDefinition.getEventName());
} else {
subscriptionEntities = commandContext
.getEventSubscriptionEntityManager()
.findSignalEventSubscriptionsByEventName(signalDefinition.getEventName(), execution.getTenantId());
}
for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) {
ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(signalEventSubscriptionEntity.getProcessDefinitionId());
if (Flowable5Util.isVersion5Tag(processDefinition.getEngineVersion())) {
signalEventSubscriptionEntity.eventReceived(null, signalDefinition.isAsync());
} else {
org.flowable.engine.ProcessEngineConfiguration flowable6ProcessEngineConfiguration = commandContext.getProcessEngineConfiguration()
.getFlowable5CompatibilityHandler()
.getFlowable6ProcessEngineConfiguration();
org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl flowable6ProcessEngineConfigurationImpl = (org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl) flowable6ProcessEngineConfiguration;
EventSubscriptionEntityManager eventSubScriptionEntityManager = flowable6ProcessEngineConfigurationImpl.getEventSubscriptionEntityManager();
EventSubscriptionEntity flowable6EventSubscription = eventSubScriptionEntityManager.findById(signalEventSubscriptionEntity.getId());
eventSubScriptionEntityManager.eventReceived(flowable6EventSubscription, null, signalDefinition.isAsync());
}
}
ActivityExecution activityExecution = (ActivityExecution) execution;
if (activityExecution.getActivity() != null) { // don't continue if process has already finished
leave(activityExecution);
}
}
示例13: performDefaultOutgoingBehavior
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
/**
* Performs the default outgoing BPMN 2.0 behavior, which is having parallel paths of executions for the outgoing sequence flow.
* <p>
* More precisely: every sequence flow that has a condition which evaluates to true (or which doesn't have a condition), is selected for continuation of the process instance. If multiple sequencer
* flow are selected, multiple, parallel paths of executions are created.
*/
public void performDefaultOutgoingBehavior(ActivityExecution activityExecution) {
ActivityImpl activity = (ActivityImpl) activityExecution.getActivity();
if (!(activity.getActivityBehavior() instanceof IntermediateCatchEventActivityBehavior)) {
dispatchJobCanceledEvents(activityExecution);
}
performOutgoingBehavior(activityExecution, true, false, null);
}
示例14: execute
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
activityExecution.inactivate();
lockConcurrentRoot(activityExecution);
PvmActivity activity = activityExecution.getActivity();
if (!activeConcurrentExecutionsExist(activityExecution)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("inclusive gateway '{}' activates", activity.getId());
}
List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
String defaultSequenceFlow = (String) activityExecution.getActivity().getProperty("default");
List<PvmTransition> transitionsToTake = new ArrayList<>();
for (PvmTransition outgoingTransition : activityExecution.getActivity().getOutgoingTransitions()) {
Expression skipExpression = outgoingTransition.getSkipExpression();
if (!SkipExpressionUtil.isSkipExpressionEnabled(activityExecution, skipExpression)) {
if (defaultSequenceFlow == null || !outgoingTransition.getId().equals(defaultSequenceFlow)) {
Condition condition = (Condition) outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
if (condition == null || condition.evaluate(outgoingTransition.getId(), execution)) {
transitionsToTake.add(outgoingTransition);
}
}
} else if (SkipExpressionUtil.shouldSkipFlowElement(activityExecution, skipExpression)) {
transitionsToTake.add(outgoingTransition);
}
}
if (!transitionsToTake.isEmpty()) {
activityExecution.takeAll(transitionsToTake, joinedExecutions);
} else {
if (defaultSequenceFlow != null) {
PvmTransition defaultTransition = activityExecution.getActivity().findOutgoingTransition(defaultSequenceFlow);
if (defaultTransition != null) {
activityExecution.take(defaultTransition);
} else {
throw new ActivitiException("Default sequence flow '"
+ defaultSequenceFlow + "' could not be not found");
}
} else {
// No sequence flow could be found, not even a default one
throw new ActivitiException(
"No outgoing sequence flow of the inclusive gateway '"
+ activityExecution.getActivity().getId()
+ "' could be selected for continuing the process");
}
}
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Inclusive gateway '{}' does not activate", activity.getId());
}
}
}