Package com.dtrules.session

Examples of com.dtrules.session.EntityFactory


  public RDecisionTable(IRSession session, String name) throws RulesException{
        this.session = session;
        ruleset      = session.getRuleSet();
    dtname       = RName.getRName(name,true);
   
        EntityFactory ef = session.getEntityFactory();
        RDecisionTable dttable =ef.findDecisionTable(RName.getRName(name));
        if(dttable != null){
            new CompilerError(CompilerError.Type.TABLE,"Duplicate Decision Tables Found",0,0);
    }   
  }
View Full Code Here


     * @param rulesetname The Rule Set to be written out to the output stream
     * @throws RulesException
     */
  public void saveDecisionTables(OutputStream out, RSession session, String rulesetname) throws RulesException {
      RuleSet       rs       = rd.getRuleSet(RName.getRName(rulesetname));
        EntityFactory ef       = rs.getEntityFactory(session);
       
        PrintStream  ps  = new PrintStream(out);
        Iterator<RName> tables = ef.getDecisionTableRNameIterator();
        ps.println("<decision_tables>");
        while(tables.hasNext()){
            RName dtname = tables.next();
            ef.getDecisionTable(dtname).writeXML(ps);
        }
        ps.println("\n</decision_tables>");
       
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.dtrules.admin.IRulesAdminService#updateEntity(java.lang.String, com.dtrules.entity.REntity)
   */
  public void saveEDD(RSession session, String rulesetname) throws RulesException {
        RuleSet       rs       = rd.getRuleSet(RName.getRName(rulesetname));
        EntityFactory ef       = rs.getEntityFactory(session);
        String        filepath = rs.getFilepath();
        String        filename = rs.getEDD_XMLName();
       
        OutputStream out;
        try {
            out = new FileOutputStream(filepath+filename);
        } catch (FileNotFoundException e) {
            throw new RulesException(
                    "OutputFileCreationError",
                    "saveDecisionTables",
                    "An error occured openning the file: "+filepath+filename+"\n"+e
                   );
        }
        PrintStream  ps  = new PrintStream(out);
        Iterator<RName> entities = ef.getEntityRNameIterator();
        ps.println("<entity_data_dictionary>");
        while(entities.hasNext()){
            RName ename = entities.next();
            ef.findRefEntity(ename).writeXML(ps);
        }
        ps.println("\n</entity_data_dictionary>");
  }
View Full Code Here

    }
       
    void writeEDD(String excelName){
        try{           
            Sheet s = newEDDSheet();
            EntityFactory ef = session.getEntityFactory();
           
            ArrayList<RName> list    = EntityFactory.sorted(ef.getEntityRNameIterator(),true);
            int rowC = 1;
           
            for(RName entity : list){
                rowC = writeEntity(s, rowC, entity );
                nextRow(s, rowC, 8);
View Full Code Here

     * @throws Exception
     */
    public void convertEDDs(RuleSet rs, String excelName, String outputXMLName) throws Exception {
        File         excel = new File(excelName);
       
        EntityFactory ef = new EntityFactory(rs);
        if(excel.isDirectory()){
            File files[] = excel.listFiles();
            for(File file : files){
                String filename = file.getName().toLowerCase();
                if( !file.isDirectory() && (filename.endsWith(".xls")||filename.endsWith(".xml"))){
                    convertEDD(ef, rs,file.getAbsolutePath());
                }
            }
        }else{
            convertEDD(ef,rs,excelName);
        }
        XMLPrinter   xptr  = new XMLPrinter(new FileOutputStream(outputXMLName));
        xptr.opentag("entity_data_dictionary","version","2","xmlns:xs","http://www.w3.org/2001/XMLSchema");
        ef.writeAttributes(xptr);
        xptr.close();
    }
View Full Code Here

     * @param session The session which gives us the outputstreams for debug statements and trace statements
     * @param rulesetname The Rule Set to be written out to the output stream
     * @throws RulesException
     */
  public void saveDecisionTables(OutputStream out, RSession session, String rulesetname) throws RulesException {
      EntityFactory ef       = session.getEntityFactory();
       
        PrintStream  ps  = new PrintStream(out);
        Iterator<RName> tables = ef.getDecisionTableRNameIterator();
        ps.println("<decision_tables>");
        while(tables.hasNext()){
            RName dtname = tables.next();
            ef.getDecisionTable(dtname).writeXML(ps);
        }
        ps.println("\n</decision_tables>");
       
  }
View Full Code Here

        }
    }

    public void saveEDD(RSession session, String rulesetname) throws RulesException {
        RuleSet       rs       = rulesDirectory.getRuleSet(RName.getRName(rulesetname));
        EntityFactory ef       = session.getEntityFactory();
        String        filepath = rs.getFilepath();
        String        filename = rs.getEDD_XMLName();
       
        OutputStream out;
        try {
            out = new FileOutputStream(filepath+filename);
        } catch (FileNotFoundException e) {
            throw new RulesException(
                    "OutputFileCreationError",
                    "saveDecisionTables",
                    "An error occured openning the file: "+filepath+filename+"\n"+e
                   );
        }
        PrintStream  ps  = new PrintStream(out);
        Iterator<RName> entities = ef.getEntityRNameIterator();
        ps.println("<entity_data_dictionary>");
        while(entities.hasNext()){
            RName ename = entities.next();
            ef.findRefEntity(ename).writeXML(ps);
        }
        ps.println("\n</entity_data_dictionary>");
  }
View Full Code Here

           
            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();
View Full Code Here

  public RDecisionTable(IRSession session, String name) throws RulesException{
        this.session = session;
        ruleset      = session.getRuleSet();
    dtname       = RName.getRName(name,true);
   
        EntityFactory ef = ruleset.getEntityFactory(session);
        RDecisionTable dttable =ef.findDecisionTable(RName.getRName(name));
        if(dttable != null){
            new CompilerError(CompilerError.Type.TABLE,"Duplicate Decision Tables Found",0,0);
    }   
  }
View Full Code Here

           
            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();
View Full Code Here

TOP

Related Classes of com.dtrules.session.EntityFactory

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.