use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class EvaluateStartConditionCmd method checkAuthorization.
protected void checkAuthorization(CommandContext commandContext, ConditionHandlerResult result) {
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
ProcessDefinitionEntity definition = result.getProcessDefinition();
checker.checkCreateProcessInstance(definition);
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationCmd method execute.
@Override
public Void execute(final CommandContext commandContext) {
List<AbstractProcessInstanceModificationCommand> instructions = builder.getInstructions();
final Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
ensureNotEmpty(BadUserRequestException.class, "Modification instructions cannot be empty", instructions);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "Process instance ids", processInstanceIds);
ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.getProcessDefinitionId());
ensureNotNull(BadUserRequestException.class, "Process definition id cannot be null", processDefinition);
if (writeUserOperationLog) {
writeUserOperationLog(commandContext, processDefinition, processInstanceIds.size(), false);
}
boolean skipCustomListeners = builder.isSkipCustomListeners();
boolean skipIoMappings = builder.isSkipIoMappings();
for (String processInstanceId : processInstanceIds) {
ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId);
ensureProcessInstanceExist(processInstanceId, processInstance);
ensureSameProcessDefinition(processInstance, processDefinition.getId());
ProcessInstanceModificationBuilderImpl builder = createProcessInstanceModificationBuilder(processInstanceId, commandContext);
builder.execute(false, skipCustomListeners, skipIoMappings);
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity 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.persistence.entity.ProcessDefinitionEntity 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.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class RestartProcessInstancesCmd method execute.
@Override
public Void execute(final CommandContext commandContext) {
final Collection<String> processInstanceIds = collectProcessInstanceIds();
final List<AbstractProcessInstanceModificationCommand> instructions = builder.getInstructions();
ensureNotEmpty(BadUserRequestException.class, "Restart instructions cannot be empty", "instructions", instructions);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "Process instance ids", processInstanceIds);
final ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.getProcessDefinitionId());
ensureNotNull("Process definition cannot be found", "processDefinition", processDefinition);
checkAuthorization(commandContext, processDefinition);
if (writeUserOperationLog) {
writeUserOperationLog(commandContext, processDefinition, processInstanceIds.size(), false);
}
final String processDefinitionId = builder.getProcessDefinitionId();
Runnable runnable = new Runnable() {
@Override
public void run() {
for (String processInstanceId : processInstanceIds) {
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstance(commandContext, processInstanceId);
ensureNotNull(BadUserRequestException.class, "Historic process instance cannot be found", "historicProcessInstanceId", historicProcessInstance);
ensureHistoricProcessInstanceNotActive(historicProcessInstance);
ensureSameProcessDefinition(historicProcessInstance, processDefinitionId);
ProcessInstantiationBuilderImpl instantiationBuilder = getProcessInstantiationBuilder(commandExecutor, processDefinitionId);
applyProperties(instantiationBuilder, processDefinition, historicProcessInstance);
ProcessInstanceModificationBuilderImpl modificationBuilder = instantiationBuilder.getModificationBuilder();
modificationBuilder.setModificationOperations(instructions);
VariableMap variables = collectVariables(commandContext, historicProcessInstance);
instantiationBuilder.setVariables(variables);
instantiationBuilder.execute(builder.isSkipCustomListeners(), builder.isSkipIoMappings());
}
}
};
ProcessApplicationContextUtil.doContextSwitch(runnable, processDefinition);
return null;
}
Aggregations