Пример #1
0
        public void TestRecordSetCollectionCreationEnsure1Set()
        {
            IList <IDev2Definition> defs   = DataListFactory.CreateOutputParser().Parse(TestStrings.sampleActivityMappingRecordSets);
            IRecordSetCollection    recCol = DataListFactory.CreateRecordSetCollection(defs, true);

            Assert.IsTrue((recCol.RecordSetNames.Count == 1));
        }
Пример #2
0
 public void CreateRecordSetsInputs(IExecutionEnvironment outerEnvironment, IRecordSetCollection inputRecSets, IList <IDev2Definition> inputs, IExecutionEnvironment env, int update)
 {
     foreach (var recordSetDefinition in inputRecSets.RecordSets)
     {
         CreateRecordSetsInputs(outerEnvironment, recordSetDefinition, inputs, env, update);
     }
 }
Пример #3
0
        public static IRecordSetCollection CreateListInputRecordSetMapping(string xmlServiceDefintion)
        {
            IList <IDev2Definition> inputDef    = DataListFactory.CreateInputParser().ParseAndAllowBlanks(xmlServiceDefintion);
            IRecordSetCollection    inputRecSet = DataListFactory.CreateRecordSetCollection(inputDef, false);

            return(inputRecSet);
        }
Пример #4
0
        public static IRecordSetCollection CreateListOutputRecordSetMapping(string xmlServiceDefintion)
        {
            IList <IDev2Definition> outputDef    = DataListFactory.CreateOutputParser().Parse(xmlServiceDefintion);
            IRecordSetCollection    outputRecSet = DataListFactory.CreateRecordSetCollection(outputDef, true);

            return(outputRecSet);
        }
Пример #5
0
        public void TestScalarRecordSetMixedParsing()
        {
            IList <IDev2Definition> defs       = DataListFactory.CreateOutputParser().Parse(TestStrings.sampleActivityMappingMixed);
            IRecordSetCollection    recCol     = DataListFactory.CreateRecordSetCollection(defs, true);
            IList <IDev2Definition> scalarList = DataListFactory.CreateScalarList(defs, true);


            Assert.IsTrue(scalarList.Count == 1 && recCol.RecordSetNames.Count == 1);
        }
Пример #6
0
        static IRecordSetCollection RecordSetCollection(IList <IDev2Definition> parsedOutput, bool isOutput, bool isDbService)
        {
            RecordSetCollectionBuilder b = new RecordSetCollectionBuilder();

            b.SetParsedOutput(parsedOutput);
            b.IsOutput    = isOutput;
            b.IsDbService = isDbService;
            IRecordSetCollection result = b.Generate();

            return(result);
        }
Пример #7
0
        public void TestOutputParsingRecordSet()
        {
            IList <IDev2Definition> defs   = DataListFactory.CreateOutputParser().Parse(TestStrings.sampleActivityMappingRecordSets);
            IRecordSetCollection    recCol = DataListFactory.CreateRecordSetCollectionForDbService(defs, true);

            IDev2Definition d = defs[0];

            Assert.IsTrue(d.IsRecordSet);
            Assert.AreEqual("ppl", recCol.RecordSetNames[0]);
            Assert.AreEqual("ppl().firstName", recCol.RecordSets[0].Columns[0].Value);
        }
Пример #8
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);
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Shapes the definitions to data list.
        /// </summary>
        /// <returns></returns>
        public static IExecutionEnvironment InputsToEnvironment(IExecutionEnvironment outerEnvironment, string inputDefs, int update)
        {
            var env = new ExecutionEnvironment();

            try
            {
                var inputs = DataListFactory.CreateInputParser().Parse(inputDefs);
                IRecordSetCollection    inputRecSets    = DataListFactory.CreateRecordSetCollection(inputs, false);
                IList <IDev2Definition> inputScalarList = DataListFactory.CreateScalarList(inputs, false);
                IList <IDev2Definition> inputObjectList = DataListFactory.CreateObjectList(inputs);
                Common.CreateRecordSetsInputs(outerEnvironment, inputRecSets, inputs, env, update);
                Common.CreateScalarInputs(outerEnvironment, inputScalarList, env, update);
                Common.CreateObjectInputs(outerEnvironment, inputObjectList, env, update);
            }
            finally
            {
                env.CommitAssign();
            }
            return(env);
        }
 private static void EvalAssignRecordSets(IExecutionEnvironment innerEnvironment, IExecutionEnvironment environment, int update, IRecordSetCollection outputRecSets, IList <IDev2Definition> outputs)
 {
     foreach (var recordSetDefinition in outputRecSets.RecordSets)
     {
         var outPutRecSet = outputs.FirstOrDefault(definition => definition.IsRecordSet && definition.RecordSetName == recordSetDefinition.SetName);
         if (outPutRecSet != null)
         {
             foreach (var outputColumnDefinitions in recordSetDefinition.Columns)
             {
                 var correctRecSet      = "[[" + outputColumnDefinitions.RecordSetName + "(*)." + outputColumnDefinitions.Name + "]]";
                 var warewolfEvalResult = innerEnvironment.Eval(correctRecSet, 0);
                 if (warewolfEvalResult.IsWarewolfAtomListresult)
                 {
                     var recsetResult = warewolfEvalResult as CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult;
                     if (outPutRecSet.IsRecordSet)
                     {
                         var enRecordsetIndexType = DataListUtil.GetRecordsetIndexType(outputColumnDefinitions.RawValue);
                         if (enRecordsetIndexType == enRecordsetIndexType.Star)
                         {
                             if (recsetResult != null)
                             {
                                 environment.EvalAssignFromNestedStar(outputColumnDefinitions.RawValue, recsetResult, update);
                             }
                         }
                         if (enRecordsetIndexType == enRecordsetIndexType.Blank)
                         {
                             if (recsetResult != null)
                             {
                                 environment.EvalAssignFromNestedLast(outputColumnDefinitions.RawValue, recsetResult, 0);
                             }
                         }
                         if (enRecordsetIndexType == enRecordsetIndexType.Numeric)
                         {
                             if (recsetResult != null)
                             {
                                 environment.EvalAssignFromNestedNumeric(outputColumnDefinitions.RawValue, recsetResult, 0);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 static void TryEvalAssignRecordSets(IExecutionEnvironment innerEnvironment, IExecutionEnvironment environment, int update, IRecordSetCollection outputRecSets, IList <IDev2Definition> outputs)
 {
     foreach (var recordSetDefinition in outputRecSets.RecordSets)
     {
         var outPutRecSet = outputs.FirstOrDefault(definition => definition.IsRecordSet && definition.RecordSetName == recordSetDefinition.SetName);
         if (outPutRecSet != null)
         {
             foreach (var outputColumnDefinitions in recordSetDefinition.Columns)
             {
                 EvalAssignRecordSets(innerEnvironment, environment, update, outPutRecSet, outputColumnDefinitions);
             }
         }
     }
 }