use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class HandleExternalTaskCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
validateInput();
ExternalTaskEntity externalTask = commandContext.getExternalTaskManager().findExternalTaskById(externalTaskId);
EnsureUtil.ensureNotNull(NotFoundException.class, "Cannot find external task with id " + externalTaskId, "externalTask", externalTask);
if (!workerId.equals(externalTask.getWorkerId())) {
throw new BadUserRequestException(getErrorMessageOnWrongWorkerAccess() + "'. It is locked by worker '" + externalTask.getWorkerId() + "'.");
}
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstanceById(externalTask.getProcessInstanceId());
}
execute(externalTask);
return null;
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class GetDeployedStartFormCmd method checkAuthorization.
@Override
protected void checkAuthorization(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class GetDeploymentProcessModelCmd method execute.
public InputStream execute(final CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
final String deploymentId = processDefinition.getDeploymentId();
final String resourceName = processDefinition.getResourceName();
InputStream processModelStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
return processModelStream;
}
use of org.camunda.bpm.engine.impl.cfg.CommandChecker in project camunda-bpm-platform by camunda.
the class GetDeploymentResourceForIdCmd method execute.
public InputStream execute(CommandContext commandContext) {
ensureNotNull("deploymentId", deploymentId);
ensureNotNull("resourceId", resourceId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDeployment(deploymentId);
}
ResourceEntity resource = commandContext.getResourceManager().findResourceByDeploymentIdAndResourceId(deploymentId, resourceId);
ensureNotNull("no resource found with id '" + resourceId + "' 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 GetRenderedStartFormCmd method execute.
public Object execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
ensureNotNull("Process Definition '" + processDefinitionId + "' not found", "processDefinition", processDefinition);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
return null;
}
FormEngine formEngine = Context.getProcessEngineConfiguration().getFormEngines().get(formEngineName);
ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine);
StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
Object renderedStartForm = null;
try {
renderedStartForm = formEngine.renderStartForm(startForm);
} catch (ScriptEvaluationException e) {
LOG.exceptionWhenStartFormScriptEvaluation(processDefinitionId, e);
}
return renderedStartForm;
}
Aggregations