Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }