Search in sources :

Example 46 with InvalidRequestException

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

the class CaseExecutionResourceImpl method getCaseExecution.

public CaseExecutionDto getCaseExecution() {
    CaseService caseService = engine.getCaseService();
    CaseExecution execution = caseService.createCaseExecutionQuery().caseExecutionId(caseExecutionId).singleResult();
    if (execution == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Case execution with id " + caseExecutionId + " does not exist.");
    }
    CaseExecutionDto result = CaseExecutionDto.fromCaseExecution(execution);
    return result;
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseExecutionDto(org.camunda.bpm.engine.rest.dto.runtime.CaseExecutionDto) CaseService(org.camunda.bpm.engine.CaseService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 47 with InvalidRequestException

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

the class CaseInstanceResourceImpl method getCaseInstance.

public CaseInstanceDto getCaseInstance() {
    CaseService caseService = engine.getCaseService();
    CaseInstance instance = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
    if (instance == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Case instance with id " + caseInstanceId + " does not exist.");
    }
    CaseInstanceDto result = CaseInstanceDto.fromCaseInstance(instance);
    return result;
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseService(org.camunda.bpm.engine.CaseService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) CaseInstanceDto(org.camunda.bpm.engine.rest.dto.runtime.CaseInstanceDto)

Example 48 with InvalidRequestException

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

the class JobResourceImpl method executeJob.

@Override
public void executeJob() {
    try {
        ManagementService managementService = engine.getManagementService();
        managementService.executeJob(this.jobId);
    } catch (AuthorizationException e) {
        throw e;
    } catch (ProcessEngineException e) {
        throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
    } catch (RuntimeException r) {
        throw new RestException(Status.INTERNAL_SERVER_ERROR, r.getMessage());
    }
}
Also used : ManagementService(org.camunda.bpm.engine.ManagementService) AuthorizationException(org.camunda.bpm.engine.AuthorizationException) RestException(org.camunda.bpm.engine.rest.exception.RestException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 49 with InvalidRequestException

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

the class JobResourceImpl method getStacktrace.

@Override
public String getStacktrace() {
    try {
        ManagementService managementService = engine.getManagementService();
        String stacktrace = managementService.getJobExceptionStacktrace(jobId);
        return stacktrace;
    } catch (AuthorizationException e) {
        throw e;
    } catch (ProcessEngineException e) {
        throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
    }
}
Also used : ManagementService(org.camunda.bpm.engine.ManagementService) AuthorizationException(org.camunda.bpm.engine.AuthorizationException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 50 with InvalidRequestException

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

the class JobResourceImpl method setJobRetries.

@Override
public void setJobRetries(RetriesDto dto) {
    try {
        ManagementService managementService = engine.getManagementService();
        managementService.setJobRetries(jobId, dto.getRetries());
    } catch (AuthorizationException e) {
        throw e;
    } catch (ProcessEngineException e) {
        throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e.getMessage());
    }
}
Also used : ManagementService(org.camunda.bpm.engine.ManagementService) AuthorizationException(org.camunda.bpm.engine.AuthorizationException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

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