Search in sources :

Example 6 with CaseService

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

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

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

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

the class LocalCaseExecutionVariablesResource method updateVariableEntities.

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

Example 10 with CaseService

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

the class LocalCaseExecutionVariablesResource method setVariableEntity.

protected void setVariableEntity(String variableKey, TypedValue variableValue) {
    CaseService caseService = engine.getCaseService();
    caseService.withCaseExecution(resourceId).setVariableLocal(variableKey, variableValue).execute();
}
Also used : CaseService(org.camunda.bpm.engine.CaseService)

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