Ejemplo n.º 1
0
        void GenerateDefsFromXmlNodeListForDebug(enDev2ColumnArgumentDirection dev2ColumnArgumentDirection, IList <IDev2Definition> result, XmlNodeList nl, int i)
        {
            var tmpNode = nl[i];

            var ioDirection = DataListUtil.GetDev2ColumnArgumentDirection(tmpNode);
            var isObject    = IsObject(tmpNode);
            var isArray     = IsArray(tmpNode);

            if (DataListUtil.CheckIODirection(dev2ColumnArgumentDirection, ioDirection, false) && tmpNode.HasChildNodes && !isObject)
            {
                result.Add(DataListFactory.CreateDefinition("", "", "", tmpNode.Name, false, "", false, "", false));
            }
            else if (tmpNode.HasChildNodes && !isObject)
            {
                var recordsetName = tmpNode.Name;
                var childNl       = tmpNode.ChildNodes;
                for (int q = 0; q < childNl.Count; q++)
                {
                    var xmlNode          = childNl[q];
                    var fieldIoDirection = DataListUtil.GetDev2ColumnArgumentDirection(xmlNode);
                    if (DataListUtil.CheckIODirection(dev2ColumnArgumentDirection, fieldIoDirection, false))
                    {
                        result.Add(DataListFactory.CreateDefinition(xmlNode.Name, "", "", recordsetName, false, "",
                                                                    false, "", false));
                    }
                }
            }
            else
            {
                if (DataListUtil.CheckIODirection(dev2ColumnArgumentDirection, ioDirection, false))
                {
                    var dev2Definition = isObject ? DataListFactory.CreateDefinition("@" + tmpNode.Name, "", "", false, "", false, "", false, isArray) : DataListFactory.CreateDefinition(tmpNode.Name, "", "", false, "", false, "");
                    result.Add(dev2Definition);
                }
            }
        }
Ejemplo n.º 2
0
        void CreateRecordSetsInputs(IExecutionEnvironment outerEnvironment, IRecordSetDefinition recordSetDefinition, IList <IDev2Definition> inputs, IExecutionEnvironment env, int update)
        {
            var outPutRecSet = inputs.FirstOrDefault(definition => definition.IsRecordSet && DataListUtil.ExtractRecordsetNameFromValue(definition.MapsTo) == recordSetDefinition.SetName);

            if (outPutRecSet != null)
            {
                CreateRecordSetsInputs(outerEnvironment, recordSetDefinition, env, update);
            }
        }
Ejemplo n.º 3
0
        public bool IsValueScalar(string value)
        {
            var result = false;

            if (!string.IsNullOrEmpty(value) && value.StartsWith(DataListUtil.OpeningSquareBrackets) && value.EndsWith(DataListUtil.ClosingSquareBrackets) && !DataListUtil.IsValueRecordset(value) && !value.Contains("."))
            {
                result = true;
            }


            return(result);
        }
Ejemplo n.º 4
0
        public bool ProcessFieldsForRecordSet(IParseTO payload, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, out string search, out bool emptyOk, string display, IDev2DataLanguageIntellisensePart recordsetPart, string partName)
        {
            emptyOk = false;
            search  = "";
            if (parts[0].IndexOf(DataListUtil.RecordsetIndexClosingBracket, StringComparison.Ordinal) <= 0)
            {
                // its an error ;)
                IDataListVerifyPart part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], "." + parts[1], true);
                result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] is a malformed recordset", enIntellisenseErrorCode.InvalidRecordsetNotation, !payload.HangingOpen));
            }
            else
            {
                search = parts[1].ToLower();
                var intellisenseResult = ValidateName(search, "Recordset field");
                if (intellisenseResult != null)
                {
                    result.Add(intellisenseResult);
                    return(true);
                }
                foreach (IDev2DataLanguageIntellisensePart t in recordsetPart.Children)
                {
                    string match = t.Name.ToLower();
                    if (match.Contains(search) && ((match != search) || (match == search && addCompleteParts)))
                    {
                        string index = payload.Child != null ? payload.Child.Payload : DataListUtil.ExtractIndexRegionFromRecordset(parts[0]);

                        IDataListVerifyPart part = IntellisenseFactory.CreateDataListValidationRecordsetPart(partName, t.Name, t.Description, index);
                        result.Add(IntellisenseFactory.CreateSelectableResult(parts[0].Length, payload.EndIndex, part, part.Description));
                    }
                    else if (match == search)
                    {
                        emptyOk = true;
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        public IList <IDev2Definition> GenerateDefsFromDataList(string dataList, enDev2ColumnArgumentDirection dev2ColumnArgumentDirection)
        {
            IList <IDev2Definition> result = new List <IDev2Definition>();

            if (!string.IsNullOrEmpty(dataList))
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(dataList);

                XmlNodeList tmpRootNl = xDoc.ChildNodes;
                XmlNodeList nl        = tmpRootNl[0].ChildNodes;

                for (int i = 0; i < nl.Count; i++)
                {
                    XmlNode tmpNode = nl[i];

                    var ioDirection = DataListUtil.GetDev2ColumnArgumentDirection(tmpNode);

                    if (DataListUtil.CheckIODirection(dev2ColumnArgumentDirection, ioDirection))
                    {
                        var jsonAttribute = false;
                        var xmlAttribute  = tmpNode.Attributes?["IsJson"];
                        if (xmlAttribute != null)
                        {
                            bool.TryParse(xmlAttribute.Value, out jsonAttribute);
                        }
                        if (tmpNode.HasChildNodes && !jsonAttribute)
                        {
                            // it is a record set, make it as such
                            string recordsetName = tmpNode.Name;
                            // now extract child node defs
                            XmlNodeList childNl = tmpNode.ChildNodes;
                            for (int q = 0; q < childNl.Count; q++)
                            {
                                var xmlNode = childNl[q];
                                if (xmlNode == null)
                                {
                                    continue;
                                }
                                var fieldIoDirection = DataListUtil.GetDev2ColumnArgumentDirection(xmlNode);
                                if (DataListUtil.CheckIODirection(dev2ColumnArgumentDirection, fieldIoDirection))
                                {
                                    result.Add(DataListFactory.CreateDefinition(xmlNode.Name, "", "", recordsetName, false, "",
                                                                                false, "", false));
                                }
                            }
                        }
                        else
                        {
                            // scalar value, make it as such
                            var name           = jsonAttribute ? "@" + tmpNode.Name : tmpNode.Name;
                            var dev2Definition = DataListFactory.CreateDefinition(name, "", "", false, "", false, "");
                            dev2Definition.IsObject = jsonAttribute;
                            result.Add(dev2Definition);
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 6
0
        public void CreateRecordSetsInputs(IExecutionEnvironment outerEnvironment, IRecordSetCollection inputRecSets, IList <IDev2Definition> inputs, IExecutionEnvironment env, int update)
        {
            foreach (var recordSetDefinition in inputRecSets.RecordSets)
            {
                var outPutRecSet = inputs.FirstOrDefault(definition => definition.IsRecordSet && DataListUtil.ExtractRecordsetNameFromValue(definition.MapsTo) == recordSetDefinition.SetName);
                if (outPutRecSet != null)
                {
                    var emptyList = new List <string>();
                    foreach (var dev2ColumnDefinition in recordSetDefinition.Columns)
                    {
                        if (dev2ColumnDefinition.IsRecordSet)
                        {
                            var defn = "[[" + dev2ColumnDefinition.RecordSetName + "()." + dev2ColumnDefinition.Name + "]]";


                            if (string.IsNullOrEmpty(dev2ColumnDefinition.RawValue))
                            {
                                if (!emptyList.Contains(defn))
                                {
                                    emptyList.Add(defn);
                                    continue;
                                }
                            }
                            var warewolfEvalResult = outerEnvironment.Eval(dev2ColumnDefinition.RawValue, update);

                            if (warewolfEvalResult.IsWarewolfAtomListresult)
                            {
                                AtomListInputs(warewolfEvalResult, dev2ColumnDefinition, env);
                            }
                            if (warewolfEvalResult.IsWarewolfAtomResult)
                            {
                                AtomInputs(warewolfEvalResult, dev2ColumnDefinition, env);
                            }
                        }
                    }
                    foreach (var defn in emptyList)
                    {
                        env.AssignDataShape(defn);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void ProcessRecordSetMatch(IParseTO payload, IList <IIntellisenseResult> result, string rawSearch, string search, IDev2DataLanguageIntellisensePart t1)
        {
            // only process if it is an open region
            // we need to add all children
            string idx;

            idx = !payload.IsLeaf && !payload.Child.HangingOpen ? DataListUtil.OpeningSquareBrackets + payload.Child.Payload + DataListUtil.ClosingSquareBrackets : DataListUtil.ExtractIndexRegionFromRecordset(rawSearch);
            // add general closed recordset
            var rsName = search;

            if (idx == string.Empty)
            {
                rsName = payload.Payload;
            }
            var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(rsName, "", t1.Description + " / Select a specific row", idx);

            result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));

            var children = t1.Children;

            if (children != null)
            {
                foreach (IDev2DataLanguageIntellisensePart t in children)
                {
                    part = IntellisenseFactory.CreateDataListValidationRecordsetPart(rsName, t.Name, t.Description + " / Select a specific field at a specific row", idx);
                    result.Add(IntellisenseFactory.CreateSelectableResult(payload.StartIndex, payload.EndIndex, part, part.Description));
                }
            }
        }