/// <summary> /// /// </summary> /// <param name="otherJob"></param> /// <returns></returns> protected internal virtual ISuspendedJobEntity CreateSuspendedJobFromOtherJob(IAbstractJobEntity otherJob) { ISuspendedJobEntity suspendedJob = processEngineConfiguration.SuspendedJobEntityManager.Create(); CopyJobInfo(suspendedJob, otherJob); return(suspendedJob); }
/// <summary> /// /// </summary> /// <param name="job"></param> /// <returns></returns> public virtual ISuspendedJobEntity MoveJobToSuspendedJob(IAbstractJobEntity job) { ISuspendedJobEntity suspendedJob = CreateSuspendedJobFromOtherJob(job); processEngineConfiguration.SuspendedJobEntityManager.Insert(suspendedJob); if (job is ITimerJobEntity) { processEngineConfiguration.TimerJobEntityManager.Delete((ITimerJobEntity)job); } else if (job is IJobEntity) { processEngineConfiguration.JobEntityManager.Delete((IJobEntity)job); } return(suspendedJob); }
/// <summary> /// /// </summary> /// <param name="job"></param> /// <returns></returns> public virtual IAbstractJobEntity ActivateSuspendedJob(ISuspendedJobEntity job) { IAbstractJobEntity activatedJob; if (JobFields.JOB_TYPE_TIMER.Equals(job.JobType)) { activatedJob = CreateTimerJobFromOtherJob(job); processEngineConfiguration.TimerJobEntityManager.Insert((ITimerJobEntity)activatedJob); } else { activatedJob = CreateExecutableJobFromOtherJob(job); IJobEntity jobEntity = (IJobEntity)activatedJob; processEngineConfiguration.JobEntityManager.Insert(jobEntity); TriggerExecutorIfNeeded(jobEntity); } processEngineConfiguration.SuspendedJobEntityManager.Delete(job); return(activatedJob); }