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.
14 years, 5 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.
14 years, 5 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.
14 years, 5 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.
14 years, 5 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.
14 years, 5 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.
______________________________________________________________________
14 years, 5 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.
______________________________________________________________________
14 years, 5 months
Re: [rules-users] Exception while using package deployed in drools-guvnor
by Pardeep Ruhil
Hi,
I checked the version of the drools-guvnor, it was 5.0 and of drools is 5.1,
So I downloaded the drools-guvnor 5.1 candidate release and
from there I downloaded the ChangeSet.xml file and replaced the one I had used it before.
But still m getting the same exception.
Exception is :
2010:07:208 12:07:201:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
2010:07:208 12:07:201:debug] KnowledgeAgent building resource=[UrlResource path='http://172.17.88.140:8441/drools-guvnor/org.d
ools.guvnor.Guvnor/package/payRoll_pradeep/LATEST']
2010:07:208 12:07:217:exception]
java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage
at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:425)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:121)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:110)
at org.ofbiz.drools.event.drool.RuleIntegrate.createKnowledgeBase(RuleIntegrate.java:45)
at org.ofbiz.drools.event.drool.RuleIntegrate.createWorkingMemory(RuleIntegrate.java:29)
at org.ofbiz.payRoll.PayRollTax.callPayRollTaxRule(PayRollTax.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.
.
.
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:154)
at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:102)
at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:414)
Please help me in this, If I am missing something.
Thanks & Regards
Pradeep Ruhil
Hi,
Which version of drools are you using? Make sure you are using the same
version in guvnor and in your application.
Best,
El jul 26, 2010 7:48 a.m., "Pardeep Ruhil" <Pardeep.Ruhil(a)lntinfotech.com>
escribi?:
Hi,
________________________________
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.
______________________________________________________________________
14 years, 5 months
GWT Console - Drools Flow problems.
by tom ska
Hello,
I am trying to use Drools Flow with GWT Console v.2.1. I use Guvnor and
Eclipse too. I am new in server applications, and jBoss is for me something
new, so please be patient :)
What I did are:
14 years, 5 months
Guvnor 5 on Tomcat 5.x?
by Hendrik Beck
Hey guys,
just a quick question: can anyone confirm that Guvnor 5 is running or _not_
running on Tomcat 5.x. I have tried it some time ago without success and now
I'm hearing here that my co-workers tried again without success. Does anyone
have experience with that and can give a quick info?
Thanks a lot and best regards
Hendrik
--------------------
Hendrik Beck
Software Development, IT Consulting, Project Management
Currently located in Vietnam
+84 168 7936919
www.hendrikbeck.com <http://www.hendrikbeck.com?src=161>
--------------------
14 years, 5 months