Sir
I have modified according to your suggestion but still I am getting the
same error.
Regards
Sanjib Karmakar
SkyTech Solutions Pvt. Ltd
Please consider the environment before printing this email.
Wolfgang Laun <wolfgang.laun(a)gmail.com>
Sent by: rules-users-bounces(a)lists.jboss.org
08/23/2010 06:15 PM
Please respond to
Rules Users List <rules-users(a)lists.jboss.org>
To
Rules Users List <rules-users(a)lists.jboss.org>
cc
Subject
Re: [rules-users] Please help me to fix the AgendaFilter related issue
The error message says StatefulRuleSession, but I'd say you have a
StatefulKnowledgeSession ksession.
Do a cast:
org.drools.runtime.rule.StatefulRuleSession sfrs =
(org.drools.runtime.rule.StatefulRuleSession)ksession;
and use this one for firing all rules with an agenda filter.
-W
On 23 August 2010 14:32, Sanjib Karmakar <sanjibk(a)skytechsolutions.co.in>
wrote:
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.spi.Activation;
import org.drools.spi.AgendaFilter;
.
.
.
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(
ResourceFactory.newClassPathResource(resourceIndicator),
ResourceType.XDRL
);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
.
.
.
public Object getSpecificRuleReport(
Object requestDTO,
Object responseDTO,
final String ruleAry[]
)
throws Exception
{
AgendaFilter agendafilter =
new StatefulKnowledgeSessionImpl.AgendaFilterWrapper(null)
{
public boolean accept(Activation activation)
{
boolean returnFlag = false;
int ruleArySize = ruleAry.length;
for (int cnt=0; cnt<ruleArySize; cnt++)
{
if (activation.getRule().getName().equals(ruleAry[cnt]))
returnFlag = false;
else
returnFlag = true;
}
return returnFlag;
}
};
try
{
ksession.insert(requestDTO);
ksession.insert(responseDTO);
ksession.fireAllRules(agendafilter);
}catch(Exception t)
{
_logger.error(t.getMessage()+"\n"+t);
}
return responseDTO;
}
Eclipse is showing that there is a method fireAllRules() which takes
AgendaFilter as a parameter
but I am getting error "The method fireAllRules(int) in the type
StatefulRuleSession is not applicable for the arguments (AgendaFilter)" at
'ksession.fireAllRules(agendafilter);'
I am trying to execute specific rules out of set of rules. Please help me
to
fix this issue.
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Please-help-me-to-fix...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users