Package com.dtrules.session

Examples of com.dtrules.session.RuleSet


             // Select a particular rule set and create a session to load the data and evaluate
             // that data against the rules within this ruleset. 
          
             String         ruleset  = getRuleSetName();
             RName          rsName   = RName.getRName(ruleset);
             RuleSet        rs       = rd.getRuleSet(rsName);
             File           dir      = new File(getTestDirectory());
             File           files[]  = dir.listFiles();
             int            dfcnt    = 1;
            
             Date start = new Date();
View Full Code Here


            file = args[0];
        }
       
        try {
            RulesDirectory rd       = new RulesDirectory(path,file);
            RuleSet        rs       = rd.getRuleSet(RName.getRName("ebdemo"));
            IRSession      session  = rs.newSession();
            DTState        state    = session.getState();
            DecisionTableTypeTest test;
           
            test = new DecisionTableTypeTest(session,rs);
            test.dt.setType(RDecisionTable.Type.FIRST);
View Full Code Here

       
        String          file    = "c:\\eclipse\\workspace\\DTRules\\com.dtrules.testfiles\\DTRules.xml";
        IRSession       session;
        DTState         state;
        RulesDirectory  rd;
        RuleSet         rs;
       
        try {
            rd      = new RulesDirectory("",file);
            rs      = rd.getRuleSet(RName.getRName("test",true));
            session = rs.newSession();
            state   = session.getState();
        } catch (RulesException e1) {
            System.out.println("Failed to initialize the Rules Engine");
            return;
        }
View Full Code Here

    }
   
    public void writeDecisionTables(String tables, String fields[], boolean ascending, int limit){
        try {
            RulesDirectory    rd    = new RulesDirectory(getPath(),getRulesDirectoryFile());
            RuleSet           rs    = rd.getRuleSet(getRuleSetName());
            IRSession         s     = rs.newSession();
            RulesAdminService admin = new RulesAdminService(s);
           
            Rules2Excel r2e = new Rules2Excel();
           
            r2e.writeExcel(admin, rs, tables, fields, ascending, limit);
View Full Code Here

             // Select a particular rule set and create a session to load the data and evaluate
             // that data against the rules within this ruleset. 
          
             String         ruleset  = getRuleSetName();
             RName          rsName   = RName.getRName(ruleset);
             RuleSet        rs       = rd.getRuleSet(rsName);
            File           dir      = new File(getTestDirectory());
             File           files[]  = getFiles();
             int            dfcnt    = 1;
            
             if(rs == null){
View Full Code Here

            OutputStream   outDTStream  = new FileOutputStream(ruleSet.getFilepath()+"/"+ruleSet.getDT_XMLName());
           
            dtcompiler.compile(inDTStream, outDTStream);
                       
            RulesDirectory  rd  = new RulesDirectory(path, rulesDirectoryXML);
            RuleSet         rs  = rd.getRuleSet(RName.getRName(ruleset));
            EntityFactory   ef  = rs.newSession().getEntityFactory();
            IREntity        dt  = ef.getDecisiontables();
            Iterator<RName> idt = ef.getDecisionTableRNameIterator();
           
            while(idt.hasNext()){
                RDecisionTable t = (RDecisionTable) dt.get(idt.next());
                t.build(session.getState());
                List<IDecisionTableError> errs = t.compile();
                for (IDecisionTableError error : errs){
                    dtcompiler.logError(
                            t.getName().stringValue(),
                            t.getFilename(),
                            "validity check",
                            error.getMessage(),
                            0,
                            "In the "+error.getErrorType().name()+" row "+error.getIndex()+"\r\n"+error.getSource());
                }
                Coordinate err_RowCol = t.validate();
                if(!t.isCompiled()  || err_RowCol!=null){
                    int column = 0;
                    int row    = 0;
                    if(err_RowCol!=null){
                        row    = err_RowCol.getRow();
                        column = err_RowCol.getCol();
                    }
                    dtcompiler.logError(
                            t.getName().stringValue(),
                            t.getFilename(),
                            "validity check",
                            "Decision Table did not compile",
                            0,
                            "A problem may have been found on row "+row+" and column "+column);
                }
            }
           
            dtcompiler.printErrors(err, NumErrorsToReport);
            err.println("Total Errors Found: "+dtcompiler.getErrors().size());
            if(dtcompiler.getErrors().size() == 0){
                rd  = new RulesDirectory(path, rulesDirectoryXML);
                rs  = rd.getRuleSet(RName.getRName(ruleset));
                PrintStream btables = new PrintStream(rs.getWorkingdirectory()+"balanced.txt");
                rs.newSession().printBalancedTables(btables);
                RulesAdminService admin = new RulesAdminService(rs.newSession(),rd);
                List tables = admin.getDecisionTables(rs.getName());
                for(Object table : tables){
                   RDecisionTable dtable = admin.getDecisionTable(rs.getName(),(String)table);
                   dtable.check(System.out);
                }
            }
        } catch (Exception e) {
            err.print(e);
View Full Code Here

     * @param filename  File name for the mapping file generated
     * @throws Exception
     */
    @Deprecated
    public void generateMap(String mapping, String filename) throws Exception {
        RuleSet        rs   = getRuleSet();
        IMapGenerator   mgen = new MapGenerator();          
        mgen.generateMapping(
                mapping,
                rs.getFilepath()+rs.getEDD_XMLName(),
                rs.getWorkingdirectory()+"map.xml");
    }
View Full Code Here

     * @param filename  File name for the mapping file generated
     * @throws Exception
     */
    public void generateMap(int version, String mapping, String filename) throws Exception {
        filename = filename.trim();
        RuleSet        rs   = getRuleSet();
        IMapGenerator   mgen;
        if(version == 1){
            mgen = new MapGenerator();
        }else{
            mgen = new MapGenerator2();
        }
        if(!filename.toLowerCase().endsWith(".xml")){
            filename += ".xml";
        }
        mgen.generateMapping(
                mapping,
                rs.getFilepath()+rs.getEDD_XMLName(),
                rs.getWorkingdirectory()+filename);
    }
View Full Code Here

    TraceNode t = trace.find(250);
   
    RulesDirectory rd = new RulesDirectory(
        System.getProperty("user.dir")+"/../sampleprojects/CHIP/", "DTRules.xml");
   
    RuleSet rs = rd.getRuleSet("CHIP");
   
    IRSession s = trace.setState(rs, t);
 
    List<IREntity> entities = trace.instancesOf("client");
   
View Full Code Here

   
    public static void main(String arg[]) throws Exception {
        String         path     = "C:\\eb\\eb_dev2\\rulesDevelopment\\eb-newyork\\";
        RulesDirectory rd       = new RulesDirectory(path,"DTRules.xml");
        RName          rsName   = RName.getRName("enrollment");
        RuleSet        rs       = rd.getRuleSet(rsName);
       
        try {
            Coverage c = new Coverage(rs,path+"ny-enrollment\\testfiles\\output\\");
            c.compute();
            c.printReport(System.out);
View Full Code Here

TOP

Related Classes of com.dtrules.session.RuleSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.