use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method evaluateDecision.
@Override
public List<Map<String, VariableValueDto>> evaluateDecision(UriInfo context, EvaluateDecisionDto parameters) {
DecisionService decisionService = engine.getDecisionService();
Map<String, Object> variables = VariableValueDto.toMap(parameters.getVariables(), engine, objectMapper);
try {
DmnDecisionResult decisionResult = decisionService.evaluateDecisionById(decisionDefinitionId).variables(variables).evaluate();
return createDecisionResultDto(decisionResult);
} catch (AuthorizationException e) {
throw e;
} catch (NotFoundException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.NOT_FOUND, e, errorMessage);
} catch (NotValidException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.BAD_REQUEST, e, errorMessage);
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
} catch (DmnEngineException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method getDecisionDefinition.
@Override
public DecisionDefinitionDto getDecisionDefinition() {
RepositoryService repositoryService = engine.getRepositoryService();
DecisionDefinition definition = null;
try {
definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
}
return DecisionDefinitionDto.fromDecisionDefinition(definition);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DeploymentResourceImpl method redeploy.
public DeploymentDto redeploy(UriInfo uriInfo, RedeploymentDto redeployment) {
DeploymentWithDefinitions deployment = null;
try {
deployment = tryToRedeploy(redeployment);
} catch (NotFoundException e) {
throw createInvalidRequestException("redeploy", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("redeploy", Status.BAD_REQUEST, e);
}
DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment);
URI uri = uriInfo.getBaseUriBuilder().path(relativeRootResourcePath).path(DeploymentRestService.PATH).path(deployment.getId()).build();
// GET /
deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self");
return deploymentDto;
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class CaseExecutionResourceImpl method manualStart.
public void manualStart(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
initializeCommand(commandBuilder, triggerDto, "start manually");
commandBuilder.manualStart();
} catch (NotFoundException e) {
throw createInvalidRequestException("manualStart", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("manualStart", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("manualStart", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("manualStart", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotFoundException 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);
}
}
Aggregations