Search in sources :

Example 16 with InvalidRequestException

use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.

the class SignalRestServiceImpl method throwSignal.

@Override
public void throwSignal(SignalDto dto) {
    String name = dto.getName();
    if (name == null) {
        throw new InvalidRequestException(Status.BAD_REQUEST, "No signal name given");
    }
    SignalEventReceivedBuilder signalEvent = createSignalEventReceivedBuilder(dto);
    signalEvent.send();
}
Also used : SignalEventReceivedBuilder(org.camunda.bpm.engine.runtime.SignalEventReceivedBuilder) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 17 with InvalidRequestException

use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.

the class TaskRestServiceImpl method createTask.

public void createTask(TaskDto taskDto) {
    ProcessEngine engine = getProcessEngine();
    TaskService taskService = engine.getTaskService();
    Task newTask = taskService.newTask(taskDto.getId());
    taskDto.updateTask(newTask);
    try {
        taskService.saveTask(newTask);
    } catch (NotValidException e) {
        throw new InvalidRequestException(Status.BAD_REQUEST, e, "Could not save task: " + e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) NotValidException(org.camunda.bpm.engine.exception.NotValidException) TaskService(org.camunda.bpm.engine.TaskService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 18 with InvalidRequestException

use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.

the class TenantRestServiceImpl method createTenant.

public void createTenant(TenantDto dto) {
    if (getIdentityService().isReadOnly()) {
        throw new InvalidRequestException(Status.FORBIDDEN, "Identity service implementation is read-only.");
    }
    Tenant newTenant = getIdentityService().newTenant(dto.getId());
    dto.update(newTenant);
    getIdentityService().saveTenant(newTenant);
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 19 with InvalidRequestException

use of org.camunda.bpm.engine.rest.exception.InvalidRequestException 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());
    }
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)

Example 20 with InvalidRequestException

use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.

the class GroupRestServiceImpl method createGroup.

public void createGroup(GroupDto groupDto) {
    final IdentityService identityService = getIdentityService();
    if (identityService.isReadOnly()) {
        throw new InvalidRequestException(Status.FORBIDDEN, "Identity service implementation is read-only.");
    }
    Group newGroup = identityService.newGroup(groupDto.getId());
    groupDto.update(newGroup);
    identityService.saveGroup(newGroup);
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) Group(org.camunda.bpm.engine.identity.Group) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Aggregations

InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)116 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)30 RestException (org.camunda.bpm.engine.rest.exception.RestException)25 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)20 NotValidException (org.camunda.bpm.engine.exception.NotValidException)12 ArrayList (java.util.ArrayList)11 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)11 ManagementService (org.camunda.bpm.engine.ManagementService)11 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)11 VariableQueryParameterDto (org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto)10 HistoryService (org.camunda.bpm.engine.HistoryService)9 RuntimeService (org.camunda.bpm.engine.RuntimeService)9 InputStream (java.io.InputStream)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)8 Batch (org.camunda.bpm.engine.batch.Batch)8 URI (java.net.URI)6 VariableMap (org.camunda.bpm.engine.variable.VariableMap)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 FormService (org.camunda.bpm.engine.FormService)5 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)5