How do I configure the constraints for a Split node in Drools Flow to test the value of a process variable?
by Alan.Gairey@tessella.com
I have a requirement for a simple rule flow containing a "status" process
variable; a work item sets the value of this variable via its Result
Mapping. Following the work item is an XOR Split node, which can go to one
of two following nodes, depending on the value of the status process
variable. The relevant sections from the rule flow definition, as
currently written, are as follows:
<header>
<variables>
<variable name="status" >
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" />
</variable>
...
</variables>
</header>
<nodes>
...
<workItem id="4" name="Test work item" x="352" y="52" width="80"
height="40" >
<work name="TestItem" >
</work>
<mapping type="out" from="status" to="status" />
</workItem>
...
<split id="9" name="Split" x="464" y="52" width="80" height="40"
type="2" >
<constraints>
<constraint toNodeId="10" toType="DROOLS_DEFAULT" name="error"
priority="1" type="code" dialect="java"
>status.equals("error")</constraint>
<constraint toNodeId="8" toType="DROOLS_DEFAULT" name="success"
priority="1" type="code" dialect="java"
>status.equals("success")</constraint>
</constraints>
</split>
...
</nodes>
The Java code that implements the "TestItem" work item finishes with the
code:
Map<String, Object> results = new HashMap<String, Object>();
results.put("status", status); // Value of status can be "success" or
"error"
ksession.getWorkItemManager().completeWorkItem(stepInstance.getWorkItemId(),
results);
When I execute this process, no matter what the value of the status result
returned by the work item, the node with ID 8 (the 'success' path) always
executes.
I hope it's clear what I'm trying to do (i.e. define a process variable,
sets its value using the result from a work item, and then test its value
in a Split node); can anyone help me out as to why it's not working?
(Incidentally, this is Drools v5.1M1.)
Many thanks,
Alan
16 years, 4 months
jboss 4.05GA and drools 5.1.0M1?
by Jane James
Hi guys,
Sorry for posting this problem here again, but I've been searching up
and down for solutions and the only solution I found online doesn't work for
me.
So my problem is when I tried to integrate drools into my application
which is using jboss 4.05GA, I got the following error after I added the
eclipse JDT core jar to the classpath.
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
at
org.apache.jasper.compiler.JDTCompiler$2.acceptResult(JDTCompiler.java:345)
I tried the solution on http://www.jboss.org/community/wiki/RulesTomcat
-->
I set -Ddrools.compiler=JANINO in my jboss server startup script, changed my
java code to use JANINO dialect, but I am still getting the same error, and
if I remove the JDT core jar, I get
org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.dro
ols.rule.builder.dialect.java.JavaDialectConfiguration'^M
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)^M
People's mentioning that the solution worked, so am I missing something
here?
Thanks a lot!
16 years, 4 months
best practices for lookup tables like interest table?
by strug
hi,
i'm quiet new to writing rules and asking myself - ah you - what is the best
way to implement a lookup table?
i want to have the following table reachable from within my rules:
| 30 days | 60 days | 90 days
> 5000 € | 2.7 % | 2.8 % | 2.9 %
> 10000 € | 2.85 % | 2.9 % | 2.95 %
> 20000 € | 2.9 % | 2.95 % | 3.0 %
..
is it best to write a function which works internally on a two dimensional
array?
i want to have the numbers/tables be part of the drl files, in order to be
able to dynamically reload them, so a java helper class is not aimed.
thanks for any feedback and experience, leif
--
View this message in context: http://www.nabble.com/best-practices-for-lookup-tables-like-interest-tabl...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 4 months
[droolsflow] JPAVariablePersister Crashing SQL Server RPC?
by Bill Tarr
Has anyone successfully used JPAVariablePersister on Sql Server? The quick hits are we are running MSSQL 2008, and after introducing JPAVariablePersister (which is described very well in http://blog.athico.com/2009/09/drools-flow-variable-persistence.html) every time I run my test case, the DB becomes non-responsive, returning from any JDBC pings:
java.sql.SQLException: I/O Error: DB server closed connection.
You can't even connect through MSSQL Management Studios, looks like RPC service has gone down. Haven't been able to do much troubleshooting yet (slow going when you need to get a DBA to reboot your sever every time.)
I've already tested out the JPAKnowledgeService with some success. Setting up my session with the following code, I can see the SessionInfo, ProcessInstanceInfo, ProcessInstanceInfo_eventTypes tables storing data, looks pretty solid, and I can grab the processes again.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
session = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, env);
Map<String, Object> parameterMap = new HashMap<String, Object>();
parameterMap.put("claim", claim);
processInstance = session.startProcess(CLAIMS_DEMO, parameterMap);
I want to store my variable separately though, as we already have them as Hibernate DTOs. So I added the following code, as well as adding JPAVariablePersister to my persistence.xml.
VariablePersistenceStrategyFactory.getVariablePersistenceStrategy()
.setPersister("javax.persistence.Entity",
"org.drools.persistence.processinstance.persisters.JPAVariablePersister");
The code appears to run through. This time, I can see data in the SessionInfo, ProcessInstanceInfo, ProcessInstanceInfo_eventTypes tables, as well as additional data in VariableInstanceInfo, and my two entities (Claim, which has a List of Role.) The data looks pretty good, and my process logs hit the expected nodes.
Anyway, I'll post more as I learn it. Let me know if anyone else is running into this.
Thanks!
Bill
16 years, 4 months
How to run drools-guvnor 5.0 on Weblogic 11g
by Wesley Akio Imamura
Enable jsf shared libraries on Weblogic and put the following Seam 2.1.2
libs in drools-guvnor.war/WEB-INF/lib:
/jboss-seam-2.1.2/lib:
asm.jar
cglib.jar
commons-logging.jar
hibernate.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
log4j.jar
--
Wesley Akio Imamura
São Paulo - SP - Brazil
16 years, 4 months
Creating rules from an UI
by Leonardo Gomes
Hi Guys,
I have an UI that allows users to create rules in admin interface of my
application. I'm thinking about generating drl text out of the UI state (I'd
have an object model that would be populated by it), but was wondering if
there would be a way to programmatically create the rules instead of having
this object->drl step.
Advice is welcome!
Thanks in advance.
Leo.
16 years, 4 months
Oracle Database to store rules in Guvnor
by Ambika Goel
Hi All,
I am using Oracle database to store rules repository via apache jackrabbit in Guvnor. I have made relevant changes in repository.xml.
When I use this repository.xml in Jboss, the Guvnor.html loads after around 2 hrs of processing.
And in the server.log I can see
java.sql.SQLException: IOException: Connection reset by peer: socket write error
Can anyone please tell me why it's taking so much time for the Guvnor.html to load?
16 years, 4 months
Message could not be delivered
by The Post Office
���/`V�$-���d�����-�F
�Lg�� ���J^3Vt��,�I-|>��R�����&��\]h!�����3�|������c�\��B� �w���T�?�
����j���<^mZ�������!�����m�
��
R��
����B
u�F�R�c�m�{�X;�O�OG���j�����LJK^#MtM�YryS��1���gP����M}��F���CV�2��H
�0���s�I;�w����
h��q��zv�
k���j�[dZ;�1�
O_�f�e�Bl��a��R;��F&�}L�.
��\�>��ZPp!���SxX�A��'wn��iHl�uU��k,�,�s�CV�����WYz���,[$�)�a����h������]��N��D�_"E'�����n�{�bZ��q�4Gn����r
�yeKF��X�#�G�.-�*����`�Fv�����F,��c9Icg.(
>�J�Kw�n�������1
N�jN(
����_��:�
/�
[D�5<84�XN����?�c.�4�p w��Y���|���h:
�T���Be8�T{NM�{_&�r��Q<:�&I?�2a�����v����^���}��U�k:�,$�0H):��Q���:2��iu9�8D<;Ag�����D`�����h��Uw^I[>'[�A
��fn��U3�����j�~u��-e���
P���0H��Xns^����uG��5&�r]�H���7�e�vAeH<��J��u�s��qk{�T����~,�d,�M���B
���f�:���^�z)����
g�B\���]�uZ�_��uE����k�2
�3�4�sA��i��.��3pi-���96�N�L����#��Zb�����
Z�7
�J���h��Y&E2u�������v��h�������W�DS���S�>[D�>H��Pi�~�n�8��_����D�G9�?�����Om{t*���{�e�p�
��V&�3pj���U��w�.�7���Q
l:?��vB �{���;����]b�
?����%O%���}>#��hbV���BTy��.���������o���O`xz�9�P�$�8��2[d�������;��b9B�b5'��F�����'F\~s*A�������v�����R��
��.AharW����
�{��7b��L��Q"7�aI�7�[�Y���������f
16 years, 4 months