本文整理汇总了Java中org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.getActivity方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionEntity.getActivity方法的具体用法?Java ExecutionEntity.getActivity怎么用?Java ExecutionEntity.getActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
的用法示例。
在下文中一共展示了ExecutionEntity.getActivity方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeLegacySubscriptionOnParent
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
/**
* <p>Required for migrating active sequential MI receive tasks. These activities were formerly not scope,
* but are now. This has the following implications:
*
* <p>Before migration:
* <ul><li> the event subscription is attached to the miBody scope execution</ul>
*
* <p>After migration:
* <ul><li> a new subscription is created for every instance
* <li> the new subscription is attached to a dedicated scope execution as a child of the miBody scope
* execution</ul>
*
* <p>Thus, this method removes the subscription on the miBody scope
*/
public static void removeLegacySubscriptionOnParent(ExecutionEntity execution, EventSubscriptionEntity eventSubscription) {
ActivityImpl activity = execution.getActivity();
if (activity == null) {
return;
}
ActivityBehavior behavior = activity.getActivityBehavior();
ActivityBehavior parentBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
if (behavior instanceof ReceiveTaskActivityBehavior &&
parentBehavior instanceof MultiInstanceActivityBehavior) {
List<EventSubscriptionEntity> parentSubscriptions = execution.getParent().getEventSubscriptions();
for (EventSubscriptionEntity subscription : parentSubscriptions) {
// distinguish a boundary event on the mi body with the same message name from the receive task subscription
if (areEqualEventSubscriptions(subscription, eventSubscription)) {
subscription.delete();
}
}
}
}
示例2: assignExecutionsToActivities
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void assignExecutionsToActivities(List<ExecutionEntity> leaves) {
for (ExecutionEntity leaf : leaves) {
ScopeImpl activity = leaf.getActivity();
if (activity != null) {
if (leaf.getActivityInstanceId() != null) {
EnsureUtil.ensureNotNull("activity", activity);
submitExecution(leaf, activity);
}
mergeScopeExecutions(leaf);
}
else if (leaf.isProcessInstanceExecution()) {
submitExecution(leaf, leaf.getProcessDefinition());
}
}
}
示例3: resolveJobHandlerConfiguration
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
protected JobHandlerConfiguration resolveJobHandlerConfiguration(AtomicOperationInvocation context) {
AsyncContinuationConfiguration configuration = new AsyncContinuationConfiguration();
configuration.setAtomicOperation(context.getOperation().getCanonicalName());
ExecutionEntity execution = context.getExecution();
PvmActivity activity = execution.getActivity();
if(activity != null && activity.isAsyncAfter()) {
if(execution.getTransition() != null) {
// store id of selected transition in case this is async after.
// id is not serialized with the execution -> we need to remember it as
// job handler configuration.
configuration.setTransitionId(execution.getTransition().getId());
}
}
return configuration;
}
示例4: execute
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public void execute(AsyncContinuationConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
LegacyBehavior.repairMultiInstanceAsyncJob(execution);
PvmAtomicOperation atomicOperation = findMatchingAtomicOperation(configuration.getAtomicOperation());
ensureNotNull("Cannot process job with configuration " + configuration, "atomicOperation", atomicOperation);
// reset transition id.
String transitionId = configuration.getTransitionId();
if (transitionId != null) {
PvmActivity activity = execution.getActivity();
TransitionImpl transition = (TransitionImpl) activity.findOutgoingTransition(transitionId);
execution.setTransition(transition);
}
Context.getCommandInvocationContext()
.performOperation(atomicOperation, execution);
}
示例5: initActivityInstanceEvent
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void initActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, ExecutionEntity execution, HistoryEventType eventType) {
PvmScope eventSource = execution.getActivity();
if (eventSource == null) {
eventSource = (PvmScope) execution.getEventSource();
}
String activityInstanceId = execution.getActivityInstanceId();
String parentActivityInstanceId = null;
ExecutionEntity parentExecution = execution.getParent();
if (parentExecution != null && CompensationBehavior.isCompensationThrowing(parentExecution) && execution.getActivity() != null) {
parentActivityInstanceId = CompensationBehavior.getParentActivityInstanceId(execution);
} else {
parentActivityInstanceId = execution.getParentActivityInstanceId();
}
initActivityInstanceEvent(evt,
execution,
eventSource,
activityInstanceId,
parentActivityInstanceId,
eventType);
}
示例6: notify
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
ExecutionEntity executionCasted = ((ExecutionEntity)execution);
String parameterValue = null;
if (parameter != null) {
parameterValue = (String)parameter.getValue(execution);
}
String activityName = null;
if (executionCasted.getActivity() != null) {
activityName = executionCasted.getActivity().getProperties().get(new PropertyKey<String>("name"));
}
recordedEvents.add( new RecordedEvent(
executionCasted.getActivityId(),
activityName,
execution.getEventName(),
parameterValue,
execution.getActivityInstanceId(),
execution.getCurrentTransitionId(),
execution.isCanceled(),
execution.getId()));
}
示例7: repairMultiInstanceAsyncJob
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
/**
* When executing an async job for an activity wrapped in an miBody, set the execution to the
* miBody except the wrapped activity is marked as async.
*
* Background: in <= 7.2 async jobs were created for the inner activity, although the
* semantics are that they are executed before the miBody is entered
*/
public static void repairMultiInstanceAsyncJob(ExecutionEntity execution) {
ActivityImpl activity = execution.getActivity();
if (!isAsync(activity) && isActivityWrappedInMultiInstanceBody(activity)) {
execution.setActivity((ActivityImpl) activity.getFlowScope());
}
}
示例8: handleChildRemovalInScope
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void handleChildRemovalInScope(ExecutionEntity removedExecution) {
// TODO: the following should be closer to PvmAtomicOperationDeleteCascadeFireActivityEnd
// (note though that e.g. boundary events expect concurrent executions to be preserved)
//
// Idea: attempting to prune and synchronize on the parent is the default behavior when
// a concurrent child is removed, but scope activities implementing ModificationObserverBehavior
// override this default (and therefore *must* take care of reorganization themselves)
// notify the behavior that a concurrent execution has been removed
// must be set due to deleteCascade behavior
ActivityImpl activity = removedExecution.getActivity();
if (activity == null) {
return;
}
ScopeImpl flowScope = activity.getFlowScope();
PvmExecutionImpl scopeExecution = removedExecution.getParentScopeExecution(false);
PvmExecutionImpl executionInParentScope = removedExecution.isConcurrent() ? removedExecution : removedExecution.getParent();
if (flowScope.getActivityBehavior() != null && flowScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
// let child removal be handled by the scope itself
ModificationObserverBehavior behavior = (ModificationObserverBehavior) flowScope.getActivityBehavior();
behavior.destroyInnerInstance(executionInParentScope);
}
else {
if (executionInParentScope.isConcurrent()) {
executionInParentScope.remove();
scopeExecution.tryPruneLastConcurrentChild();
scopeExecution.forceUpdate();
}
}
}
示例9: validateAndSwitchVersionOfExecution
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void validateAndSwitchVersionOfExecution(CommandContext commandContext, ExecutionEntity execution, ProcessDefinitionEntity newProcessDefinition) {
// check that the new process definition version contains the current activity
if (execution.getActivity() != null) {
String activityId = execution.getActivity().getId();
PvmActivity newActivity = newProcessDefinition.findActivity(activityId);
if (newActivity == null) {
throw new ProcessEngineException(
"The new process definition " +
"(key = '" + newProcessDefinition.getKey() + "') " +
"does not contain the current activity " +
"(id = '" + activityId + "') " +
"of the process instance " +
"(id = '" + processInstanceId + "').");
}
// clear cached activity so that outgoing transitions are refreshed
execution.setActivity(newActivity);
}
// switch the process instance to the new process definition version
execution.setProcessDefinition(newProcessDefinition);
// and change possible existing tasks (as the process definition id is stored there too)
List<TaskEntity> tasks = commandContext.getTaskManager().findTasksByExecutionId(execution.getId());
for (TaskEntity taskEntity : tasks) {
taskEntity.setProcessDefinitionId(newProcessDefinition.getId());
}
}
示例10: getEventScopeCompensationHandler
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
/**
* In the context when an event scope execution is created (i.e. a scope such as a subprocess has completed),
* this method returns the compensation handler activity that is going to be executed when by the event scope execution.
*
* This method is not relevant when the scope has a boundary compensation handler.
*/
protected static ActivityImpl getEventScopeCompensationHandler(ExecutionEntity execution) {
ActivityImpl activity = execution.getActivity();
ActivityImpl compensationHandler = activity.findCompensationHandler();
if (compensationHandler != null && compensationHandler.isSubProcessScope()) {
// subprocess with inner compensation event subprocess
return compensationHandler;
} else {
// subprocess without compensation handler or
// multi instance activity
return activity;
}
}
示例11: determineEndState
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void determineEndState(ExecutionEntity executionEntity, HistoricProcessInstanceEventEntity evt) {
//determine state
if (executionEntity.getActivity() != null) {
evt.setState(HistoricProcessInstance.STATE_COMPLETED);
} else if (executionEntity.getActivity() == null && executionEntity.isExternallyTerminated()) {
evt.setState(HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED);
} else if (executionEntity.getActivity() == null && !executionEntity.isExternallyTerminated()) {
evt.setState(HistoricProcessInstance.STATE_INTERNALLY_TERMINATED);
}
}
示例12: execute
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public Void execute(CommandContext commandContext) {
String processInstanceId = builder.getProcessInstanceId();
ExecutionManager executionManager = commandContext.getExecutionManager();
ExecutionEntity processInstance = executionManager.findExecutionById(processInstanceId);
ensureProcessInstanceExist(processInstanceId, processInstance);
checkUpdateProcessInstance(processInstance, commandContext);
processInstance.setPreserveScope(true);
List<AbstractProcessInstanceModificationCommand> instructions = builder.getModificationOperations();
checkCancellation(commandContext);
for (int i = 0; i < instructions.size(); i++) {
AbstractProcessInstanceModificationCommand instruction = instructions.get(i);
LOG.debugModificationInstruction(processInstanceId, i + 1, instruction.describe());
instruction.setSkipCustomListeners(builder.isSkipCustomListeners());
instruction.setSkipIoMappings(builder.isSkipIoMappings());
instruction.execute(commandContext);
}
processInstance = executionManager.findExecutionById(processInstanceId);
if (!processInstance.hasChildren()) {
if (!(processInstance.getActivity() != null && !processInstance.getId().equals(processInstance.getActivityInstanceId()))) {
// process instance was cancelled
checkDeleteProcessInstance(processInstance, commandContext);
deletePropagate(processInstance, builder.getModificationReason(), builder.isSkipCustomListeners(), builder.isSkipIoMappings());
}
else if (processInstance.isEnded()) {
// process instance has ended regularly
processInstance.propagateEnd();
}
}
if (writeOperationLog) {
commandContext.getOperationLogManager().logProcessInstanceOperation(getLogEntryOperation(),
processInstanceId,
null,
null,
Collections.singletonList(PropertyChange.EMPTY_CHANGE));
}
return null;
}
示例13: createEventScopeExecution
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
/**
* creates an event scope for the given execution:
*
* create a new event scope execution under the parent of the given execution
* and move all event subscriptions to that execution.
*
* this allows us to "remember" the event subscriptions after finishing a
* scope
*/
public static void createEventScopeExecution(ExecutionEntity execution) {
// parent execution is a subprocess or a miBody
ActivityImpl activity = execution.getActivity();
ExecutionEntity scopeExecution = (ExecutionEntity) execution.findExecutionForFlowScope(activity.getFlowScope());
List<EventSubscriptionEntity> eventSubscriptions = execution.getCompensateEventSubscriptions();
if (eventSubscriptions.size() > 0 || hasCompensationEventSubprocess(activity)) {
ExecutionEntity eventScopeExecution = scopeExecution.createExecution();
eventScopeExecution.setActivity(execution.getActivity());
eventScopeExecution.activityInstanceStarting();
eventScopeExecution.enterActivityInstance();
eventScopeExecution.setActive(false);
eventScopeExecution.setConcurrent(false);
eventScopeExecution.setEventScope(true);
// copy local variables to eventScopeExecution by value. This way,
// the eventScopeExecution references a 'snapshot' of the local variables
Map<String, Object> variables = execution.getVariablesLocal();
for (Entry<String, Object> variable : variables.entrySet()) {
eventScopeExecution.setVariableLocal(variable.getKey(), variable.getValue());
}
// set event subscriptions to the event scope execution:
for (EventSubscriptionEntity eventSubscriptionEntity : eventSubscriptions) {
EventSubscriptionEntity newSubscription =
EventSubscriptionEntity.createAndInsert(
eventScopeExecution,
EventType.COMPENSATE,
eventSubscriptionEntity.getActivity());
newSubscription.setConfiguration(eventSubscriptionEntity.getConfiguration());
// use the original date
newSubscription.setCreated(eventSubscriptionEntity.getCreated());
}
// set existing event scope executions as children of new event scope execution
// (ensuring they don't get removed when 'execution' gets removed)
for (PvmExecutionImpl childEventScopeExecution : execution.getEventScopeExecutions()) {
childEventScopeExecution.setParent(eventScopeExecution);
}
ActivityImpl compensationHandler = getEventScopeCompensationHandler(execution);
EventSubscriptionEntity eventSubscription = EventSubscriptionEntity
.createAndInsert(
scopeExecution,
EventType.COMPENSATE,
compensationHandler
);
eventSubscription.setConfiguration(eventScopeExecution.getId());
}
}