Search in sources :

Example 21 with CaseService

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

the class CaseExecutionResourceImpl method complete.

public void complete(CaseExecutionTriggerDto triggerDto) {
    try {
        CaseService caseService = engine.getCaseService();
        CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
        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 22 with CaseService

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

the class CaseInstanceResourceImpl method close.

public void close(CaseExecutionTriggerDto triggerDto) {
    try {
        CaseService caseService = engine.getCaseService();
        CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
        initializeCommand(commandBuilder, triggerDto, "close");
        commandBuilder.close();
    } catch (NotFoundException e) {
        throw createInvalidRequestException("close", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("close", Status.BAD_REQUEST, e);
    } catch (NotAllowedException e) {
        throw createInvalidRequestException("close", Status.FORBIDDEN, e);
    } catch (ProcessEngineException e) {
        throw createRestException("close", 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)

Aggregations

CaseService (org.camunda.bpm.engine.CaseService)22 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)9 NotValidException (org.camunda.bpm.engine.exception.NotValidException)9 CaseExecutionCommandBuilder (org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder)8 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)4 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)4 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)4 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)3 CaseInstanceDto (org.camunda.bpm.engine.rest.dto.runtime.CaseInstanceDto)2 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)2 URI (java.net.URI)1 ExternalTaskService (org.camunda.bpm.engine.ExternalTaskService)1 FilterService (org.camunda.bpm.engine.FilterService)1 FormService (org.camunda.bpm.engine.FormService)1 HistoryService (org.camunda.bpm.engine.HistoryService)1 IdentityService (org.camunda.bpm.engine.IdentityService)1 ManagementService (org.camunda.bpm.engine.ManagementService)1