Exemplo n.º 1
0
        private static void workflowParse()
        {
            AntlrInputStream w3inputstream;

            BaseRuleEngineDL efw = new BaseRuleEngineDL(ConfigurationManager.AppSettings[""], new TimeSpan(0, 1, 0, 0));

            var rulesChunk = DB.GetWorkFlowRules(100);

            foreach (var flowRulesPoco in rulesChunk)
            {
                w3inputstream = new AntlrInputStream(flowRulesPoco.RuleXPath);
                var w3Lexer  = new XPath1W3Lexer(w3inputstream);
                var w3Tokens = new CommonTokenStream(w3Lexer);
                var w3Parser = new XPath1W3Parser(w3Tokens)
                {
                    BuildParseTree = true
                };
                var w3Tree = w3Parser.start();

                //w3tree.ToStringTree(w3parser);
                XPath1W3Visitor w3Visitor = new XPath1W3Visitor();

                flowRulesPoco.ConvertedCode = w3Visitor.Visit(w3Tree);

                //efw.InsertOrUpdateRule(flowRulesPoco.Map());
            }
        }
Exemplo n.º 2
0
        private static void Test()
        {
            //string inputXPATH = "/clp/pat[(@fname='LENA' and @lname='BRUCE') or (@fname='ROSA' and @lname='DANIELS')]";
            //string outputExpected = "clp.pat.Where(c17=>(c17.fname==\"LENA\" && c17.lname==\"BRUCE\") || (c17.fname==\"ROSA\" && c17.lname==\"DANIELS\"))";

            string inputXPATH     = "/payer/@type[.='CH']";
            string outputExpected = "payer.type==\"CH\"";

            #region xpath1w3

            AntlrInputStream w3inputstream = new AntlrInputStream(inputXPATH);
            var w3lexer  = new XPath1W3Lexer(w3inputstream);
            var w3tokens = new CommonTokenStream(w3lexer);
            var w3parser = new XPath1W3Parser(w3tokens);
            w3parser.BuildParseTree = true;
            var w3tree = w3parser.start();

            w3tree.ToStringTree(w3parser);
            //XPath1W3Visitor w3Visitor = new XPath1W3Visitor();
            XPath1W3VisistorLinkedList w3Visitor = new XPath1W3VisistorLinkedList();
            string convertTest = w3Visitor.Visit(w3tree);

            if (convertTest != outputExpected)
            {
                Console.WriteLine("basic conversion failure");
            }

            #endregion
        }
Exemplo n.º 3
0
        private static void validationParse()
        {
            AntlrInputStream w3inputstream;

            var rulesChunk = DB.GetRuleValiations(100);

            foreach (var ruleValsPoco in rulesChunk)
            {
                w3inputstream = new AntlrInputStream(ruleValsPoco.xpath);
                var w3Lexer  = new XPath1W3Lexer(w3inputstream);
                var w3Tokens = new CommonTokenStream(w3Lexer);
                var w3Parser = new XPath1W3Parser(w3Tokens)
                {
                    BuildParseTree = true
                };
                var w3Tree = w3Parser.start();

                //w3tree.ToStringTree(w3parser);
                XPath1W3Visitor w3Visitor = new XPath1W3Visitor();

                ruleValsPoco.ConvertedCode = w3Visitor.Visit(w3Tree);

                w3inputstream = new AntlrFileStream(ruleValsPoco.xpathCondAlt);
                w3Lexer       = new XPath1W3Lexer(w3inputstream);
                w3Tokens      = new CommonTokenStream(w3Lexer);
                w3Parser      = new XPath1W3Parser(w3Tokens)
                {
                    BuildParseTree = true
                };
                w3Tree = w3Parser.start();

                //w3tree.ToStringTree(w3parser);
                w3Visitor = new XPath1W3Visitor();

                ruleValsPoco.ConvertedCondCode = w3Visitor.Visit(w3Tree);
            }
        }