How to compare java.sql.Dates in a Drools 'when'
by Stephen Mcgruer
Hi there,
Sorry for so many questions today. How would one compare dates in a
Drools when/then rule? I have an object, Tool, that has a last used
field which is a java.sql.Date (yes, this is a fairly bad type for it
to be. Long story.). I want to write a rule to check if there is a
Tool that has this date set in the future. Now, to get the current
date/time (in Java!) you would do:
java.util.Date today = new java.util.Date();
java.sql.Date sqlToday = new java.sql.Date(today.getTime());
But how do I do something like this in a Drools rule?! (Where I want
to compare last used to sqlToday).
Thanks,
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 7 months
How do I totally clear out an installation of Guvnor (Tomcat 6.0)
by Stephen Mcgruer
Hi there,
I'm migrating to Guvnor RC atm, and was wanting to completely clear
out my Guvnor Packages files before I did so - I wanted everything
gone. I thought that all information was stored in the Guvnor folder
created in Tomcat/webapps, so I deleted that, restarted the server and
dragged in the new Guvnor RC WAR file. This built itself fine and is
up and running on the server - but my packages are still there! Where
abouts are these kept in Apache Tomcat? I can't just delete them from
within Guvnor because despite me being able to delete most of the
files/packages/etc, there are three categories that claim to be 'still
in use' and won't let me delete them... even though there are *no*
other files left!
Any help is much appreciated.
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 7 months
General rules in spreadsheet.
by tom ska
Hello,
I want to use StatelessSession with spreadsheet. I wrote few rules in DRL,
but I cant do it in spreadsheet. First I want to present rules and class
that is used by rules:
public class CProduct {
private String name;
private int value;
public CProduct ()
{
name = "empty";
value = 0;
}
public CProduct (String name, int value)
{
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
}
Rules:
rule "Case A"
salience 1
activation-group "g1"
when
p : CProduct( name == "A" )
then
System.out.println("Special product: " + p.getName());
end
rule "Case B"
salience 1
activation-group "g1"
when
p : CProduct( name == "B" )
then
System.out.println("Special product: " + p.getName());
end
rule "Case general"
salience 0
activation-group "g1"
when
p : CProduct( )
then
System.out.println("Normal product: " + p.getName());
end
Using stateLessSession, salience, and activation-group I can determine, that
only one rule is going to be fired for each CProduct. And with salience
param, I can determine priority (it is important to get special products
first).
Now I am going to write those rules in spreadsheet. But I can't define rule
"Case general".
CONDITION ACTION ACTIVATION-GROUP PRIORITY p:CProduct name
System.out.println("$param"); Rules names
Product name what to print
Case A
A
Special A
G1 1 Case B
B Special B G1 1 General case
normal G1 0
But when I am going to use the spreadsheet, I get this error:
"p cannot be resolved"
Problem disappears, when I fill "Product name" in "General case".
But I want it to be empty, because I want to fire rule "General case" when
rules "Case A" & "Case B" won't fire for any object's name.
Thanks, Tom.
15 years, 7 months
Timers' Week :)
by nanic23
Alright... two more:
1. If a process suspends, do timers keep running/firing?
2. Let's say I have workItem_1 --> workItem_2 --> workItem_3 of which
"workItem_1" suspends the flow and "workItem_3" has a timer. After reloading
the StatefulKnowledgeSession and completing "workItem_1" and moving on do I
need to restart the timer for "workItem_3"?
I would like to mention some inconsistent behavior I have experienced:
- ksession.fireUntilHalt() is not starting the timers, instead
ksession.fireAllRules() DOES.
- ksession.halt() does not stop the timers (if that is the way I'm supposed
to stop them)
Any tips or personal experience will be very appreciated.
Thanks,
Nick.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Timers-Week-tp912807p...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
fireAllRules performance
by sjoo822
I have several thousand objects that gets inserted into a statefull knowledge
session as show below:
for (Item item : itemList)
{
session.insert(item);
}
session.fireAllRules();
Assuming that all the conditions in the rules only concern with one item at
a time, will there be a big performance difference if I changed the above to
as shown below?
for (Item item : itemList)
{
session.insert(item);
session.fireAllRules();
}
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/fireAllRules-performa...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Exception when use Human Task
by XiaoMiTang
I got an exception when using Human Task ,caused by the following code:
===============code===========
EntityManagerFactory emf = Persistence.createEntityManagerFactory("aaaa");
TaskService taskService = new
TaskService(emf,SystemEventListenerFactory.getSystemEventListener());
===============code end=======
the error info in the Eclipse's Console llike this:
===========error info=====
严重: Unsuccessful: create table Notification_EmailNotificationHeader
(Notification_id numeric(19,0) not null, emailHeaders_id numeric(19,0) not
null, mapkey varchar(255) null, primary key (Notification_id, mapkey),
unique (emailHeaders_id))
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create
严重: 无法在表 'Notification_EmailNotificationHeader' 中可为 Null 的列上定义 PRIMARY KEY
约束。
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create
严重: Unsuccessful: alter table Notification_EmailNotificationHeader add
constraint FK92169CC0379F97EA foreign key (emailHeaders_id) references
EmailNotificationHeader
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create
严重: 找不到对象 "Notification_EmailNotificationHeader",因为它不存在或者您没有所需的权限。
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create
严重: Unsuccessful: alter table Notification_EmailNotificationHeader add
constraint FK92169CC01B1E66DC foreign key (Notification_id) references
Notification
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport create
严重: 找不到对象 "Notification_EmailNotificationHeader",因为它不存在或者您没有所需的权限。
2010-7-27 16:39:38 org.hibernate.tool.hbm2ddl.SchemaExport execute
信息: schema export complete
java.lang.IllegalArgumentException: Named query not found:
UnescalatedDeadlines
at
org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108)
at org.drools.task.service.TaskService.<init>(TaskService.java:65)
at org.drools.task.service.TaskService.<init>(TaskService.java:48)
at com.demo.action.loginController.HumanTask(loginController.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:174)
at
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
at
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
=======error info end===============================================
the top error info(chinese text) means that:
[mapkey] is nullable, it can not be defined as primary key ;
how to slove it?
Thansks~
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Exception-when-use-Hu...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Question about fireAllRules method
by sjoo822
I have several thousand objects that gets inserted into a statefull knowledge
session as show below:
for (Item item : itemList)
{
session.insert(item);
}
session.fireAllRules();
Assuming that all the conditions in the rules only concern with one item at
a time, will there be a big performance difference if I changed the above to
as shown below?
for (Item item : itemList)
{
session.insert(item);
session.fireAllRules();
}
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-fireAl...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Drools-Guvnor doubt regarding cosuming a previous rule generated.
by Pardeep Ruhil
Hi,
I have doubt regarding rules made in drools-guvnor.
>From the documentation I have read that, I cannot have two rules of the same name.
But is there a facility available like I have rule created with date-expires=30-July-2011, and after some time I
changed the same rule and specifies new date for expire as date-expires=20-Oct-2010.
Now can I call the previously created rule programmatically i.e. of 30-July-2011
Or can I call the previous version of the rule programmatically, created in drools-guvnor.
Please help me in this.
Thanks & Regards
Pradeep Ruhil
L& T Infotech
Mahape, Vashi
Mumbai
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
15 years, 7 months
Problem in executing Rule in Drools Guvnor for date-effective attribute
by Pardeep Ruhil
Hi,
I have created a rule in drools-guvnor and I have given date-effective parameters in that.
My rule looks like when I click on view source as :
1.
|
rule "ProfTaxPradeep"
2.
|
date-effective "28-July-2010 "
3.
|
dialect "mvel"
4.
|
when
5.
|
empInfo : EmplInfo( state == "KA" )
6.
|
profTaxResult : ProfTaxResultPradeep( )
7.
|
then
8.
|
profTaxResult.setProfTaxResult( profTaxKA_pradeep(empInfo.basicSal,"10000:15000:999999999", "00:150:200") );
9.
|
end
Now when I created a test scenario in Drools-Guvnor, it is not running successfully.
I have given the simlulated time as Friday, July 30, 2010 12:00:00 AM
But it is not running successfully.
Without using the date-effective attribute my test scenario executes properly.
Please tell me if I am doing anything wrong in this.
Thanks & Regards
Pradeep Ruhil
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
15 years, 7 months