Ejemplo n.º 1
0
        public static string GenerateRemark(this SmartETLTool tool, bool addnew, IProcessManager manager)
        {
            var list = new List <string>();

            if (addnew)
            {
                list.Add(GlobalHelper.FormatArgs("doc_task_new", tool.TypeName, tool.Name));
            }
            if (string.IsNullOrWhiteSpace(tool.Remark) == false)
            {
                list.Add(GlobalHelper.RandomFormatArgs("reason_desc", tool.Remark));
            }
            list.Add(GenerateItemRemark(tool, new List <string>()
            {
                "Name"
            }));
            int index = 1;

            list.Add("\n");
            foreach (var item in tool.CurrentETLTools)
            {
                list.Add(String.Format("{0}. {1}", index, GenerateRemark(item, true, manager)));
                index++;
            }
            return("\n".Join(list));
        }
Ejemplo n.º 2
0
        public static string GenerateRemarkPlus(this SmartETLTool tool, bool addnew, IProcessManager manager)
        {
            var refs = tool.GetReference(manager).ToList();

            refs.Add(tool);
            return(manager.GenerateRemark(refs));
        }
Ejemplo n.º 3
0
        public virtual bool Init(IEnumerable <IFreeDocument> datas)
        {
            mainstream =
                processManager.CurrentProcessCollections.OfType <SmartETLTool>()
                .FirstOrDefault(d => d.CurrentETLTools.Contains(this));
            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;
            if (etl != null)
            {
                return(true);
            }

            var task = processManager.CurrentProject.Tasks.FirstOrDefault(d => d.Name == ETLSelector);

            if (task == null)
            {
                return(false);
            }

            ControlExtended.UIInvoke(() => { task.Load(false); });

            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;
            etl.InitProcess(true);
            return(etl != null);
        }
Ejemplo n.º 4
0
        public virtual bool Init(IEnumerable <IFreeDocument> datas)
        {
            if (string.IsNullOrEmpty(ETLSelector))
            {
                return(false);
            }
            mainstream =
                processManager.CurrentProcessCollections.OfType <SmartETLTool>()
                .FirstOrDefault(d => d.CurrentETLTools.Contains(this));
            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;
            if (etl != null)
            {
                return(true);
            }

            var task = processManager.CurrentProject.Tasks.FirstOrDefault(d => d.Name == ETLSelector);

            if (task == null)

            {
                throw new NullReferenceException($"can't find a ETL Module named {ETLSelector}");
            }

            ControlExtended.UIInvoke(() => { task.Load(false); });

            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;


            etl.InitProcess(true);
            return(etl != null);
        }
Ejemplo n.º 5
0
 public override bool Init(IEnumerable <IFreeDocument> datas)
 {
     if (string.IsNullOrEmpty(ETLSelector.SelectItem))
     {
         return(false);
     }
     etl = this.GetTask <SmartETLTool>(ETLSelector.SelectItem);
     etl?.InitProcess(true);
     return(etl != null);
 }
Ejemplo n.º 6
0
        public SubTaskModel(SmartETLTool mother, SmartETLTool subTask, ETLBase etlmodule, string[] mother_keys = null, string[] sub_keys = null)
        {
            MappingPairs =
                new ObservableCollection <MappingPair>();
            Mother  = mother;
            SubTask = subTask;
            var start = 0;
            var end   = 0;

            ETLBase.GetRange(etlmodule.ETLRange, subTask.AllETLMount, out start, out end);
            if (mother_keys != null)
            {
                motherkeys.AddRange(mother_keys);
            }
            if (sub_keys != null)
            {
                subkeys.AddRange(sub_keys);
            }
            RangeStart = start;
            RangeEnd   = end;
            ETLModule  = etlmodule;
            if (!string.IsNullOrEmpty(etlmodule.MappingSet))
            {
                foreach (var item in etlmodule.MappingSet.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var    kv    = item.Split(':');
                    string key   = "";
                    string value = "";
                    if (kv.Length == 1)
                    {
                        key = value = kv[1];
                    }
                    if (kv.Length > 1)
                    {
                        key   = kv[0];
                        value = kv[1];
                    }
                    var pair = new MappingPair(motherkeys, subkeys);
                    pair.Source._SelectItem = key;
                    pair.Target._SelectItem = value;
                    MappingPairs.Add(pair);
                }
            }
            // Refresh();
        }
Ejemplo n.º 7
0
        public virtual bool Init(IEnumerable <IFreeDocument> datas)
        {
            if (string.IsNullOrEmpty(ETLSelector))
            {
                return(false);
            }
            mainstream =
                processManager.CurrentProcessCollections.OfType <SmartETLTool>()
                .FirstOrDefault(d => d.CurrentETLTools.Contains(this));
            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;
            if (mainstream != null && mainstream.Name == this.Name)
            {
                throw new Exception("子流程不能调用自身,否则会引起循环调用");
            }
            if (etl != null)
            {
                return(true);
            }

            var task = processManager.CurrentProject.Tasks.FirstOrDefault(d => d.Name == ETLSelector);

            if (task == null)
            {
                return(false);
            }

            ControlExtended.UIInvoke(() => { task.Load(false); });

            etl =
                processManager.CurrentProcessCollections.FirstOrDefault(d => d.Name == ETLSelector) as SmartETLTool;


            etl.InitProcess(true);
            return(etl != null);
        }
Ejemplo n.º 8
0
 /// <summary>
 ///     find all references
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="manager"></param>
 /// <returns></returns>
 public static IEnumerable <AbstractProcessMethod> GetReference(this SmartETLTool etl, IProcessManager manager)
 {
     return(etl.CurrentETLTools.SelectMany(d => d.GetReference(manager)).Distinct());
 }