Drools running in OSGi
by diego.vera@capgemini-sdm.com
Hi all,
I am trying to run Drools as a bundle with Equinox, however I found an issue with Drools 5 with the classloader, apparently Drools 5 does not always uses the classloader that I pass in the configuration (PackageBuilderConfiguration). Then I decided to test it with Drools 4.0.7 and I do not have the classloader problem anymore but I got the following error (NoSuchMethodError) when I execute stateFulSession.fireAllRules, below is the stack.
I am trying to run it with Equinox 3.4 and I reviewed that all the dependencies are ok. The .drl file is compiled successfully, see the code that I am using below.
I followed the sample publishe in: http://www.dynamicjava.org/articles/osgi-integration/drools-osgi
And I tried with the bundles published by spring and I also tried with my own sample but I get the same error.
Does anybody used successfully Drools 4.0.7 or 5 in OSGi successfully? What should I change to have my code running in OSGi?
Thanks in advance,
The Code:
InputStreamReader source = new InputStreamReader( this.getClass.getResourceAsStream( "helloWorld.drl" ) );
OsgiEnvironmentClassLoader classLoader =
new OsgiEnvironmentClassLoader(bundleContext,
Thread.currentThread().getContextClassLoader(),
bundleContext.getBundle());
PackageBuilderConfig packageBuilderConfig = new PackageBuilderConfiguration(classLoader, null);
PackageBuilder builder = new PackageBuilder(packageBuilderConfig);
//this wil parse and compile in one step
builder.addPackageFromDrl( source );
// Check the builder for errors
if ( builder.hasErrors() ) {
System.out.println( builder.getErrors().toString() );
throw new RuntimeException( "Unable to compile \"helloWorld.drl\".");
}
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
Package ruleBaseConfig = new RuleBaseConfiguration()
ruleBaseConfig.setClassLoader(classLoader);
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfig);
ruleBase.addPackage( pkg );
StateFulSession session = ruleBase.newStatefulSession();
session.fireAllRules();
The Exception:
INFO: bundle changed: TopicMapEditorService
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1028)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:984)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:344)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:267)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:259)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._st
art(FrameworkCommandProvider.java:254)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.
execute(FrameworkCommandInterpreter.java:150)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(F
rameworkConsole.java:302)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Fra
meworkConsole.java:287)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(Framewo
rkConsole.java:223)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: org.drools.WorkingMemory.fireAllRules()I
at org.topicology.security.TSecurity.initialize(TSecurity.scala:49)
at org.topicology.TMEditorService.Activator.start(Activator.scala:28)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1003)
... 14 more
Nested Exception:
java.lang.NoSuchMethodError: org.drools.WorkingMemory.fireAllRules()I
at org.topicology.security.TSecurity.initialize(TSecurity.scala:49)
at org.topicology.TMEditorService.Activator.start(Activator.scala:28)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1003)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:984)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:344)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:267)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:259)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._st
art(FrameworkCommandProvider.java:254)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.
execute(FrameworkCommandInterpreter.java:150)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(F
rameworkConsole.java:302)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Fra
meworkConsole.java:287)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(Framewo
rkConsole.java:223)
at java.lang.Thread.run(Unknown Source)
Nested Exception:
java.lang.NoSuchMethodError: org.drools.WorkingMemory.fireAllRules()I
at org.topicology.security.TSecurity.initialize(TSecurity.scala:49)
at org.topicology.TMEditorService.Activator.start(Activator.scala:28)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActiv
ator(BundleContextImpl.java:1003)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(Bund
leContextImpl.java:984)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:344)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:267)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:259)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._st
art(FrameworkCommandProvider.java:254)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.
execute(FrameworkCommandInterpreter.java:150)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(F
rameworkConsole.java:302)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(Fra
meworkConsole.java:287)
at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(Framewo
rkConsole.java:223)
at java.lang.Thread.run(Unknown Source)
15 years, 3 months
Maven Plugin to build pkg files
by Bernd Rücker
Hi all.
I wonder if there exists a maven plugin to build pkg files out of the rule
base during the maven packaging. Because we dont use the Guvnor
repository in this project and I want to package the pkg files with the
overall ear.
I searched a bit, but didnt found anything
Okay, not hard to write
ourself, but would be nicer to reuse existing stuff
Thanks
Bernd
15 years, 3 months
More knowledge bases in application - Performance Hit ?
by Kumar Mynam
Hello All,
Does KnowledgeBase has lot of overhead in it..?
Would there be a performance hit on an application if it has 200 different KnowledgeBases, because of the size of the KnowledgeBase, overhead storage of the KnowledgeBase object or for any other reason..?
Ofcourse, Application would only build KnowledgeBases once at the startup of the application, stores them, and uses them for rest of the life.
Thank you,
kumar.
15 years, 3 months
Running drools 4 code using drools 5 jars
by Nikhil D. Deshpande
Hi,
I have written some code using drools 4 jars.
Now as drools 5 is launched, I want to migrate my existing 'RuleBase' (drools 4) to 'KnowledgeBase'(drools 5).
1. Can I/Should I use RuleBase, PackageBuilder, ExternalSpreadSheetCompiler using drools 5 jars??
I can use these classes as they are present in drools-compiler-5.0.1.jar
Is anybody facing the same issue?
Please let me know if somebody has a solution for this.
Thanks & Regards,
Nikhil
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 years, 3 months
Rule-base doubt
by ganesh ezhilarasu
Hi am using drools -guvnor. i need to help
Now the rules are created and persistence in reposity path. i need
persistence to data base what i have need to do?
when i create rule in my setting path .How to move the file in user
environment ?
one more am persistence rule in database. How to move user environment.
Any body help me
--
Regards
Ganesh.E
9790723660
15 years, 3 months
Confusing behavior for StatefulKnowledgeSession.fireAllRules() with negated conditions.
by bill simms
Hello again,
Recently while continuing to work on a complex event processing project I
have encountered strange,
but interesting, situations where the fireAllRules() method of a
StatefulKnowledgeSession appears to
return before actually emptying the activations on the agenda. I was under
the impression that this
method only returns after all activations, including subsequent activations,
have been completed and
removed from the agenda. If I'm incorrect then feel free to disregard the
rest of this message.
[Drools v 5.0.1, JUnit 4.0, Spring 2.5.6]
The behavior I have noticed begins when working with a rule such as "Find
Missing Input Events"
(in file test.drl):
------------------------------------------------------------------------
package org.drools.test
import org.drools.test.*
declare Event
@role( event )
@timestamp( beginning )
@duration( length )
@expires( 1h )
end
declare Fault
@role( event )
@timestamp( beginning )
@duration( length )
@expires( 1h )
end
query "getFaults"
$fault: Fault() from entry-point "faults"
end
rule "Find Missing Input Events"
when
$a: Event()
from entry-point "input"
$b: Event( this after $a)
from entry-point "input"
not (Event( (this after $a || this metby $a), (this before $b ||
this meets $b))
from entry-point "input")
not (Fault(this metby $a, this meets $b)
from entry-point "faults")
then
entryPoints["faults"].insert(new Fault($a, $b));
end
rule "Print Faults"
when
$f: Fault() from entry-point "faults"
then
System.out.println($f);
end
------------------------------------------------------------------------
The purpose of this rule is to detect when one or more events are missing in
an event sequence. The
events in question are supposed to continue from one to the next without any
time in-between. If this
rule does discover a gap/absence between two events a Fault is created for
further processing. (*Note
that the Event and Fault classes that I used only contain two fields,
beginning and length, to be used as
the time-stamp and duration respectively.) I noticed the unexpected
behavior shortly after creating this
unit test:
------------------------------------------------------------------------
public class FireAllRulesTest {
KnowledgeBase knowledgeBase;
StatefulKnowledgeSession session;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add(ResourceFactory.newFileResource("target/test-classes/test.drl"),
ResourceType.DRL);
if(builder.hasErrors()){
throw new RuntimeException(builder.getErrors().toString());
}
KnowledgeBaseConfiguration configuration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
configuration.setOption(EventProcessingOption.STREAM);
knowledgeBase =
KnowledgeBaseFactory.newKnowledgeBase(configuration);
knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());
session = knowledgeBase.newStatefulKnowledgeSession();
WorkingMemoryConsoleLogger logger = new
WorkingMemoryConsoleLogger(session);
}
@Test
public void testAbsence(){
System.out.println("Running...");
//Record the rules that have fired.
ActivationTrackingEventListener listener = new
ActivationTrackingEventListener();
session.addEventListener(listener);
//Start at 0, go to 100.
Event first = new Event(0,100);
//Start at 1000, go to 1100. Absence of 900.
Event second = new Event(1000, 100);
//Start at 1100, go to 1200. No absence.
Event third = new Event(1100, 100);
//Start at 1200, go to 1300. No absence.
Event fourth = new Event(1200, 100);
//Start at 2000, go to 2100. Absence of 700.
Event fifth = new Event(2000, 100);
WorkingMemoryEntryPoint ingest =
session.getWorkingMemoryEntryPoint("input");
ingest.insert(first);
ingest.insert(second);
ingest.insert(third);
ingest.insert(fourth);
ingest.insert(fifth);
System.out.println("All events have been inserted.");
session.fireAllRules();
System.out.println("Rules have finished firing.");
//Expect that "Find Missing Input Events" has fired and that there
are two faults as a result.
assertTrue(listener.hasRuleFired("Find Missing Input Events"));
assertEquals(2,faultCount());
System.out.println("Test completed.");
}
public int faultCount(){
QueryResults results = session.getQueryResults("getFaults");
return results.size();
}
}
------------------------------------------------------------------------
The typical result of this test is a failure about 90% of the time.
Strangely, the other 10% of the time this exact
same test is run it will pass, without any modifications. Equally
interesting is the output of the WorkingMemoryLogger:
------------------------------------------------------------------------
Running...
OBJECT ASSERTED value:org.drools.test.Event@1b994de factId: 1
BEFORE ACTIVATION FIRED rule:Find Missing Input Events activationId:Find
Missing Input Events [2, 1, 0]
declarations: $b=org.drools.test.Event@2803d5(2);
$a=org.drools.test.Event@1b994de(1)
ACTIVATION CREATED rule:Find Missing Input Events activationId:Find Missing
Input Events [2, 1, 0]
declarations: $b=org.drools.test.Event@2803d5(2);
$a=org.drools.test.Event@1b994de(1)
OBJECT ASSERTED value:org.drools.test.Event@2803d5 factId: 2
OBJECT ASSERTED value:org.drools.test.Event@1b32627 factId: 3
OBJECT ASSERTED value:org.drools.test.Event@ad157f factId: 4
ACTIVATION CREATED rule:Find Missing Input Events activationId:Find Missing
Input Events [5, 4, 0]
declarations: $b=org.drools.test.Event@1bfa3d3(5);
$a=org.drools.test.Event@ad157f(4)
OBJECT ASSERTED value:org.drools.test.Event@1bfa3d3 factId: 5
All events have been inserted.
***Rules have finished firing.
ACTIVATION CREATED rule:Print Faults activationId:Print Faults [6, 0]
declarations: $f=org.drools.test.Fault@159780d(6)
OBJECT ASSERTED value:org.drools.test.Fault@159780d factId: 6
AFTER ACTIVATION FIRED rule:Find Missing Input Events activationId:Find
Missing Input Events [2, 1, 0]
declarations: $b=org.drools.test.Event@2803d5(2);
$a=org.drools.test.Event@1b994de(1)
BEFORE ACTIVATION FIRED rule:Print Faults activationId:Print Faults [6, 0]
declarations: $f=org.drools.test.Fault@159780d(6)
org.drools.test.Fault@159780d
AFTER ACTIVATION FIRED rule:Print Faults activationId:Print Faults [6, 0]
declarations: $f=org.drools.test.Fault@159780d(6)
BEFORE ACTIVATION FIRED rule:Find Missing Input Events activationId:Find
Missing Input Events [5, 4, 0]
declarations: $b=org.drools.test.Event@1bfa3d3(5);
$a=org.drools.test.Event@ad157f(4)
ACTIVATION CREATED rule:Print Faults activationId:Print Faults [7, 0]
declarations: $f=org.drools.test.Fault@c26b16(7)
OBJECT ASSERTED value:org.drools.test.Fault@c26b16 factId: 7
AFTER ACTIVATION FIRED rule:Find Missing Input Events activationId:Find
Missing Input Events [5, 4, 0]
declarations: $b=org.drools.test.Event@1bfa3d3(5);
$a=org.drools.test.Event@ad157f(4)
BEFORE ACTIVATION FIRED rule:Print Faults activationId:Print Faults [7, 0]
declarations: $f=org.drools.test.Fault@c26b16(7)
org.drools.test.Fault@c26b16
AFTER ACTIVATION FIRED rule:Print Faults activationId:Print Faults [7, 0]
declarations: $f=org.drools.test.Fault@c26b16(7)
------------------------------------------------------------------------
It seems that the rule is indeed firing correctly, but that it is doing so
only after returning from fireAllRules method.
I have marked line that follows fireAllRules() with *** above. So the rule
fires, but the test fails because the firing
takes place after the junit assertions are checked.
But that's not all, it gets more interesting. Looking back at the rule
file, when you comment out the last condition:
not (Fault(this metby $a, this meets $b)
from entry-point "faults")
The problem with the unit test disappears. After much thought I'm still not
sure why this is, but the last condition is
critical to avoid creating redundant Faults (Because a lot of the Events are
redundant as well. It just comes with the
problem being solved). The problem also disappears if you put a
Thread.sleep(1000) after firing the rules, which is
why I suspect a timing issue between the rules firing and the unit test
assertions being evaluated. This could explain
why the test sometimes works, and sometimes doesn't.
I'm hopeful that someone will understand why this is happening, and point
how how to prevent it. Thank you in advance.
Bill
15 years, 3 months
NPE while creating new knowledge session on IBM JVM (Drools 5.0.1)
by Przemysław Różycki
Hello,
I experienced some problem while working on IBM WebSphere 7.0.0.3 (64
bit) and IBM JVM V9 (1.6.0) with Drools 5.0.1.
To be precise, I get NPE from inside
java.util.concurrent.CopyOnWriteArrayList object. The problem repeats
randomly and I didn't detect an exact factor that causes it. For me, it
looks like an issue in JVM, but I'd like to know if anyone here
experienced it.
KnowledgeBase has been deserialized from DroolsObjectInputStream before
creating session.
The exact stack trace goes here:
2009-09-03 17:14:46,487 [SimpleAsyncTaskExecutor-2] ERROR
amg.exion.statements.StatementContentManager - Exception thrown while
generating marketing info:
java.lang.NullPointerException
at
java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:273)
at
java.util.concurrent.CopyOnWriteArrayList.add(CopyOnWriteArrayList.java:393)
at
org.drools.event.AbstractEventSupport.addEventListener(AbstractEventSupport.java:52)
at
org.drools.common.AbstractRuleBase.addEventListener(AbstractRuleBase.java:846)
at
org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:332)
at
org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:306)
at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:151)
at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:134)
at
amg.exion.statements.internal.processor.impl.DroolsSessionGenericProcessorImpl.process(DroolsSessionGenericProcessorImpl.java:54)
at
amg.exion.statements.internal.processor.impl.DroolsSessionStatementProcessorImpl.processStatement(DroolsSessionStatementProcessorImpl.java:72)
at
amg.exion.statements.StatementContentManager.process(StatementContentManager.java:272)
at
amg.exion.statements.StatementContentManager.process(StatementContentManager.java:80)
at
org.springframework.batch.core.step.item.SimpleChunkProcessor.doProcess(SimpleChunkProcessor.java:118)
at
org.springframework.batch.core.step.item.SimpleChunkProcessor.transform(SimpleChunkProcessor.java:260)
at
org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:171)
at
org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:70)
at
org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:268)
at
org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
at
org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
at
org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at
org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
at
org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:242)
at
org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198)
at
org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:348)
at
org.springframework.batch.core.job.flow.FlowJob.access$0(FlowJob.java:1)
at
org.springframework.batch.core.job.flow.FlowJob$JobFlowExecutor.executeStep(FlowJob.java:135)
at
org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
at
org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
at
org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
at
org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:103)
at
org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:250)
at
org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:110)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:105)
at
amg.exion.statements.internal.StatementsInternalImpl$1.run(StatementsInternalImpl.java:100)
at java.lang.Thread.run(Thread.java:735)
Best regards,
--
Przemysław Różycki
IT Architect
AMG.net, A Bull Group Company
ul. Łąkowa 29
90-554 Łódź, Poland
www.amg.net.pl
15 years, 3 months
rules getting fired in an infiniteloop even when noloop is set to true
by Abarna Ramachandran
i have my rule as
rule AssignSomething
no-loop true
when
$ao:AssertionObject()
$ssc:String() from getSSC(getRecordData($ao,"stationNo"))
eval(!($ssc==null))
then
modify($ao){setBillingRecord("posId",$ssc);}
info(BillingRecordHelper.SSCPOC_ASSIGNED_INFO,log);
end
Here i am setting values for the assertionobject in my rhs. But this
value is different from the ssc value i am checking in the rule
condition. But still this goes into an infinite loop.
what am i doing wrong?
thanks
Abarna
15 years, 3 months
How to Use List in When Part of a Rule
by Pardeep.Ruhil@lntinfotech.com
Hi,
I have a doubt regarding on making of a rule.
I have a scenario in which I have a List of Roles of Person and I want to
check role of person to the roles specified in the list.
So I got stuck how to Iterate through the list Rules and use them in Rules
'when' part to specify the condition.
Like in Java I do the same with Iterator on the List and then taking each
element in the List and then
checking the Roles in a IF Condition.
Iterator obj=objList.Iterator();
while(obj.hasNext())
{
if((String)obj.next().equalsIgnoreCase(personRole)){
..
}
}
But I don't know how to do the same in Rules. Please help me in this.
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
15 years, 3 months