示例#1
0
 public EntityProcess(Process process, Entity entity)
     : base(process)
 {
     _process = process;
     _logger  = process.Logger;
     _entity  = entity;
     _collectors[STANDARD_OUTPUT] = new CollectorOperation();
     PipelineExecuter             = entity.PipelineThreading == PipelineThreading.SingleThreaded ? (AbstractPipelineExecuter) new SingleThreadedPipelineExecuter() : new ThreadPoolPipelineExecuter();
 }
示例#2
0
 public MasterJoinProcess(Process process, ref CollectorOperation collector)
     : base(process)
 {
     _process   = process;
     _collector = collector;
 }
示例#3
0
        public IEnumerable <Row> Run(Process process)
        {
            var result = Enumerable.Empty <Row>();

            if (!process.IsReady())
            {
                return(result);
            }

            var timer = new Stopwatch();

            timer.Start();

            process.Setup();
            process.IsFirstRun = process.MasterEntity == null || !process.OutputConnection.RecordsExist(process.MasterEntity);
            process.PerformActions(a => a.Before);

            if (!process.IsFirstRun)
            {
                ProcessDeletes(process);
            }

            ProcessEntities(process);

            if (process.StarEnabled && !process.OutputConnection.Is.Internal())
            {
                ProcessMaster(process);
            }

            if (process.OutputConnection.Is.Internal())
            {
                if (process.Relationships.Any())
                {
                    var collector = new CollectorOperation();
                    new MasterJoinProcess(process, ref collector).Execute();
                    process.Results = collector.Rows;
                }
                else
                {
                    process.Results = process.MasterEntity == null?Enumerable.Empty <Row>() : process.MasterEntity.Rows;
                }
            }
            else
            {
                process.Results = Enumerable.Empty <Row>();
            }

            if (process.OutputConnection.Is.Internal())
            {
                ProcessTransforms(process, new RowsOperation(process.Results));
            }
            else
            {
                ProcessTransforms(process, new ParametersExtract(process));
            }

            new TemplateManager(process).Manage();

            process.PerformActions(a => a.After);

            timer.Stop();
            process.Logger.Info("Process affected {0} records in {1}.", process.Anything, timer.Elapsed);

            process.Complete = true;
            return(process.Results);
        }