public MigratingTimerJobInstance(JobEntity jobEntity, JobDefinitionEntity jobDefinitionEntity, ScopeImpl targetScope, bool updateEvent, TimerDeclarationImpl targetTimerDeclaration) : base(jobEntity, jobDefinitionEntity, targetScope) { TimerTriggerTargetScope = DetermineTimerTriggerTargetScope(jobEntity, targetScope); this.UpdateEvent = updateEvent; TargetJobDeclaration = targetTimerDeclaration; }
public static bool DefinesPersistentEventTrigger(IPvmScope activity) { var eventScope = (ScopeImpl)activity.EventScope; if (eventScope != null) { return(TimerDeclarationImpl.GetDeclarationsForScope(eventScope).ContainsKey(activity.Id) || EventSubscriptionDeclaration.GetDeclarationsForScope(eventScope).ContainsKey(activity.Id)); } return(false); }
public virtual void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance activityInstance, IList <JobEntity> elements) { IDictionary <string, TimerDeclarationImpl> sourceTimerDeclarationsInEventScope = getTimerDeclarationsByTriggeringActivity(activityInstance.SourceScope); IDictionary <string, TimerDeclarationImpl> targetTimerDeclarationsInEventScope = getTimerDeclarationsByTriggeringActivity(activityInstance.TargetScope); foreach (JobEntity job in elements) { if (!isTimerJob(job)) { // skip non timer jobs continue; } MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(job.ActivityId); ActivityImpl targetActivity = parseContext.getTargetActivity(migrationInstruction); if (targetActivity != null && activityInstance.migratesTo(targetActivity.EventScope)) { // the timer job is migrated JobDefinitionEntity targetJobDefinitionEntity = parseContext.getTargetJobDefinition(targetActivity.ActivityId, job.JobHandlerType); TimerDeclarationImpl targetTimerDeclaration = targetTimerDeclarationsInEventScope.Remove(targetActivity.Id); MigratingJobInstance migratingTimerJobInstance = new MigratingTimerJobInstance(job, targetJobDefinitionEntity, targetActivity, migrationInstruction.UpdateEventTrigger, targetTimerDeclaration); activityInstance.addMigratingDependentInstance(migratingTimerJobInstance); parseContext.submit(migratingTimerJobInstance); } else { // the timer job is removed MigratingJobInstance removingJobInstance = new MigratingTimerJobInstance(job); activityInstance.addRemovingDependentInstance(removingJobInstance); parseContext.submit(removingJobInstance); } parseContext.consume(job); } if (activityInstance.migrates()) { addEmergingTimerJobs(parseContext, activityInstance, sourceTimerDeclarationsInEventScope, targetTimerDeclarationsInEventScope); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public Void execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public virtual Void execute(CommandContext commandContext) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.JobEntity job = commandContext.getJobManager().findJobById(jobId); JobEntity job = commandContext.JobManager.findJobById(jobId); ensureNotNull(typeof(NotFoundException), "No job found with id '" + jobId + "'", "job", job); // allow timer jobs only checkJobType(job); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkUpdateJob(job); } // prepare recalculation //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.jobexecutor.TimerDeclarationImpl timerDeclaration = findTimerDeclaration(commandContext, job); TimerDeclarationImpl timerDeclaration = findTimerDeclaration(commandContext, job); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.TimerEntity timer = (org.camunda.bpm.engine.impl.persistence.entity.TimerEntity) job; TimerEntity timer = (TimerEntity)job; DateTime oldDuedate = job.Duedate; ThreadStart runnable = () => { timerDeclaration.resolveAndSetDuedate(timer.Execution, timer, creationDateBased); }; // run recalculation in correct context ProcessDefinitionEntity contextDefinition = commandContext.ProcessEngineConfiguration.DeploymentCache.findDeployedProcessDefinitionById(job.ProcessDefinitionId); ProcessApplicationContextUtil.doContextSwitch(runnable, contextDefinition); // log operation IList <PropertyChange> propertyChanges = new List <PropertyChange>(); propertyChanges.Add(new PropertyChange("duedate", oldDuedate, job.Duedate)); propertyChanges.Add(new PropertyChange("creationDateBased", null, creationDateBased)); commandContext.OperationLogManager.logJobOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RECALC_DUEDATE, jobId, job.JobDefinitionId, job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, propertyChanges); return(null); }
protected internal virtual TimerDeclarationImpl findTimerDeclaration(CommandContext commandContext, JobEntity job) { TimerDeclarationImpl timerDeclaration = null; if (!string.ReferenceEquals(job.ExecutionId, null)) { // boundary or intermediate or subprocess start event timerDeclaration = findTimerDeclarationForActivity(commandContext, job); } else { // process instance start event timerDeclaration = findTimerDeclarationForProcessStartEvent(commandContext, job); } if (timerDeclaration == null) { throw new ProcessEngineException("No timer declaration found for job id '" + jobId + "'."); } return(timerDeclaration); }
public EmergingJobInstance(TimerDeclarationImpl timerDeclaration) { this.TimerDeclaration = timerDeclaration; }
protected internal virtual bool isNonInterruptingTimerTriggeredAlready(MigratingInstanceParseContext parseContext, IDictionary <string, TimerDeclarationImpl> sourceTimerDeclarationsInEventScope, TimerDeclarationImpl targetTimerDeclaration) { if (targetTimerDeclaration.InterruptingTimer || !string.ReferenceEquals(targetTimerDeclaration.JobHandlerType, TimerExecuteNestedActivityJobHandler.TYPE) || sourceTimerDeclarationsInEventScope.Values.Count == 0) { return(false); } foreach (TimerDeclarationImpl sourceTimerDeclaration in sourceTimerDeclarationsInEventScope.Values) { MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(sourceTimerDeclaration.ActivityId); ActivityImpl targetActivity = parseContext.getTargetActivity(migrationInstruction); if (targetActivity != null && targetTimerDeclaration.ActivityId.Equals(targetActivity.ActivityId)) { return(true); } } return(false); }
protected internal virtual IDictionary <string, TimerDeclarationImpl> getTimerDeclarationsByTriggeringActivity(ScopeImpl scope) { return(new Dictionary <string, TimerDeclarationImpl>(TimerDeclarationImpl.getDeclarationsForScope(scope))); }
public TimerEntity(TimerDeclarationImpl timerDeclaration) { repeat = timerDeclaration.Repeat; }