public override void Execute(IExecutionEntity execution) { IJobManager jobManager = Context.CommandContext.JobManager; // end date should be ignored for intermediate timer events. ITimerJobEntity timerJob = jobManager.CreateTimerJob(timerEventDefinition, false, execution, TriggerTimerEventJobHandler.TYPE, TimerEventHandler.CreateConfiguration(execution.CurrentActivityId, null, timerEventDefinition.CalendarName)); if (timerJob != null) { jobManager.ScheduleTimerJob(timerJob); } }
public override void Execute(IExecutionEntity execution) { if (!(execution.CurrentFlowElement is BoundaryEvent)) { throw new ActivitiException("Programmatic error: " + this.GetType() + " should not be used for anything else than a boundary event"); } IJobManager jobManager = Context.CommandContext.JobManager; string timerConfig = TimerEventHandler.CreateConfiguration(execution.CurrentActivityId, timerEventDefinition.EndDate, timerEventDefinition.CalendarName); ITimerJobEntity timerJob = jobManager.CreateTimerJob(timerEventDefinition, interrupting, execution, TriggerTimerEventJobHandler.TYPE, timerConfig); if (timerJob != null) { jobManager.ScheduleTimerJob(timerJob); } }
public override void Execute(IExecutionEntity execution) { if (!(execution.CurrentFlowElement is BoundaryEvent)) { throw new ActivitiException("Programmatic error: " + this.GetType() + " should not be used for anything else than a boundary event"); } if (timerEventDefinition.TimeDate == "-1" || timerEventDefinition.TimeCycle == "-1" || timerEventDefinition.TimeDuration == "-1") { ProcessEngineConfigurationImpl processConfig = Context.CommandContext.ProcessEngineConfiguration; var element = execution.CurrentFlowElement as BoundaryEvent; var beab = new BoundaryEventActivityBehavior(element.CancelActivity); beab.Trigger(execution, TriggerTimerEventJobHandler.TYPE, null); processConfig.ExecutionEntityManager.Delete(execution); //if (element.CancelActivity) //{ // IExecutionEntityManager executionEntityManager = processConfig.ExecutionEntityManager; // IExecutionEntity attachedRefScopeExecution = executionEntityManager.FindById<IExecutionEntity>(execution.ParentId); // processConfig.ExecutionEntityManager.Delete(attachedRefScopeExecution); // processConfig.ExecutionEntityManager.Delete(execution); //} } else { IJobManager jobManager = Context.CommandContext.JobManager; string timerConfig = TimerEventHandler.CreateConfiguration(execution.CurrentActivityId, timerEventDefinition.EndDate, timerEventDefinition.CalendarName); ITimerJobEntity timerJob = jobManager.CreateTimerJob(timerEventDefinition, interrupting, execution, TriggerTimerEventJobHandler.TYPE, timerConfig); if (timerJob != null) { jobManager.ScheduleTimerJob(timerJob); } } }
protected internal virtual IList <ITimerJobEntity> GetTimerDeclarations(IProcessDefinitionEntity processDefinition, Process process) { IJobManager jobManager = Context.CommandContext.JobManager; IList <ITimerJobEntity> timers = new List <ITimerJobEntity>(); if (CollectionUtil.IsNotEmpty(process.FlowElements)) { foreach (FlowElement element in process.FlowElements) { if (element is StartEvent startEvent) { if (CollectionUtil.IsNotEmpty(startEvent.EventDefinitions)) { EventDefinition eventDefinition = startEvent.EventDefinitions[0]; if (eventDefinition is TimerEventDefinition timerEventDefinition) { ITimerJobEntity timerJob = jobManager.CreateTimerJob(timerEventDefinition, false, null, TimerStartEventJobHandler.TYPE, TimerEventHandler.CreateConfiguration(startEvent.Id, timerEventDefinition.EndDate, timerEventDefinition.CalendarName)); if (timerJob != null) { timerJob.ProcessDefinitionId = processDefinition.Id; if (processDefinition.TenantId is object) { timerJob.TenantId = processDefinition.TenantId; } timers.Add(timerJob); } } } } } } return(timers); }