public virtual IList <HistoricProcessInstanceDto> queryHistoricProcessInstances(HistoricProcessInstanceQueryDto queryDto, int?firstResult, int?maxResults) { queryDto.ObjectMapper = objectMapper; HistoricProcessInstanceQuery query = queryDto.toQuery(processEngine); IList <HistoricProcessInstance> matchingHistoricProcessInstances; if (firstResult != null || maxResults != null) { matchingHistoricProcessInstances = executePaginatedQuery(query, firstResult, maxResults); } else { matchingHistoricProcessInstances = query.list(); } IList <HistoricProcessInstanceDto> historicProcessInstanceDtoResults = new List <HistoricProcessInstanceDto>(); foreach (HistoricProcessInstance historicProcessInstance in matchingHistoricProcessInstances) { HistoricProcessInstanceDto resultHistoricProcessInstanceDto = HistoricProcessInstanceDto.fromHistoricProcessInstance(historicProcessInstance); historicProcessInstanceDtoResults.Add(resultHistoricProcessInstanceDto); } return(historicProcessInstanceDtoResults); }
public virtual BatchDto setRetriesByProcessHistoricQueryBased(SetJobRetriesByProcessDto setJobRetriesDto) { IList <string> processInstanceIds = new List <string>(); HistoricProcessInstanceQueryDto queryDto = setJobRetriesDto.HistoricProcessInstanceQuery; if (queryDto != null) { HistoricProcessInstanceQuery query = queryDto.toQuery(ProcessEngine); IList <HistoricProcessInstance> historicProcessInstances = query.list(); foreach (HistoricProcessInstance historicProcessInstance in historicProcessInstances) { processInstanceIds.Add(historicProcessInstance.Id); } } if (setJobRetriesDto.ProcessInstances != null) { ((IList <string>)processInstanceIds).AddRange(setJobRetriesDto.ProcessInstances); } try { ManagementService managementService = ProcessEngine.ManagementService; Batch batch = managementService.setJobRetriesAsync(processInstanceIds, (ProcessInstanceQuery)null, setJobRetriesDto.Retries.Value); return(BatchDto.fromBatch(batch)); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e.Message); } }
public virtual BatchDto deleteAsyncHistoricQueryBased(DeleteProcessInstancesDto deleteProcessInstancesDto) { IList <string> processInstanceIds = new List <string>(); HistoricProcessInstanceQueryDto queryDto = deleteProcessInstancesDto.HistoricProcessInstanceQuery; if (queryDto != null) { HistoricProcessInstanceQuery query = queryDto.toQuery(ProcessEngine); IList <HistoricProcessInstance> historicProcessInstances = query.list(); foreach (HistoricProcessInstance historicProcessInstance in historicProcessInstances) { processInstanceIds.Add(historicProcessInstance.Id); } } if (deleteProcessInstancesDto.ProcessInstanceIds != null) { ((IList <string>)processInstanceIds).AddRange(deleteProcessInstancesDto.ProcessInstanceIds); } try { RuntimeService runtimeService = ProcessEngine.RuntimeService; Batch batch = runtimeService.deleteProcessInstancesAsync(processInstanceIds, null, deleteProcessInstancesDto.DeleteReason, deleteProcessInstancesDto.SkipCustomListeners, deleteProcessInstancesDto.SkipSubprocesses); return(BatchDto.fromBatch(batch)); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e.Message); } }
public virtual void shouldSetExternalTaskRetriesWithLargeList() { // given engineRule.ProcessEngineConfiguration.BatchJobsPerSeed = 1010; IList <string> processIds = startProcessInstance(PROCESS_DEFINITION_KEY, 1100); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery(); // when Batch batch = externalTaskService.updateRetries().historicProcessInstanceQuery(processInstanceQuery).setAsync(3); createAndExecuteSeedJobs(batch.SeedJobDefinitionId, 2); executeBatchJobs(batch); // then no error is thrown assertHistoricBatchExists(); // cleanup if (!testHelper.HistoryLevelNone) { batch = historyService.deleteHistoricProcessInstancesAsync(processIds, null); createAndExecuteSeedJobs(batch.SeedJobDefinitionId, 2); executeBatchJobs(batch); } }
public virtual void shouldUpdateRetriesByAllParameters() { // given ExternalTask externalTask = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[0]).singleResult(); ExternalTaskQuery externalTaskQuery = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[1]); ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceIds[2]); HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceIds[3]); // when Batch batch = externalTaskService.updateRetries().externalTaskIds(externalTask.Id).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery).processInstanceIds(processInstanceIds[4]).setAsync(5); executeSeedAndBatchJobs(batch); // then IList <ExternalTask> tasks = externalTaskService.createExternalTaskQuery().list(); assertEquals(6, tasks.Count); foreach (ExternalTask task in tasks) { assertEquals(Convert.ToInt32(5), task.Retries); } }
protected internal virtual UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) { ExternalTaskService externalTaskService = ProcessEngine.ExternalTaskService; IList <string> externalTaskIds = retriesDto.ExternalTaskIds; IList <string> processInstanceIds = retriesDto.ProcessInstanceIds; ExternalTaskQuery externalTaskQuery = null; ProcessInstanceQuery processInstanceQuery = null; HistoricProcessInstanceQuery historicProcessInstanceQuery = null; ExternalTaskQueryDto externalTaskQueryDto = retriesDto.ExternalTaskQuery; if (externalTaskQueryDto != null) { externalTaskQuery = externalTaskQueryDto.toQuery(ProcessEngine); } ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.ProcessInstanceQuery; if (processInstanceQueryDto != null) { processInstanceQuery = processInstanceQueryDto.toQuery(ProcessEngine); } HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.HistoricProcessInstanceQuery; if (historicProcessInstanceQueryDto != null) { historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(ProcessEngine); } return(externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetRemovalTime_ByQuery() public virtual void shouldSetRemovalTime_ByQuery() { SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricProcessInstances()).thenReturn(builderMock); HistoricProcessInstanceQuery query = mock(typeof(HistoricProcessInstanceQueryImpl), RETURNS_DEEP_STUBS); when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(query); IDictionary <string, object> payload = new Dictionary <string, object>(); payload["calculatedRemovalTime"] = true; payload["historicProcessInstanceQuery"] = Collections.singletonMap("processDefinitionId", EXAMPLE_PROCESS_DEFINITION_ID); given().contentType(ContentType.JSON).body(payload).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_PROCESS_INSTANCES_ASYNC_URL); SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builder = historyServiceMock.setRemovalTimeToHistoricProcessInstances(); verify(query).processDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID); verify(builder).calculatedRemovalTime(); verify(builder).byIds(null); verify(builder).byQuery(query); verify(builder).executeAsync(); verifyNoMoreInteractions(builder); }
public virtual void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(1L)); }
public virtual void testQueryDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(3L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetNonExistingProcessInstance() public virtual void testGetNonExistingProcessInstance() { HistoricProcessInstanceQuery sampleInstanceQuery = mock(typeof(HistoricProcessInstanceQuery)); when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(sampleInstanceQuery); when(sampleInstanceQuery.processInstanceId(anyString())).thenReturn(sampleInstanceQuery); when(sampleInstanceQuery.singleResult()).thenReturn(null); given().pathParam("id", "aNonExistingInstanceId").then().expect().statusCode(Status.NOT_FOUND.StatusCode).contentType(ContentType.JSON).body("type", equalTo(typeof(InvalidRequestException).Name)).body("message", equalTo("Historic process instance with id aNonExistingInstanceId does not exist")).when().get(HISTORIC_SINGLE_PROCESS_INSTANCE_URL); }
public virtual void testQueryByTenantId() { HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().tenantIdIn(TENANT_ONE); assertThat(query.count(), @is(1L)); query = historyService.createHistoricProcessInstanceQuery().tenantIdIn(TENANT_TWO); assertThat(query.count(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoryProcessInstancesAsyncWithEmptyQuery() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeleteHistoryProcessInstancesAsyncWithEmptyQuery() { //expect thrown.expect(typeof(ProcessEngineException)); //given HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().unfinished(); //when historyService.deleteHistoricProcessInstancesAsync(query, TEST_REASON); }
// historic process instance query ////////////////////////////////////////////////////////// public virtual void testSimpleQueryWithoutAuthorization() { // given startProcessInstanceByKey(PROCESS_KEY); // when HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); // then verifyQueryResults(query, 0); }
public virtual void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(3L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L)); assertThat(query.withoutTenantId().count(), @is(1L)); }
public virtual void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(0L)); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), @is(1L)); }
public virtual CountResultDto queryHistoricProcessInstancesCount(HistoricProcessInstanceQueryDto queryDto) { queryDto.ObjectMapper = objectMapper; HistoricProcessInstanceQuery query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
private void createHistoricProcessInstanceMock() { IList <HistoricProcessInstance> processes = new List <HistoricProcessInstance>(); HistoricProcessInstance mockInstance = MockProvider.createMockHistoricProcessInstance(); processes.Add(mockInstance); HistoricProcessInstanceQuery mockHistoricProcessInstanceQuery = mock(typeof(HistoricProcessInstanceQuery)); when(mockHistoricProcessInstanceQuery.list()).thenReturn(processes); when(mockHistoryService.createHistoricProcessInstanceQuery()).thenReturn(mockHistoricProcessInstanceQuery); }
private IList <HistoricProcessInstance> executePaginatedQuery(HistoricProcessInstanceQuery query, int?firstResult, int?maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = int.MaxValue; } return(query.listPage(firstResult, maxResults)); }
public virtual void testSimpleQueryWithMultiple() { // given startProcessInstanceByKey(PROCESS_KEY).Id; createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY); createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY); // when HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); // then verifyQueryResults(query, 1); }
public virtual void shouldAuthorizeSetRemovalTimeForHistoricProcessInstancesBatch() { // given setupHistory(); authRule.init(scenario).withUser("userId").bindResource("batchId", "*").start(); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); // when historyService.setRemovalTimeToHistoricProcessInstances().absoluteRemovalTime(DateTime.Now).byQuery(query).executeAsync(); // then authRule.assertScenario(scenario); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void deleteHistoricProcessInstanceWithAuthenticatedTenant() public virtual void deleteHistoricProcessInstanceWithAuthenticatedTenant() { testRule.deployForTenant(TENANT_ONE, BPMN_PROCESS); string processInstanceId = startProcessInstance(null); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); historyService.deleteHistoricProcessInstance(processInstanceId); identityService.clearAuthentication(); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoryProcessInstancesAsyncWithQuery() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeleteHistoryProcessInstancesAsyncWithQuery() { //given HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processInstanceIds(new HashSet <string>(historicProcessInstances)); Batch batch = historyService.deleteHistoricProcessInstancesAsync(query, TEST_REASON); executeSeedJob(batch); //when IList <Exception> exceptions = executeBatchJobs(batch); // then assertThat(exceptions.Count, @is(0)); assertNoHistoryForTasks(); assertHistoricBatchExists(testRule); assertAllHistoricProcessInstancesAreDeleted(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetSingleInstance() public virtual void testGetSingleInstance() { HistoricProcessInstance mockInstance = MockProvider.createMockHistoricProcessInstance(); HistoricProcessInstanceQuery sampleInstanceQuery = mock(typeof(HistoricProcessInstanceQuery)); when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(sampleInstanceQuery); when(sampleInstanceQuery.processInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)).thenReturn(sampleInstanceQuery); when(sampleInstanceQuery.singleResult()).thenReturn(mockInstance); Response response = given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).then().expect().statusCode(Status.OK.StatusCode).when().get(HISTORIC_SINGLE_PROCESS_INSTANCE_URL); string content = response.asString(); string returnedProcessInstanceId = from(content).getString("id"); string returnedProcessInstanceBusinessKey = from(content).getString("businessKey"); string returnedProcessDefinitionId = from(content).getString("processDefinitionId"); string returnedProcessDefinitionKey = from(content).getString("processDefinitionKey"); string returnedStartTime = from(content).getString("startTime"); string returnedEndTime = from(content).getString("endTime"); long returnedDurationInMillis = from(content).getLong("durationInMillis"); string returnedStartUserId = from(content).getString("startUserId"); string returnedStartActivityId = from(content).getString("startActivityId"); string returnedDeleteReason = from(content).getString(DELETE_REASON); string returnedSuperProcessInstanceId = from(content).getString("superProcessInstanceId"); string returnedSuperCaseInstanceId = from(content).getString("superCaseInstanceId"); string returnedCaseInstanceId = from(content).getString("caseInstanceId"); string returnedTenantId = from(content).getString("tenantId"); string returnedState = from(content).getString("state"); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, returnedProcessInstanceId); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY, returnedProcessInstanceBusinessKey); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, returnedProcessDefinitionId); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, returnedProcessDefinitionKey); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_TIME, returnedStartTime); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_END_TIME, returnedEndTime); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DURATION_MILLIS, returnedDurationInMillis); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_USER_ID, returnedStartUserId); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_ACTIVITY_ID, returnedStartActivityId); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DELETE_REASON, returnedDeleteReason); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_PROCESS_INSTANCE_ID, returnedSuperProcessInstanceId); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_CASE_INSTANCE_ID, returnedSuperCaseInstanceId); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID, returnedCaseInstanceId); Assert.assertEquals(MockProvider.EXAMPLE_TENANT_ID, returnedTenantId); Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE, returnedState); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteUserOperationLogForProcessInstances_ModeAbsoluteRemovalTime() public virtual void shouldWriteUserOperationLogForProcessInstances_ModeAbsoluteRemovalTime() { // given testRule.process().serviceTask().deploy().start(); identityService.AuthenticatedUserId = "aUserId"; HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery(); // when historyService.setRemovalTimeToHistoricProcessInstances().absoluteRemovalTime(DateTime.Now).byQuery(historicProcessInstanceQuery).executeAsync(); UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().property("mode").singleResult(); // then assertThat(userOperationLogEntry.OrgValue).Null; assertThat(userOperationLogEntry.NewValue).isEqualTo("ABSOLUTE_REMOVAL_TIME"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteUserOperationLogForProcessInstances_HierarchicalFalse() public virtual void shouldWriteUserOperationLogForProcessInstances_HierarchicalFalse() { // given testRule.process().serviceTask().deploy().start(); identityService.AuthenticatedUserId = "aUserId"; HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery(); // when historyService.setRemovalTimeToHistoricProcessInstances().clearedRemovalTime().byQuery(historicProcessInstanceQuery).executeAsync(); UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().property("hierarchical").singleResult(); // then assertThat(userOperationLogEntry.OrgValue).Null; assertThat(userOperationLogEntry.NewValue).isEqualTo("false"); }
public virtual void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition() { // given string processInstanceId = startProcessInstanceByKey(PROCESS_KEY).Id; createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY); // when HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); // then verifyQueryResults(query, 1); HistoricProcessInstance instance = query.singleResult(); assertNotNull(instance); assertEquals(processInstanceId, instance.Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoryProcessInstancesAsyncWithNonExistingIDAsQuery() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeleteHistoryProcessInstancesAsyncWithNonExistingIDAsQuery() { //given List <string> processInstanceIds = new List <string>(); processInstanceIds.Add(historicProcessInstances[0]); processInstanceIds.Add("aFakeId"); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().processInstanceIds(new HashSet <object>(processInstanceIds)); //when Batch batch = historyService.deleteHistoricProcessInstancesAsync(query, TEST_REASON); executeSeedJob(batch); executeBatchJobs(batch); //then assertHistoricBatchExists(testRule); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void deleteHistoricProcessInstanceWithDisabledTenantCheck() public virtual void deleteHistoricProcessInstanceWithDisabledTenantCheck() { testRule.deployForTenant(TENANT_ONE, BPMN_PROCESS); testRule.deployForTenant(TENANT_TWO, BPMN_PROCESS); string processInstanceIdOne = startProcessInstance(TENANT_ONE); string processInstanceIdTwo = startProcessInstance(TENANT_TWO); identityService.setAuthentication("user", null, null); processEngineConfiguration.TenantCheckEnabled = false; historyService.deleteHistoricProcessInstance(processInstanceIdOne); historyService.deleteHistoricProcessInstance(processInstanceIdTwo); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), @is(0L)); }
public override Batch execute(CommandContext commandContext) { ISet <string> historicProcessInstanceIds = new HashSet <string>(); IList <string> instanceIds = builder.Ids; HistoricProcessInstanceQuery instanceQuery = builder.Query; if (instanceQuery == null && instanceIds == null) { throw new BadUserRequestException("Either query nor ids provided."); } if (instanceQuery != null) { foreach (HistoricProcessInstance historicDecisionInstance in instanceQuery.list()) { historicProcessInstanceIds.Add(historicDecisionInstance.Id); } } if (instanceIds != null) { historicProcessInstanceIds.addAll(findHistoricInstanceIds(instanceIds, commandContext)); } ensureNotNull(typeof(BadUserRequestException), "removalTime", builder.getMode()); ensureNotEmpty(typeof(BadUserRequestException), "historicProcessInstances", historicProcessInstanceIds); checkAuthorizations(commandContext, BatchPermissions.CREATE_BATCH_SET_REMOVAL_TIME); writeUserOperationLog(commandContext, historicProcessInstanceIds.Count, builder.getMode(), builder.RemovalTime, builder.Hierarchical, true); BatchEntity batch = createBatch(commandContext, new List <>(historicProcessInstanceIds)); batch.createSeedJobDefinition(); batch.createMonitorJobDefinition(); batch.createBatchJobDefinition(); batch.fireHistoricStartEvent(); batch.createSeedJob(); return(batch); }
public virtual BatchDto setRemovalTimeAsync(SetRemovalTimeToHistoricProcessInstancesDto dto) { HistoryService historyService = processEngine.HistoryService; HistoricProcessInstanceQuery historicProcessInstanceQuery = null; if (dto.HistoricProcessInstanceQuery != null) { historicProcessInstanceQuery = dto.HistoricProcessInstanceQuery.toQuery(processEngine); } SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builder = historyService.setRemovalTimeToHistoricProcessInstances(); if (dto.CalculatedRemovalTime) { builder.calculatedRemovalTime(); } DateTime removalTime = dto.AbsoluteRemovalTime; if (dto.AbsoluteRemovalTime != null) { builder.absoluteRemovalTime(removalTime); } if (dto.ClearedRemovalTime) { builder.clearedRemovalTime(); } builder.byIds(dto.HistoricProcessInstanceIds); builder.byQuery(historicProcessInstanceQuery); if (dto.Hierarchical) { builder.hierarchical(); } Batch batch = builder.executeAsync(); return(BatchDto.fromBatch(batch)); }