use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceImpl method setRetriesByProcess.
@Override
public BatchDto setRetriesByProcess(SetJobRetriesByProcessDto setJobRetriesDto) {
try {
EnsureUtil.ensureNotNull("setJobRetriesDto", setJobRetriesDto);
EnsureUtil.ensureNotNull("retries", setJobRetriesDto.getRetries());
} catch (NullValueException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
ProcessInstanceQuery processInstanceQuery = null;
if (setJobRetriesDto.getProcessInstanceQuery() != null) {
processInstanceQuery = setJobRetriesDto.getProcessInstanceQuery().toQuery(getProcessEngine());
}
try {
Batch batch = getProcessEngine().getManagementService().setJobRetriesAsync(setJobRetriesDto.getProcessInstances(), processInstanceQuery, setJobRetriesDto.getRetries().intValue());
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 ProcessInstanceRestServiceImpl method deleteAsyncHistoricQueryBased.
@Override
public BatchDto deleteAsyncHistoricQueryBased(DeleteProcessInstancesDto deleteProcessInstancesDto) {
List<String> processInstanceIds = new ArrayList<String>();
HistoricProcessInstanceQueryDto queryDto = deleteProcessInstancesDto.getHistoricProcessInstanceQuery();
if (queryDto != null) {
HistoricProcessInstanceQuery query = queryDto.toQuery(getProcessEngine());
List<HistoricProcessInstance> historicProcessInstances = query.list();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
processInstanceIds.add(historicProcessInstance.getId());
}
}
if (deleteProcessInstancesDto.getProcessInstanceIds() != null) {
processInstanceIds.addAll(deleteProcessInstancesDto.getProcessInstanceIds());
}
try {
RuntimeService runtimeService = getProcessEngine().getRuntimeService();
Batch batch = runtimeService.deleteProcessInstancesAsync(processInstanceIds, null, deleteProcessInstancesDto.getDeleteReason(), deleteProcessInstancesDto.isSkipCustomListeners(), deleteProcessInstancesDto.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 ExternalTaskRestServiceImpl method setRetriesAsync.
@Override
public BatchDto setRetriesAsync(SetRetriesForExternalTasksDto retriesDto) {
UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto);
int retries = retriesDto.getRetries();
try {
Batch batch = builder.setAsync(retries);
return BatchDto.fromBatch(batch);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} 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 JobRestServiceImpl method setRetries.
@Override
public BatchDto setRetries(SetJobRetriesDto setJobRetriesDto) {
try {
EnsureUtil.ensureNotNull("setJobRetriesDto", setJobRetriesDto);
EnsureUtil.ensureNotNull("retries", setJobRetriesDto.getRetries());
} catch (NullValueException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
JobQuery jobQuery = null;
if (setJobRetriesDto.getJobQuery() != null) {
jobQuery = setJobRetriesDto.getJobQuery().toQuery(getProcessEngine());
}
try {
Batch batch = getProcessEngine().getManagementService().setJobRetriesAsync(setJobRetriesDto.getJobIds(), jobQuery, setJobRetriesDto.getRetries().intValue());
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 HistoricProcessInstanceRestServiceImpl method deleteAsync.
@Override
public BatchDto deleteAsync(DeleteHistoricProcessInstancesDto dto) {
HistoryService historyService = processEngine.getHistoryService();
HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
if (dto.getHistoricProcessInstanceQuery() != null) {
historicProcessInstanceQuery = dto.getHistoricProcessInstanceQuery().toQuery(processEngine);
}
try {
Batch batch = historyService.deleteHistoricProcessInstancesAsync(dto.getHistoricProcessInstanceIds(), historicProcessInstanceQuery, dto.getDeleteReason());
return BatchDto.fromBatch(batch);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
Aggregations