use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class MigrationRestServiceImpl method createMigrationPlanExecutionBuilder.
protected MigrationPlanExecutionBuilder createMigrationPlanExecutionBuilder(MigrationExecutionDto migrationExecution) {
MigrationPlan migrationPlan = createMigrationPlan(migrationExecution.getMigrationPlan());
List<String> processInstanceIds = migrationExecution.getProcessInstanceIds();
MigrationPlanExecutionBuilder executionBuilder = processEngine.getRuntimeService().newMigration(migrationPlan).processInstanceIds(processInstanceIds);
ProcessInstanceQueryDto processInstanceQueryDto = migrationExecution.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
ProcessInstanceQuery processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
executionBuilder.processInstanceQuery(processInstanceQuery);
}
if (migrationExecution.isSkipCustomListeners()) {
executionBuilder.skipCustomListeners();
}
if (migrationExecution.isSkipIoMappings()) {
executionBuilder.skipIoMappings();
}
return executionBuilder;
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ModificationRestServiceImpl method createModificationBuilder.
private ModificationBuilder createModificationBuilder(ModificationDto dto) {
ModificationBuilder builder = getProcessEngine().getRuntimeService().createModification(dto.getProcessDefinitionId());
if (dto.getInstructions() != null && !dto.getInstructions().isEmpty()) {
dto.applyTo(builder, getProcessEngine(), objectMapper);
}
List<String> processInstanceIds = dto.getProcessInstanceIds();
builder.processInstanceIds(processInstanceIds);
ProcessInstanceQueryDto processInstanceQueryDto = dto.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
ProcessInstanceQuery processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
builder.processInstanceQuery(processInstanceQuery);
}
if (dto.isSkipCustomListeners()) {
builder.skipCustomListeners();
}
if (dto.isSkipIoMappings()) {
builder.skipIoMappings();
}
return builder;
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithValidProcessInstanceQuerySync.
@Test
public void executeModificationWithValidProcessInstanceQuerySync() {
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());
json.put("processDefinitionId", "processDefinitionId");
ProcessInstanceQueryDto processInstanceQueryDto = new ProcessInstanceQueryDto();
processInstanceQueryDto.setBusinessKey("foo");
json.put("processInstanceQuery", processInstanceQueryDto);
json.put("instructions", instructions);
given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(EXECUTE_MODIFICATION_SYNC_URL);
verify(runtimeServiceMock, times(1)).createProcessInstanceQuery();
verify(modificationBuilderMock).startAfterActivity("activityId");
verify(modificationBuilderMock).processInstanceQuery(processInstanceQueryDto.toQuery(processEngine));
verify(modificationBuilderMock).execute();
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendInstancesMultipleGroupOperations.
@Test
public void testSuspendInstancesMultipleGroupOperations() {
List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
ProcessInstanceQueryDto query = new ProcessInstanceQueryDto();
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("processInstanceIds", ids);
messageBodyJson.put("processInstanceQuery", query);
messageBodyJson.put("suspended", true);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(PROCESS_INSTANCE_SUSPENDED_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceIds(ids);
verify(mockUpdateProcessInstancesSuspensionStateBuilder).byProcessInstanceQuery(query.toQuery(processEngine));
verify(mockUpdateProcessInstancesSuspensionStateBuilder).suspend();
}
use of org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendAsyncWithProcessInstanceQuery.
@Test
public void testSuspendAsyncWithProcessInstanceQuery() {
ProcessInstanceQueryDto query = new ProcessInstanceQueryDto();
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("processInstanceQuery", query);
messageBodyJson.put("suspended", true);
when(mockUpdateProcessInstancesSuspensionStateBuilder.suspendAsync()).thenReturn(new BatchEntity());
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(PROCESS_INSTANCE_SUSPENDED_ASYNC_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceQuery(query.toQuery(processEngine));
verify(mockUpdateProcessInstancesSuspensionStateBuilder).suspendAsync();
}
Aggregations