use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceImpl method updateRetries.
protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) {
ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService();
List<String> externalTaskIds = retriesDto.getExternalTaskIds();
List<String> processInstanceIds = retriesDto.getProcessInstanceIds();
ExternalTaskQuery externalTaskQuery = null;
ProcessInstanceQuery processInstanceQuery = null;
HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery();
if (externalTaskQueryDto != null) {
externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine());
}
ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
}
HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery();
if (historicProcessInstanceQueryDto != null) {
historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine());
}
return externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery);
}
use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceRestServiceTest method testRestartProcessInstanceWithHistoricProcessInstanceQueryAsync.
@Test
public void testRestartProcessInstanceWithHistoricProcessInstanceQueryAsync() {
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(new HistoricProcessInstanceQueryImpl());
HashMap<String, Object> json = new HashMap<String, Object>();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startBefore().activityId("activityId").getJson());
json.put("instructions", instructions);
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
query.setProcessInstanceBusinessKey("businessKey");
json.put("historicProcessInstanceQuery", query);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(RESTART_PROCESS_INSTANCE_ASYNC_URL);
verify(runtimeServiceMock).restartProcessInstances(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
verify(builderMock).startBeforeActivity("activityId");
verify(builderMock).historicProcessInstanceQuery(query.toQuery(processEngine));
verify(builderMock).executeAsync();
}
use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceRestServiceTest method testRestartProcessInstanceWithHistoricProcessInstanceQuerySync.
@Test
public void testRestartProcessInstanceWithHistoricProcessInstanceQuerySync() {
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(new HistoricProcessInstanceQueryImpl());
HashMap<String, Object> json = new HashMap<String, Object>();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startBefore().activityId("activityId").getJson());
json.put("instructions", instructions);
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
query.setProcessInstanceBusinessKey("businessKey");
json.put("historicProcessInstanceQuery", query);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(RESTART_PROCESS_INSTANCE_URL);
verify(runtimeServiceMock).restartProcessInstances(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
verify(builderMock).startBeforeActivity("activityId");
verify(builderMock).historicProcessInstanceQuery(query.toQuery(processEngine));
verify(builderMock).execute();
}
use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceRestServiceTest method testRestartProcessInstanceWithoutProcessInstanceIdsSync.
@Test
public void testRestartProcessInstanceWithoutProcessInstanceIdsSync() {
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(new HistoricProcessInstanceQueryImpl());
Map<String, Object> json = new HashMap<String, Object>();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
query.setFinished(true);
json.put("historicProcessInstanceQuery", query);
instructions.add(ModificationInstructionBuilder.startBefore().activityId("activityId").getJson());
json.put("instructions", instructions);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(RESTART_PROCESS_INSTANCE_URL);
verify(builderMock).startBeforeActivity("activityId");
verify(builderMock).historicProcessInstanceQuery(query.toQuery(processEngine));
verify(builderMock).execute();
verifyNoMoreInteractions(builderMock);
}
use of org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessWithNegativeRetries.
@Test
public void testSetRetriesByProcessWithNegativeRetries() {
doThrow(new BadUserRequestException("retries are negative")).when(mockManagementService).setJobRetriesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), eq(-1));
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put(RETRIES, -1);
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
messageBodyJson.put("processInstanceQuery", query);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_URL);
}
Aggregations