Package com.dtrules.session

Examples of com.dtrules.session.RuleSet


     * @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

    }
   
    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);
           
            r2e.writeExcel(admin, rs, tables, fields, ascending, limit);
View Full Code Here

   
    PrintStream rpt=null; // Report file where summaries are written.
   
    public void runTests(){
       
        RuleSet        rs = null;
       
        try {
            
             // Allocate a RulesDirectory.  This object can contain many different Rule Sets.
             // A Rule set is a set of decision tables defined in XML,
View Full Code Here

   
    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

        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

            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

     *                    assumed that this Entity already exists.
     * @return true if the attribute was successfully added.
   */
  public boolean createAttribute(final String rulesetname, final REntityEntry attribute) {
        try {
            RuleSet  rs     = getRuleset(rulesetname);
            IREntity entity = rs.getEntityFactory(session).findRefEntity(attribute.attribute);
            entity.addAttribute(attribute);
            return true;
        } catch (RulesException e) {
            return false;
        }
View Full Code Here

     * @param entityname    The entity name of intrest.
     * @return              The list of Entity Entries that define the attributes of the Entity
     */
    public List<REntityEntry> getEntityEntries(String rulesetname, String entityname){
        ArrayList<REntityEntry> entries = new ArrayList<REntityEntry>();
        RuleSet                 rs      = getRuleset(rulesetname);
        IREntity entity;
        try {
            entity = rs.getEntityFactory(session).findRefEntity(RName.getRName(entityname));
            Iterator<RName>         attribs = entity.getAttributeIterator();
           
            while(attribs.hasNext()){
                entries.add(entity.getEntry(attribs.next()));
            }
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.