org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity Java Examples
The following examples show how to use
org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HistoricVariableInstanceQueryImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public List<HistoricVariableInstance> executeList(CommandContext commandContext, Page page) { checkQueryOk(); ensureVariablesInitialized(); List<HistoricVariableInstance> historicVariableInstances = commandContext.getHistoricVariableInstanceEntityManager().findHistoricVariableInstancesByQueryCriteria(this, page); if (excludeVariableInitialization == false) { for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) { if (historicVariableInstance instanceof HistoricVariableInstanceEntity) { HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) historicVariableInstance; if (variableEntity != null && variableEntity.getVariableType() != null) { variableEntity.getValue(); // make sure JPA entities are cached for later retrieval if (JPAEntityVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName())) { ((CacheableVariable) variableEntity.getVariableType()).setForceCacheable(true); } } } } } return historicVariableInstances; }
Example #2
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testRestrictByExecutionId() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().executionId(processInstance.getId()).list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(5, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(3, historyService.createHistoricDetailQuery().count()); } }
Example #3
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testTwoSubProcessInParallelWithinSubProcess() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list(); assertEquals(2, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("myVar", historicVariable.getName()); assertEquals("test101112", historicVariable.getTextValue()); HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1); assertEquals("myVar1", historicVariable1.getName()); assertEquals("test789", historicVariable1.getTextValue()); assertEquals(18, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(7, historyService.createHistoricDetailQuery().count()); } }
Example #4
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testParallelNoWaitState() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(7, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(2, historyService.createHistoricDetailQuery().count()); } }
Example #5
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testSimpleNoWaitState() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(4, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(2, historyService.createHistoricDetailQuery().count()); } }
Example #6
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testSimple() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(5, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(3, historyService.createHistoricDetailQuery().count()); } }
Example #7
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testSimple() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(5, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(3, historyService.createHistoricDetailQuery().count()); } }
Example #8
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testSimpleNoWaitState() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(4, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(2, historyService.createHistoricDetailQuery().count()); } }
Example #9
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testParallelNoWaitState() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(7, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(2, historyService.createHistoricDetailQuery().count()); } }
Example #10
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testTwoSubProcessInParallelWithinSubProcess() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess"); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list(); assertEquals(2, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("myVar", historicVariable.getName()); assertEquals("test101112", historicVariable.getTextValue()); HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1); assertEquals("myVar1", historicVariable1.getName()); assertEquals("test789", historicVariable1.getTextValue()); assertEquals(18, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(7, historyService.createHistoricDetailQuery().count()); } }
Example #11
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testRestrictByExecutionId() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().executionId(processInstance.getId()).list(); assertEquals(1, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("test456", historicVariable.getTextValue()); assertEquals(5, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(3, historyService.createHistoricDetailQuery().count()); } }
Example #12
Source File: HistoricVariableInstanceQueryImpl.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public List<HistoricVariableInstance> executeList(CommandContext commandContext, Page page) { checkQueryOk(); ensureVariablesInitialized(); List<HistoricVariableInstance> historicVariableInstances = commandContext .getHistoricVariableInstanceEntityManager() .findHistoricVariableInstancesByQueryCriteria(this, page); if (!excludeVariableInitialization) { for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) { if (historicVariableInstance instanceof HistoricVariableInstanceEntity) { HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) historicVariableInstance; if (variableEntity.getVariableType() != null) { variableEntity.getValue(); // make sure JPA entities are cached for later retrieval if (JPAEntityVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName())) { ((CacheableVariable) variableEntity.getVariableType()).setForceCacheable(true); } } } } } return historicVariableInstances; }
Example #13
Source File: DefaultHistoryManager.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void recordVariableUpdate(VariableInstanceEntity variable) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricVariableInstanceEntity historicProcessVariable = getDbSqlSession() .findInCache(HistoricVariableInstanceEntity.class, variable.getId()); if (historicProcessVariable == null) { historicProcessVariable = Context.getCommandContext() .getHistoricVariableInstanceEntityManager() .findHistoricVariableInstanceByVariableInstanceId(variable.getId()); } if (historicProcessVariable != null) { historicProcessVariable.copyValue(variable); } else { HistoricVariableInstanceEntity.copyAndInsert(variable); } } }
Example #14
Source File: DefaultHistoryManager.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void recordVariableRemoved(VariableInstanceEntity variable) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricVariableInstanceEntity historicProcessVariable = getDbSqlSession() .findInCache(HistoricVariableInstanceEntity.class, variable.getId()); if (historicProcessVariable == null) { historicProcessVariable = Context.getCommandContext() .getHistoricVariableInstanceEntityManager() .findHistoricVariableInstanceByVariableInstanceId(variable.getId()); } if (historicProcessVariable != null) { Context.getCommandContext() .getHistoricVariableInstanceEntityManager() .delete(historicProcessVariable); } } }
Example #15
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testParallel() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list(); assertEquals(2, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("myVar", historicVariable.getName()); assertEquals("test789", historicVariable.getTextValue()); HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1); assertEquals("myVar1", historicVariable1.getName()); assertEquals("test456", historicVariable1.getTextValue()); assertEquals(8, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(5, historyService.createHistoricDetailQuery().count()); } }
Example #16
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = "org/activiti/engine/test/history/HistoricVariableInstanceTest.testSimple.bpmn20.xml") public void testNativeHistoricVariableInstanceQuery() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { assertEquals("ACT_HI_VARINST", managementService.getTableName(HistoricVariableInstance.class)); assertEquals("ACT_HI_VARINST", managementService.getTableName(HistoricVariableInstanceEntity.class)); String tableName = managementService.getTableName(HistoricVariableInstance.class); String baseQuerySql = "SELECT * FROM " + tableName; Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "value1"); variables.put("var2", "value2"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc", variables); assertNotNull(processInstance); assertEquals(3, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).list().size()); String sqlWithConditions = baseQuerySql + " where NAME_ = #{name}"; assertEquals("test123", historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions).parameter("name", "myVar").singleResult().getValue()); sqlWithConditions = baseQuerySql + " where NAME_ like #{name}"; assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions).parameter("name", "var%").list().size()); // paging assertEquals(3, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).listPage(0, 3).size()); assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).listPage(1, 3).size()); assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions).parameter("name", "var%").listPage(0, 2).size()); } }
Example #17
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = "org/activiti5/engine/test/history/HistoricVariableInstanceTest.testSimple.bpmn20.xml") public void testNativeHistoricVariableInstanceQuery() { if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { assertEquals("ACT_HI_VARINST", managementService.getTableName(HistoricVariableInstance.class)); assertEquals("ACT_HI_VARINST", managementService.getTableName(HistoricVariableInstanceEntity.class)); String tableName = managementService.getTableName(HistoricVariableInstance.class); String baseQuerySql = "SELECT * FROM " + tableName; Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "value1"); variables.put("var2", "value2"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc", variables); assertNotNull(processInstance); assertEquals(3, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).list().size()); String sqlWithConditions = baseQuerySql + " where NAME_ = #{name}"; assertEquals("test123", historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions) .parameter("name", "myVar").singleResult().getValue()); sqlWithConditions = baseQuerySql + " where NAME_ like #{name}"; assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions) .parameter("name", "var%").list().size()); // paging assertEquals(3, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).listPage(0, 3).size()); assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).listPage(1, 3).size()); assertEquals(2, historyService.createNativeHistoricVariableInstanceQuery().sql(sqlWithConditions) .parameter("name", "var%").listPage(0, 2).size()); } }
Example #18
Source File: ProcessInstanceLogQueryAndByteArrayTypeVariableTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testIncludeVariables() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariables() .singleResult(); List<HistoricData> events = log.getHistoricData(); assertEquals(1, events.size()); for (HistoricData event : events) { assertTrue(event instanceof HistoricVariableInstance); assertEquals(((HistoricVariableInstanceEntity) event).getValue(), LARGE_STRING_VALUE); } } }
Example #19
Source File: HistoricJPAVariableTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testGetJPAEntityAsHistoricLog() { setupJPAEntities(); // ----------------------------------------------------------------------------- // Simple test, Start process with JPA entities as variables // ----------------------------------------------------------------------------- Map<String, Object> variables = new HashMap<String, Object>(); variables.put("simpleEntityFieldAccess", simpleEntityFieldAccess); // Start the process with the JPA-entities as variables. They will be stored // in the DB. this.processInstanceId = runtimeService.startProcessInstanceByKey("JPAVariableProcess", variables).getId(); // Finish tasks for (Task task : taskService.createTaskQuery().includeTaskLocalVariables().list()) { taskService.complete(task.getId()); } // Get JPAEntity Variable by ProcessInstanceHistoryLogQuery ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId).includeVariables().singleResult(); List<HistoricData> events = log.getHistoricData(); for (HistoricData event : events) { Object value = ((HistoricVariableInstanceEntity) event).getValue(); assertTrue(value instanceof FieldAccessJPAEntity); assertEquals(((FieldAccessJPAEntity) value).getValue(), simpleEntityFieldAccess.getValue()); } }
Example #20
Source File: HistoricJPAVariableTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testGetJPAEntityAsHistoricLog() { setupJPAEntities(); // ----------------------------------------------------------------------------- // Simple test, Start process with JPA entities as variables // ----------------------------------------------------------------------------- Map<String, Object> variables = new HashMap<String, Object>(); variables.put("simpleEntityFieldAccess", simpleEntityFieldAccess); // Start the process with the JPA-entities as variables. They will be stored in the DB. this.processInstanceId = runtimeService.startProcessInstanceByKey("JPAVariableProcess", variables).getId(); // Finish tasks for (Task task : taskService.createTaskQuery().includeTaskLocalVariables().list()) { taskService.complete(task.getId()); } // Get JPAEntity Variable by ProcessInstanceHistoryLogQuery ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariables() .singleResult(); List<HistoricData> events = log.getHistoricData(); for (HistoricData event : events) { Object value = ((HistoricVariableInstanceEntity) event).getValue(); assertTrue(value instanceof FieldAccessJPAEntity); assertEquals(((FieldAccessJPAEntity)value).getValue(), simpleEntityFieldAccess.getValue()); } }
Example #21
Source File: DefaultHistoryManager.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void recordVariableCreate(VariableInstanceEntity variable) { // Historic variables if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricVariableInstanceEntity.copyAndInsert(variable); } }
Example #22
Source File: ProcessInstanceLogQueryAndByteArrayTypeVariableTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testIncludeVariables() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariables() .singleResult(); List<HistoricData> events = log.getHistoricData(); assertEquals(1, events.size()); for (HistoricData event : events) { assertTrue(event instanceof HistoricVariableInstance); assertEquals(((HistoricVariableInstanceEntity) event).getValue(), LARGE_STRING_VALUE); } } }
Example #23
Source File: HistoricVariableInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testParallel() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc"); TaskQuery taskQuery = taskService.createTaskQuery(); Task userTask = taskQuery.singleResult(); assertEquals("userTask1", userTask.getName()); taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789")); assertProcessEnded(processInstance.getId()); List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list(); assertEquals(2, variables.size()); HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0); assertEquals("myVar", historicVariable.getName()); assertEquals("test789", historicVariable.getTextValue()); HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1); assertEquals("myVar1", historicVariable1.getName()); assertEquals("test456", historicVariable1.getTextValue()); assertEquals(8, historyService.createHistoricActivityInstanceQuery().count()); assertEquals(5, historyService.createHistoricDetailQuery().count()); } }
Example #24
Source File: DefaultHistoryManager.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public void recordVariableRemoved(VariableInstanceEntity variable) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricVariableInstanceEntity historicProcessVariable = getEntityCache() .findInCache(HistoricVariableInstanceEntity.class, variable.getId()); if (historicProcessVariable == null) { historicProcessVariable = getHistoricVariableInstanceEntityManager() .findHistoricVariableInstanceByVariableInstanceId(variable.getId()); } if (historicProcessVariable != null) { getHistoricVariableInstanceEntityManager().delete(historicProcessVariable); } } }
Example #25
Source File: DefaultHistoryManager.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public void recordVariableUpdate(VariableInstanceEntity variable) { if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) { HistoricVariableInstanceEntity historicProcessVariable = getEntityCache().findInCache(HistoricVariableInstanceEntity.class, variable.getId()); if (historicProcessVariable == null) { historicProcessVariable = getHistoricVariableInstanceEntityManager().findHistoricVariableInstanceByVariableInstanceId(variable.getId()); } if (historicProcessVariable != null) { getHistoricVariableInstanceEntityManager().copyVariableValue(historicProcessVariable, variable); } else { getHistoricVariableInstanceEntityManager().copyAndInsert(variable); } } }
Example #26
Source File: HistoricVariableInstanceByTaskIdMatcher.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public boolean isRetained(HistoricVariableInstanceEntity historicVariableInstanceEntity, Object parameter) { return historicVariableInstanceEntity.getTaskId() != null && historicVariableInstanceEntity.getTaskId().equals((String) parameter); }
Example #27
Source File: HistoricVariableInstanceByProcInstMatcher.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public boolean isRetained(HistoricVariableInstanceEntity historicVariableInstanceEntity, Object parameter) { return historicVariableInstanceEntity.getProcessInstanceId() != null && historicVariableInstanceEntity.getProcessInstanceId().equals((String) parameter); }
Example #28
Source File: MybatisHistoricVariableInstanceDataManager.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public Class<? extends HistoricVariableInstanceEntity> getManagedEntityClass() { return HistoricVariableInstanceEntityImpl.class; }
Example #29
Source File: MybatisHistoricVariableInstanceDataManager.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override public HistoricVariableInstanceEntity create() { return new HistoricVariableInstanceEntityImpl(); }
Example #30
Source File: ProcessInstanceHistoryLogQueryImpl.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public ProcessInstanceHistoryLog execute(CommandContext commandContext) { // Fetch historic process instance HistoricProcessInstanceEntity historicProcessInstance = commandContext .getHistoricProcessInstanceEntityManager().findHistoricProcessInstance(processInstanceId); if (historicProcessInstance == null) { return null; } // Create a log using this historic process instance ProcessInstanceHistoryLogImpl processInstanceHistoryLog = new ProcessInstanceHistoryLogImpl(historicProcessInstance); // Add events, based on query settings // Tasks if (includeTasks) { List<? extends HistoricData> tasks = commandContext.getHistoricTaskInstanceEntityManager() .findHistoricTaskInstancesByQueryCriteria( new HistoricTaskInstanceQueryImpl(commandExecutor).processInstanceId(processInstanceId)); processInstanceHistoryLog.addHistoricData(tasks); } // Activities if (includeActivities) { List<HistoricActivityInstance> activities = commandContext.getHistoricActivityInstanceEntityManager() .findHistoricActivityInstancesByQueryCriteria( new HistoricActivityInstanceQueryImpl(commandExecutor).processInstanceId(processInstanceId), null); processInstanceHistoryLog.addHistoricData(activities); } // Variables if (includeVariables) { List<HistoricVariableInstance> variables = commandContext.getHistoricVariableInstanceEntityManager() .findHistoricVariableInstancesByQueryCriteria( new HistoricVariableInstanceQueryImpl(commandExecutor).processInstanceId(processInstanceId), null); // Make sure all variables values are fetched (similar to the HistoricVariableInstance query) for (HistoricVariableInstance historicVariableInstance : variables) { historicVariableInstance.getValue(); // make sure JPA entities are cached for later retrieval HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) historicVariableInstance; if (JPAEntityVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName())) { ((CacheableVariable) variableEntity.getVariableType()).setForceCacheable(true); } } processInstanceHistoryLog.addHistoricData(variables); } // Comment if (includeComments) { List<? extends HistoricData> comments = commandContext.getCommentEntityManager().findCommentsByProcessInstanceId(processInstanceId); processInstanceHistoryLog.addHistoricData(comments); } // Details: variables if (includeVariableUpdates) { List<? extends HistoricData> variableUpdates = commandContext.getHistoricDetailEntityManager() .findHistoricDetailsByQueryCriteria(new HistoricDetailQueryImpl(commandExecutor).variableUpdates(), null); // Make sure all variables values are fetched (similar to the HistoricVariableInstance query) for (HistoricData historicData : variableUpdates) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) historicData; variableUpdate.getValue(); } processInstanceHistoryLog.addHistoricData(variableUpdates); } // Details: form properties if (includeFormProperties) { List<? extends HistoricData> formProperties = commandContext.getHistoricDetailEntityManager() .findHistoricDetailsByQueryCriteria(new HistoricDetailQueryImpl(commandExecutor).formProperties(), null); processInstanceHistoryLog.addHistoricData(formProperties); } // All events collected. Sort them by date. processInstanceHistoryLog.orderHistoricData(); return processInstanceHistoryLog; }