本文整理汇总了Java中org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.setActivity方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionEntity.setActivity方法的具体用法?Java ExecutionEntity.setActivity怎么用?Java ExecutionEntity.setActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
的用法示例。
在下文中一共展示了ExecutionEntity.setActivity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiateScopes
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
protected void instantiateScopes(
MigratingScopeInstance ancestorScopeInstance,
MigratingScopeInstanceBranch executionBranch,
List<ScopeImpl> scopesToInstantiate) {
if (scopesToInstantiate.isEmpty()) {
return;
}
// must always be an activity instance
MigratingActivityInstance ancestorActivityInstance = (MigratingActivityInstance) ancestorScopeInstance;
ExecutionEntity newParentExecution = ancestorActivityInstance.createAttachableExecution();
Map<PvmActivity, PvmExecutionImpl> createdExecutions =
newParentExecution.instantiateScopes((List) scopesToInstantiate, skipCustomListeners, skipIoMappings);
for (ScopeImpl scope : scopesToInstantiate) {
ExecutionEntity createdExecution = (ExecutionEntity) createdExecutions.get(scope);
createdExecution.setActivity(null);
createdExecution.setActive(false);
executionBranch.visited(new MigratingActivityInstance(scope, createdExecution));
}
}
示例2: migrateState
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public void migrateState() {
ExecutionEntity representativeExecution = resolveRepresentativeExecution();
representativeExecution.setProcessDefinition(targetScope.getProcessDefinition());
representativeExecution.setActivity((PvmActivity) targetScope);
}
示例3: instantiateScopes
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
protected void instantiateScopes(
MigratingScopeInstance ancestorScopeInstance,
MigratingScopeInstanceBranch executionBranch,
List<ScopeImpl> scopesToInstantiate) {
if (scopesToInstantiate.isEmpty()) {
return;
}
ExecutionEntity ancestorScopeExecution = ancestorScopeInstance.resolveRepresentativeExecution();
ExecutionEntity parentExecution = ancestorScopeExecution;
for (ScopeImpl scope : scopesToInstantiate) {
ExecutionEntity compensationScopeExecution = parentExecution.createExecution();
compensationScopeExecution.setScope(true);
compensationScopeExecution.setEventScope(true);
compensationScopeExecution.setActivity((PvmActivity) scope);
compensationScopeExecution.setActive(false);
compensationScopeExecution.activityInstanceStarting();
compensationScopeExecution.enterActivityInstance();
EventSubscriptionEntity eventSubscription = EventSubscriptionEntity.createAndInsert(parentExecution, EventType.COMPENSATE, (ActivityImpl) scope);
eventSubscription.setConfiguration(compensationScopeExecution.getId());
executionBranch.visited(new MigratingEventScopeInstance(eventSubscription, compensationScopeExecution, scope));
parentExecution = compensationScopeExecution;
}
}
示例4: detachState
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public void detachState() {
ExecutionEntity currentExecution = resolveRepresentativeExecution();
currentExecution.setActivity(null);
currentExecution.leaveActivityInstance();
currentExecution.setActive(false);
getParent().destroyAttachableExecution(currentExecution);
}
示例5: migrateState
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public void migrateState() {
ExecutionEntity currentExecution = resolveRepresentativeExecution();
currentExecution.setProcessDefinition(targetScope.getProcessDefinition());
currentExecution.setActivity((PvmActivity) targetScope);
currentScope = targetScope;
if (targetScope.isScope()) {
becomeScope();
}
migrateHistory(currentExecution);
}
示例6: 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());
}
}
示例7: 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());
}
}
示例8: handleEvent
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; //导入方法依赖的package包/类
@Override
public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
eventSubscription.delete();
String configuration = eventSubscription.getConfiguration();
ensureNotNull("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId(), "configuration", configuration);
ExecutionEntity compensatingExecution = commandContext.getExecutionManager().findExecutionById(configuration);
ActivityImpl compensationHandler = eventSubscription.getActivity();
// activate execution
compensatingExecution.setActive(true);
if (compensatingExecution.getActivity().getActivityBehavior() instanceof CompositeActivityBehavior) {
compensatingExecution.getParent().setActivityInstanceId(compensatingExecution.getActivityInstanceId());
}
if (compensationHandler.isScope() && !compensationHandler.isCompensationHandler()) {
// descend into scope:
List<EventSubscriptionEntity> eventsForThisScope = compensatingExecution.getCompensateEventSubscriptions();
CompensationUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false);
} else {
try {
if (compensationHandler.isSubProcessScope() && compensationHandler.isTriggeredByEvent()) {
compensatingExecution.executeActivity(compensationHandler);
}
else {
// since we already have a scope execution, we don't need to create another one
// for a simple scoped compensation handler
compensatingExecution.setActivity(compensationHandler);
compensatingExecution.performOperation(PvmAtomicOperation.ACTIVITY_START);
}
} catch (Exception e) {
throw new ProcessEngineException("Error while handling compensation event " + eventSubscription, e);
}
}
}
示例9: 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());
}
}