Search in sources :

Example 91 with ProcessEngineException

use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.

the class CaseExecutionResourceImpl method terminate.

public void terminate(CaseExecutionTriggerDto triggerDto) {
    try {
        CaseService caseService = engine.getCaseService();
        CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
        initializeCommand(commandBuilder, triggerDto, "terminate");
        commandBuilder.terminate();
    } catch (NotFoundException e) {
        throw createInvalidRequestException("terminate", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("terminate", Status.BAD_REQUEST, e);
    } catch (NotAllowedException e) {
        throw createInvalidRequestException("terminate", Status.FORBIDDEN, e);
    } catch (ProcessEngineException e) {
        throw createRestException("terminate", Status.INTERNAL_SERVER_ERROR, e);
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) NotAllowedException(org.camunda.bpm.engine.exception.NotAllowedException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) CaseService(org.camunda.bpm.engine.CaseService) CaseExecutionCommandBuilder(org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 92 with ProcessEngineException

use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.

the class CaseInstanceResourceImpl method terminate.

public void terminate(CaseExecutionTriggerDto triggerDto) {
    try {
        CaseService caseService = engine.getCaseService();
        CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
        initializeCommand(commandBuilder, triggerDto, "terminate");
        commandBuilder.terminate();
    } catch (NotFoundException e) {
        throw createInvalidRequestException("terminate", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("terminate", Status.BAD_REQUEST, e);
    } catch (NotAllowedException e) {
        throw createInvalidRequestException("terminate", Status.FORBIDDEN, e);
    } catch (ProcessEngineException e) {
        throw createRestException("terminate", Status.INTERNAL_SERVER_ERROR, e);
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) NotAllowedException(org.camunda.bpm.engine.exception.NotAllowedException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) CaseService(org.camunda.bpm.engine.CaseService) CaseExecutionCommandBuilder(org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 93 with ProcessEngineException

use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.

the class CaseInstanceResourceImpl method complete.

public void complete(CaseExecutionTriggerDto triggerDto) {
    try {
        CaseService caseService = engine.getCaseService();
        CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
        initializeCommand(commandBuilder, triggerDto, "complete");
        commandBuilder.complete();
    } catch (NotFoundException e) {
        throw createInvalidRequestException("complete", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("complete", Status.BAD_REQUEST, e);
    } catch (NotAllowedException e) {
        throw createInvalidRequestException("complete", Status.FORBIDDEN, e);
    } catch (ProcessEngineException e) {
        throw createRestException("complete", Status.INTERNAL_SERVER_ERROR, e);
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) NotAllowedException(org.camunda.bpm.engine.exception.NotAllowedException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) CaseService(org.camunda.bpm.engine.CaseService) CaseExecutionCommandBuilder(org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 94 with ProcessEngineException

use of org.camunda.bpm.engine.ProcessEngineException 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 95 with ProcessEngineException

use of org.camunda.bpm.engine.ProcessEngineException 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)

Aggregations

ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)611 Test (org.junit.Test)185 Deployment (org.camunda.bpm.engine.test.Deployment)138 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)79 HashMap (java.util.HashMap)62 RestException (org.camunda.bpm.engine.rest.exception.RestException)62 Matchers.anyString (org.mockito.Matchers.anyString)60 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)57 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)47 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)41 Task (org.camunda.bpm.engine.task.Task)40 ArrayList (java.util.ArrayList)39 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)36 Matchers.containsString (org.hamcrest.Matchers.containsString)35 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)24 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)22 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)21 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)21 NotValidException (org.camunda.bpm.engine.exception.NotValidException)19 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)18