//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testExecuteExclusiveFollowUpJobInDifferentProcessInstance() public virtual void testExecuteExclusiveFollowUpJobInDifferentProcessInstance() { testHelper.deploy(CALL_ACTIVITY_PROCESS, ONE_TASK_PROCESS); // given // a process instance with a single job ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceByKey("callActivityProcess"); jobExecutor.start(); // and first job acquisition that acquires the job acquisitionThread.waitForSync(); acquisitionThread.makeContinueAndWaitForSync(); // and job is executed acquisitionThread.makeContinueAndWaitForSync(); // then // the called instance has been created ProcessInstance calledInstance = engineRule.RuntimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.Id).singleResult(); Assert.assertNotNull(calledInstance); // and there is a transition instance for the service task ActivityInstance activityInstance = engineRule.RuntimeService.getActivityInstance(calledInstance.Id); Assert.assertEquals(1, activityInstance.getTransitionInstances("serviceTask").Length); // but the corresponding job is not locked JobEntity followUpJob = (JobEntity)engineRule.ManagementService.createJobQuery().singleResult(); Assert.assertNotNull(followUpJob); Assert.assertNull(followUpJob.LockOwner); Assert.assertNull(followUpJob.LockExpirationTime); }
protected internal virtual void setJobRetriesByJobId(string jobId, int retries, CommandContext commandContext) { JobEntity job = commandContext.JobManager.findJobById(jobId); if (job != null) { foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkUpdateRetriesJob(job); } if (job.InInconsistentLockState) { job.resetLock(); } int oldRetries = job.Retries; job.Retries = retries; PropertyChange propertyChange = new PropertyChange(RETRIES, oldRetries, job.Retries); commandContext.OperationLogManager.logJobOperation(LogEntryOperation, job.Id, job.JobDefinitionId, job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, propertyChange); } else { throw new ProcessEngineException("No job found with id '" + jobId + "'."); } }
public override Void execute(CommandContext commandContext) { monitor.sync(); JobEntity jobEntity = commandContext.JobManager.findJobById(outerInstance.job.get().Id); jobEntity.LockOwner = "foo"; return(null); }
public Void execute(CommandContext commandContext) { JobEntity jobEntity = outerInstance.job.get(); jobEntity.Revision = 2; commandContext.JobManager.deleteJob(jobEntity); commandContext.ByteArrayManager.deleteByteArrayById(jobEntity.ExceptionByteArrayId); commandContext.HistoricJobLogManager.deleteHistoricJobLogByJobId(jobEntity.Id); return(null); }
protected internal virtual ScopeImpl determineTimerTriggerTargetScope(JobEntity jobEntity, ScopeImpl targetScope) { if (TimerStartEventSubprocessJobHandler.TYPE.Equals(jobEntity.JobHandlerType)) { // for event subprocess start jobs, the job handler configuration references the subprocess while // the job references the start event return(targetScope.FlowScope); } else { return(targetScope); } }
public override Void execute(CommandContext commandContext) { monitor.sync(); JobEntity jobEntity = commandContext.JobManager.findJobById(outerInstance.job.get().Id); monitor.sync(); commandContext.JobManager.deleteJob(jobEntity); string byteArrayId = jobEntity.ExceptionByteArrayId; commandContext.ByteArrayManager.deleteByteArrayById(byteArrayId); return(null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testExecuteExclusiveFollowUpJobInSameProcessInstance() public virtual void testExecuteExclusiveFollowUpJobInSameProcessInstance() { testHelper.deploy(TWO_TASKS_PROCESS); // given // a process instance with a single job ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceByKey("process"); jobExecutor.start(); // and first job acquisition that acquires the job acquisitionThread.waitForSync(); acquisitionThread.makeContinueAndWaitForSync(); // and first job execution acquisitionThread.makeContinue(); // waiting inside delegate executionThread.waitForSync(); // completing delegate executionThread.makeContinueAndWaitForSync(); // then // the follow-up job should be executed right away // i.e., there is a transition instance for the second service task ActivityInstance activityInstance = engineRule.RuntimeService.getActivityInstance(processInstance.Id); Assert.assertEquals(1, activityInstance.getTransitionInstances("serviceTask2").Length); // and the corresponding job is locked JobEntity followUpJob = (JobEntity)engineRule.ManagementService.createJobQuery().singleResult(); Assert.assertNotNull(followUpJob); Assert.assertNotNull(followUpJob.LockOwner); Assert.assertNotNull(followUpJob.LockExpirationTime); // and the job can be completed successfully such that the process instance ends executionThread.makeContinue(); acquisitionThread.waitForSync(); // and the process instance has finished testHelper.assertProcessEnded(processInstance.Id); }
public virtual Void execute(CommandContext commandContext) { EnsureUtil.ensureNotNull("job id must not be null", "jobId", jobId); JobEntity job = commandContext.JobManager.findJobById(jobId); EnsureUtil.ensureNotNull(typeof(NotFoundException), "No job found with id '" + jobId + "'", "job", job); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkUpdateJob(job); } long currentPriority = job.Priority; job.Priority = priority; createOpLogEntry(commandContext, currentPriority, job); return(null); }
public virtual Void execute(CommandContext commandContext) { JobEntity job = Job; if (Context.JobExecutorContext == null) { EnsureUtil.ensureNotNull("Job with id " + jobId + " does not exist", "job", job); } else if (Context.JobExecutorContext != null && job == null) { // CAM-1842 // Job was acquired but does not exist anymore. This is not a problem. // It usually means that the job has been deleted after it was acquired which can happen if the // the activity instance corresponding to the job is cancelled. LOG.debugAcquiredJobNotFound(jobId); return(null); } job.unlock(); return(null); }
protected internal virtual bool isProcessStartJob(JobEntity job) { AsyncContinuationConfiguration configuration = (AsyncContinuationConfiguration)job.JobHandlerConfiguration; return(org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.PROCESS_START.CanonicalName.Equals(configuration.AtomicOperation)); }
public virtual void onDelete(BatchSeedJobConfiguration configuration, JobEntity jobEntity) { // do nothing }
protected internal virtual void createOpLogEntry(CommandContext commandContext, long previousPriority, JobEntity job) { PropertyChange propertyChange = new PropertyChange(JOB_PRIORITY_PROPERTY, previousPriority, job.Priority); commandContext.OperationLogManager.logJobOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_PRIORITY, job.Id, job.JobDefinitionId, job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, propertyChange); }
protected internal override void checkAuthorization(CommandContext commandContext) { foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { if (!string.ReferenceEquals(jobId, null)) { JobManager jobManager = commandContext.JobManager; JobEntity job = jobManager.findJobById(jobId); if (job != null) { string processInstanceId = job.ProcessInstanceId; if (!string.ReferenceEquals(processInstanceId, null)) { checker.checkUpdateProcessInstanceById(processInstanceId); } else { // start timer job is not assigned to a specific process // instance, that's why we have to check whether there // exists a UPDATE_INSTANCES permission on process definition or // a UPDATE permission on any process instance string processDefinitionKey = job.ProcessDefinitionKey; if (!string.ReferenceEquals(processDefinitionKey, null)) { checker.checkUpdateProcessInstanceByProcessDefinitionKey(processDefinitionKey); } } // if (processInstanceId == null && processDefinitionKey == null): // job is not assigned to any process instance nor process definition // then it is always possible to activate/suspend the corresponding job // -> no authorization check necessary } } else { if (!string.ReferenceEquals(jobDefinitionId, null)) { JobDefinitionManager jobDefinitionManager = commandContext.JobDefinitionManager; JobDefinitionEntity jobDefinition = jobDefinitionManager.findById(jobDefinitionId); if (jobDefinition != null) { string processDefinitionKey = jobDefinition.ProcessDefinitionKey; checker.checkUpdateProcessInstanceByProcessDefinitionKey(processDefinitionKey); } } else { if (!string.ReferenceEquals(processInstanceId, null)) { checker.checkUpdateProcessInstanceById(processInstanceId); } else { if (!string.ReferenceEquals(processDefinitionId, null)) { checker.checkUpdateProcessInstanceByProcessDefinitionId(processDefinitionId); } else { if (!string.ReferenceEquals(processDefinitionKey, null)) { checker.checkUpdateProcessInstanceByProcessDefinitionKey(processDefinitionKey); } } } } } } }
public MigratingTimerJobInstance(JobEntity jobEntity) : base(jobEntity) { }
public virtual void onDelete(EventSubscriptionJobConfiguration configuration, JobEntity jobEntity) { // do nothing }
public virtual void onDelete(HistoryCleanupJobHandlerConfiguration configuration, JobEntity jobEntity) { }
public abstract void onDelete(T configuration, JobEntity jobEntity);
public virtual void onDelete(TimerJobConfiguration configuration, JobEntity jobEntity) { // do nothing }
public virtual void onDelete(JobDefinitionSuspensionStateConfiguration configuration, JobEntity jobEntity) { // do nothing }
public MigratingTimerJobInstance(JobEntity jobEntity, JobDefinitionEntity jobDefinitionEntity, ScopeImpl targetScope, bool updateEvent, TimerDeclarationImpl targetTimerDeclaration) : base(jobEntity, jobDefinitionEntity, targetScope) { timerTriggerTargetScope = determineTimerTriggerTargetScope(jobEntity, targetScope); this.updateEvent = updateEvent; this.targetJobDeclaration = targetTimerDeclaration; }