Hi,
 
     I am using Decision table in drools. But it is not giving any output. I am doing the correct one or not.
 
 
The code
  RuleSet com.sample    
  Import com.sample.Paternity.RuleBean;  
  Notes This decision table is a Paternity decision table  
  RuleTablefor Paternity    
  CONDITION CONDITION CONDITION ACTION
         
  RuleBean(status == "$param") RuleBean(role =="$param") RuleBean(NoOfDays == $param) System.out.println ("Kranthis");
Paternity Rules Status Role NoOfDays Print out message?
  Married Permanent 2 Kranthi3
         
 
The following the my code
for
Paternity.java
 

public

class Paternity {

public static final void main(String[] args) {

try {

RuleBase ruleBase = readDecisionTable();

WorkingMemory workingMemory = ruleBase.newStatefulSession();

//go !

RuleBean rule=

new RuleBean("Married", "Permanent",2);

System.

out.println("Kranthi1");

workingMemory.assertObject(rule);

System.

out.println("kranthi2");

workingMemory.fireAllRules();

}

catch (Throwable t) {

t.printStackTrace();

}

}

private static RuleBase readDecisionTable() throws Exception {

//read in the source

final SpreadsheetCompiler converter = new SpreadsheetCompiler();

final String drl = converter.compile( "/Sample.xls", InputType. XLS );

PackageBuilder builder =

new PackageBuilder();

builder.addPackageFromDrl(

new StringReader( drl ) );

Package pkg = builder.getPackage();

RuleBase ruleBase = RuleBaseFactory.newRuleBase();

ruleBase.addPackage( pkg );

return ruleBase;

}

}

 

and the following is my RuleBean.java

package

com.sample;

 

import

com.sample.Paternity;

 

 

public

class RuleBean{

private String status;

private String role;

public int NoOfDays ;

public RuleBean(String status,String role,int NoOfDays) {

System.

out.println("kranthiobj");

this.status = status;

this.role = role;

this.NoOfDays = NoOfDays;

}

public int getNoOfDays() {

return NoOfDays;

}

public void setNoOfDays(int noOfDays) {

NoOfDays = noOfDays;

}

public String getRole() {

return role;

}

public void setRole(String role) {

this.role = role;

}

public String getStatus() {

return status;

}

public void setStatus(String status) {

this.status = status;

}

}