use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method updateTask.
public void updateTask(TaskDto taskDto) {
TaskService taskService = engine.getTaskService();
Task task = getTaskById(taskId);
if (task == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "No matching task with id " + taskId);
}
taskDto.updateTask(task);
taskService.saveTask(task);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method complete.
@Override
public void complete(CompleteTaskDto dto) {
TaskService taskService = engine.getTaskService();
try {
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
taskService.complete(taskId, variables);
} catch (RestException e) {
String errorMessage = String.format("Cannot complete task %s: %s", taskId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot complete task %s: %s", taskId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method submit.
public void submit(CompleteTaskDto dto) {
FormService formService = engine.getFormService();
try {
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
formService.submitTaskForm(taskId, variables);
} catch (RestException e) {
String errorMessage = String.format("Cannot submit task form %s: %s", taskId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot submit task form %s: %s", taskId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class FilterResourceImpl method updateFilter.
public void updateFilter(FilterDto filterDto) {
Filter filter = getDbFilter();
try {
filterDto.updateFilter(filter, processEngine);
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, "Unable to update filter with invalid content");
}
filterService.saveFilter(filter);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class MessageEventSubscriptionResource method triggerEvent.
@Override
public void triggerEvent(ExecutionTriggerDto triggerDto) {
RuntimeService runtimeService = engine.getRuntimeService();
try {
VariableMap variables = VariableValueDto.toMap(triggerDto.getVariables(), engine, objectMapper);
runtimeService.messageEventReceived(messageName, executionId, variables);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, String.format("Cannot trigger message %s for execution %s: %s", messageName, executionId, e.getMessage()));
} catch (RestException e) {
String errorMessage = String.format("Cannot trigger message %s for execution %s: %s", messageName, executionId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
}
}
Aggregations