use of org.camunda.bpm.engine.rest.exception.InvalidRequestException 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.rest.exception.InvalidRequestException 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.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class DeploymentResourceImpl method deleteDeployment.
@Override
public void deleteDeployment(String deploymentId, UriInfo uriInfo) {
RepositoryService repositoryService = getProcessEngine().getRepositoryService();
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' do not exist");
}
boolean cascade = isQueryPropertyEnabled(uriInfo, CASCADE);
boolean skipCustomListeners = isQueryPropertyEnabled(uriInfo, "skipCustomListeners");
boolean skipIoMappings = isQueryPropertyEnabled(uriInfo, "skipIoMappings");
repositoryService.deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class DeploymentResourceImpl method getDeployment.
public DeploymentDto getDeployment() {
RepositoryService repositoryService = getProcessEngine().getRepositoryService();
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' does not exist");
}
return DeploymentDto.fromDeployment(deployment);
}
use of org.camunda.bpm.engine.rest.exception.InvalidRequestException in project camunda-bpm-platform by camunda.
the class ExecutionResourceImpl method signalExecution.
@Override
public void signalExecution(ExecutionTriggerDto triggerDto) {
RuntimeService runtimeService = engine.getRuntimeService();
try {
VariableMap variables = VariableValueDto.toMap(triggerDto.getVariables(), engine, objectMapper);
runtimeService.signal(executionId, variables);
} catch (RestException e) {
String errorMessage = String.format("Cannot signal execution %s: %s", executionId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, "Cannot signal execution " + executionId + ": " + e.getMessage());
}
}
Aggregations