protected void ensureSubCaseInstanceInitialized() { if (shouldQueryForSubCaseInstance && subCaseInstance == null) { subCaseInstance = Context.getCommandContext().getCaseExecutionManager().findSubCaseInstanceBySuperExecutionId(id); } }
protected void ensureTasksInitialized() { if (tasks == null) { tasks = Context.getCommandContext().getTaskManager().findTasksByExecutionId(id); } }
protected void ensureExternalTasksInitialized() { if (externalTasks == null) { externalTasks = Context.getCommandContext().getExternalTaskManager().findExternalTasksByExecutionId(id); } }
public JobDefinitionEntity getSeedJobDefinition() { if (seedJobDefinition == null && seedJobDefinitionId != null) { seedJobDefinition = Context.getCommandContext().getJobDefinitionManager().findById(seedJobDefinitionId); } return seedJobDefinition; }
protected Date calculateMonitorJobDueDate() { int pollTime = Context.getCommandContext() .getProcessEngineConfiguration() .getBatchPollTime(); long dueTime = ClockUtil.getCurrentTime().getTime() + (pollTime * 1000); return new Date(dueTime); }
@SuppressWarnings("unchecked") public List<U> list() { this.resultType = ResultType.LIST; if (commandExecutor!=null) { return (List<U>) commandExecutor.execute(this); } return evaluateExpressionsAndExecuteList(Context.getCommandContext(), null); }
protected void ensurePreviousCaseDefinitionIdInitialized() { if (previousCaseDefinitionId == null && !firstVersion) { previousCaseDefinitionId = Context .getCommandContext() .getCaseDefinitionManager() .findPreviousCaseDefinitionId(key, version, tenantId); if (previousCaseDefinitionId == null) { firstVersion = true; } } }
protected void insertHistoricDecisionEvaluationEvent(HistoricDecisionEvaluationEvent event) { Context .getCommandContext() .getHistoricDecisionInstanceManager() .insertHistoricDecisionInstances(event); }
@Override protected void configureQuery(@SuppressWarnings("rawtypes") AbstractQuery query, Resource resource) { Context.getCommandContext() .getAuthorizationManager() .configureQuery(query, resource); }
protected void deploy(DeploymentEntity deployment) { deployment.setNew(true); Context .getCommandContext() .getDeploymentManager() .insertDeployment(deployment); }
protected void suspending(CmmnActivityExecution execution) { String id = execution.getId(); Context .getCommandContext() .getTaskManager() .updateTaskSuspensionStateByCaseExecutionId(id, SuspensionState.SUSPENDED); }
protected void processEventSync(Object payload, Object payloadLocal, String businessKey) { EventHandler eventHandler = Context.getProcessEngineConfiguration().getEventHandler(eventType); ensureNotNull("Could not find eventhandler for event of type '" + eventType + "'", "eventHandler", eventHandler); eventHandler.handleEvent(this, payload, payloadLocal, businessKey, Context.getCommandContext()); }
public Void execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinition = Context .getCommandContext() .getProcessDefinitionManager() .findLatestProcessDefinitionById(processDefinitionId); EnsureUtil.ensureNotNull("Cannot find process definition with id " + processDefinitionId, "processDefinition", processDefinition); processDefinition.addIdentityLink(userId, groupId); return null; }
protected void scheduleEventAsync(Object payload, Object payloadLocal, String businessKey) { EventSubscriptionJobDeclaration asyncDeclaration = getJobDeclaration(); if (asyncDeclaration == null) { // fallback to sync if we couldn't find a job declaration processEventSync(payload, payloadLocal, businessKey); } else { MessageEntity message = asyncDeclaration.createJobInstance(this); CommandContext commandContext = Context.getCommandContext(); commandContext.getJobManager().send(message); } }
public JobEntity createMonitorJob(boolean setDueDate) { // Maybe use an other job declaration JobEntity monitorJob = BATCH_MONITOR_JOB_DECLARATION.createJobInstance(this); if (setDueDate) { monitorJob.setDuedate(calculateMonitorJobDueDate()); } Context.getCommandContext() .getJobManager().insertAndHintJobExecutor(monitorJob); return monitorJob; }
public List execute(CommandContext commandContext) { ensureNotNull("deploymentId", deploymentId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadDeployment(deploymentId); } return Context .getCommandContext() .getResourceManager() .findResourcesByDeploymentId(deploymentId); }
public MigratingInstanceParseContext( MigratingInstanceParser parser, MigrationPlan migrationPlan, ExecutionEntity processInstance, ProcessDefinitionEntity targetProcessDefinition) { this.parser = parser; this.sourceProcessDefinition = processInstance.getProcessDefinition(); this.targetProcessDefinition = targetProcessDefinition; this.migratingProcessInstance = new MigratingProcessInstance(processInstance.getId(), sourceProcessDefinition, targetProcessDefinition); this.mapping = new ActivityExecutionTreeMapping(Context.getCommandContext(), processInstance.getId()); this.instructionsBySourceScope = organizeInstructionsBySourceScope(migrationPlan); }
public List execute(CommandContext commandContext) { ensureNotNull("deploymentId", deploymentId); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkReadDeployment(deploymentId); } return Context .getCommandContext() .getDeploymentManager() .getDeploymentResourceNames(deploymentId); }
public void insert(ExecutionEntity execution) { ensureParentTaskActive(); propagateExecutionTenantId(execution); propagateParentTaskTenantId(); CommandContext commandContext = Context.getCommandContext(); TaskManager taskManager = commandContext.getTaskManager(); taskManager.insertTask(this); if(execution != null) { execution.addTask(this); } }
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); } } }