use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto 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.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method verifyMigrationExecutionBuilderInteraction.
protected void verifyMigrationExecutionBuilderInteraction(InOrder inOrder, Map<String, Object> migrationExecution) {
List<String> processInstanceIds = ((List<String>) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_PROCESS_INSTANCE_IDS));
inOrder.verify(migrationPlanExecutionBuilderMock).processInstanceIds(eq(processInstanceIds));
ProcessInstanceQueryDto processInstanceQuery = (ProcessInstanceQueryDto) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_PROCESS_INSTANCE_QUERY);
if (processInstanceQuery != null) {
verifyMigrationPlanExecutionProcessInstanceQuery(inOrder);
}
Boolean skipCustomListeners = (Boolean) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_SKIP_CUSTOM_LISTENERS);
if (Boolean.TRUE.equals(skipCustomListeners)) {
inOrder.verify(migrationPlanExecutionBuilderMock).skipCustomListeners();
}
Boolean skipIoMappings = (Boolean) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_SKIP_IO_MAPPINGS);
if (Boolean.TRUE.equals(skipIoMappings)) {
inOrder.verify(migrationPlanExecutionBuilderMock).skipIoMappings();
}
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithInvalidProcessInstanceQueryAsync.
@Test
public void executeModificationWithInvalidProcessInstanceQueryAsync() {
when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
Map<String, Object> json = new HashMap<String, Object>();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startAfter().activityId("acivityId").getJson());
ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
processInstanceQueryDto.setBusinessKey("foo");
json.put("processInstanceQuery", processInstanceQueryDto);
json.put("instructions", instructions);
json.put("processDefinitionId", "processDefinitionId");
given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MODIFICATION_ASYNC_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithInvalidProcessInstanceQuerySync.
@Test
public void executeModificationWithInvalidProcessInstanceQuerySync() {
when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
Map<String, Object> json = new HashMap<String, Object>();
String message = "Process instance ids is null";
doThrow(new BadUserRequestException(message)).when(modificationBuilderMock).execute();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startAfter().activityId("acivityId").getJson());
ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
processInstanceQueryDto.setBusinessKey("foo");
json.put("processInstanceQuery", processInstanceQueryDto);
json.put("instructions", instructions);
json.put("processDefinitionId", "processDefinitionId");
given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(EXECUTE_MODIFICATION_SYNC_URL);
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithValidProcessInstanceQueryAsync.
@Test
public void executeModificationWithValidProcessInstanceQueryAsync() {
when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
Map<String, Object> json = new HashMap<String, Object>();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startAfter().activityId("activityId").getJson());
ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
processInstanceQueryDto.setBusinessKey("foo");
json.put("processInstanceQuery", processInstanceQueryDto);
json.put("instructions", instructions);
json.put("processDefinitionId", "processDefinitionId");
given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MODIFICATION_ASYNC_URL);
verify(runtimeServiceMock, times(1)).createProcessInstanceQuery();
verify(modificationBuilderMock).startAfterActivity("activityId");
verify(modificationBuilderMock).processInstanceQuery(processInstanceQueryDto.toQuery(processEngine));
verify(modificationBuilderMock).executeAsync();
}
Aggregations