Search in sources :

Example 1 with CaseService

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

the class CaseExecutionVariablesResource method updateVariableEntities.

protected void updateVariableEntities(VariableMap variables, List<String> deletions) {
    CaseService caseService = engine.getCaseService();
    caseService.withCaseExecution(resourceId).setVariables(variables).removeVariables(deletions).execute();
}
Also used : CaseService(org.camunda.bpm.engine.CaseService)

Example 2 with CaseService

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

the class CaseExecutionResourceImpl method reenable.

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

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

the class CaseExecutionResourceImpl method disable.

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

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

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

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