@Override public void execute(DelegateExecution execution) throws Exception { ExecutionEntity execution1 = new ExecutionEntity(); execution1.setId(ENTITY_ID1); execution1.setExecutions(new ArrayList<ExecutionEntity>()); ExecutionEntity execution2 = new ExecutionEntity(); execution2.setId(ENTITY_ID2); execution2.setExecutions(new ArrayList<ExecutionEntity>()); execution2.setParent(execution1); ExecutionManager executionManager = Context.getCommandContext().getExecutionManager(); executionManager.insert(execution1); executionManager.insert(execution2); executionThreadControl.sync(); }
@Test public void testRestoreProcessInstance() { //given parent execution List<ExecutionEntity> entities = new ArrayList<ExecutionEntity>(); ExecutionEntity parent = new ExecutionEntity(); parent.setId("parent"); entities.add(parent); //when restore process instance is called parent.restoreProcessInstance(entities, null, null, null, null, null, null); //then no problem should occure //when child is added and restore is called again ExecutionEntity entity = new ExecutionEntity(); entity.setId("child"); entity.setParentId(parent.getId()); entities.add(entity); parent.restoreProcessInstance(entities, null, null, null, null, null, null); //then again no problem should occure //when parent is deleted from the list entities.remove(parent); //then exception is thrown because child reference to parent which does not exist anymore thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot resolve parent with id 'parent' of execution 'child', perhaps it was deleted in the meantime"); parent.restoreProcessInstance(entities, null, null, null, null, null, null); }
execution1.setId("101"); execution2 = new ExecutionEntity(); execution2.setId("102"); execution3 = new ExecutionEntity(); execution3.setId("103"); execution4 = new ExecutionEntity(); execution4.setId("104"); execution5 = new ExecutionEntity(); execution5.setId("105"); execution6 = new ExecutionEntity(); execution6.setId("106"); execution7 = new ExecutionEntity(); execution7.setId("107"); execution8 = new ExecutionEntity(); execution8.setId("108");
public void execute(DelegateExecution execution) throws Exception { String existingId = execution.getId(); // insert an execution referencing the current execution ExecutionEntity newExecution = new ExecutionEntity(); newExecution.setId("someId"); newExecution.setParentId(existingId); DbEntityOperation insertOperation = new DbEntityOperation(); insertOperation.setOperationType(DbOperationType.INSERT); insertOperation.setEntity(newExecution); Context.getCommandContext() .getDbSqlSession() .executeDbOperation(insertOperation); }
@Override public void execute(DelegateExecution execution) throws Exception { ExecutionEntity execution1 = new ExecutionEntity(); execution1.setId(ENTITY_ID1); execution1.setExecutions(new ArrayList<ExecutionEntity>()); ExecutionEntity execution2 = new ExecutionEntity(); execution2.setId(ENTITY_ID2); execution2.setExecutions(new ArrayList<ExecutionEntity>()); execution2.setParent(execution1); ExecutionManager executionManager = Context.getCommandContext().getExecutionManager(); executionManager.insert(execution1); executionManager.insert(execution2); executionThreadControl.sync(); }
@Test public void testRestoreProcessInstance() { //given parent execution List<ExecutionEntity> entities = new ArrayList<ExecutionEntity>(); ExecutionEntity parent = new ExecutionEntity(); parent.setId("parent"); entities.add(parent); //when restore process instance is called parent.restoreProcessInstance(entities, null, null, null, null, null, null); //then no problem should occure //when child is added and restore is called again ExecutionEntity entity = new ExecutionEntity(); entity.setId("child"); entity.setParentId(parent.getId()); entities.add(entity); parent.restoreProcessInstance(entities, null, null, null, null, null, null); //then again no problem should occure //when parent is deleted from the list entities.remove(parent); //then exception is thrown because child reference to parent which does not exist anymore thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot resolve parent with id 'parent' of execution 'child', perhaps it was deleted in the meantime"); parent.restoreProcessInstance(entities, null, null, null, null, null, null); }
execution1.setId("101"); execution2 = new ExecutionEntity(); execution2.setId("102"); execution3 = new ExecutionEntity(); execution3.setId("103"); execution4 = new ExecutionEntity(); execution4.setId("104"); execution5 = new ExecutionEntity(); execution5.setId("105"); execution6 = new ExecutionEntity(); execution6.setId("106"); execution7 = new ExecutionEntity(); execution7.setId("107"); execution8 = new ExecutionEntity(); execution8.setId("108");
public void execute(DelegateExecution execution) throws Exception { String existingId = execution.getId(); // insert an execution referencing the current execution ExecutionEntity newExecution = new ExecutionEntity(); newExecution.setId("someId"); newExecution.setParentId(existingId); DbEntityOperation insertOperation = new DbEntityOperation(); insertOperation.setOperationType(DbOperationType.INSERT); insertOperation.setEntity(newExecution); Context.getCommandContext() .getDbSqlSession() .executeDbOperation(insertOperation); }