Пример #1
0
        public virtual object execute(CommandContext commandContext)
        {
            ensureNotNull("jobId", jobId);

            JobEntity job = commandContext.JobManager.findJobById(jobId);

            ensureNotNull("No job found with id '" + jobId + "'", "job", job);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkUpdateJob(job);
            }
            // We need to check if the job was locked, ie acquired by the job acquisition thread
            // This happens if the the job was already acquired, but not yet executed.
            // In that case, we can't allow to delete the job.
            if (!string.ReferenceEquals(job.LockOwner, null) || job.LockExpirationTime != null)
            {
                throw new ProcessEngineException("Cannot delete job when the job is being executed. Try again later.");
            }

            commandContext.OperationLogManager.logJobOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_DELETE, jobId, job.JobDefinitionId, job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, PropertyChange.EMPTY_CHANGE);

            job.delete();
            return(null);
        }
Пример #2
0
        public virtual Void execute(CommandContext commandContext)
        {
            JobEntity jobToDelete = null;

            foreach (string jobId in jobIds)
            {
                jobToDelete = Context.CommandContext.JobManager.findJobById(jobId);

                if (jobToDelete != null)
                {
                    // When given job doesn't exist, ignore
                    jobToDelete.delete();

                    if (cascade)
                    {
                        commandContext.HistoricJobLogManager.deleteHistoricJobLogByJobId(jobId);
                    }
                }
            }
            return(null);
        }
Пример #3
0
 public virtual void remove()
 {
     jobEntity.delete();
 }