use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceImpl method deleteAsync.
@Override
public BatchDto deleteAsync(DeleteProcessInstancesDto dto) {
RuntimeService runtimeService = getProcessEngine().getRuntimeService();
ProcessInstanceQuery processInstanceQuery = null;
if (dto.getProcessInstanceQuery() != null) {
processInstanceQuery = dto.getProcessInstanceQuery().toQuery(getProcessEngine());
}
Batch batch = null;
try {
batch = runtimeService.deleteProcessInstancesAsync(dto.getProcessInstanceIds(), processInstanceQuery, dto.getDeleteReason(), dto.isSkipCustomListeners(), dto.isSkipSubprocesses());
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceRestServiceImpl method deleteAsync.
public BatchDto deleteAsync(DeleteHistoricDecisionInstancesDto dto) {
HistoricDecisionInstanceQuery decisionInstanceQuery = null;
if (dto.getHistoricDecisionInstanceQuery() != null) {
decisionInstanceQuery = dto.getHistoricDecisionInstanceQuery().toQuery(processEngine);
}
try {
List<String> historicDecisionInstanceIds = dto.getHistoricDecisionInstanceIds();
String deleteReason = dto.getDeleteReason();
Batch batch = processEngine.getHistoryService().deleteHistoricDecisionInstancesAsync(historicDecisionInstanceIds, decisionInstanceQuery, deleteReason);
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceImpl method generateMigrationPlan.
public MigrationPlanDto generateMigrationPlan(MigrationPlanGenerationDto generationDto) {
RuntimeService runtimeService = processEngine.getRuntimeService();
String sourceProcessDefinitionId = generationDto.getSourceProcessDefinitionId();
String targetProcessDefinitionId = generationDto.getTargetProcessDefinitionId();
try {
MigrationInstructionsBuilder instructionsBuilder = runtimeService.createMigrationPlan(sourceProcessDefinitionId, targetProcessDefinitionId).mapEqualActivities();
if (generationDto.isUpdateEventTriggers()) {
instructionsBuilder = instructionsBuilder.updateEventTriggers();
}
MigrationPlan migrationPlan = instructionsBuilder.build();
return MigrationPlanDto.from(migrationPlan);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ExternalTaskResourceImpl method complete.
@Override
public void complete(CompleteExternalTaskDto dto) {
ExternalTaskService externalTaskService = engine.getExternalTaskService();
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
VariableMap localVariables = VariableValueDto.toMap(dto.getLocalVariables(), engine, objectMapper);
try {
externalTaskService.complete(externalTaskId, dto.getWorkerId(), variables, localVariables);
} catch (NotFoundException e) {
throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
} catch (BadUserRequestException e) {
throw new RestException(Status.BAD_REQUEST, e, e.getMessage());
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceRestServiceInteractionTest method testDeleteAsyncWithBadRequestQuery.
@Test
public void testDeleteAsyncWithBadRequestQuery() {
doThrow(new BadUserRequestException("process instance ids are empty")).when(historyServiceMock).deleteHistoricDecisionInstancesAsync(eq((List<String>) null), eq((HistoricDecisionInstanceQuery) null), anyString());
given().contentType(ContentType.JSON).body(EMPTY_JSON_OBJECT).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(HISTORIC_DECISION_INSTANCES_DELETE_ASYNC_URL);
}
Aggregations