public static void ensureWhitelistedResourceId(CommandContext commandContext, String resourceType, String resourceId) { String resourcePattern = determineResourceWhitelistPattern(commandContext.getProcessEngineConfiguration(), resourceType); Pattern PATTERN = Pattern.compile(resourcePattern); if (!PATTERN.matcher(resourceId).matches()) { throw generateException(ProcessEngineException.class, resourceType + " has an invalid id", "'" + resourceId + "'", "is not a valid resource identifier."); } }
protected ProcessDefinitionEntity getProcessDefinition(CommandContext commandContext, String processDefinitionId) { return commandContext .getProcessEngineConfiguration() .getDeploymentCache() .findDeployedProcessDefinitionById(processDefinitionId); } }
protected Date calculateMonitorJobDueDate() { int pollTime = Context.getCommandContext() .getProcessEngineConfiguration() .getBatchPollTime(); long dueTime = ClockUtil.getCurrentTime().getTime() + (pollTime * 1000); return new Date(dueTime); }
protected void checkDeleteTask(TaskEntity task, CommandContext commandContext) { for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkDeleteTask(task); } } }
protected void checkGetExecutionVariable(ExecutionEntity execution, CommandContext commandContext) { for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadProcessInstance(execution); } } }
protected void checkPermissions(CommandContext commandContext) { for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateBatch(BatchPermissions.CREATE_BATCH_RESTART_PROCESS_INSTANCES); } }
protected void checkTaskPriority(TaskEntity task, CommandContext commandContext) { for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkTaskAssign(task); } } }
protected ProcessDefinitionEntity getProcessDefinition(CommandContext commandContext, String processDefinitionId) { return commandContext.getProcessEngineConfiguration() .getDeploymentCache() .findDeployedProcessDefinitionById(processDefinitionId); }
protected void checkAccess(CommandContext commandContext, BatchEntity batch) { for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkDeleteBatch(batch); } }
protected void checkGetIdentityLink(TaskEntity task, CommandContext commandContext) { for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadTask(task); } } }
protected void checkDeleteProcessInstance(ExecutionEntity execution, CommandContext commandContext) { for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkDeleteProcessInstance(execution); } }
protected DecisionDefinition getDecisionDefinition(CommandContext commandContext) { DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache(); if (decisionDefinitionId != null) { return findById(deploymentCache); } else { return findByKey(deploymentCache); } }
protected HistoricProcessInstance getHistoricProcessInstance(CommandContext commandContext, String processInstanceId) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); return historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); }
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()); }
public List execute(CommandContext commandContext) { ensureNotNull("deploymentId", deploymentId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadDeployment(deploymentId); } return Context .getCommandContext() .getResourceManager() .findResourcesByDeploymentId(deploymentId); }
public List execute(CommandContext commandContext) { ensureNotNull("deploymentId", deploymentId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadDeployment(deploymentId); } return Context .getCommandContext() .getDeploymentManager() .getDeploymentResourceNames(deploymentId); }
public DecisionDefinition execute(CommandContext commandContext) { ensureNotNull("decisionDefinitionId", decisionDefinitionId); DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache(); DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadDecisionDefinition(decisionDefinition); } return decisionDefinition; }
public BpmnModelInstance execute(CommandContext commandContext) { ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); final DeploymentCache deploymentCache = configuration.getDeploymentCache(); ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadProcessDefinition(processDefinition); } BpmnModelInstance modelInstance = deploymentCache.findBpmnModelInstanceForProcessDefinition(processDefinitionId); ensureNotNull("no BPMN model instance found for process definition id " + processDefinitionId, "modelInstance", modelInstance); return modelInstance; } }
protected void checkAuthorization(CorrelationHandlerResult correlation) { CommandContext commandContext = Context.getCommandContext(); for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { if (MessageCorrelationResultType.Execution.equals(correlation.getResultType())) { ExecutionEntity execution = correlation.getExecutionEntity(); checker.checkUpdateProcessInstanceById(execution.getProcessInstanceId()); } else { ProcessDefinitionEntity definition = correlation.getProcessDefinitionEntity(); checker.checkCreateProcessInstance(definition); } } }
protected VariableMap collectLastVariables(CommandContext commandContext, HistoricProcessInstance processInstance) { HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService(); List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery() .executionIdIn(processInstance.getId()) .list(); VariableMap variables = new VariableMapImpl(); for (HistoricVariableInstance variable : historicVariables) { variables.putValueTyped(variable.getName(), variable.getTypedValue()); } return variables; }