@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; } }
@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; } }
public void testExecutionEntitySerialization() throws Exception { ExecutionEntity execution = new ExecutionEntity(); ActivityImpl activityImpl = new ActivityImpl("test", null); activityImpl.getExecutionListeners().put("start", Collections.<ExecutionListener>singletonList(new TestExecutionListener())); execution.setActivity(activityImpl); ProcessDefinitionImpl processDefinitionImpl = new ProcessDefinitionImpl("test"); processDefinitionImpl.getExecutionListeners().put("start", Collections.<ExecutionListener>singletonList(new TestExecutionListener())); execution.setProcessDefinition(processDefinitionImpl); TransitionImpl transitionImpl = new TransitionImpl("test", new ProcessDefinitionImpl("test")); transitionImpl.addExecutionListener(new TestExecutionListener()); execution.setTransition(transitionImpl); execution.getProcessInstanceStartContext().setInitial(activityImpl); execution.setSuperExecution(new ExecutionEntity()); execution.setActive(true); execution.setCanceled(false); execution.setBusinessKey("myBusinessKey"); execution.setDeleteReason("no reason"); execution.setActivityInstanceId("123"); execution.setScope(false); byte[] data = writeObject(execution); execution = (ExecutionEntity) readObject(data); assertEquals("myBusinessKey", execution.getBusinessKey()); assertEquals("no reason", execution.getDeleteReason()); assertEquals("123", execution.getActivityInstanceId()); }
@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; } }
public void testExecutionEntitySerialization() throws Exception { ExecutionEntity execution = new ExecutionEntity(); ActivityImpl activityImpl = new ActivityImpl("test", null); activityImpl.getExecutionListeners().put("start", Collections.<ExecutionListener>singletonList(new TestExecutionListener())); execution.setActivity(activityImpl); ProcessDefinitionImpl processDefinitionImpl = new ProcessDefinitionImpl("test"); processDefinitionImpl.getExecutionListeners().put("start", Collections.<ExecutionListener>singletonList(new TestExecutionListener())); execution.setProcessDefinition(processDefinitionImpl); TransitionImpl transitionImpl = new TransitionImpl("test", new ProcessDefinitionImpl("test")); transitionImpl.addExecutionListener(new TestExecutionListener()); execution.setTransition(transitionImpl); execution.getProcessInstanceStartContext().setInitial(activityImpl); execution.setSuperExecution(new ExecutionEntity()); execution.setActive(true); execution.setCanceled(false); execution.setBusinessKey("myBusinessKey"); execution.setDeleteReason("no reason"); execution.setActivityInstanceId("123"); execution.setScope(false); byte[] data = writeObject(execution); execution = (ExecutionEntity) readObject(data); assertEquals("myBusinessKey", execution.getBusinessKey()); assertEquals("no reason", execution.getDeleteReason()); assertEquals("123", execution.getActivityInstanceId()); }