Starting ruleflow on event
by bbking
I'm using Drools 5.0.1 and have read in the online documentation that i can
start a process on event:
"Events could also be used to start a process. Whenever a Start node defines
an event trigger of a specific type, a new process instance will be started
every time that type of event is signalled to the process engine."
However, I cannot find a property on the Start activity that exposes this
functionality.
Am I missing something?
--
View this message in context: http://n3.nabble.com/Starting-ruleflow-on-event-tp73368p73368.html
Sent from the Drools - User mailing list archive at Nabble.com.
16 years, 2 months
Inserting elements of a list into a session from a rule consequence
by Warren, David [USA]
I am trying to write a rule whose consequence loads several lists into the session. Each list contains a different type of class. What I would like to do (need to do as far as I can tell) is loop through the list and insert each element individually, rather than inserting the list as a whole. Is ther a way to do this in DRL?
Here is my example rule:
rule "Do we need to validate ONFI final action"
when
a : PackageMovementInfo( finalActionInd == "*", packageId == "AA")
b : SubmissionsInfoForRules(subId == a.subId, amendment == false, onfiAssignmentId != null)
then
insert( new RuleFlag("Validate ONFI final action") );
insert( onfiService.getONFIAssignment(b.getSubId()) );
insert( onfiService.getONFIReviewers(b.getOnfiAssignmentId()) );
insert( onfiService.getONFIAttachments(b.getOnfiAssignmentId()) );
end
The last two insert statements insert lists. A problem occurs in subsequent rules if I try to evaluate the contents of the lists. I've been getting a ClassCastException when lists are present for both the reviewers and attachments, because they are not the same class. Here is an example rule that causes a ClassCastException:
rule "Validate ONFI final action - code 666"
when
RuleFlag(value == "Validate ONFI final action")
a: PackageMovementInfo(actionCode == "666")
b: ONFIAssignmentInfo(reviewType == "ES", subId == a.subId)
$list : List( size > 0 )
ONFIReviewerInfo(notId == b.notId, revStatus == "CLO", reviewerRole == "PR") from $list
then
result.addMessage(a, "You can't do action code 666..." );
end
What I need to do is either (1) load each element of the lists individually, or (2) rewrite "$list : List (size > 0)" to only pick up lists of a particular class.
Is there a way to do either of these things from DRL? Or do I need to handle the loading outside of my rules (in the Java class that calls the rules).
Thank you,
David Warren
16 years, 2 months
rule on Array of custom Object
by stefano corna
hello,
im using drools 5.0 on eclipse and i have a problem. i want to use an array
of object in my rule condition.
now i try to explain:
i have my java class with the array attribute
-------------------------------------------------
public static class Message {
public numbers[] numbersArray;
}
--------------------------------------------
and the numbers class that rapresent the objects contained in numbersArray
----------------------------------------------
public static class numbers
{
public int first;
public int last;
}
--------------------------------------------------
my goal is make a rule that check if Message.numbersArray[0].first="value"
i use
-------------------------------------------------
rule "rule_001"
dialect "mvel"
when
$msg : Message(numbersArray[0].first=="1")
then
System.out.println("something....");
end
-------------------------------
and on runtime it give me this error:
---------------------------------------
org.drools.RuntimeDroolsException: Exception executing predicate
numbersArray[0].first=="1"
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:279)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:143)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
at com.sample.DroolsTest.main(DroolsTest.java:47)
Caused by: [Error: unable to access property (null parent): first]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:861)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:585)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:313)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138)
at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133)
at
org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:102)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel2.MVEL.executeExpression(MVEL.java:978)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:75)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:272)
... 10 more
-------------------------------------------------------
moreover if i try to print the "first" value:
.
.
.
then
System.out.println(numbersArray[0].first);
end
appear this new error and i cant compile:
"BuildError: Unable to build expression for 'consequence': Failed to
compile: 1 compilation error(s):
- (1,12) unqualified type in strict mode for: numbersArray'
System.out.println(numbersArray[0].first);
'"
someone can kindly help me?
16 years, 2 months
Delivery reports about your e-mail
by Returned mail
The original message was received at Sat, 12 Dec 2009 12:32:15 +0530 from lists.jboss.org [61.182.35.53]
----- The following addresses had permanent fatal errors -----
<rules-users(a)lists.jboss.org>
----- Transcript of session follows -----
... while talking to 78.176.237.227:
554 Service unavailable; [211.20.41.227] blocked using relays.osirusoft.com, reason: Blocked
Session aborted
16 years, 2 months
Delivery reports about your e-mail
by Post Office
Dear user rules-users(a)lists.jboss.org,
We have found that your account was used to send a huge amount of unsolicited e-mail during the recent week.
Probably, your computer was infected by a recent virus and now contains a trojan proxy server.
We recommend that you follow the instructions in the attached text file in order to keep your computer safe.
Best regards,
The lists.jboss.org support team.
16 years, 2 months
Returned mail: Data format error
by Mail Administrator
Dear user rules-users(a)lists.jboss.org,
We have detected that your e-mail account has been used to send a huge amount of junk e-mail during the recent week.
Probably, your computer was infected by a recent virus and now runs a trojan proxy server.
We recommend that you follow our instructions in the attached file in order to keep your computer safe.
Best regards,
lists.jboss.org technical support team.
16 years, 2 months
Dynamic fact generation
by Sahid Khan (সাহিদ)
Hello,
The facts I need for Guvnor is dynamic in nature. These facts will be
based on objects modified by another application. I was thinking if I
can call Guvnor from the other application to create/update these
facts directly?
--
S.
Argue with idiots, and you become an idiot. - PG
16 years, 2 months
Drools Guvnor and jboss single sign on
by Sahid Khan (সাহিদ)
Hello,
I have couple of web applications other than Guvnor deployed in JBoss.
I use jboss single sign on [1] for authentication. But guvnor does not
seem to be working. I believe there are some issues with JBoss Seam
and JBoss SSO. But is there any work around to integrate JBoss SSO
with Guvnor? Please help.
1. http://www.jboss.org/community/wiki/JBossWebSingleSignOn
Thanks in advance,
--
Sahid.
Argue with idiots, and you become an idiot. - PG
16 years, 3 months
Debuggin in Eclipse
by chris richmond
Ok, I have a project working with Eclipse Galileo 3.5.1 and it works fine. I
can create new drools projects and they debug fine with the DroolsTest
example. However I have a very larege existing project that does not use
the src/main/java and src/main/rules src folder structure and the project
runs fine, and I can "Debug as Drools Application" no problem, however it
will never stop on any breakpoints in the rules file. Does this have
anything to do with the fact that I am not using the default src/rules
direcories structure? Or, is it dependent on loading the DRL file in a
particular method. I am loading the file usin this method:
java.io.FileInputStream fis = *new* java.io.FileInputStream(
*new* java.io.File(*"C:\\Path\\To\\Some\\Dir\\rules.drl*));
builder.add(ResourceFactory.*newInputStreamResource*(fis),
ResourceType.*DRL*);
Should I be loading the fule file using the DroolsTest sample code method
like below?
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.*newKnowledgeBuilder*();
kbuilder.add(ResourceFactory.*newClassPathResource*("Sample.drl"),
ResourceType.*DRL*);
Does these even make a difference? Or any ideas why I can't get any debug
breakpoints in my rule file in my custom project to go into break-time?
Thanks,
Chris
16 years, 3 months