Re: [rules-users] DATE-EXPIRES in rule table ?

2010-08-06 Thread Michael Anstis
Yes, sorry. The DefaultRuleSheetListener is limited to the documented
meta-data.

Have a look at the source and follow your nose (to Rule); it doesn't look
too hard to add additional attributes.

2010/8/6 Arun Kumar 

> Thank you Michael. Sorry,  I  missed to mentioned in my mail that i had
> referred the documentation.
> I was wondering if DRL can have those attributes (like
> enabled,date-expires) then how can those property be set in spreadsheet.
>
> Looks like currently one few attributes are supported for spreadsheet,
> right ?
>
> Regards,
> Arun
>
> 2010/8/5 Michael Anstis 
>
>> The supported meta-tags are listed
>> http://downloads.jboss.com/drools/docs/5.1.0.34406.FINAL/drools-expert/html_single/index.html#d4e3129
>>  under
>> "Table 5.3. Column header keywords to use in the RuleTable".
>>
>> 2010/8/4 Arun Kumar 
>>
>>>  Hi,
>>>
>>> Am using a spreadsheet based rules.  Is it possible to set the attribute
>>>  like "date-expires", "enabled"
>>> in the spread sheet ?
>>> *
>>> *
>>> *Regards,*
>>> *Arun*
>>>  *
>>> *
>>>
>>> ___
>>> rules-users mailing list
>>>
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] IllegalStateException : DroolsJPAManager while calling session.dispose() method.

2010-08-06 Thread drooRam

i am facing the above problem when i tried to integrate hibernate with
drools.

Anyone used hibernate with drools? If so, what is the transaction manager
setting for hibernate + drools + tomcat i am trying to use the default
transaction manager or the jpa transaction manager implementation from
springlike the one below... but running into the above error







 








  





 

  





-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/IllegalStateException-DroolsJPAManager-while-calling-session-dispose-method-tp1027858p1030457.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MinaTaskClientHandler Reference Object

2010-08-06 Thread drooRam

Thanks for your prompt response

Exactly..this is what i pretty much wanted to try out... i referred to the
book drools 5 dev guide... It is mentioned that I need to use
MinaTaskClientHandler to retrieve task's status like claim, complete, wait
e.t.c..

At this point, I am not aware of writing the own client to look for those
stauses... can you please shed me some light on this with any available
example of writing the own client... I appreciate your help..thx again...
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/MinaTaskClientHandler-Reference-Object-tp1027255p1030205.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] MinaTaskClientHandler Reference Object

2010-08-06 Thread Kris Verlaenen
Why do you need that specific client?  I think you should just create your 
own client if you want to do operations like complete and claim?

Kris

- Original Message - 
From: "drooRam" 
To: 
Sent: Thursday, August 05, 2010 8:05 PM
Subject: [rules-users] MinaTaskClientHandler Reference Object


>
> How can I obtain reference to MinaTaskClientHandler through drools config
> tags? I mean .. we have  tag for KnowledgeBase...similarly, 
> do
> we have anything for MinaTaskClientHandler...
>
> I basically need to call the methods, TaskClient.claim, 
> TaskClient.complete
> etc thro MinaTaskClientHandler.getClient().
>
> Please let me know how can i obtain MinaTaskClientHandler thro config or
> snippet ?
>
> -drooRam
> -- 
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/MinaTaskClientHandler-Reference-Object-tp1027255p1027255.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5.1.0 install minor issue

2010-08-06 Thread Kris Verlaenen
Patricia,

The build.properties in the install folder allows you to update the url and 
version of drools you're using.  But I'll update trunk to start using 5.2 
already.

Thx,
Kris

  - Original Message - 
  From: Patricia Bogoevici 
  To: Rules Users List 
  Sent: Thursday, August 05, 2010 7:13 PM
  Subject: [rules-users] Drools 5.1.0 install minor issue


Hi all,

Just wanted to let know that there is a minor issue on the installation 
script for 5.1.0. When running the task:

ant install.demo

It fails with this error:
drools-5.1.0/install/build.xml:158: Can't get 
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/drools-5.1.0.SNAPSHOT-guvnor.war

Checking the download location, the last successful build is 
drools-5.2.0.SNAPSHOT-guvnor.war. This is a minor issue, as one can manually 
download the expected war, but thought to mention it.



The fix would be to use
   




--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Bug: ActivationCreatedEvent - Activation: InitialFactImpl in Object set

2010-08-06 Thread Wolfgang Laun
Given this rule

rule "show no gaps"
when
not Gap()
then
System.out.println( "No gaps!" );
end

the ActivationCreatedEvent references an Activation, where the list of
fact handles (getFactHandles) contains one element, but its Object is null:
   Fact null @0:0:27032609:1306428912:0:DEFAULT
But the list of objects (getObjects) returns a list where there *is* an
object:
   Object (org.drools.reteoo.InitialFactImpl):
org.drools.reteoo.initialfacti...@4dde85f0

I think that this should be changed; neither a fact handle nor an object
should
be returned if there are no user objects participating in the activation.

Cheers
Wolfgang
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools Flow - Dependency Injection

2010-08-06 Thread jawa

Hi,

I am writing a custom workItem handler in drools flow and want to access my
Stateless session bean from there. I will deploy my drools project to JBoss
so can I use @EJB annotation to get my stateless bean injected by jboss with
in WorkItemHandler?

Secondly I'll call my flow from with in a Stateless session bean. Is it ok?
Or does drools use multi threading? As multi threading is not recommended to
be used in EJBs?

Thanks
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-Dependency-Injection-tp1030054p1030054.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Edit global imports through eclipse plugin

2010-08-06 Thread Kris Verlaenen
Imports are always defined globally (i.e. at the process level).  So simply 
opening up any expression editor and adding the imports there should allow 
you to add imports.

Kris

- Original Message - 
From: "drooRam" 
To: 
Sent: Thursday, August 05, 2010 8:24 PM
Subject: [rules-users] Edit global imports through eclipse plugin


>
> how can i edit global imports in workflow rf file through eclipse 
> plugin...
> not manually...
>
> I would like to add global imports to workflow file through eclipse ??
>
> -drooRam
> -- 
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/Edit-global-imports-through-eclipse-plugin-tp1027368p1027368.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Can't see process in gwt-console after changingguvnor to authenticator

2010-08-06 Thread Kris Verlaenen
Han Ming,

The gwt-console uses the authentication as defined in the ChangeSet.xml inside 
the drools-gwt-console-{version}.jar in the gwt server war:



I guess you could change that or make sure the credential that is specified 
here works for your configuration, would that help?

Kris

  - Original Message - 
  From: Han Ming Low 
  To: Rules Users List 
  Sent: Thursday, August 05, 2010 10:28 AM
  Subject: [rules-users] Can't see process in gwt-console after changingguvnor 
to authenticator


  Hi,
   
  I'm having problems with seeing the process in gwt-console. :p
   
  This time the difference is I change the guvnor components.xml authenticator 
to "other" and role based authorization as "true" and set the login-config.xml 
authentication to a users.properties
   
  The steps and difference in setup I have made is as follows
  1) change guvnor and flow persistence to mysql instead of h2 
  2) Build defaultPackage, ABLE to see process in Drools Flow console
  3) Shutdown both human task and jboss
  4) Configure role-base authorization and users.properties file authentication
  5) Start human.task and jboss
  6) Not able to see process in Drools Flow console
  7) Rebuild defaultPackage
  8) Not able to see process in Drools Flow console
  9) Restart both human task and jboss
  10) Not able to see process in Drools Flow console
  11) Delete process in guvnor and delete archive
  12) Copy process from local file system to guvnor through WebDAV
  13) Build defaultPackage
  14) Not able to see process in Drools Flow console
  15) Shutdown both human task and jboss
  16) Change login back to defaultAuthenticator.authenticate
  17) Start human.task and jboss
  18) ABLE to see process again
   
  What should I do to allow the process to be seen when other authenticator is 
used?
  Any advice is greatly appreciated.

  Thanks.


  Han Ming



--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5 for process simulation

2010-08-06 Thread Kris Verlaenen
Jonathan,

Drools supports a simulated clock (unified for rules and processes), so this 
should allow you to build a simulator.  The code that Mark is referring to is 
just something built on top that allows you to define a simulation as a 
sequence of commands that are sent to the session at specific time points etc.  
You could try to reuse this as is if it would be useful in your case, or simply 
try to do something similar.  In any case, there shouldn't be any technical 
difficulties that should prevent you from doing something like you described I 
think (just not all out-of-the-box).

Kris

  - Original Message - 
  From: Labin, Jonathan W. 
  To: Rules Users List 
  Sent: Wednesday, August 04, 2010 7:22 PM
  Subject: Re: [rules-users] Drools 5 for process simulation


  Mark,

   

  Thanks for the link.  I'll look into it.  I'm not sure I'll have time to 
learn enough about Drools to actually modify it for this project.  

  Do you think it's not practical to attempt to build a simulator without 
modifying Drools?

   

  Thanks,

   

  Jonathan

   

  From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Mark Proctor
  Sent: Wednesday, August 04, 2010 11:33 AM
  To: rules-users@lists.jboss.org
  Subject: Re: [rules-users] Drools 5 for process simulation

   

  On 04/08/2010 16:20, Labin, Jonathan W. wrote: 

Drools users, I am currently researching Drools 5 as a potential toolkit to 
enable my nextproject.  I have read through the Documentation for Drools 
Expert, Flow andskimmed through Fusion and I believe that Drools looks it 
provides manyfeatures we need.  However, I am concerned about one aspect of the 
way thatthe system seems to operate and was wondering if anyone could point me 
to asection of documentation (chapter of the manual / wiki / external 
how-toblog post... whatever) that will clear things up for me. I would like to 
use Drools Flow to define behaviors of agents as FlowProcesses to create an 
agent-based simulation.  This application requiresthat the processes are kept 
synchronized with each other by a simulated(faster than real time) clock. Is 
there a Drools mechanism that enables this?  Would I need to create a setof 
WorkItemHandler classes that perform the synchronization manually?  Iswhat I 
want to do not really practical within the Drools Flow framework?I have 
something prototyped and it works, but I need to refactor the api and make it 
much simpler. so if you use it, expect it to change a lot and get a lot simpler 
and better :)
  http://blog.athico.com/2009/07/drools-simulation-and-test-framework.html

  Mark



 Thanks in advance, Jonathan Labin  
___rules-users mailing 
listrules-us...@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
 



--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Instructions for upgrading designer.war?

2010-08-06 Thread Kris Verlaenen
Han Ming,

Here is the full list of changes that were made to the original war that is 
located here:
http://www.intalio.org/public/maven2/com/intalio/bpms/web/designer/1.0.0.010/

Note that most of the changes in the src dir (as described below) were to get 
the import/export functionality of Oryx working.  If you're serious about 
helping out, just let me know, there is lots you could help with, like 
improving the import/export for other cases, maybe updating to the BPMN 2.0 
beta 2 format, etc.

Kris

-- Changes --

unzip in deploy folder, in folder designer.war

in WEB-INF/web.xml, enable tomcat settings for DirectoryListingServlet
removed WEB-INF/lib/javax.servlet-*.jar
added slf4j-api and slf4j-jdk14 to WEB-INF/lib

remove console.log statement from oryx.js
replace enterprise-repository in oryx.js with drools-guvnor

moved designer.war/lib/bpmn2 to designer.war/WEB-INF/lib/bpmn2

small fragment in oryx.js in construct of ORYX.Editor for setting id as uuid

remove "oryx_editor_header" init + ref from Oryx.js

Replace some BPMN2 import/export classes in WEB-INF/classes:

de/hpi/bpmn2_0/model/FlowElement.java
de/hpi/bpmn2_0/model/activity/Task.java
de/hpi/bpmn2_0/model/activity/type/BusinessRuleTask.java  
de/hpi/bpmn2_0/model/activity/type/ReceiveTask.java  
de/hpi/bpmn2_0/model/activity/type/SendTask.java 
de/hpi/bpmn2_0/model/activity/type/UserTask.java
de/hpi/bpmn2_0/model/activity/type/ManualTask.java
de/hpi/bpmn2_0/model/activity/type/ScriptTask.java   
de/hpi/bpmn2_0/model/activity/type/ServiceTask.java
de/hpi/bpmn2_0/model/diagram/BpmnNode.java
de/hpi/bpmn2_0/model/gateway/ComplexGateway.java 
de/hpi/bpmn2_0/model/gateway/ExclusiveGateway.java  
de/hpi/bpmn2_0/model/gateway/InclusiveGateway.java
de/hpi/bpmn2_0/model/gateway/EventBasedGateway.java  
de/hpi/bpmn2_0/model/gateway/Gateway.java   
de/hpi/bpmn2_0/model/gateway/ParallelGateway.java
de/hpi/bpmn2_0/transformation/BPMN2DiagramConverter.java
de/hpi/bpmn2_0/model/gateway/Diagram2BpmnConverter.java
org/oryxeditor/server/EditorHandler.java
org/oryxeditor/server/diagram/JSONBuilder.java
  - Original Message - 
  From: Han Ming Low 
  To: rules-users@lists.jboss.org 
  Sent: Wednesday, August 04, 2010 12:09 PM
  Subject: [rules-users] Instructions for upgrading designer.war?


  Hi,

  I understand that the designer.war is a project by intalio.

  When looking at the source for the war at 
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/designer/designer-src.war,
 I saw the changes to be made to make it compatible with Drools.

  I think I can do some of the steps like
  1) changing the web.xml to use tomcat instead of jetty
  2) added slf4j library
  3) move lib/bpmn2 library to web-inf/lib
  4) changes to oryx.js that involve 
  - commenting out the header
  - commenting out the log
  - change the repository url from "/designer/uuidRepository?uuid="+ uuid to 
"/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI?action=load&uuid="+ uuid

  However, I'm not sure what is the BPMN2 import/export classes to replace in 
WEB-INF/classes

  Can someone could tell me which are the classes?
  I can also help to update the designer. :)

  Thanks.


  Han Ming


--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools BPMN 2.0 service task error for process editedusing Oryx

2010-08-06 Thread Kris Verlaenen
Patricia,

Note that the service task should contain an operationRef that refers to an 
operation defined as part of an interface in your process.  The process would 
probably open fine if you included that element, though I must admit that it 
should probably be able to handle incomplete process specifications as well 
(but this is still work in progress, especially since Oryx is still using the 
old BPMN 2.0 beta1 format).

Note that the service task concept in BPMN2 matches with the work item node in 
Drools Flow.  So while the editor contains 2 predefined service tasks, is it 
possible to define your own, as explained in the documentation here:
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch.Domain_Specific_Processes.html

Kris

  - Original Message - 
  From: Patricia Bogoevici 
  To: Rules Users List 
  Sent: Tuesday, August 03, 2010 9:47 PM
  Subject: [rules-users] Drools BPMN 2.0 service task error for process 
editedusing Oryx


Hi all,

I am using Drools 5.1 release, and I am testing the BPMN process 
definition created with Oryx designer. The main problem I ran into is the 
serviceTask element. I cannot open the  process file created with Oryx 
designer, in Eclipse, as it complains about this error:

"java.lang.IllegalArgumentException: No interfaces found at 
org.drools.bpmn2.legacy.beta1.ServiceTaskHandler.handleNode(ServiceTaskHandler.java:35)"
 

Below is a snippet from the BPMN 2.0 xml file got using Oryx for 
serviceTask. I also attached the whole xml file, in case that help. 

I appreciate a lot if someone can help me with this issue, as I am 
practically stuck at this point. 

On the other hand, I noticed that Drools Eclipse workflow editor allows 
only for 2 types of service tasks: Email and Log. Is that a limitation of the 
Eclipse workflow editor, or the serviceTask is not implemented in Drools BPMN 
2.0? 
Can I use serviceTask BPMN 2.0 element in Drools workflow? 


** serviceTask from Oryx process **



Thanks in advance,
Patricia
   




--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Is nested loops possible ?

2010-08-06 Thread Swindells, Thomas
I'm not sure if it is possible or not but personally I wouldn't do it.
I would have both Order and CustomerOrder as facts within your knowledge base 
(and probably orderItem as well).

I would add a "total" field to Order and write a rule to maintain this value by 
accumulating the itemAmount of all the orderitems. Similarly I would have 
another rule on CustomerOrder to accumulate the value of the "total" of each of 
the orders. When an Order is updated this would automatically trigger the 
re-calculation of the CustomerOrder total.

Seperately I would have rules written against these fields which are then 
trivial to write and will make it much easier to cater for future requirements 
(eg in the future if customer name is "Mr Rich" then allow a max order value of 
XYZ).

If you can't modify your core objects then you can also implement it by having 
a separate fact which links the object (CustomerOrder or order) to the order 
value) eg ValueFact (source, value).

Thomas

Ps.
It is a really bad idea to try and use doubles to store currency amounts. 
Doubles do not store decimal numbers precisely, this means £0.30 may actually 
be stored as 0.30004, and if you keep add £0.10 100 times you may 
end up with £9.99 not £10.00. You should either use integer numbers (store 
pence not fractions of pounds) or use big decimal.  
http://www.velocityreviews.com/forums/t139008-java-double-precision.html shows 
the problem in action.

> -Original Message-
> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> boun...@lists.jboss.org] On Behalf Of Dinesh kumar
> Sent: 06 August 2010 11:58
> To: rules-users@lists.jboss.org
> Subject: [rules-users] Is nested loops possible ?
>
>
> Hi,
>
> I am having a problem in iterating a list inside a list.
>
> I am having the following business scenario.
>
> Public Class CustomerOrder {
>
> private String customerName;
>
> private ArrayList orderList;
>
> }
>
>
> Public Class Order {
>
> private String orderId;
>
> private String orderTime;
>
> private ArrayList orderList;
>
> }
>
>
> Public Class OrderItem {
>
> private String itemName;
>
> private Double itemAmount;
>
> }
>
>
> I need to find the total order amount for each order and the sum of all
> order.
> My rule is like individual orders should not exceed a 1 and total order
> amount of all customers should not exceed 10.
>
> For this, I need to iterate ArrayList orderList and during each
> iteration , I need to iterate ArrayList orderList. Is this
> possible in Drools ?
>
>
> I tried something like this. But it doesn't seem to be working.
> when
>
> ClaimRegistration($orderList: orderList)
>
> Number( $count : intValue > 0)
> from accumulate(Order(orderId== "order1"
> &&
>  Number( doubleValue > 1 )
>  from accumulate( OrderItem( $value : itemAmount),
>  init( double total = 0; ),
>  action( total += $value; ),
>  reverse( total -= $value; ),
>  result( total ) )
>
>
> ) from $orderList,count(1))
>
>
> then
>
> Sysout(",");
>
>
>
> It would be of great help if any one can give suggestions to solve this.
>
> Is nested loops possible in Drools ?
>
>
> Regards,
> Dinesh
>
> --
> View this message in context: http://drools-java-rules-
> engine.46999.n3.nabble.com/Is-nested-loops-possible-tp1029366p1029366.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Is nested loops possible ?

2010-08-06 Thread Dinesh kumar

Hi,

I am having a problem in iterating a list inside a list. 

I am having the following business scenario.

Public Class CustomerOrder {

private String customerName;

private ArrayList orderList;

}


Public Class Order {

private String orderId;

private String orderTime;

private ArrayList orderList;

}


Public Class OrderItem {

private String itemName;

private Double itemAmount;

}


I need to find the total order amount for each order and the sum of all
order. 
My rule is like individual orders should not exceed a 1 and total order
amount of all customers should not exceed 10.

For this, I need to iterate ArrayList orderList and during each
iteration , I need to iterate ArrayList orderList. Is this
possible in Drools ?


I tried something like this. But it doesn't seem to be working.
when

ClaimRegistration($orderList: orderList)

Number( $count : intValue > 0) 
from accumulate(Order(orderId== "order1"
&& 
 Number( doubleValue > 1 )
 from accumulate( OrderItem( $value : itemAmount),
 init( double total = 0; ),
 action( total += $value; ),
 reverse( total -= $value; ),
 result( total ) )


) from $orderList,count(1))


then

Sysout(",");



It would be of great help if any one can give suggestions to solve this.

Is nested loops possible in Drools ?


Regards,
Dinesh

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-nested-loops-possible-tp1029366p1029366.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] DATE-EXPIRES in rule table ?

2010-08-06 Thread Arun Kumar
Thank you Michael. Sorry,  I  missed to mentioned in my mail that i had
referred the documentation.
I was wondering if DRL can have those attributes (like enabled,date-expires)
then how can those property be set in spreadsheet.

Looks like currently one few attributes are supported for spreadsheet, right
?

Regards,
Arun

2010/8/5 Michael Anstis 

> The supported meta-tags are listed
> http://downloads.jboss.com/drools/docs/5.1.0.34406.FINAL/drools-expert/html_single/index.html#d4e3129
>  under
> "Table 5.3. Column header keywords to use in the RuleTable".
>
> 2010/8/4 Arun Kumar 
>
>> Hi,
>>
>> Am using a spreadsheet based rules.  Is it possible to set the attribute
>>  like "date-expires", "enabled"
>> in the spread sheet ?
>> *
>> *
>> *Regards,*
>> *Arun*
>>  *
>> *
>>
>> ___
>> rules-users mailing list
>>
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Math calculations on attributes in WHEN section of rules.

2010-08-06 Thread tom ska
Thanks for answer. I will look for info about eval (Expert User Guide - I
know where ;) ) But, even, if this works, what with Guvnor, and GUI based
rule constructor? How can I do it with Guvnor GUI?

2010/8/6 Swindells, Thomas 

>  Have you looked at eval()?
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *tom ska
> *Sent:* 06 August 2010 10:49
> *To:* rules-users@lists.jboss.org
> *Subject:* [rules-users] Math calculations on attributes in WHEN section
> of rules.
>
>
>
> Hello,
> what I want to do, is to calculate on object's attributes in WHEN section
> of rule. Can I do it?
>
> For example:
>
> class CObj
> {
>   private int k;
>   private int n;
>
>   // setters and getters
> }
>
> Now what I want to do is:
>
> rule "r1"
> when
> p : CObj ( k + n <= 1000)
> then
> System.out.println("We love Drools :)");
> end
>
> Why can't I construct conditions like in Java, or C++ (with calculations in
> conditions)? How can I achieve my goal?
>
> Thx,
> Tom.
>
> --
>
>
> **
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmas...@nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
> 4EX, United Kingdom. A company registered in England and Wales. Registered
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Math calculations on attributes in WHEN section of rules.

2010-08-06 Thread Swindells, Thomas
Have you looked at eval()?

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of tom ska
Sent: 06 August 2010 10:49
To: rules-users@lists.jboss.org
Subject: [rules-users] Math calculations on attributes in WHEN section of rules.

Hello,
what I want to do, is to calculate on object's attributes in WHEN section of 
rule. Can I do it?

For example:

class CObj
{
  private int k;
  private int n;

  // setters and getters
}

Now what I want to do is:

rule "r1"
when
p : CObj ( k + n <= 1000)
then
System.out.println("We love Drools :)");
end

Why can't I construct conditions like in Java, or C++ (with calculations in 
conditions)? How can I achieve my goal?

Thx,
Tom.



**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Math calculations on attributes in WHEN section of rules.

2010-08-06 Thread tom ska
Hello,
what I want to do, is to calculate on object's attributes in WHEN section of
rule. Can I do it?

For example:

class CObj
{
  private int k;
  private int n;

  // setters and getters
}

Now what I want to do is:

rule "r1"
when
p : CObj ( k + n <= 1000)
then
System.out.println("We love Drools :)");
end

Why can't I construct conditions like in Java, or C++ (with calculations in
conditions)? How can I achieve my goal?

Thx,
Tom.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Another solution for: Detecting more than 3 occurrences within 1 hour

2010-08-06 Thread Wolfgang Laun
2010/8/5 Tina Vießmann 

>  Thank you for this approach, Wolfgang. That sounds great.  :)
> I just have some further question about your solution.
>
> #1
> I'm thinking about an approach without the need modifying things outside
> the drl file. Is something like that doable?
> Because I have to create the watcher class? (I don't expect it to be, but
> why not ask. ;))
>

The DRL language provides "declare" (see Section 4.7 in the Expert manual).
Metadata is described in the Fusion manual.



>
> #2
>
> (What and count are somewhat redundant, but this avoids clumsy patterns.)
>
> Am I right that what and count have to be defined as global variables and
> initialized using setGlobal() (from a part of the java application)?
>

No! See the Java snippet "class Watcher". (If you use declare, you'll have
to do the initializations after creation.)


>
> #3
>
> rule addEvent
> when
>  $watcher : Watcher( $eventA : what, $set : valueSet )
>  $eventB : Value( this after[0ms,1h] $eventA  &&
>   //   this != $eventA  &&  ### set
> includes Watcher.what
>
>  eval(valueExceededLimit($eventB.getAlarms()) && ! $set.contains( this ) ) )
>
> I'm sorry, could you explain to me the part of $eventB in sentences,
> please? I've got confused by the comments... :(
>

If there is
a Watcher watching $eventA and with a set of related events $set,
and
a Value less than 1hr later than $eventA and with more alarms than limit and
Watcher's $set does not contain this Value
then...

The line I commented out isn't necessary as I propose to add the very 1st
event tied to the Watcher to this Watcher's list.


>
> Thank you very much! :)
>

You're welcome.
-W


> Tina
>
>
>
> Basic idea: associate a Watcher with each event.
>
> class Watcher {
>Value what;
>int count = 1;
>Set valueSet = new HashSet();
>Watcher( Value first ){
>   valueSet.add( what = first );
>}
>//...
> }
>
> And now the rules:
>
> rule attachWatcher
> when
>   $event : Value( eval(parameterValueExceededLimit($eventA.getAlarms())) )
>   not( Watcher( what == $event ) )
> then
>   insert( new Watcher( $event ) );
> end
>
> rule addEvent
> when
>  $watcher : Watcher( $eventA : what, $set : valueSet )
>  $eventB : Value( this after[0ms,1h] $eventA  &&
>   //   this != $eventA  &&  ### set
> includes Watcher.what
>
>  eval(valueExceededLimit($eventB.getAlarms()) && ! $set.contains( this ) ) )
> then
>   modify( $watcher ){
>   setValueList( $watcher.getValueSet().add( $eventB ),
>   setCount( $watcher.getCount() + 1 )
>   }
> end
>
> rule testLimit
> when
>$watcher : Watcher( count > Limit )
> then
>   // raise hell,
>   // probably: get rid of all in $watcher.set, and $watcher
> end
>
> (What and count are somewhat redundant, but this avoids clumsy patterns.)
>
> Watcher should be declared as Event, with @expires, so they'll disappear
> with the (primary) Event each one is watching.
>
> Cheers
> -W
>
>
> 2010/8/5 Tina Vießmann 
>
>> Hi,
>>
>> I'm working on thinking in Drools rules. Right now I'm trying to solve
>> this:
>>   The rule shall fire if *a special event occurs more than 3 times within
>> 1 hour*.
>>
>> My *first thought of a solution* was to count the count the detected
>> events using a counter. But the counter has to be a global variable, hasn't
>> it? And global variables are not to be used to frequently, aren't they?
>> And global variables must always be initialized from outside the rules
>> file, don't they?
>>
>> Because of these thoughts I've looked for a *different solution without
>> global variables*. I came up with:
>>
>> function boolean valueExceededLimit(Set alarmSet) {
>>//
>> }
>>
>> rule "more than 3 occurs within 1 hour"
>>
>> when
>> // event #1
>> $eventA : Value(
>> eval(parameterValueExceededLimit($eventA.getAlarms())) )
>> // event #2
>> $eventB : Value( this after[0ms,1h] $eventA  &&
>> this != $eventA  &&
>>
>>  eval(valueExceededLimit($eventB.getAlarms())) )
>> // event #3
>> $eventC : Value( this after[0ms,1h] $eventA  &&
>> this != $eventA  &&
>> this != $eventB  &&
>>
>>  eval(valueExceededLimit($eventC.getAlarms())) )
>> // event #4  ->  4 > 3
>> $eventD : Value( this after[0ms,1h] $eventA  &&
>> this != $eventA  &&
>> this != $eventB  &&
>> this != $eventC  &&
>>
>>  eval(valueExceededLimit($eventD.getAlarms())) )
>>
>> then
>> // ... do something ...
>>
>> end
>>
>>
>> More than 3 is kind of a doable task. But I think of this solution as
>> heavy in case its needed to detect a larger number of events. I would be
>> thankful for other approaches to the problem.
>>
>>
>> Thanks :)
>> Tina
>>
>> _

Re: [rules-users] Drools Gunvor and Oryx integration

2010-08-06 Thread Han Ming Low
Hi,

The reason is that the Evaluation.bpmn is 2.0 while the version supported by
oryx is 2.0 beta.
Thus, Drools is more advance compare to oryx.

But as for running the bpmn, drools engine can still do it.

In order to have a version that will open up both in drools and oryx, you
can try the following
1) goto http://localhost:8080/designer/editor
2) create your own process
3) use the export button to either show or download a BPMN 2.0 DI XML
4) now you have a bpmn file that can be used by drools and oryx in drools
which you can upload as the Evaluation.bpmn

Hope this helps.


Han Ming

2010/8/6 Patricia Bogoevici 

>   Hi,
>
>
> I followed the steps provided but the Evaluation.bpmn file does not load
> correctly into the Oryx editor. Looking into the logs, it seems like Oryx
> complains because the BPMN schema  namespace is different from what it
> expects. While Drools is using this: http://www.omg.org/spec/BPMN/20100524,
> Oryx editor is expecting this: http://schema.omg.org/spec/BPMN/2.0.
>
> Stack trace snippet:
> ERROR [STDERR] javax.xml.bind.UnmarshalException: unexpected element (uri:"
> http://www.omg.org/spec/BPMN/20100524/MODEL";, local:"definitions").
> Expected elements are <{
> http://schema.omg.org/spec/BPMN/2.0}activityResource
> >,<{http://bpmndi.org}activityShape>,<{
> http://schema.omg.org/spec/BPMN/2.0}adHocSubProcess
> >
> ……
>
>
> I changed the BPMN 2.0 schema for Evaluation.bpmn to match the one the
> designer expects, and imported the file manually into the designer
> (localhost:8080/designer/editor), to check if that fixed the problem. And it
> seems that fixed it, although, now I got a different error:
>
> 2010-08-06 02:29:55,482 ERROR [STDERR] java.lang.IndexOutOfBoundsException:
> Index: 0, Size: 0
> 2010-08-06 02:29:55,482 ERROR [STDERR] at
> java.util.ArrayList.RangeCheck(ArrayList.java:547)
> 2010-08-06 02:29:55,482 ERROR [STDERR] at
> java.util.ArrayList.get(ArrayList.java:322)
> 2010-08-06 02:29:55,482 ERROR [STDERR] at
> org.oryxeditor.server.BPMN2_0Importer.getJsonFromBpmn20Xml(BPMN2_0Importer.java:99)
> 2010-08-06 02:29:55,482 ERROR [STDERR] at
> org.oryxeditor.server.BPMN2_0Importer.doPost(BPMN2_0Importer.java:66)
> ……
>
>
> What I changed to Evaluation.bpmn was the root element which is now:
>
>   targetNamespace="http://www.jboss.org/drools";
>  typeLanguage="http://www.java.com/javaTypes";
>  expressionLanguage="http://www.mvel.org/2.0";
>  xmlns="http://schema.omg.org/spec/BPMN/2.0";
>  xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
>  xs:schemaLocation="http://schema.omg.org/spec/BPMN/2.0BPMN20.xsd";
>  xmlns:g="http://www.jboss.org/drools/flow/gpd";
>  xmlns:tns="http://www.jboss.org/drools";>
>
>
> I will download the source code for the designer, and try to debug this
> issue, but I wonder if any of you know what this problem is about and can
> advise on what to do next.
>
> Thanks,
>
> Patricia
>
>
>
>
> --- On *Wed, 7/28/10, Mark Proctor * wrote:
>
>
> From: Mark Proctor 
> Subject: Re: [rules-users] Drools Gunvor and Oryx integration
> To: rules-users@lists.jboss.org
> Date: Wednesday, July 28, 2010, 11:26 PM
>
>   On 29/07/2010 04:05, Han Ming Low wrote:
>
> Hi,
>
> Just for information.
>
> In order for the Oryx integration to work, you need to install the oryx
> designer available from
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/designer/
>
> I would add that the .war is provided by the Antoine Toulme, who maintains
> a branch at github, with the aim of merging changes back into the main oryx
> tree, and you can get the latest version there:
> http://github.com/atoulme
> http://github.com/intalio/process-designer/
>
>
>
> Install the designer.war into JBoss and make sure you can access it from
> localhost:8080/designer
>
> Then, in the download drools-5.1.0.CR1-install.zip, you should see a
> Evaluation.bpmn
> Copy this file into your Guvnor repository through WebDAV into the
> defaultPackage (note : not any other package)
> Once you have done this, you should see the process under the
> defaultPackage Processes in Guvnor.
> And when you double click on it, you should have the bpm loaded in the
> designer.
>
> A side note is that the designer will only load bpmn file, for obvious
> reason that the rf format is not supported by oryx.
> So, you cannot create a process from Guvnor and load it in the designer
> because the default type is rf.
>
> Hope this helps.
>
>
> Han Ming
>
> 2010/7/28 Patricia Bogoevici 
> http://mc/compose?to=patriciabogoev...@yahoo.com>
> >
>
>   Hi all,
>
> I found a preview of the Guvnor /Oryx integration here (
> http://blog.athico.com/2010/06/browser-based-bpmn2-authoring-in-drools.html
> ).
>
> I tried Drools Guvnor 5.1.0.CR1, but there is nothing about this
> integration, one can only