org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl Java Examples
The following examples show how to use
org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimerJobEntity.java From flowable-engine with Apache License 2.0 | 6 votes |
protected int checkStartEventDefinitions(ProcessDefinition def, String embededActivityId) { List<TimerDeclarationImpl> startTimerDeclarations = (List<TimerDeclarationImpl>) ((ProcessDefinitionEntity) def).getProperty("timerStart"); if (startTimerDeclarations != null && startTimerDeclarations.size() > 0) { TimerDeclarationImpl timerDeclaration = null; for (TimerDeclarationImpl startTimerDeclaration : startTimerDeclarations) { String definitionActivityId = TimerEventHandler.getActivityIdFromConfiguration(startTimerDeclaration.getJobHandlerConfiguration()); if (startTimerDeclaration.getJobHandlerType().equalsIgnoreCase(jobHandlerType) && (definitionActivityId.equalsIgnoreCase(embededActivityId))) { timerDeclaration = startTimerDeclaration; } } if (timerDeclaration != null) { return calculateMaxIterationsValue(timerDeclaration.getDescription().getExpressionText()); } } return 1; }
Example #2
Source File: BpmnDeployer.java From flowable-engine with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected void addTimerDeclarations(ProcessDefinitionEntity processDefinition, List<TimerJobEntity> timers) { List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) processDefinition.getProperty(BpmnParse.PROPERTYNAME_START_TIMER); if (timerDeclarations != null) { for (TimerDeclarationImpl timerDeclaration : timerDeclarations) { TimerJobEntity timer = timerDeclaration.prepareTimerEntity(null); if (timer != null) { timer.setProcessDefinitionId(processDefinition.getId()); // Inherit timer (if applicable) if (processDefinition.getTenantId() != null) { timer.setTenantId(processDefinition.getTenantId()); } timers.add(timer); } } } }
Example #3
Source File: TimerJobEntity.java From flowable-engine with Apache License 2.0 | 5 votes |
public TimerJobEntity(TimerDeclarationImpl timerDeclaration) { this.jobHandlerType = timerDeclaration.getJobHandlerType(); this.jobHandlerConfiguration = timerDeclaration.getJobHandlerConfiguration(); this.isExclusive = timerDeclaration.isExclusive(); this.repeat = timerDeclaration.getRepeat(); this.retries = timerDeclaration.getRetries(); this.jobType = "timer"; this.revision = 1; }
Example #4
Source File: ExecutionEntity.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void initialize() { LOGGER.debug("initializing {}", this); ScopeImpl scope = getScopeObject(); ensureParentInitialized(); // initialize the lists of referenced objects (prevents db queries) variableInstances = new HashMap<>(); eventSubscriptions = new ArrayList<>(); // Cached entity-state initialized to null, all bits are zero, indicating NO entities present cachedEntityState = 0; List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) scope.getProperty(BpmnParse.PROPERTYNAME_TIMER_DECLARATION); if (timerDeclarations != null) { for (TimerDeclarationImpl timerDeclaration : timerDeclarations) { TimerJobEntity timer = timerDeclaration.prepareTimerEntity(this); if (timer != null) { callJobProcessors(JobProcessorContext.Phase.BEFORE_CREATE, timer, Context.getProcessEngineConfiguration()); Context.getCommandContext().getJobEntityManager().schedule(timer); } } } // create event subscriptions for the current scope List<EventSubscriptionDeclaration> eventSubscriptionDeclarations = (List<EventSubscriptionDeclaration>) scope.getProperty(BpmnParse.PROPERTYNAME_EVENT_SUBSCRIPTION_DECLARATION); if (eventSubscriptionDeclarations != null) { for (EventSubscriptionDeclaration eventSubscriptionDeclaration : eventSubscriptionDeclarations) { if (!eventSubscriptionDeclaration.isStartEvent()) { EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptionDeclaration.prepareEventSubscriptionEntity(this); if (getTenantId() != null) { eventSubscriptionEntity.setTenantId(getTenantId()); } eventSubscriptionEntity.insert(); } } } }
Example #5
Source File: TimerEventDefinitionParseHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void addTimerDeclaration(ScopeImpl scope, TimerDeclarationImpl timerDeclaration) { List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) scope.getProperty(PROPERTYNAME_TIMER_DECLARATION); if (timerDeclarations == null) { timerDeclarations = new ArrayList<>(); scope.setProperty(PROPERTYNAME_TIMER_DECLARATION, timerDeclarations); } timerDeclarations.add(timerDeclaration); }
Example #6
Source File: TimerEventDefinitionParseHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
protected TimerDeclarationImpl createTimer(BpmnParse bpmnParse, TimerEventDefinition timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) { TimerDeclarationType type = null; Expression expression = null; Expression endDate = null; Expression calendarName = null; ExpressionManager expressionManager = bpmnParse.getExpressionManager(); if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDate())) { // TimeDate type = TimerDeclarationType.DATE; expression = expressionManager.createExpression(timerEventDefinition.getTimeDate()); } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) { // TimeCycle type = TimerDeclarationType.CYCLE; expression = expressionManager.createExpression(timerEventDefinition.getTimeCycle()); // support for endDate if (StringUtils.isNotEmpty(timerEventDefinition.getEndDate())) { endDate = expressionManager.createExpression(timerEventDefinition.getEndDate()); } } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDuration())) { // TimeDuration type = TimerDeclarationType.DURATION; expression = expressionManager.createExpression(timerEventDefinition.getTimeDuration()); } if (StringUtils.isNotEmpty(timerEventDefinition.getCalendarName())) { calendarName = expressionManager.createExpression(timerEventDefinition.getCalendarName()); } // neither date, cycle or duration configured! if (expression == null) { LOGGER.warn("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) ({})", timerActivity.getId()); } String jobHandlerConfiguration = timerActivity.getId(); if (jobHandlerType.equalsIgnoreCase(TimerExecuteNestedActivityJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerCatchIntermediateEventJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerStartEventJobHandler.TYPE)) { jobHandlerConfiguration = TimerStartEventJobHandler.createConfiguration(timerActivity.getId(), endDate, calendarName); } // Parse the timer declaration // TODO move the timer declaration into the bpmn activity or next to the // TimerSession TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType, endDate, calendarName); timerDeclaration.setJobHandlerConfiguration(jobHandlerConfiguration); timerDeclaration.setExclusive(true); return timerDeclaration; }