protected Date calculateDueDate(CommandContext commandContext, int waitTimeInSeconds, Date oldDate) { Calendar newDateCal = new GregorianCalendar(); if (oldDate != null) { newDateCal.setTime(oldDate); } else { newDateCal.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); } newDateCal.add(Calendar.SECOND, waitTimeInSeconds); return newDateCal.getTime(); }
@Override public IntegrationContextEntity execute(CommandContext commandContext) { return commandContext.getProcessEngineConfiguration().getIntegrationContextManager().findById(integrationContextId); } }
@Override public IntegrationContextEntity execute(CommandContext commandContext) { commandContext.getProcessEngineConfiguration().getIntegrationContextManager().delete(integrationContext); return integrationContext; } }
/** * Executes the execution listeners defined on the given element, with the given event type, * and passing the provided execution to the {@link ExecutionListener} instances. */ protected void executeExecutionListeners(HasExecutionListeners elementWithExecutionListeners, ExecutionEntity executionEntity, String eventType) { commandContext.getProcessEngineConfiguration().getListenerNotificationHelper() .executeExecutionListeners(elementWithExecutionListeners, executionEntity, eventType); }
public ProcessDefinition execute(CommandContext commandContext) { return commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); } }
protected void lockJob(CommandContext commandContext, TimerJobEntity job, int lockTimeInMillis) { // This will trigger an optimistic locking exception when two concurrent executors // try to lock, as the revision will not match. GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); gregorianCalendar.add(Calendar.MILLISECOND, lockTimeInMillis); job.setLockOwner(asyncExecutor.getLockOwner()); job.setLockExpirationTime(gregorianCalendar.getTime()); } }
protected void lockJob(CommandContext commandContext, JobEntity job, int lockTimeInMillis) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); gregorianCalendar.add(Calendar.MILLISECOND, lockTimeInMillis); job.setLockOwner(asyncExecutor.getLockOwner()); job.setLockExpirationTime(gregorianCalendar.getTime()); } }
@Override public Void execute(CommandContext commandContext) { if (listener == null) { throw new ActivitiIllegalArgumentException("listener is null."); } if (types != null) { commandContext.getProcessEngineConfiguration().getEventDispatcher().addEventListener(listener, types); } else { commandContext.getProcessEngineConfiguration().getEventDispatcher().addEventListener(listener); } return null; }
public Void execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } // Remove process definitions from cache: commandContext.getProcessEngineConfiguration().getDeploymentManager().removeDeployment(deploymentId, cascade); return null; } }
/** * Since no transitions are followed when leaving the inner activity, it is needed to call the end listeners yourself. */ protected void callActivityEndListeners(DelegateExecution execution) { Context.getCommandContext().getProcessEngineConfiguration().getListenerNotificationHelper() .executeExecutionListeners(activity, execution, ExecutionListener.EVENTNAME_END); }
@Override public void execute(CommandContext commandContext) { CommandExecutor commandExecutor = commandContext.getProcessEngineConfiguration().getCommandExecutor(); CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW); commandExecutor.execute(commandConfig, new Command<Void>() { public Void execute(CommandContext commandContext) { listener.notify(scope.getProcessInstanceId(), scope.getExecutionId(), scope.getFlowElement(), scope.getExecutionVariables(), scope.getCustomPropertiesMap()); return null; } }); }
@Override public Void execute(CommandContext commandContext) { if (listener == null) { throw new ActivitiIllegalArgumentException("listener is null."); } commandContext.getProcessEngineConfiguration().getEventDispatcher().removeEventListener(listener); return null; }
@Override public List<ValidationError> execute(CommandContext commandContext) { ProcessValidator processValidator = commandContext.getProcessEngineConfiguration().getProcessValidator(); if (processValidator == null) { throw new ActivitiException("No process validator defined"); } return processValidator.validate(bpmnModel); }
@Override public void execute(CommandContext commandContext) { CommandExecutor commandExecutor = commandContext.getProcessEngineConfiguration().getCommandExecutor(); CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW); commandExecutor.execute(commandConfig, new Command<Void>() { public Void execute(CommandContext commandContext) { listener.notify(scope.getProcessInstanceId(), scope.getExecutionId(), scope.getTask(), scope.getExecutionVariables(), scope.getCustomPropertiesMap()); return null; } }); }
public static boolean shouldSkipFlowElement(CommandContext commandContext, DelegateExecution execution, String skipExpressionString) { Expression skipExpression = commandContext.getProcessEngineConfiguration().getExpressionManager().createExpression(skipExpressionString); Object value = skipExpression.getValue(execution); if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } else { throw new ActivitiIllegalArgumentException("Skip expression does not resolve to a boolean: " + skipExpression.getExpressionText()); } }
protected void dispatchProcessDefinitionEntityInitializedEvent(ParsedDeployment parsedDeployment) { CommandContext commandContext = Context.getCommandContext(); for (ProcessDefinitionEntity processDefinitionEntity : parsedDeployment.getAllProcessDefinitions()) { log.info("Process deployed: {id: " + processDefinitionEntity.getId() + ", key: " + processDefinitionEntity.getKey() + ", name: " + processDefinitionEntity.getName() +" }"); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_INITIALIZED, processDefinitionEntity)); } } }
public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; if (StringUtils.isNotEmpty(signalEventDefinition.getSignalRef())) { signalName = signalEventDefinition.getSignalRef(); } else { Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); } commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); }
protected List<ProcessInstance> fetchProcessInstancesPage(CommandContext commandContext, ProcessDefinition processDefinition, int currentPageStartIndex) { if (SuspensionState.ACTIVE.equals(getProcessDefinitionSuspensionState())) { return new ProcessInstanceQueryImpl(commandContext).processDefinitionId(processDefinition.getId()).suspended() .listPage(currentPageStartIndex, commandContext.getProcessEngineConfiguration().getBatchSizeProcessInstances()); } else { return new ProcessInstanceQueryImpl(commandContext).processDefinitionId(processDefinition.getId()).active() .listPage(currentPageStartIndex, commandContext.getProcessEngineConfiguration().getBatchSizeProcessInstances()); } }
public InputStream execute(CommandContext commandContext) { ProcessDefinition processDefinition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); String deploymentId = processDefinition.getDeploymentId(); String resourceName = processDefinition.getResourceName(); InputStream processModelStream = new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext); return processModelStream; }
@Override public Void execute(CommandContext commandContext) { boolean messageQueueMode = commandContext.getProcessEngineConfiguration().isAsyncExecutorIsMessageQueueMode(); for (String jobId : jobIds) { if (!messageQueueMode) { Job job = commandContext.getJobEntityManager().findById(jobId); commandContext.getJobManager().unacquire(job); } else { commandContext.getJobEntityManager().resetExpiredJob(jobId); } } return null; }