示例#1
0
 /// <summary>
 /// Клонирует значения параметров
 /// </summary>
 /// <param name="origin">Оригинальный экземпляр</param>
 /// <param name="cloneContext">Контекст клонирования</param>
 protected virtual void CloneParameters(BizProcess origin, BpCloneContext cloneContext)
 {
     if (!cloneContext.IsStatus())
     {
         lock (origin.Parameters)
         {
             foreach (KeyValuePair <string, object> pair in origin.Parameters)
             {
                 this.Parameters.Add(pair.Key, pair.Value);
             }
         }
     }
 }
示例#2
0
        /// <summary>
        /// Конструктор. Используется только при клонировании
        /// </summary>
        /// <param name="origin">Оригинальный экземпляр</param>
        /// <param name="cloneContext">Контекст клонирования</param>
        protected BizProcess(BizProcess origin, BpCloneContext cloneContext)
        {
            this.CompleteExecution = origin.CompleteExecution;
            this.StartedOnServer   = origin.StartedOnServer;

            this.Id = (cloneContext.IsPrototype() ? Guid.NewGuid() : origin.Id);

            this.Stage      = origin.Stage;
            this._status    = origin._status;
            this.StartTime  = origin.StartTime;
            this.FinishTime = origin.FinishTime;

            if (!cloneContext.IsAnyPeristence())
            {
                this.Progress = origin.Progress;
            }

            this.ChildProcesses = new List <BizProcess>();
            if (!cloneContext.IsShortPeristence())
            {
                lock (origin.ChildProcesses)
                {
                    foreach (BizProcess childProcess in origin.ChildProcesses)
                    {
                        this.AddChild(childProcess.Clone(cloneContext));
                    }
                }
            }

            if (!cloneContext.IsAnyPeristence() || origin.ParentProcess == null)
            {
                this._contextData = origin._contextData;
            }

            this.Parameters = new Dictionary <string, object>();
            this.CloneParameters(origin, cloneContext);

            if (!cloneContext.IsStatus())
            {
                this.Result = origin.Result.Clone(cloneContext);
            }
            this.PopulateExceptions = origin.PopulateExceptions;
            this.TrackMode          = origin.TrackMode;
            this.Node = origin.Node;
        }
示例#3
0
 /// <summary>
 /// Клонирует поддерево процессов, начиная с текущего
 /// </summary>
 /// <param name="cloneContext">Контекст клонирования</param>
 /// <returns>Копия процесса</returns>
 public virtual BizProcess Clone(BpCloneContext cloneContext)
 {
     throw new NotImplementedException();
 }
示例#4
0
 /// <summary>
 /// Клонирует дерево процесса, начиная с корня
 /// </summary>
 /// <param name="cloneContext">Контекст клонирования</param>
 /// <returns>Копия процесса</returns>
 public BizProcess CloneWithParents(BpCloneContext cloneContext)
 {
     return(this.GetRoot().Clone(cloneContext).GetById(this.Id));
 }