Package net.firstpartners.drools.data

Examples of net.firstpartners.drools.data.RuleSource


    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    logEnvironment();

    //Identify where the rules are stored
    RuleSource ruleSource = new RuleSource();
    //ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setKnowledgeBaseLocation(KNOWLEDGE_BASE_FILE);

    if (user != null) {

      resp.setContentType("application/vnd.ms-excel");
      resp.setHeader("Content-Disposition",
View Full Code Here


    facts[1]=holiday1;
    facts[2]=holiday2;


    //Set these into a new RuleSource object
    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setFacts(facts);
    ruleSource.setGlobals(startDate);

    // A lot of the running rules uses the same code. The RuleRunner (code in this project)
    // keeps this code in one place. It needs to know
    // - the name(s) of the files containing our rules
    // - the fact object(s) containing the information to be passed in and out of our rules
View Full Code Here

  @Test
  public final void testLoadCachedRulesFromUrl() throws IOException, ClassNotFoundException {

    //Set the rule source
    RuleSource ruleSource = new RuleSource();
    ruleSource.setKnowledgeBaseLocation("http://red-piranha.appspot.com/sampleresources/SpreadSheetServlet/log-then-modify-rules.KnowledgeBase");


    //Check that we can read rules from remote location
    KnowledgeBase kb = ruleLoader.loadKnowledgeBase(ruleSource);
View Full Code Here

  @Test
  public final void testSecurityManagerPrefixOnUrlLoad() throws IOException, ClassNotFoundException{

    //check that dodgy domains are caught
    //Set the rule source
    RuleSource ruleSource = new RuleSource();
    ruleSource.setKnowledgeBaseLocation("http://www.bbc.co.uk/not-on-whitelist-should-fail.Knowledgebase");

    //Check that we cannot read rules from remote location
    try{
      KnowledgeBase kb = ruleLoader.loadKnowledgeBase(ruleSource);
      fail("Expected Security Exception not thrown");
View Full Code Here

  @Test
  public final void testSecurityManagerSuffixOnUrlLoad() throws IOException, ClassNotFoundException{

    //check that dodgy domains are caught
    //Set the rule source
    RuleSource ruleSource = new RuleSource();
    ruleSource.setKnowledgeBaseLocation("http://red-piranha.appspot.com/sampleresources/SpreadSheetServlet/log-then-modify-rules.SomeUnknownResourceType");

    //Check that we cannoread rules from remote location
    try{
      KnowledgeBase kb = ruleLoader.loadKnowledgeBase(ruleSource);
      fail("Expected Security Exception not thrown");
View Full Code Here

    for (Range r : ranges) {
      log.debug(r);
    }

    //Setup our parameters
    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setFacts(ranges.getAllRangesAndCells());
    ruleSource.setGlobals(globals);

    // Load and fire our rules files against the data
    new RuleRunner(new FileRuleLoader()).runStatelessRules(ruleSource,excelLogger);

    // Log the cell contents
View Full Code Here

  @Test
  public final void testLoadCachedRules() throws IOException, ClassNotFoundException {

    //Set the rule source
    RuleSource ruleSource = new RuleSource();
    ruleSource.setKnowledgeBaseLocation("war/sampleresources/SpreadSheetServlet/log-then-modify-rules.KnowledgeBase");

    //do the call
    KnowledgeBase kb = ruleLoader.loadKnowledgeBase(ruleSource);
    assertNotNull(kb);
    StatefulKnowledgeSession sks = kb.newStatefulKnowledgeSession();
View Full Code Here

  public final void testCompileRunDrlFromUrl() throws Exception{


    //Get the URL
    URL url = new URL(SpreadsheetServletSample.EXCEL_DATA_FILE);
    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(SpreadsheetServletSample.RULES_FILES);

    HSSFWorkbook wb;
    wb = commonUtils.callRules(url,ruleSource, SpreadsheetServletSample.getExcelLogWorksheetName());

View Full Code Here

    log.info("Default file location:"+whereAmI.getAbsolutePath());

    //Get the URL
    URL url = new URL(SpreadsheetServletSample.EXCEL_DATA_FILE);

    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(SpreadsheetServletSample.RULES_FILES);


    HSSFWorkbook wb;
    wb = commonUtils.callRules(url,ruleSource, SpreadsheetServletSample.getExcelLogWorksheetName());
View Full Code Here

TOP

Related Classes of net.firstpartners.drools.data.RuleSource

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.