[rules-users] FW: FW: Drools in non-eclipse environment

2011-06-20 Thread Abhay B. Chaware
Any ideas guys ?

-abhay

-Original Message-
From: Abhay B. Chaware
Sent: Friday, June 17, 2011 7:47 AM
To: Rules Users List
Subject: RE: [rules-users] FW: Drools in non-eclipse environment

I tried that .. I was able to reproduce same crash on android emulator .. 
default heap is 24M ( like any android device ).  I tried raising it upto 400Mb 
in steps, but it failed everytime with same error .. but was able to sustain 
longer everytime i increase the heap. Seems that I can not go beyond 400m .. 
the emulator crashed !

-abhay

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Michael Anstis [michael.ans...@gmail.com]
Sent: Thursday, June 16, 2011 6:48 PM
To: Rules Users List
Subject: Re: [rules-users] FW: Drools in non-eclipse environment

In a meeting right now, but you could try Googling for ways to increase the 
heap size on Android?

I did a very quick search and it looked possible

2011/6/16 Abhay B. Chaware 
mailto:abhay.chaw...@kpitcummins.com>>
Thanks Mike !
It is failing after few seconds ( about 30-35 secs ) after I get the “Creating 
Package Builder ..” line on the console …I am not getting the next debug 
statement, but getting the exception instead. I am seeing a lot of garbage 
collection calls right after “Creating Package Builder …” line in the console 
before crashing, which tells me that the issue is probably related to 
heap/memory.
Here’s the snippet from my code.
System.out.println (“Creating Package Builder .. ”);
PackageBuilder builder = new PackageBuilder( cfg0 );
builder.addPackageFromDrl(new InputStreamReader(is)); 
// “is” is input stream for drl file
RuleBase ruleBase  = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
System.out.println (“Package added to rule base.. ”);
-abhay

From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org]
 On Behalf Of Michael Anstis
Sent: Thursday, June 16, 2011 6:17 PM
To: Rules Users List
Subject: Re: [rules-users] FW: Drools in non-eclipse environment

Congratulations Abhay!

When does your application crash? e.g. building package, inserting facts, 
firing all rules?


I'm not sure how much help I can be, but your advice might help others.

Unfortunately I'm not able to analyse the Android log :(

Cheers,

Mike

2011/6/16 Abhay B. Chaware 
mailto:abhay.chaw...@kpitcummins.com>>
I am have now managed to get past all the compiler errors for Drools on android 
.. ( I think ) ☺ .

My app is failing ( crashing ) when run on android device. Looking at the log, 
appears to be a heap memory problem, can anyone see anything suspicious here in 
the android log, that may point to the drools code as suspect ?


I/DEBUG ( 1280): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1280): Build fingerprint: 
'samsung/GT-I9003/GT-I9003/GT-I9003:2.2.1/FROYO/XXKB3:user/release-keys'
I/DEBUG ( 1280): pid: 11341, tid: 11341 >>> com.first <<<
I/DEBUG ( 1280): signal 11 (SIGSEGV), fault addr 004c
I/DEBUG ( 1280): r0  r1 4831de40 r2  r3 
I/DEBUG ( 1280): r4 809a2400 r5 00240d00 r6  r7 cd28
I/DEBUG ( 1280): r8 80917040 r9 cd28 10 430cb970 fp bea15728
I/DEBUG ( 1280): ip  sp bea153a8 lr 809681f7 pc 8096809c cpsr 8070
I/DEBUG ( 1280): d0 65643a64696f7262 d1 0065006400610075
I/DEBUG ( 1280): d2 4ba11af20567 d3 4b815b67
I/DEBUG ( 1280): d4 0065007400730079 d5 00610050002e006d
I/DEBUG ( 1280): d6 006c004300680074 d7 3eab3f80
I/DEBUG ( 1280): d8  d9 
I/DEBUG ( 1280): d10  d11 
I/DEBUG ( 1280): d12  d13 
I/DEBUG ( 1280): d14  d15 
I/DEBUG ( 1280): d16 ade46221 d17 0064002f005b0072
I/DEBUG ( 1280): d18 002f006100740061 d19 002f007000700061
I/DEBUG ( 1280): d20 0073002e006b0069 d21 0065007400730079
I/DEBUG ( 1280): d22 00610050002e006d d23 006c004300680074
I/DEBUG ( 1280): d24 3ff0 d25 
I/DEBUG ( 1280): d26  d27 
I/DEBUG ( 1280): d28  d29 
I/DEBUG ( 1280): d30  d31 
I/DEBUG ( 1280): scr 8012
I/DEBUG ( 1280):
I/DEBUG ( 1280): #00 pc 0006809c /system/lib/libdvm.so
I/DEBUG ( 1280): #01 pc 000681f2 /system/lib/libdvm.so
I/DEBUG ( 1280): #02 pc 00068238 /system/lib/libdvm.so
I/DEBUG ( 1280): #03 pc 000690a6 /system/lib/libdvm.so
I/DEBUG ( 1280): #04 pc 00061a0c /system/lib/libdvm.so
I/DEBUG ( 1280): #05 pc 00063f1a /system/lib/libdvm.so
I/DEBUG ( 1280): #06 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #07 pc

Re: [rules-users] can not use mvel to access object in a map in THEN

2011-06-20 Thread Wolfgang Laun
On 21 June 2011 05:29, James Gu  wrote:
> Is there anyone can help on this?

No.

You neither tell us the Drools version nor the exact stack trace, let
alone provide all code required to reeproduce the error.

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


Re: [rules-users] can not use mvel to access object in a map in THEN

2011-06-20 Thread James Gu
Is there anyone can help on this?

--
View this message in context: 
http://drools.46999.n3.nabble.com/can-not-use-mvel-to-access-object-in-a-map-in-THEN-tp3062652p3089104.html
Sent from the Drools: User forum 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] OutOfMemoryError happens when dynamic loading of Rules from Guvnor frequently

2011-06-20 Thread Jason Smith
Try using JMAP to get a heap dump, and then find an analysis tool you like to 
find the memory leak.  It is probably due to a memory leak in MVEL that show 
itself when you do dynamic rules allocation (I don't think it has been fixed 
yet), but I can't be sure unless you find the class that is leaking.  

Jason Smith


From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Oliver Liu [liuyy2...@hotmail.com]
Sent: Monday, June 20, 2011 5:44 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] OutOfMemoryError happens when dynamic loading of 
Rules from Guvnor frequently

Any idea is appreciated, it's critical for my project. Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/OutOfMemoryError-happens-when-dynamic-loading-of-Rules-from-Guvnor-frequently-tp3079965p3088701.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
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] problem with ruleflow-group

2011-06-20 Thread Tihomir Surdilovic

Hi, take a look at JIRA: https://issues.jboss.org/browse/JBRULES-2718.
The fix is in 5.2.0.CR1 which you can get from 
http://www.jboss.org/drools/downloads.html.


Thanks.
Tihomir

On 6/20/11 11:06 AM, Ruault Gaetan wrote:


Hi,

I have  a problem with ruleflow.

I have a RF  like this :

Start  --->  log : « init » --->  ruleflowgroup : INI  ---> log : 
« next Step » --->  ruleflowgroup : AKT  ---> END


And a rule like this.

when

then

drools.getWorkingMemory().startProcess("My Flow");

But when i start a stateless Session, i have this result :

1 :  log init

2 : rules in ruleflow-group INIT are activated.

3. nothing else

Log « next Step »  and   ruleflow-goup AKT are not launched.

Could you help me ? I use  Drools 5.1.1 and  guvnor 5.1.1.  thanks.

Gaetan


___
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] Troubles with Oryx designer in Guvnor - jBPM 5.1.CR1

2011-06-20 Thread Tihomir Surdilovic
Really weird error, I cannot reproduce it. Is your Guvnor instance 
running on localhost:8080? Are you using the designer version that ships 
with jbpm-installer or something else?
Another thing to check is if you have any weird JavaScript restrictions 
in your browser. In Guvnor when you create your bpmn2 process, use 
Firebug (in FireFox) in the console tab type in:

frames[3].ORYX.EDITOR.getSerializedJSON()

and post the JSON that gets printed out.

Thanks.

On 6/20/11 7:09 PM, Dan Seaver wrote:
> I'm attempting to use the Oryx designer in Guvnor, however I can't seem to
> save / redisplay any diagram. I've tried it with various configurations,
> including using the jBPM demo, but always get the same results. After I save
> the newly created BPMN diagram, the Oryx designer refreshes to a blank
> diagram. The new diagram name is on the list of Guvnor processes (for the
> default package), and when I try to open it, I get the same blank diagram.
>
> After starting the jBPM demo (5.1.CR1), I see the h2 database started, jboss
> started and the human task service started. The jboss log looks pretty clean
> except for an SLF4J error and a mention that the persistence provider caller
> for org.jbpm.persistence.jpa does not implement the ejb3 spec correctly.
> Also, there is an error regarding the log4j FileAppender.
>
> Then I goto Guvnor with FireFox (or Chrome or IE6) and create the new BPMN
> process. I get the following message in the jboss log:
>
> 2011-06-20 16:00:05,288 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
> (null: -1, -1): Premature end of file.
>
> Then I create the process with the designer:
> 2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
> SLF4J: Class path contains multiple SLF4J bindings.
> 2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
> SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
> 5.1.CR1/jbpm-installer/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
> 2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
> SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
> 5.1.CR1/jbpm-installer/jboss-5.1.0.GA/server/default/deploy/designer.war/WEB-INF/lib/slf4j-jdk14-1.5.6.jar/org/slf4j/impl/StaticLoggerBinder.class]
> 2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> 2011-06-20 16:00:03,242 INFO  [org.oryxeditor.server.EditorHandler]
> (http-localhost%2F127.0.0.1-8080-1) The diagram editor is running in
> development mode. Javascript will be served uncompressed
> 2011-06-20 16:00:05,116 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
> INFO  20-06 16:00:05,116 (NilAuthenticator.java:authenticate:35)   All 
> users
> are guests.
> 2011-06-20 16:00:05,288 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
> (null: -1, -1): Premature end of file.
>
> and save:
> 2011-06-20 16:06:51,247 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-7)
> ERROR 20-06 16:06:51,247 (LoggingHelper.java:error:69)
> java.lang.NullPointerException
>   at java.net.URLEncoder.encode(URLEncoder.java:188)
>   at
> org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.storeAssetContent(BPMN2ProcessHandler.java:129)
>   at
> org.drools.guvnor.server.RepositoryAssetOperations.checkinVersion(RepositoryAssetOperations.java:187)
>   at
> org.drools.guvnor.server.RepositoryAssetService.checkinVersion(RepositoryAssetService.java:227)
> ...
>
>
> Anybody have any ideas on what could cause this on my system and how I may
> be able to solve it? Any help would be appreciated.
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Troubles-with-Oryx-designer-in-Guvnor-jBPM-5-1-CR1-tp3088609p3088609.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> 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] OutOfMemoryError happens when dynamic loading of Rules from Guvnor frequently

2011-06-20 Thread Oliver Liu
Any idea is appreciated, it's critical for my project. Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/OutOfMemoryError-happens-when-dynamic-loading-of-Rules-from-Guvnor-frequently-tp3079965p3088701.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Troubles with Oryx designer in Guvnor - jBPM 5.1.CR1

2011-06-20 Thread Dan Seaver
I'm attempting to use the Oryx designer in Guvnor, however I can't seem to
save / redisplay any diagram. I've tried it with various configurations,
including using the jBPM demo, but always get the same results. After I save
the newly created BPMN diagram, the Oryx designer refreshes to a blank
diagram. The new diagram name is on the list of Guvnor processes (for the
default package), and when I try to open it, I get the same blank diagram.

After starting the jBPM demo (5.1.CR1), I see the h2 database started, jboss
started and the human task service started. The jboss log looks pretty clean
except for an SLF4J error and a mention that the persistence provider caller
for org.jbpm.persistence.jpa does not implement the ejb3 spec correctly.
Also, there is an error regarding the log4j FileAppender.

Then I goto Guvnor with FireFox (or Chrome or IE6) and create the new BPMN
process. I get the following message in the jboss log:

2011-06-20 16:00:05,288 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
(null: -1, -1): Premature end of file.

Then I create the process with the designer:
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Class path contains multiple SLF4J bindings.
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
5.1.CR1/jbpm-installer/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: Found binding in [vfszip:/D:/dev/Drools/jbpm
5.1.CR1/jbpm-installer/jboss-5.1.0.GA/server/default/deploy/designer.war/WEB-INF/lib/slf4j-jdk14-1.5.6.jar/org/slf4j/impl/StaticLoggerBinder.class]
2011-06-20 16:00:02,929 ERROR [STDERR] (http-localhost%2F127.0.0.1-8080-1)
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
2011-06-20 16:00:03,242 INFO  [org.oryxeditor.server.EditorHandler]
(http-localhost%2F127.0.0.1-8080-1) The diagram editor is running in
development mode. Javascript will be served uncompressed
2011-06-20 16:00:05,116 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
INFO  20-06 16:00:05,116 (NilAuthenticator.java:authenticate:35) All 
users
are guests.
2011-06-20 16:00:05,288 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-3)
(null: -1, -1): Premature end of file.

and save:
2011-06-20 16:06:51,247 INFO  [STDOUT] (http-localhost%2F127.0.0.1-8080-7)
ERROR 20-06 16:06:51,247 (LoggingHelper.java:error:69)   
java.lang.NullPointerException
at java.net.URLEncoder.encode(URLEncoder.java:188)
at
org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.storeAssetContent(BPMN2ProcessHandler.java:129)
at
org.drools.guvnor.server.RepositoryAssetOperations.checkinVersion(RepositoryAssetOperations.java:187)
at
org.drools.guvnor.server.RepositoryAssetService.checkinVersion(RepositoryAssetService.java:227)
...


Anybody have any ideas on what could cause this on my system and how I may
be able to solve it? Any help would be appreciated.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Troubles-with-Oryx-designer-in-Guvnor-jBPM-5-1-CR1-tp3088609p3088609.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor guided editor problem - "add more options"

2011-06-20 Thread capeja
Hi all, I'm completely new to Drools and Guvnor and I'm following the "JBoss
Drools Business Rules" book's instructions for getting familiar with Drools. 

When adding action to rule I cannot get the "add more options" feature
working in Guided Editor - "U->" like icon is missing and the "pen" icon
does not work either. For those who have the book, I'm talking about the
example in page 102. The data model is exactly as described in the sample
case. Any idea of what's the problem?

BR,

Pekka

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-guided-editor-problem-add-more-options-tp3087495p3087495.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] problem with ruleflow-group

2011-06-20 Thread Ruault Gaetan
Hi,

I have  a problem with ruleflow.

I have a RF  like this :

Start  --->  log : < init > --->  ruleflowgroup : INI  ---> log : < next Step > 
--->  ruleflowgroup : AKT  ---> END


And a rule like this.

when
then
drools.getWorkingMemory().startProcess("My Flow");



But when i start a stateless Session, i have this result :
1 :  log init
2 : rules in ruleflow-group INIT are activated.
3. nothing else

Log < next Step >  and   ruleflow-goup AKT are not launched.


Could you help me ? I use  Drools 5.1.1 and  guvnor 5.1.1.  thanks.

Gaetan





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


[rules-users] Guvnor 5.2 CR1 under IE8

2011-06-20 Thread Vincent LEGENDRE
Hi all

I was using firefox for Guvnor, every thing was well.
But here, users use IE 8, and under IE8, Guvnor displays some strange list of 
icons in place of some other icons :
   - validate rule dialog : in place of the check (or error icon) : a big image 
containing all icons
   - new rule dialog : category icons are replaced by the same big image
   - history part of a rule : one more time the same big image

Does anyone has the problem ?
Does anyone uses IE :) ?

I suspect something like GWT using a big image as a cache, and some javascript 
to display only a small part of it, and this javascript is not compatible with 
IE. Make sense ? If yes, is there a workaround ?

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


Re: [rules-users] Trouble getting functions to work in Guvnor

2011-06-20 Thread jarno niemelä
Thanks.

2011/6/20 Wolfgang Laun :
> Isn't this a simple coding error:
>    releaseDate<= ( (ageInDays(current.releaseDate)<100) )
> as is compares a Date with a boolean?
>
> I think that the constraint should just be
>    eval( ageInDays(current.releaseDate) < 100 )
>
> -W
>
>
> On 20 June 2011 07:38, jarno niemelä  wrote:
>>
>> Hello.
>>
>> I am trying to set up guvnor environment for business users, and I am
>> having a bit of trouble in getting functions to work.
>>
>> What I am trying to do is to make a function that would calculate age
>> of product in days as comparison between release date and current
>> date.
>>
>> I have following POJO:
>>
>> public class Product {
>>
>>        private String name;
>>
>>        private Date releaseDate;
>>
>>        public Date getReleaseDate() {
>>                return releaseDate;
>>        }
>>
>>        public void setReleaseDate(Date releaseDate) {
>>                this.releaseDate = releaseDate;
>>        }
>> }
>>
>> My function:
>>
>> import java.util.Date;
>> import java.util.Calendar;
>>
>> function int ageInDays(Date beginDate) {
>>
>> Date today = Calendar.getInstance().getTime();
>> long age=today.getTime()-beginDate.getTime();
>> return (int)((age/1000)/60/60/24);
>> }
>>
>> My rule:
>> 1.      |       rule "test2"
>> 2.      |           dialect "mvel"
>> 3.      |           when
>> 4.      |               current : Product( supported != "supported" ,
>> releaseDate
>> <= ( (ageInDays(current.releaseDate)<100) ) )
>> 5.      |           then
>> 6.      |               current.setSupported( "supported" );
>> 7.      |               update( current );
>> 8.      |       end
>>
>> I am getting error when running test:
>>
>> Exception executing ReturnValue constraint
>> org.drools.rule.ReturnValueRestriction@4219ae2e :
>> java.lang.IllegalArgumentException: Unable to convert class
>> java.lang.Boolean to a Date.
>>
>> What I am doing wrong here?
>>
>> Alternative solution would be to create getAge() function in my POJO,
>> but are POJOs supposed to have executable code or are they supposed to
>> be used only for storing fact values?
>>
>> Jarno
>> ___
>> 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] java.lang.reflect.InvocationTargetException

2011-06-20 Thread Satyendra Sharma
No Of Rules : 13000
Package build successfully for 13000 but when trying to read rules using
Knowledge agent in java program 
BRMS server is generating java.lang.reflect.InvocationTargetException Caused
by java.lang.OutOfMemory error.

Please let me know how I resolve this issue

-
Satyendra Sharma
--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-reflect-InvocationTargetException-tp3086072p3086072.html
Sent from the Drools: User forum 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] Trouble getting functions to work in Guvnor

2011-06-20 Thread Wolfgang Laun
Isn't this a simple coding error:
   releaseDate<= ( (ageInDays(current.releaseDate)<100) )
as is compares a Date with a boolean?

I think that the constraint should just be
   eval( ageInDays(current.releaseDate) < 100 )

-W


On 20 June 2011 07:38, jarno niemelä  wrote:

> Hello.
>
> I am trying to set up guvnor environment for business users, and I am
> having a bit of trouble in getting functions to work.
>
> What I am trying to do is to make a function that would calculate age
> of product in days as comparison between release date and current
> date.
>
> I have following POJO:
>
> public class Product {
>
>private String name;
>
>private Date releaseDate;
>
>public Date getReleaseDate() {
>return releaseDate;
>}
>
>public void setReleaseDate(Date releaseDate) {
>this.releaseDate = releaseDate;
>}
> }
>
> My function:
>
> import java.util.Date;
> import java.util.Calendar;
>
> function int ageInDays(Date beginDate) {
>
> Date today = Calendar.getInstance().getTime();
> long age=today.getTime()-beginDate.getTime();
> return (int)((age/1000)/60/60/24);
> }
>
> My rule:
> 1.  |   rule "test2"
> 2.  |   dialect "mvel"
> 3.  |   when
> 4.  |   current : Product( supported != "supported" ,
> releaseDate
> <= ( (ageInDays(current.releaseDate)<100) ) )
> 5.  |   then
> 6.  |   current.setSupported( "supported" );
> 7.  |   update( current );
> 8.  |   end
>
> I am getting error when running test:
>
> Exception executing ReturnValue constraint
> org.drools.rule.ReturnValueRestriction@4219ae2e :
> java.lang.IllegalArgumentException: Unable to convert class
> java.lang.Boolean to a Date.
>
> What I am doing wrong here?
>
> Alternative solution would be to create getAge() function in my POJO,
> but are POJOs supposed to have executable code or are they supposed to
> be used only for storing fact values?
>
> Jarno
> ___
> 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