Package com.dtrules.mapping

Examples of com.dtrules.mapping.Mapping


     * We create an instance that has a reference to this
     * session, but is otherwise identical to the reference
     * mapping.
     */
    public synchronized Mapping getMapping(String filename,IRSession session){
        Mapping map = mappings.get(filename);
        if(map != null)return map.clone(session);
        if(map_paths.indexOf(filename)<0){
            throw new RuntimeException("Bad Mapping File: "+filename+" For the rule set: "+name.stringValue());
        }
        map = Mapping.newMapping(rd, session, filename);
        mappings.put(filename, map);
        return map.clone(session);
    }
View Full Code Here


             System.out.println("Error comparing Test Results: "+e);
         }
     }
    
     public void loadData(IRSession session, String path, String dataset)throws Exception {
         Mapping   mapping  = session.getMapping();
        
         datamap = session.getDataMap(mapping,null);
        
         datamap.loadXML(new FileInputStream(path+"/"+dataset));
        
         mapping.loadData(session, datamap);
     }
View Full Code Here

     }
    
     public void loadData(IRSession session, String path, String dataset)throws Exception {
       InputStream input = new FileInputStream(path+"/"+dataset);
       if( harnessVersion() < 2){
           Mapping   mapping  = session.getMapping();
           DataMap datamap = session.getDataMap(mapping,null);
           datamap.loadXML(input);
           mapping.loadData(session, datamap);
          
           this.datamap = datamap;
       }else{
         AutoDataMap autoDataMap = session.getRuleSet().getAutoDataMap(session, mapName());
         autoDataMap.setCurrentGroup("applicationDataload");
View Full Code Here

     * We create an instance that has a reference to this
     * session, but is otherwise identical to the reference
     * mapping.
     */
    public synchronized Mapping getMapping(String filename,IRSession session){
        Mapping map = mappings.get(filename);
        if(map != null)return map.clone(session);
        if(map_paths.indexOf(filename)<0){
            throw new RuntimeException("Bad Mapping File: "+filename+" For the rule set: "+name.stringValue());
        }
        map = Mapping.newMapping(rd, session, filename);
        mappings.put(filename, map);
        return map.clone(session);
    }
View Full Code Here

     * We create an instance that has a reference to this
     * session, but is otherwise identical to the reference
     * mapping.
     */
    public synchronized Mapping getMapping(String filename,IRSession session){
        Mapping map = mappings.get(filename);
        if(map != null)return map.clone(session);
        if(map_paths.indexOf(filename)<0){
            throw new RuntimeException("Bad Mapping File: "+filename+" For the rule set: "+name.stringValue());
        }
        map = Mapping.newMapping(rd, session, filename);
        mappings.put(filename, map);
        return map.clone(session);
    }
View Full Code Here

       
        RuleSet        rs      = rd.getRuleSet("SampleProject2");
       
        IRSession      session = rs.newSession();
       
        Mapping        mapping = session.getMapping();
       
        mapping.loadData(session, path+"testfiles/"+"TestCase_001.xml");
       
        session.execute(decisionTable);
   
        printReport(session, System.out);
       
View Full Code Here

        IRSession      session = rs.newSession();
       
        // We are going to map the data into the session with the default mapping
        // defined by the RuleSet.  Generally a Rule Set will use only one
        // mapping file.  However, you can build other mapping files.
        Mapping        mapping = session.getMapping();
       
        // We are going to get our Data from an XML source.  The Mapping file
        // and the XML Data source is all we need to populate the Rules
        // Session.
        mapping.loadData(session, path+"testfiles/"+"TestCase_001.xml");
       
        // We will begin Execution at the main Decision Table for our Rule Set.
        // Furthermore, we are going to only execute the Decision Tables once.
        // You may, however, interact with the state of the Rules Engine, load
        // more data, and execute any of the Decision Tables as needed.  This
View Full Code Here

             }
            
             // Map the data from the job into the Rules Engine
             
             // First create a data map.
             Mapping     mapping  = session.getMapping();
           DataMap   datamap  = session.getDataMap(mapping,null);
          
           datamap.opentag(job,"job");
           datamap.readDO(job, "job");
          
             Case c = job.getCase();
             datamap.opentag(c,"case");
             datamap.readDO(c,"case");
               for(Client client : c.getClients()){
                 datamap.opentag(client,"client");
                 datamap.readDO(client,"client");
                   for(Income income : client.getIncomes()){
                    
                       datamap.readDO(income,"income");
                      
                   }
                 datamap.closetag();
               }
               for(Relationship r : c.getRelationships()){
                 datamap.opentag("relationship");
                   datamap.printdata("type", r.getType());
                   datamap.readDO(r.getSource(), "source");
                   datamap.readDO(r.getTarget(), "target");
                 datamap.closetag();
               }
             datamap.closetag();
            
           datamap.closetag();
          
             int    id  = job.getId();
            
             if(app.save >0 && id % app.save == 0){
               String cnt = ""+id;
                 for(;id<100000;id*=10)cnt = "0"+cnt;
                 try {
                   datamap.print(new FileOutputStream(app.getOutputDirectory()+"job_"+cnt+".xml"));
                 } catch (Exception e) {
                   System.out.println("Couldn't write to '"+app.getOutputDirectory()+"job_"+cnt+".xml'");
                 }
             }
            
           mapping.loadData(session, datamap);
          
           // Once the data is loaded, execute the rules.
             session.execute(app.getDecisionTableName());
        
             if(app.trace && (job.getId()%app.save == 0)){
View Full Code Here

             IRSession      session    = app.rs.newSession();
                         
             // Map the data from the job into the Rules Engine
             
             // First create a data map.
             Mapping     mapping  = session.getMapping();
           DataMap   datamap  = session.getDataMap(mapping,"BookPreview");
          
           request.write2DataMap(datamap);
          
             int    id  = request.getId();
            
             if(app.save >0 && id % app.save == 0){
               String cnt = ""+id;
                 for(;id<100000;id*=10)cnt = "0"+cnt;
                 try {
                   datamap.print(new FileOutputStream(app.getOutputDirectory()+"BP_request_"+cnt+".xml"));
                 } catch (Exception e) {
                   System.out.println("Couldn't write to '"+app.getOutputDirectory()+"BP_request_"+cnt+".xml'");
                 }
             }
            
           mapping.loadData(session, datamap);
          
           // Once the data is loaded, execute the rules.
             session.execute(app.getDecisionTableName());            
            
             printReport(threadnum, app, session);
View Full Code Here

     }
    
     public void loadData(IRSession session, String path, String dataset)throws Exception {
       InputStream input = new FileInputStream(path+"/"+dataset);
       if( harnessVersion() < 2){
           Mapping   mapping  = session.getMapping();
           DataMap datamap = session.getDataMap(mapping,null);
           datamap.loadXML(input);
           mapping.loadData(session, datamap);
          
           this.datamap = datamap;
       }else{
         AutoDataMap autoDataMap = session.getRuleSet().getAutoDataMap(session, mapName());
         autoDataMap.setCurrentGroup("applicationDataload");
View Full Code Here

TOP

Related Classes of com.dtrules.mapping.Mapping

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.