use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class GetDeploymentResourceCmd method execute.
public InputStream execute(CommandContext commandContext) {
ensureNotNull("deploymentId", deploymentId);
ensureNotNull("resourceName", resourceName);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDeployment(deploymentId);
}
ResourceEntity resource = commandContext.getResourceManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
ensureNotNull(DeploymentResourceNotFoundException.class, "no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", "resource", resource);
return new ByteArrayInputStream(resource.getBytes());
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class DeleteHistoricCaseInstanceCmd method execute.
public Object execute(CommandContext commandContext) {
ensureNotNull("caseInstanceId", caseInstanceId);
// Check if case instance is still running
HistoricCaseInstance instance = commandContext.getHistoricCaseInstanceManager().findHistoricCaseInstance(caseInstanceId);
ensureNotNull("No historic case instance found with id: " + caseInstanceId, "instance", instance);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricCaseInstance(instance);
}
ensureNotNull("Case instance is still running, cannot delete historic case instance: " + caseInstanceId, "instance.getCloseTime()", instance.getCloseTime());
commandContext.getHistoricCaseInstanceManager().deleteHistoricCaseInstancesByIds(Arrays.asList(caseInstanceId));
return null;
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class DeleteHistoricProcessInstancesCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
ensureNotEmpty(BadUserRequestException.class, "processInstanceIds", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "processInstanceId is null", "processInstanceIds", processInstanceIds);
// Check if process instance is still running
List<HistoricProcessInstance> instances = commandContext.runWithoutAuthorization(new Callable<List<HistoricProcessInstance>>() {
@Override
public List<HistoricProcessInstance> call() throws Exception {
return new HistoricProcessInstanceQueryImpl().processInstanceIds(new HashSet<String>(processInstanceIds)).list();
}
});
if (processInstanceIds.size() == 1) {
ensureNotEmpty(BadUserRequestException.class, "No historic process instance found with id: " + processInstanceIds.get(0), "historicProcessInstanceIds", instances);
} else {
ensureNotEmpty(BadUserRequestException.class, "No historic process instances found", "historicProcessInstanceIds", instances);
}
// check if all historicProcessInstances were found
List<String> existingIds = new ArrayList<String>();
for (HistoricProcessInstance historicProcessInstance : instances) {
existingIds.add(historicProcessInstance.getId());
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricProcessInstance(historicProcessInstance);
}
ensureNotNull(BadUserRequestException.class, "Process instance is still running, cannot delete historic process instance: " + historicProcessInstance, "instance.getEndTime()", historicProcessInstance.getEndTime());
}
ArrayList<String> nonExistingIds = new ArrayList<String>(processInstanceIds);
nonExistingIds.removeAll(existingIds);
ensureNumberOfElements(BadUserRequestException.class, "No historic process instances found with ids " + nonExistingIds, "nonExistingIds", nonExistingIds, 0);
commandContext.getHistoricProcessInstanceManager().deleteHistoricProcessInstanceByIds(processInstanceIds);
return null;
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class EvaluateDecisionTableCmd method execute.
@Override
public DmnDecisionTableResult execute(CommandContext commandContext) {
ensureOnlyOneNotNull("either decision definition id or key must be set", decisionDefinitionId, decisionDefinitionKey);
DecisionDefinition decisionDefinition = getDecisionDefinition(commandContext);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkEvaluateDecision(decisionDefinition);
}
return doEvaluateDecision(decisionDefinition, variables);
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class GetDeploymentDecisionRequirementsDefinitionCmd method execute.
public DecisionRequirementsDefinition execute(CommandContext commandContext) {
ensureNotNull("decisionRequirementsDefinitionId", decisionRequirementsDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DecisionRequirementsDefinitionEntity decisionRequirementsDefinition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(decisionRequirementsDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDecisionRequirementsDefinition(decisionRequirementsDefinition);
}
return decisionRequirementsDefinition;
}
Aggregations