Package com.dtrules.session

Examples of com.dtrules.session.RulesDirectory


            InputStream    inDTStream   = new FileInputStream(ruleSet.getFilepath()+"/"+UDTFilename);
            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<ICompilerError> errs = t.compile();
                for (ICompilerError 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){
View Full Code Here


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

    /**
     * We reset the Rules Directory after we have modified the XML used to
     * define the Rules Directory.
     */
    public void reset (){
        RulesDirectory rd = new RulesDirectory(path,rulesDirectoryXML);
        this.ruleSet = rd.getRuleSet(ruleset);
    }
View Full Code Here

            InputStream    inDTStream   = new FileInputStream(ruleSet.getFilepath()+"/"+UDTFilename);
            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);
                }
            }
           
            if(verbose) {
                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);

                if(verbose) {
                    RulesAdminService admin = new RulesAdminService(rs.newSession(),rd);
View Full Code Here

    return returnfiles;
    }
   
    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(false);
           
View Full Code Here

            
             // Allocate a RulesDirectory.  This object can contain many different Rule Sets.
             // A Rule set is a set of decision tables defined in XML,
             // the Entity Description Dictionary (the EDD, or schema) assumed by those tables, and
             // A Mapping file that maps data into this EDD.
             RulesDirectory rd       = new RulesDirectory(getPath(),getRulesDirectoryFile());
            
             // 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);
                            rs       = rd.getRuleSet(rsName);
            File           dir      = new File(getTestDirectory(rs));
             File           files[]  = getFiles(rs);
             int            dfcnt    = 1;
        
             rpt = new PrintStream(getReportFileName(rs));           
View Full Code Here

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

        trace.load(tracefile);
        trace.print();

        TraceNode t = trace.find(428);

        RulesDirectory rd = new RulesDirectory(
                System.getProperty("user.dir") + "/../sampleprojects/CHIP/",
                "DTRules.xml");

        RuleSet   rs = rd.getRuleSet("CHIP");
        IRSession s  = trace.setState(rs, t);
       
        if (s == null) {
            System.out.println("Could not build a session.");
            return;
View Full Code Here

 
  void generate(String name, int numCases) throws Exception {

    String          path    = System.getProperty("user.dir")+"/";
    String          config  = "DTRules_eBooks.xml";
        RulesDirectory  rd      = new RulesDirectory(path, config);
                        rs      = rd.getRuleSet(testObj.getRuleSetName());
        IRSession       session = rs.newSession();

        try{
            ostream.println("Clearing away old tests");
            // Delete old output files
View Full Code Here

    if(pathtoDTrules != null){
      file = pathtoDTrules;
    }
   
    try {
      rulesDirectory = new RulesDirectory("",file);
     
    } catch (Exception e) {
      e.printStackTrace();
    }   
   
View Full Code Here

TOP

Related Classes of com.dtrules.session.RulesDirectory

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.