Replacement for eval
by Nirmal Fernando
Hi,
I have two questions.
1) Is there any other way/method in Drools to test the truth value of a
condition other than "eval"?
In almost all rules of my application needs to test conditions, and it takes
ages to run using "eval".
2) Say I have a java method which returns a boolean, and I have used it
within an "eval" function. (eg: eval(message.emptyMessageFinder()) )
This "emptyMessageFinder()" method will return a "boolean" if there's an
empty message. This function is containing many loops and recursive
operations.
Will I get a performance improvement if I alternate the above such that the
"emptyMessageFinder()" method sets a boolean attribute (anyEmptyMessage)
in the Message class to true and false, and I'm using following in my drl.
when
m: Message()
m.emptyMessageFinder()
eval(m.anyEmptyMessage) //can I use eval here??
......
If someone can answer these questions it would be a great help!
Thank you in advance!
--
Best Regards,
Nirmal
C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.
Blog: http://nirmalfdo.blogspot.com/
14 years
Drools flow question on proper exception handling / use of faults
by Liße, Jan
Hi,
I have a process workflow where an exception might occur within one Action. I need to react on this exception in the workflow. That means I don't want to skip the entire processing
I just want to react properly by setting an error variable and skip this specific item (my process iterates over a list of items).
Now I tried to model my Action together with a Fault Node within a CompositeNode as seen in the User manual section on exception handling. The outgoing connection
of my Action is connected with the Fault. The outgoing connection of the CompositeNode is connected with the next Action. When I run the process it comes to the Action node and hangs there if no exception occurs (the next Action is never reached). Looking at the model this is reasonable since the outgoing connection leads to the Fault node. So my question is how can I properly model this kind of exception handling, where I need two ways of execution (one if everything goes fine, and one for fault handling)? Wrapping everything inside a CompositeNode alone does not seem to be sufficient...
Thanks in advance for any help!
-Jan
14 years
Drools Flow - problem with parameter mapping
by matus
Hi,
I recently run into some problems when trying to create a simple holiday
request process.
I defined process variables but I struggle to understand how to access them
in Human Task.
In my User Task ,,holiday approval" I have this as a description:
#{employee} requested holiday for #{length} days
I set both variables when I start the process and the result looks as
expected, for example ,,John requested holiday fo 14 days.
But lets say I want a manager approving the holiday request to add his
response as a variable. How do I do that?
I tried to use the Result mapping with someting like this: response=response
but I get an error saying ,,There is no ID/IDREF binding for IDREF
'_2_response'.
Also if I manage to get this running, how do I set this variable in a client
app?[using WS_HT]
I am sorry if I am asking realy basic things, but I realy need some advice.
Bellow is the process definition.
Thanks a lot, matus
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODELBPMN20.xsd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<itemDefinition id="_employeeItem" structureRef="String" />
<itemDefinition id="_lengthItem" structureRef="String" />
<itemDefinition id="_managersItem" structureRef="String" />
<itemDefinition id="_responseItem" structureRef="String" />
<process processType="Private" isExecutable="true" id="com.sample.test"
name="test process" tns:packageName="defaultPackage" >
<!-- process variables -->
<property id="employee" itemSubjectRef="_employeeItem"/>
<property id="length" itemSubjectRef="_lengthItem"/>
<property id="managers" itemSubjectRef="_managersItem"/>
<property id="response" itemSubjectRef="_responseItem"/>
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<userTask id="_2" name="Holiday approval" >
<ioSpecification>
<dataInput id="_2_CommentInput" name="Comment" />
<dataInput id="_2_SkippableInput" name="Skippable" />
<dataInput id="_2_ContentInput" name="Content" />
<dataInput id="_2_TaskNameInput" name="TaskName" />
<dataInput id="_2_PriorityInput" name="Priority" />
<dataOutput id="_2_responseOutput" name="response" />
<inputSet>
<dataInputRefs>_2_CommentInput</dataInputRefs>
<dataInputRefs>_2_SkippableInput</dataInputRefs>
<dataInputRefs>_2_ContentInput</dataInputRefs>
<dataInputRefs>_2_TaskNameInput</dataInputRefs>
<dataInputRefs>_2_PriorityInput</dataInputRefs>
</inputSet>
<outputSet>
<dataOutputRefs>_2_responseOutput</dataOutputRefs>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<targetRef>_2_CommentInput</targetRef>
<assignment>
<from xs:type="tFormalExpression">#{employee} requested holiday
for #{length} days </from>
<to xs:type="tFormalExpression">_2_CommentInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_2_SkippableInput</targetRef>
<assignment>
<from xs:type="tFormalExpression">false</from>
<to xs:type="tFormalExpression">_2_SkippableInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_2_ContentInput</targetRef>
<assignment>
<from xs:type="tFormalExpression"></from>
<to xs:type="tFormalExpression">_2_ContentInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_2_TaskNameInput</targetRef>
<assignment>
<from xs:type="tFormalExpression">Holiday Approval</from>
<to xs:type="tFormalExpression">_2_TaskNameInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>_2_PriorityInput</targetRef>
<assignment>
<from xs:type="tFormalExpression"></from>
<to xs:type="tFormalExpression">_2_PriorityInput</to>
</assignment>
</dataInputAssociation>
<dataOutputAssociation>
<sourceRef>_2_response</sourceRef>
<targetRef>_2_response</targetRef>
</dataOutputAssociation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>#{managers}</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<endEvent id="_3" name="End" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="com.sample.test" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="16" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="96" y="16" width="100" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="340" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_2" >
<di:waypoint x="40" y="40" />
<di:waypoint x="146" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="146" y="40" />
<di:waypoint x="364" y="40" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
14 years
JBoss Rule Trace feature with 5.0
by Kinjal Khandhar
Hi All,
Can anybody help me with Drools Audit Log(Rule Trace) feature.
My goal is to check which rule got executed,in what sequence and which
conditions got evaluated and which did not.
Any help/pointers greatly appreciated.
Thanks in advance.
Regards,
Kinjal
14 years
Alternate Flow Creation
by srikanthp
In process flow i need to execute alternate path based on some external
event. How can i do this ?
For Ex:In a process (shown below) billing activity was implemented using
work-item definition.
Process goes to next node i.e. Do some task only after completing billing
activity. I am calling completeWorkItem method after actually billing is
done in the application, so that process goes to next node.
http://drools-java-rules-engine.46999.n3.nabble.com/file/n1909549/flow.jpg
But i have a requirement of once process is started (in the middle of
billing activity) user may choose to cancel the process. So based on an
external event i should do a compensating activity of billing and terminate
the process. How do i trigger this alternate path?
Thanks in advance for your help.
Regards,
Srikanth
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Alternate-Flow-Creati...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years
8Puzzle problem with Drools Planner
by Anderson Rocha
Hi all,
I am wondering if Drools Planner can handle the 8Puzzle problem. I once
resolved it with the A* search. But I do not know these simulated annealing
and tabu search that Drools Planner implements. So I am having a "Getting
stuck in local optima" problem, and depending on the start sollution it gets
into loop. But if you enter a really simple start solution it resolves,
because it choose the best scores until finish with few steps. If some one
can help, let me know what I can send (source code, configuration files) to
get some help.
Thanks,
Anderson
14 years
Re: [rules-users] Drools STREAM Mode performance with rather simple rule
by Roess. Oliver
Hello again!
Thanks for the heads up, Wolfgang.
Basically, what I try to create is some sort of batch window, which is
not really implemented into Drools Fusion if I remember correctly.
It doesn't HAVE to be A, B, C in that particular order which I specified
in my last post, but the rule shall only match each A, each B, and each
C once. So what would you recommend as a best practise to build that
rule? Or is my rule correct? Actually, I don't like the fact, that I
have to complete the rule by retracting my events in the RHS of the
rule. I'd rather have a batch window specified in the LHS. Thanks in
advance.
Best regards,
Oliver
_________________________________________________________________________
SEEBURGER AG Vorstand/Seeburger Executive Board:
Sitz der Gesellschaft/ Bernd Seeburger, Axel Haas, Michael Kleeberg
Registered Office:
Edisonstrasse 1 Vorsitzender des Aufsichtsrats/Chairperson of
D-75015 Bretten the Seeburger Supervisory Board:
Tel.: 07252 / 96-0 Dr. Franz Scherer
Fax: 07252 / 96-2222
Internet: http://www.seeburger.de Registergericht/Commercial Register:
e-mail: info(a)seeburger.de HRB 240708 Mannheim
_________________________________________________________________________
Dieses E-Mail ist nur fur den Empfanger bestimmt, an den es gerichtet
ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes
Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs-
au?erung ist die des Autors und stellt nicht notwendigerweise die
Sind Sie nicht der Empfanger, so haben Sie diese E-Mail irrtumlich
erhalten und jegliche Verwendung, Veroffentlichung, Weiterleitung,
Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt.
Weder die noch der Absender (Oliver Roess)
ubernehmen die Haftung fur Viren; es obliegt Ihrer Verantwortung,
die E-Mail und deren Anhange (0) auf Viren zu prufen.
The present email addresses only the addressee which it targets and
may contain confidential material that may be protected by the
professional secret. The opinions reflected herein are not necessarily
If you are not the addressee, you have accidentally got this email and
are not enabled to use, publish, forward, copy or print it in any way.
Neither the , nor the sender (Oliver Roess) are
liable for viruses, being your own responsibility to check this email
and its attachments (0) for this purpose.
_________________________________________________________________________
14 years