Re: [rules-users] Drools Flow Persistence Doubt

2009-10-08 Thread Pardeep . Ruhil
Hi Mauricio,
Ya actually previously when it was uncommented, the flow was not going 
ahead of the first human task in Workflow file '
VariablePersistenceStrategyProcess.rf' because in the test case file '
VariablePersistenceStrategiesTest.java' query was written is of 
VariableInstancesInfoByProcessI  in orm.xml file.  So when I uncommented 
the same I got that exception. So please tell me so that I am able to 
execute the full flow of the demo project.

Jasper, 
 Thanks for replying. I tried your suggestion, but it was not working. Can 
you try that demo project and let me know you are also facing the same 
problem or not. 

Thanks & Regards
Pardeep Ruhil



>yes... the problem is that you don't need that query.
>I don't know why I include it.. Do you need it for some reason?
>I will test it asap and get back to you..

>On Thu, Oct 8, 2009 at 11:46 AM, Jesper S. Knudsen  
wrote:

> Hi Pardeep
>
> I think you are using the wrong syntax in your QL
> Should it not be:
>
> select object(v) from VariableInstanceInfo as v where
> v.processInstanceInfo.id = :processId
>
> like in ejbql?
>
> Best regards
>
> Jesper
>
>
> pardeep.ru...@lntinfotech.com skrev:
> >
> > Hi Mauricio,
> > Thanks for your reply.
> > When I try to run the demo project with configuration  to work with
> Mysql, I got this exception when I uncommented the  the named-query in
> orm.xml
> > 
> > select
> > v
> > from
> > VariableInstanceInfo v
> > where
> > v.processInstanceInfo.id = :processId
> >   
> >
> > SEVERE: Error in named query: VariableInstancesInfoByProcessId
> > org.hibernate.QueryException: could not resolve property:
> processInstanceInfo of:
> 
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
> [select v from




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


[rules-users] Jboss Drools 4.0.7 OutOfMemory issue , code cache reaching it's maximum size

2009-10-08 Thread subrahmanyam

After integrating our application with Drools 4.0.7 tomcat running 3,4 days
well with 75 users, suddenly we are facing InvocationTargetException caused
by OutOfMemoryError for 3,4 users some times. The JAVA_OPTS options are well
configured as observed no heap error issue. Heap utilization is only 60% but
Foud that CodeCache is reaching maximum always. But codecache is non heap.
Currently everyday out of production time we are restarting server to avoid
sudden exception in production. The following is the exception we received
as suggestion of finding the root cause.

In exception logs there is no permgen space erorr or heap error. Observed by
probe after 2/3days codecache is becoming full only results in OutOfMemory
as given below. For workaround we increased codecache size to 200 MB. As per
the http://www.nabble.com/OutOfMemory-Error---3500-Rules-td17019001.html
this type of issue is fixed. But in 4.0.7 itself we are facing this issue.
Any suggestions?



java.lang.reflect.InvocationTargetException
 at sun.reflect.GeneratedMethodAccessor2049.invoke(Unknown Source)  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at
org.orbeon.oxf.processor.SimpleProcessor$1.readImpl(SimpleProcessor.java:70)
 at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:995)
 at
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1178)
 at org.orbeon.oxf.processor.JavaProcessor$1.readImpl(JavaProcessor.java:66)
 at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:995)
 at
org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1178)
 at
org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:350)
 at
org.orbeon.oxf.processor.pipeline.AggregatorProcessor.access$100(AggregatorProcessor.java:38)
 at
org.orbeon.oxf.processor.pipeline.AggregatorProcessor$1.readImpl(AggregatorProcessor.java:93)
 at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:995)
.
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
 at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
 at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
 at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
 at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError
 at java.lang.Class.getDeclaredMethods0(Native Method)  at
java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
 at java.lang.Class.getDeclaredMethods(Class.java:1791)
 at
org.codehaus.janino.ReflectionIClass.getDeclaredIMethods2(ReflectionIClass.java)
 at org.codehaus.janino.IClass.getDeclaredIMethods(IClass.java)
 at org.codehaus.janino.IClass.getDeclaredIMethods(IClass.java)
 at org.codehaus.janino.UnitCompiler.getIMethods(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java) at
org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.access$51(UnitCompiler.java)
 at
org.codehaus.janino.UnitCompiler$9.visitMethodInvocation(UnitCompiler.java)
 at org.codehaus.janino.Java$MethodInvocation.accept(Java.java)
 at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.access$25(UnitCompiler.java)
 at
org.codehaus.janino.UnitCompiler$6.visitMethodInvocation(UnitCompiler.java)
 at org.codehaus.janino.Java$MethodInvocation.accept(Java.java)
 at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java)
 at
org.codehaus.janino.UnitCompiler$4.visitExpressionStatement(UnitCompiler.java)
 at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java)
 at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.access$7(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler$4.visitBlock(UnitCompiler.java)
 at org.codehaus.janino.Java$Block.accept(Java.java)
 at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
 at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
 at
org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclar

Re: [rules-users] Better way to run each rule once?

2009-10-08 Thread Wolfgang Laun
I see no cogent reason for implementing Identifiable for each fact class.
The hashCode() any object returns should be distinct enough, especially
considering that all the hash codes are munched together, which is
definitely not *guaranteed* to result in different values for *all* rule and
fact set combinations.

But please do as Greg suggested.

BTW, it's sufficient to end with
  return alreadyActivatedRules.add(hash);

-W

On Thu, Oct 8, 2009 at 11:43 PM, Dave Schweisguth wrote:

> Greetings fellow Droolers,
>
> Each of our rules modifies the fact it matches. We'd like to run each of
> those rules exactly once, not reactivating them when a fact changes. I see
> from the archives that I'm not the first person to discover that no-loop is
> too weak and lock-on-activate too strong for my purposes.
>
> I implemented our requirement with an AgendaListener that remembers hashes
> of rules + facts. This works but requires each fact to implement an
> interface with a method that returns the hash, and means TWO casts each
> time
> I examine a FactHandle. The whole AgendaFilter is below so you can see what
> I mean.
>
> Can anyone suggest a better way? I'm looking more for a better approach
> altogether than I am for critique of the implementation of my current
> approach, although the latter would not be unwelcome.
>
> private static class Once
>implements AgendaFilter {
>
>private final Set alreadyActivatedRules = new
> HashSet();
>
>public boolean accept(Activation activation) {
>int hash = activation.getRule().getName().hashCode();
>for (FactHandle handle: activation.getFactHandles()) {
>Object object = ((DefaultFactHandle) handle).getObject();
>hash *= 31;
>if (object instanceof Identifiable) {
>hash += ((Identifiable) object).getIdentity();
>} else if (object instanceof String) {
>// We get here when a rule uses from on a string collection
>hash += object.hashCode();
>} else {
>throw new IllegalStateException(
>"Don't know what to do with fact class "
>+ object.getClass() + ", value " + object);
>}
>}
>boolean accept = !alreadyActivatedRules.contains(hash);
>alreadyActivatedRules.add(hash);
> return accept;
>}
>
> }
>
> Thanks & cheers,
>
> --
> | Dave Schweisguth   
> http://schweisguth.org/~dave/|
> | Home: dave at schweisguth.orgWork: http://www.nileguide.com/|
> | For compliance with the NJ Right to Know Act: Contents partially unknown
> |
> ___
> 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] Drools Flow Persistence throws stack overflow error

2009-10-08 Thread PremKumar s
Kris,

I am new to drools flow am not aware of other better ways to pass
ProcessInstance to drools rule (DRL)  When conditions.  Based on few
examples in the forum and sample testing code with out inserting
processInstance to working memory rule constraints not able get to process
instance in drools rule drl file.

 If would be great if could  suggest better approach to pass the process
instance to drools rule (DRL) conditions. I with try that out and update
you.

Thanks
Prem

On Fri, Oct 9, 2009 at 7:12 AM, Kris Verlaenen <
kris.verlae...@cs.kuleuven.be> wrote:

> You can register a custom strategy like this:
>
> Environment env = KnowledgeBaseFactory.newEnvironment();
> env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
> env.set(EnvironmentName.TRANSACTION_MANAGER,
> TransactionManagerServices.getTransactionManager());
> ObjectMarshallingStrategy[] objectMarshalingStrategies = new
> ObjectMarshallingStrategy[] {
>  new ProcessInstanceMarshallingStrategy(env)
> };
> env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES,
> objectMarshalingStrategies);
> StatefulKnowledgeSession ksession =
> JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
>
> ... and then define the strategy as ...
>
> private static class ProcessInstanceMarshallingStrategy implements
> ObjectMarshallingStrategy {
>  private Environment environment;
>  public ProcessInstanceMarshallingStrategy(Environment environment) {
>this.environment = environment;
>  }
>  public boolean accept(Object o) {
>return o instanceof ProcessInstance;
>  }
>  public Object read(ObjectInputStream ois) throws IOException,
> ClassNotFoundException {
>long id = ois.readLong();
>return ((ProcessRuntime)
> environment.get("ksession")).getProcessInstance(id);
>  }
>  public void write(ObjectOutputStream oos, Object o) throws IOException {
>oos.writeLong(((ProcessInstance) o).getId());
>  }
> }
>
> Note that this strategy only works for active process instances (so you
> need to make sure they are removed from the working memory before ending
> the process instance, for example by using an on-entry/exit action.  I
> think we will probably build in this strategy by default in the future.
>
> Could you clarify why you need the processInstance in the working
> memory?  As there might be an easier alternative?
>
> Kris
>
>
> Quoting PremKumar s :
>
> > Thanks Kris for your input. It would be great if you could share us
> > on
> > sample code snippet how to acheive this ObjectMarshallingStrategy
> > for
> > ProcessInstances .
> >
> > Also confirm us by using this approach the process is avialable for
> > drools
> > rule constraints to take decisions.
> >
> > Thanks
> > Prem
> >
> > On Thu, Oct 8, 2009 at 4:07 PM, Kris Verlaenen <
> > kris.verlae...@cs.kuleuven.be> wrote:
> >
> > > This is indeed a special case.  Process instances are already
> > stored as
> > > part of the session runtime state, so no need to store them again
> > as
> > > part of the working memory.  You need to register a custom
> > > ObjectMarshallingStrategy for ProcessInstances in the working
> > memory
> > > that simply retrieves them from the session state.
> > >
> > > Kris
> > >
> > > Quoting PremKumar s :
> > >
> > > > Hi,
> > > >
> > > >
> > > >
> > > >   I am evaluating the drools expert with drool flow using
> > > > TimeManagement
> > > > System. I am inserting the process instance into working memory
> > of
> > > > drools
> > > > [session.insert(workflowProcessInstance)]  So that the rules can
> > use
> > > > the
> > > > process instance as part of Rule constraints to enable the rules
> > to
> > > > make
> > > > more sophisticated decisions based on the state of the current
> > > > process
> > > > instance.
> > > >
> > > >
> > > >
> > > > Rule snippet
> > > >
> > > >
> > > >
> > > > rule "Submit Time"  ruleflow-group "Submit Time"
> > > >dialect "java"
> > > >when
> > > >
> > > >processInstance:WorkflowProcessInstance()
> > > >
> > > >tkRequest:TKRequest ()
> > > >tkRequestDAO:TKRequestDAO()
> > > >then
> > > >
> > > > // check the current processInstance state
> > as
> > > > Active
> > > > then do that
> > > >
> > > >//Do custom operation, status change,
> > > > persistence
> > > > update
> > > >
> > > >end
> > > >
> > > >
> > > >
> > > >The approach is works fine with using
> > > > KnowledgeBuilder.newStatefulKnowledgeSession() that is no
> > > > persistence.  But
> > > > once i have enabled the Persistence using
> > > > JPAKnowledgeService.newStatefulKnowledgeSession(know, null,
> > > > getEnvironment())  it throws stack over flow error due the
> > > > workflowProcessInstance is not serialized while trying to persist
> > the
> > > > newly
> > > > added workflowProcessInstance  to working memory.
> > > >
> > > >
> > > >
> > > >Once i have commented the
> > > > session.insert(workflowProcessInstance

Re: [rules-users] Drools Flow Persistence throws stack overflow error

2009-10-08 Thread Kris Verlaenen
You can register a custom strategy like this:

Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager());
ObjectMarshallingStrategy[] objectMarshalingStrategies = new
ObjectMarshallingStrategy[] {
  new ProcessInstanceMarshallingStrategy(env)
};
env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES,
objectMarshalingStrategies);
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);

... and then define the strategy as ...

private static class ProcessInstanceMarshallingStrategy implements
ObjectMarshallingStrategy {
  private Environment environment;
  public ProcessInstanceMarshallingStrategy(Environment environment) {
this.environment = environment;
  }
  public boolean accept(Object o) {
return o instanceof ProcessInstance;
  }
  public Object read(ObjectInputStream ois) throws IOException,
ClassNotFoundException {
long id = ois.readLong();
return ((ProcessRuntime)
environment.get("ksession")).getProcessInstance(id);
  }
  public void write(ObjectOutputStream oos, Object o) throws IOException {
oos.writeLong(((ProcessInstance) o).getId());
  } 
}

Note that this strategy only works for active process instances (so you
need to make sure they are removed from the working memory before ending
the process instance, for example by using an on-entry/exit action.  I
think we will probably build in this strategy by default in the future.

Could you clarify why you need the processInstance in the working
memory?  As there might be an easier alternative?

Kris


Quoting PremKumar s :

> Thanks Kris for your input. It would be great if you could share us
> on
> sample code snippet how to acheive this ObjectMarshallingStrategy
> for
> ProcessInstances .
> 
> Also confirm us by using this approach the process is avialable for
> drools
> rule constraints to take decisions.
> 
> Thanks
> Prem
> 
> On Thu, Oct 8, 2009 at 4:07 PM, Kris Verlaenen <
> kris.verlae...@cs.kuleuven.be> wrote:
> 
> > This is indeed a special case.  Process instances are already
> stored as
> > part of the session runtime state, so no need to store them again
> as
> > part of the working memory.  You need to register a custom
> > ObjectMarshallingStrategy for ProcessInstances in the working
> memory
> > that simply retrieves them from the session state.
> >
> > Kris
> >
> > Quoting PremKumar s :
> >
> > > Hi,
> > >
> > >
> > >
> > >   I am evaluating the drools expert with drool flow using
> > > TimeManagement
> > > System. I am inserting the process instance into working memory
> of
> > > drools
> > > [session.insert(workflowProcessInstance)]  So that the rules can
> use
> > > the
> > > process instance as part of Rule constraints to enable the rules
> to
> > > make
> > > more sophisticated decisions based on the state of the current
> > > process
> > > instance.
> > >
> > >
> > >
> > > Rule snippet
> > >
> > >
> > >
> > > rule "Submit Time"  ruleflow-group "Submit Time"
> > >dialect "java"
> > >when
> > >
> > >processInstance:WorkflowProcessInstance()
> > >
> > >tkRequest:TKRequest ()
> > >tkRequestDAO:TKRequestDAO()
> > >then
> > >
> > > // check the current processInstance state
> as
> > > Active
> > > then do that
> > >
> > >//Do custom operation, status change,
> > > persistence
> > > update
> > >
> > >end
> > >
> > >
> > >
> > >The approach is works fine with using
> > > KnowledgeBuilder.newStatefulKnowledgeSession() that is no
> > > persistence.  But
> > > once i have enabled the Persistence using
> > > JPAKnowledgeService.newStatefulKnowledgeSession(know, null,
> > > getEnvironment())  it throws stack over flow error due the
> > > workflowProcessInstance is not serialized while trying to persist
> the
> > > newly
> > > added workflowProcessInstance  to working memory.
> > >
> > >
> > >
> > >Once i have commented the
> > > session.insert(workflowProcessInstance)
> > > the stack overflow error is gone but none of my rules are not
> > > executed.
> > >
> > >
> > >
> > > Can some one provide guidance on how to pass this
> > > workflowProcessInstance to
> > > rule constriant with persistence JPAKnowledgeSession enabled.
> > >
> > >
> > >
> > > Thanks
> > >
> > > Prem
> > >
> >
> >
> >
> >
> > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> >
> 




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] Better way to run each rule once?

2009-10-08 Thread Greg Barton
Could you give some sample rules and the nature of the problem you're solving?  
Maybe you don't need to update all of the time with a different approach.



- Original Message 
From: Dave Schweisguth 
To: rules-users@lists.jboss.org
Sent: Thu, October 8, 2009 4:43:34 PM
Subject: [rules-users] Better way to run each rule once?

Greetings fellow Droolers,

Each of our rules modifies the fact it matches. We'd like to run each of
those rules exactly once, not reactivating them when a fact changes. I see
from the archives that I'm not the first person to discover that no-loop is
too weak and lock-on-activate too strong for my purposes.

I implemented our requirement with an AgendaListener that remembers hashes
of rules + facts. This works but requires each fact to implement an
interface with a method that returns the hash, and means TWO casts each time
I examine a FactHandle. The whole AgendaFilter is below so you can see what
I mean.

Can anyone suggest a better way? I'm looking more for a better approach
altogether than I am for critique of the implementation of my current
approach, although the latter would not be unwelcome.

private static class Once
implements AgendaFilter {

private final Set alreadyActivatedRules = new HashSet();

public boolean accept(Activation activation) {
int hash = activation.getRule().getName().hashCode();
for (FactHandle handle: activation.getFactHandles()) {
Object object = ((DefaultFactHandle) handle).getObject();
hash *= 31;
if (object instanceof Identifiable) {
hash += ((Identifiable) object).getIdentity();
} else if (object instanceof String) {
// We get here when a rule uses from on a string collection
hash += object.hashCode();
} else {
throw new IllegalStateException(
"Don't know what to do with fact class "
+ object.getClass() + ", value " + object);
}
}
boolean accept = !alreadyActivatedRules.contains(hash);
alreadyActivatedRules.add(hash);
 return accept;
}

}

Thanks & cheers,

-- 
| Dave Schweisguth   http://schweisguth.org/~dave/ |
| Home: dave at schweisguth.orgWork: http://www.nileguide.com/ |
| For compliance with the NJ Right to Know Act: Contents partially unknown |
___
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] Better way to run each rule once?

2009-10-08 Thread Dave Schweisguth
Greetings fellow Droolers,

Each of our rules modifies the fact it matches. We'd like to run each of
those rules exactly once, not reactivating them when a fact changes. I see
from the archives that I'm not the first person to discover that no-loop is
too weak and lock-on-activate too strong for my purposes.

I implemented our requirement with an AgendaListener that remembers hashes
of rules + facts. This works but requires each fact to implement an
interface with a method that returns the hash, and means TWO casts each time
I examine a FactHandle. The whole AgendaFilter is below so you can see what
I mean.

Can anyone suggest a better way? I'm looking more for a better approach
altogether than I am for critique of the implementation of my current
approach, although the latter would not be unwelcome.

private static class Once
implements AgendaFilter {

private final Set alreadyActivatedRules = new HashSet();

public boolean accept(Activation activation) {
int hash = activation.getRule().getName().hashCode();
for (FactHandle handle: activation.getFactHandles()) {
Object object = ((DefaultFactHandle) handle).getObject();
hash *= 31;
if (object instanceof Identifiable) {
hash += ((Identifiable) object).getIdentity();
} else if (object instanceof String) {
// We get here when a rule uses from on a string collection
hash += object.hashCode();
} else {
throw new IllegalStateException(
"Don't know what to do with fact class "
+ object.getClass() + ", value " + object);
}
}
boolean accept = !alreadyActivatedRules.contains(hash);
alreadyActivatedRules.add(hash);
 return accept;
}

}

Thanks & cheers,

-- 
| Dave Schweisguth   http://schweisguth.org/~dave/ |
| Home: dave at schweisguth.orgWork: http://www.nileguide.com/ |
| For compliance with the NJ Right to Know Act: Contents partially unknown |
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] State management in Guvnor

2009-10-08 Thread Steve Ronderos
Try 

AssetItem(stateDescription == "Production")

stateDescription instead of statusDescription

Steve Ronderos 

rules-users-boun...@lists.jboss.org wrote on 10/08/2009 02:59:39 PM:

> [image removed] 
> 
> Re: [rules-users] State management in Guvnor
> 
> Mahashabde, Rohan 
> 
> to:
> 
> Rules Users List
> 
> 10/08/2009 03:02 PM
> 
> Sent by:
> 
> rules-users-boun...@lists.jboss.org
> 
> Please respond to Rules Users List
> 
> I am implementing the selector functionality to build out package 
> mentioned in the Guvnor documentation but facing issues while 
> getting it to work. I am using a drl file for the selector criteria 
> and this is the error I am getting:
> 
> org.drools.CheckedDroolsException: There were errors in the rule 
> source: Unable to create Field Extractor for 'statusDescription' of 
> '[ClassObjectType class=org.drools.repository.AssetItem]' in rule 
> 'rule1' : [Rule name='rule1']
> 
> This is my drl file:
> ProductionAssets.drl
> 
> package org.drools.guvnor.server.selector
> 
> dialect "mvel"
> 
> import org.drools.repository.AssetItem
> import org.drools.guvnor.server.selector.Allow
> 
> rule "rule1"
> when
> AssetItem(statusDescription =="Production")
> then
> insert(new Allow())
> end
> 
> 
> Please can anyone help me with this?
> 
> Thanks.
> 
> Thanks and Regards
> Rohan V Mahashabde
> Consultant - Infosys Technologies Ltd
> CRE Loan Solution Dev
> Ext: 980.683.5539
> 
> 
> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> boun...@lists.jboss.org] On Behalf Of Steve Ronderos
> Sent: Thursday, October 08, 2009 9:26 AM
> To: Rules Users List
> Subject: Re: [rules-users] State management in Guvnor
> 
> 
> Check out "selectors" in section 1.2.5.3 of the Guvnor Documentation 
> http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-
> guvnor/html_single/index.html#d0e233 
> 
> Steve Ronderos 
> 
> rules-users-boun...@lists.jboss.org wrote on 10/08/2009 06:35:39 AM:
> 
> > [image removed] 
> > 
> > [rules-users] State management in Guvnor 
> > 
> > Ambika Goel 
> > 
> > to: 
> > 
> > rules-users@lists.jboss.org 
> > 
> > 10/08/2009 06:41 AM 
> > 
> > Sent by: 
> > 
> > rules-users-boun...@lists.jboss.org 
> > 
> > Please respond to Rules Users List 
> > 
> > Hi All, 
> > 
> > What is the significance of Status in Guvnor. I have added multiple 
> > statuses like Production, Testing etc. 
> > How can I use it to differentiate between rules. I want to run  only
> > the rules under production status. How to do it 
> > 
> > 
> >  ___
> > 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] State management in Guvnor

2009-10-08 Thread Mahashabde, Rohan
I am implementing the selector functionality to build out package
mentioned in the Guvnor documentation but facing issues while getting it
to work. I am using a drl file for the selector criteria and this is the
error I am getting:

 

org.drools.CheckedDroolsException: There were errors in the rule source:
Unable to create Field Extractor for 'statusDescription' of
'[ClassObjectType class=org.drools.repository.AssetItem]' in rule
'rule1' : [Rule name='rule1']

 

This is my drl file:

ProductionAssets.drl

 

package org.drools.guvnor.server.selector

 

dialect "mvel"

 

import org.drools.repository.AssetItem

import org.drools.guvnor.server.selector.Allow

 

rule "rule1"

when

AssetItem(statusDescription =="Production")

then

insert(new Allow())

end

 

 

Please can anyone help me with this?

 

Thanks.

 

Thanks and Regards

Rohan V Mahashabde

Consultant - Infosys Technologies Ltd

CRE Loan Solution Dev

Ext: 980.683.5539

 



From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Steve Ronderos
Sent: Thursday, October 08, 2009 9:26 AM
To: Rules Users List
Subject: Re: [rules-users] State management in Guvnor

 


Check out "selectors" in section 1.2.5.3 of the Guvnor Documentation
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/h
tml_single/index.html#d0e233
  

Steve Ronderos 

rules-users-boun...@lists.jboss.org wrote on 10/08/2009 06:35:39 AM:

> [image removed] 
> 
> [rules-users] State management in Guvnor 
> 
> Ambika Goel 
> 
> to: 
> 
> rules-users@lists.jboss.org 
> 
> 10/08/2009 06:41 AM 
> 
> Sent by: 
> 
> rules-users-boun...@lists.jboss.org 
> 
> Please respond to Rules Users List 
> 
> Hi All, 
>   
> What is the significance of Status in Guvnor. I have added multiple 
> statuses like Production, Testing etc. 
> How can I use it to differentiate between rules. I want to run  only
> the rules under production status. How to do it 
>   
>   
>  ___
> 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] Drools Flow Persistence Doubt

2009-10-08 Thread Mauricio Salatino
yes... the problem is that you don't need that query.
I don't know why I include it.. Do you need it for some reason?
I will test it asap and get back to you..

On Thu, Oct 8, 2009 at 11:46 AM, Jesper S. Knudsen  wrote:

> Hi Pardeep
>
> I think you are using the wrong syntax in your QL
> Should it not be:
>
> select object(v) from VariableInstanceInfo as v where
> v.processInstanceInfo.id = :processId
>
> like in ejbql?
>
> Best regards
>
> Jesper
>
>
> pardeep.ru...@lntinfotech.com skrev:
> >
> > Hi Mauricio,
> > Thanks for your reply.
> > When I try to run the demo project with configuration  to work with
> Mysql, I got this exception when I uncommented the  the named-query in
> orm.xml
> > 
> > select
> > v
> > from
> > VariableInstanceInfo v
> > where
> > v.processInstanceInfo.id = :processId
> >   
> >
> > SEVERE: Error in named query: VariableInstancesInfoByProcessId
> > org.hibernate.QueryException: could not resolve property:
> processInstanceInfo of:
> org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
> [select v from
> org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
> v where v.processInstanceInfo.id = :processId]
> > at
>
> org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:67)
> > at
>
> org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:61)
> > at
>
> org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1385)
> > at
>
> org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:302)
> >
> > Please help me resolve to this exception.
> > Am i doing something wrong?
> >
> > Thanks & Regards
> >
> > Pardeep Ruhil
> >
> >
> >
> > if you take a look at this post:
> > http://blog.athico.com/2009/09/drools-flow-variable-persistence.html
> >
> > you will see that there is a demo project with the configuration to work
> > with MySQL.
> > Greetings.
> >
> > 2009/10/7 
> >
> > >
> > > Hi,
> > > I have doubt regarding persistence in Drools.
> > > I read the documentation of persistence in Drools Flow and got to know
> that
> > > it uses hibernate with H2 database as default.
> > > My doubt is if I want to use Mysql database, then I want to know which
> are
> > > the tables that I need to create in the database or
> > > Is their any code written which automatically creates the tables in the
> > > schema in Mysql database.
> > >
> > > Also is their any document present for configuring Mysql database.
> > > Please help me to get through the situation.
> > >
> > > Thanks & Regards
> > >
> > > Pardeep Ruhil
> > > _
> >
> >
> >
> > __
> >
> >
> > ___
> > 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
>



-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Flow Persistence throws stack overflow error

2009-10-08 Thread PremKumar s
Thanks Kris for your input. It would be great if you could share us on
sample code snippet how to acheive this ObjectMarshallingStrategy for
ProcessInstances .

Also confirm us by using this approach the process is avialable for drools
rule constraints to take decisions.

Thanks
Prem

On Thu, Oct 8, 2009 at 4:07 PM, Kris Verlaenen <
kris.verlae...@cs.kuleuven.be> wrote:

> This is indeed a special case.  Process instances are already stored as
> part of the session runtime state, so no need to store them again as
> part of the working memory.  You need to register a custom
> ObjectMarshallingStrategy for ProcessInstances in the working memory
> that simply retrieves them from the session state.
>
> Kris
>
> Quoting PremKumar s :
>
> > Hi,
> >
> >
> >
> >   I am evaluating the drools expert with drool flow using
> > TimeManagement
> > System. I am inserting the process instance into working memory of
> > drools
> > [session.insert(workflowProcessInstance)]  So that the rules can use
> > the
> > process instance as part of Rule constraints to enable the rules to
> > make
> > more sophisticated decisions based on the state of the current
> > process
> > instance.
> >
> >
> >
> > Rule snippet
> >
> >
> >
> > rule "Submit Time"  ruleflow-group "Submit Time"
> >dialect "java"
> >when
> >
> >processInstance:WorkflowProcessInstance()
> >
> >tkRequest:TKRequest ()
> >tkRequestDAO:TKRequestDAO()
> >then
> >
> > // check the current processInstance state as
> > Active
> > then do that
> >
> >//Do custom operation, status change,
> > persistence
> > update
> >
> >end
> >
> >
> >
> >The approach is works fine with using
> > KnowledgeBuilder.newStatefulKnowledgeSession() that is no
> > persistence.  But
> > once i have enabled the Persistence using
> > JPAKnowledgeService.newStatefulKnowledgeSession(know, null,
> > getEnvironment())  it throws stack over flow error due the
> > workflowProcessInstance is not serialized while trying to persist the
> > newly
> > added workflowProcessInstance  to working memory.
> >
> >
> >
> >Once i have commented the
> > session.insert(workflowProcessInstance)
> > the stack overflow error is gone but none of my rules are not
> > executed.
> >
> >
> >
> > Can some one provide guidance on how to pass this
> > workflowProcessInstance to
> > rule constriant with persistence JPAKnowledgeSession enabled.
> >
> >
> >
> > Thanks
> >
> > Prem
> >
>
>
>
>
> 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 Flow Persistence Doubt

2009-10-08 Thread Jesper S. Knudsen
Hi Pardeep

I think you are using the wrong syntax in your QL
Should it not be:

select object(v) from VariableInstanceInfo as v where
v.processInstanceInfo.id = :processId

like in ejbql?

Best regards

Jesper


pardeep.ru...@lntinfotech.com skrev:
>
> Hi Mauricio,
> Thanks for your reply.
> When I try to run the demo project with configuration  to work with
Mysql, I got this exception when I uncommented the  the named-query in
orm.xml
> 
> select
> v
> from
> VariableInstanceInfo v
> where
> v.processInstanceInfo.id = :processId
>   
>
> SEVERE: Error in named query: VariableInstancesInfoByProcessId
> org.hibernate.QueryException: could not resolve property:
processInstanceInfo of:
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
[select v from
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
v where v.processInstanceInfo.id = :processId]
> at
org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:67)
> at
org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:61)
> at
org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1385)
> at
org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:302)
>
> Please help me resolve to this exception.
> Am i doing something wrong?
>
> Thanks & Regards
>
> Pardeep Ruhil
>
>
>
> if you take a look at this post:
> http://blog.athico.com/2009/09/drools-flow-variable-persistence.html
>
> you will see that there is a demo project with the configuration to work
> with MySQL.
> Greetings.
>
> 2009/10/7 
>
> >
> > Hi,
> > I have doubt regarding persistence in Drools.
> > I read the documentation of persistence in Drools Flow and got to know
that
> > it uses hibernate with H2 database as default.
> > My doubt is if I want to use Mysql database, then I want to know which
are
> > the tables that I need to create in the database or
> > Is their any code written which automatically creates the tables in the
> > schema in Mysql database.
> >
> > Also is their any document present for configuring Mysql database.
> > Please help me to get through the situation.
> >
> > Thanks & Regards
> >
> > Pardeep Ruhil
> > _
>
>
>
> __
>
>
> ___
> 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] Drools Flow Persistence Doubt

2009-10-08 Thread Pardeep . Ruhil
Hi Mauricio,
Thanks for your reply. 
When I try to run the demo project with configuration  to work with Mysql, 
I got this exception when I uncommented the  the named-query in orm.xml

select
v
from
VariableInstanceInfo v
where
v.processInstanceInfo.id = :processId
  

SEVERE: Error in named query: VariableInstancesInfoByProcessId
org.hibernate.QueryException: could not resolve property: 
processInstanceInfo of: 
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo 
[select v from 
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo 
v where v.processInstanceInfo.id = :processId]
at 
org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(
AbstractPropertyMapping.java:67)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(
AbstractPropertyMapping.java:61)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(
AbstractEntityPersister.java:1385)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(
FromElementType.java:302)

Please help me resolve to this exception.
Am i doing something wrong?

Thanks & Regards

Pardeep Ruhil



if you take a look at this post:
http://blog.athico.com/2009/09/drools-flow-variable-persistence.html

you will see that there is a demo project with the configuration to work
with MySQL.
Greetings.

2009/10/7 

>
> Hi,
> I have doubt regarding persistence in Drools.
> I read the documentation of persistence in Drools Flow and got to know 
that
> it uses hibernate with H2 database as default.
> My doubt is if I want to use Mysql database, then I want to know which 
are
> the tables that I need to create in the database or
> Is their any code written which automatically creates the tables in the
> schema in Mysql database.
>
> Also is their any document present for configuring Mysql database.
> Please help me to get through the situation.
>
> Thanks & Regards
>
> Pardeep Ruhil
> _




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


Re: [rules-users] State management in Guvnor

2009-10-08 Thread Steve Ronderos
Check out "selectors" in section 1.2.5.3 of the Guvnor Documentation 
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_single/index.html#d0e233

Steve Ronderos 

rules-users-boun...@lists.jboss.org wrote on 10/08/2009 06:35:39 AM:

> [image removed] 
> 
> [rules-users] State management in Guvnor
> 
> Ambika Goel 
> 
> to:
> 
> rules-users@lists.jboss.org
> 
> 10/08/2009 06:41 AM
> 
> Sent by:
> 
> rules-users-boun...@lists.jboss.org
> 
> Please respond to Rules Users List
> 
> Hi All, 
> 
> What is the significance of Status in Guvnor. I have added multiple 
> statuses like Production, Testing etc. 
> How can I use it to differentiate between rules. I want to run  only
> the rules under production status. How to do it
> 
> 
>  ___
> 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] Uses of timer node

2009-10-08 Thread Renato Herebia
Thanks Alexandros and Kris!

It works!

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


[rules-users] Ctrl + space + enter ERASE ALL LINE? BROKEN? * DROOLS 5.0.1 Context assist*

2009-10-08 Thread mehdi bennani

Hi guys,

I have been using drools 4 for couple of months now and I am starting to get 
the hang of it. We recently decided to move to Dools 5 with Eclipse 3.4.2 
(Ganymede). 
We unfortunately hit a major 'show stopper' (for us at least). In the DSLR 
editor: Context Assist + space + enter removes/replaces the whole line, not 
only the place holder.

In other words:

DSL:
[*][]Log : {msg}=System.out.println("{msg}");
[*][]id1="some id label"

DSLR:
rule "MyRule"
when
then 
end

In my DSLR, If I Press L then control space --> the line Log:{msg} appears in 
the context menu. Hit enter I get
Log :{msg}

Now, If want to replace msg by id1. I position the cursor in the _{msg}, hit 
ctrl space, id1 shows in the list. 
I hit enter the whole line is replaced, hence I am left with
id1
instead of
Log : id1

Is this a setting somewhere in eclipse itself?? I doubt it but maybe...
The same thing use to work 'as expected' in Drools 4. Is this a bug?

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


[rules-users] State management in Guvnor

2009-10-08 Thread Ambika Goel
Hi All,

What is the significance of Status in Guvnor. I have added multiple statuses 
like Production, Testing etc.
How can I use it to differentiate between rules. I want to run  only the rules 
under production status. How to do it



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


Re: [rules-users] [droolsflow] Constraint Editor

2009-10-08 Thread Kris Verlaenen
By default, the WSHumanTaskHandler also completes the human task node if
the human task has been failed (check out the source code for details:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-process/drools-process-task/src/main/java/org/drools/process/workitem/wsht/WSHumanTaskHandler.java
).

You can easily change this behaviour by implementing your own handler
though.  You could for example add the task as a result parameter, or
add a status result parameter that contains the final state of the task.
 Simply add these to the results map in
WSHumanTaskHandler.GetCompletedTaskResponseHandler.

Kris

Quoting Anderson vasconcelos :

> I have a flow that user (Human Task) can choose two ways: Valid
> Ticket and
> Invalid Ticket
> To pass to valid way, i used a MinataskClient.Complete and it works.
> But to go to invalid way, i try to used MinaTaskClient.fail, but
> this
> command not continue my task.
> 
> My question is:
> 1) Whats the bast way to invalidade a ticket and finish the flow?
> 2) Its possible to get the task inside Split Constaint? (I think in
> this
> possibility. I get the task and check if it status=='FAILED')
> 
> Thanks
> 




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] [droolsflow] ForEach usage - Version 5.1.0

2009-10-08 Thread Kris Verlaenen
This is possible, if you only have one FactObject in the working memory.
 In general, I think it is probably a better idea to either pass this
data in as a parameter when starting the process (so you can store it as
a variable then), or maybe use a global (if there only is one anyway).

Kris

Quoting Anderson vasconcelos :

> Hi All
> To use a ForEach element i need to access a collection inside my
> FactObject.  (FactObject.list)
> I tried to call FactObject.list inside a CollectionExpressions but
> this
> fail. (Just ok with list defined as a process variable)
> *So i do something thats a consider a workaround:*
> 
> 1- I Create a '"Action Node" before a "ForEach Node"
> 
> 2-In the "Action Node", i get the FactObject and populate the
> process
> variable that represents FactObject.list :
> *FactObject factObject =
> (FactObject)drools.getKnowledgeRuntime().getObjects(new
> ClassObjectFilter(FactObject.class)).iterator().next();
> context.setVariable("list", factObject.getDefeitos());*
> 
> 3- And on the "Foreach node" i just  passed the "list" in the
> CollectionExpressions
> 
> This is the correct way to do this? Has a better way to get
> FactObject.list
> to use on "For Each Node"?
> 
> On Eclipse, the CollectionExpression of forEach don't have a window
> (Like
> Action Editor) to put a MVEL/Java expressions. I think this is a
> interesting
> resource.
> 




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] Help with Drools Flow

2009-10-08 Thread Kris Verlaenen
By default, the engine only executes rules if you tell it to.  So the
behaviour you are describing is indeed the expected behaviour, the
ruleflow-group will remain active until all rules in it that are active
have been executed.  So you need to call fireAllRules() manually or run
the engine in reactive mode.

Kris

Quoting "Nair, Mahesh" :

> Hi,
> 
> I have recently started with Drools flows .  I am having some trouble
> using the ruleFlowGroup node.
> 
> The way I understood the user guide is that when the flow reaches a
> ruleFlowGroup the engine will start firing rules associated to the
> specific rule flow group . But when I try what I see is that the call
> to the startProcess returns when it reaches a ruleFlowGroup node. The
> audit logs show that the RuleFlowGroup is activated.
> 
> After the return  when I explicitly call a fireAllRules the rule
> group  seems to get executed and the flow moves on to the subsequent
> nodes.
> 
> What is the expected behavior? Will the rules start executing
> automatically when a ruleFlowGroup node is reached or do you have to
> call fire all rules explicitly?
> 
> I am using drools 5
> 
> thanks in advance
> Mahesh
> 
> 




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 Flow Persistence throws stack overflow error

2009-10-08 Thread Kris Verlaenen
This is indeed a special case.  Process instances are already stored as
part of the session runtime state, so no need to store them again as
part of the working memory.  You need to register a custom
ObjectMarshallingStrategy for ProcessInstances in the working memory
that simply retrieves them from the session state.

Kris

Quoting PremKumar s :

> Hi,
> 
> 
> 
>   I am evaluating the drools expert with drool flow using
> TimeManagement
> System. I am inserting the process instance into working memory of
> drools
> [session.insert(workflowProcessInstance)]  So that the rules can use
> the
> process instance as part of Rule constraints to enable the rules to
> make
> more sophisticated decisions based on the state of the current
> process
> instance.
> 
> 
> 
> Rule snippet
> 
> 
> 
> rule "Submit Time"  ruleflow-group "Submit Time"
>dialect "java"
>when
> 
>processInstance:WorkflowProcessInstance()
> 
>tkRequest:TKRequest ()
>tkRequestDAO:TKRequestDAO()
>then
> 
> // check the current processInstance state as
> Active
> then do that
> 
>//Do custom operation, status change,
> persistence
> update
> 
>end
> 
> 
> 
>The approach is works fine with using
> KnowledgeBuilder.newStatefulKnowledgeSession() that is no
> persistence.  But
> once i have enabled the Persistence using
> JPAKnowledgeService.newStatefulKnowledgeSession(know, null,
> getEnvironment())  it throws stack over flow error due the
> workflowProcessInstance is not serialized while trying to persist the
> newly
> added workflowProcessInstance  to working memory.
> 
> 
> 
>Once i have commented the
> session.insert(workflowProcessInstance)
> the stack overflow error is gone but none of my rules are not
> executed.
> 
> 
> 
> Can some one provide guidance on how to pass this
> workflowProcessInstance to
> rule constriant with persistence JPAKnowledgeSession enabled.
> 
> 
> 
> Thanks
> 
> Prem
> 




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] Uses of timer node

2009-10-08 Thread Kris Verlaenen
By default, the engine runs in a passive mode.  That means it will only
execute if you ask it to (and will go back into passive mode after
that).  As a result, timers that are activated will only execute the
next time the engine is activated (by for example calling fireAllRules()).

You can however run the engine in reactive mode so it reacts to triggers
etc. immmediately:

new Thread(new Runnable() {
  public void run() {
ksession.fireUntilHalt();
  }
}).start();

Check out the documentation for more info:
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch03.html#sec.timers

Kris

Quoting Renato Herebia :

> Hi!
> 
> I'm testing the timer node and I did a simple flow with start node,
> action
> node (System.out.println("action node 1");),
> a timer node, other action node (System.out.println("action node
> 2");) and
> the end node. When the process start,
> the first action node is triggered, after that, the timer node is
> activated
> and don't pass for the next action node after
> the delay time programmed.
> 
> Has any configuration to do when working with timer nodes (handlers,
> etc.)?
> Someone has a simple example like
> this I'm testing?
> 
> Thanks!
> 
> -- 
> Renato Herebia
> 




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] For each - properties

2009-10-08 Thread Kris Verlaenen
I believe that you do not need a for each node here.  Note that rules
automatically get executed "for each" possible match.  So if you write a
rule that checks a loan linked to a person, it will automatically do
this for each loan related to that person.  E.g.

when
  p:Person()
  Loan (personId == p.id)
  ...

will get executed for each loan linked to that person.

Kris

Quoting Betto Bardi :

> Hello,
> 
> I have been experimenting with the for each loop in Drools Flow, but
> I cannot get it to work. This is because I don't know how to specify
> the properties of this node. Could you please have a look at the
> attached sample and point me in the right direction on how to specify
> these properties? I'm struggling mainly with the properties:
> CollectionExpression and Variable Name (marked red in the attached
> file: screenshot.jpg).
> 
> As you can see in the attached file DroolsTest.java my domain model
> is simple. There are two entities, Person and Loan. A Person can have
> zero or more Loans. The for each construction in the flow file should
> execute some rule for each Loan belonging to a Person.
> 
> I appreciate your help.
> 
> Thanks,
> Betto Bardi
> 
> 
>   




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] Rules file syntax validation

2009-10-08 Thread Ruben Correia

Hi there,

I'm currently working on a project that uses Drools, and we need to perform
a simple syntax validation of rules files. I've searched the forum and
elsewhere, but wasn't able to find any good example that would suite my
needs.

Thanks in advance!
-- 
View this message in context: 
http://www.nabble.com/Rules-file-syntax-validation-tp25787166p25787166.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] unable to resolve method using strict-mode

2009-10-08 Thread cdelgado

Thanks a lot vladperl. It works for me too!


vladperl wrote:
> 
> 
> try this:
> 
> System.setProperty("drools.dialect.mvel.strict", "false");
> 
> it works for me :)
> 
>> Date: Mon, 5 Oct 2009 00:08:48 -0700
>> From: cdelgad...@gmail.com
>> To: rules-users@lists.jboss.org
>> Subject: Re: [rules-users] unable to resolve method using strict-mode
>> 
>> 
>> Hi all,
>> 
>> I am getting the same problem reported by vladperl. I've got rules and
>> rulesflows using MVEL2 scripts that work fine in Windows running in JBoss
>> and junit tests. I've inserted a map into StatefulKnowledgeSession and I
>> am
>> successfully invoking myMap.myObject.myValue without any casting. However
>> I
>> am now deploying the application in RedHat with Websphere 7 and I am
>> getting
>> everywhere errors like:
>> unqualified type in strict mode for: myObject
>> unqualified type in strict mode for: myValue
>> unable to resolve method using strict-mode:
>> java.lang.Object.get(java.lang.String)]
>> 
>> It seems that somehow the MVEL's Strong Typing Mode has been setup in
>> this
>> env. This doesn't make sense to me. I rather prefer to believe the error
>> is
>> misleading and something else is bothering MVEL when parsing my rules and
>> ruleflow files.
>> 
>> Any help will be much appreciated!
>> 
>> 
>> 
>> vladperl wrote:
>> > 
>> > 
>> > Hi Wolfgang,
>> > Please take a look at attached new example.
>> > This time the example can demonstrate when strict mode is false we
>> don't
>> > have to put class cast.
>> > Beside I finally figured out how to switch strict mode for MVEL
>> dialect.
>> > 
>> > Best regards,
>> > Vladimir
>> > 
>> > Date: Sat, 3 Oct 2009 14:36:10 +0200
>> > From: wolfgang.l...@gmail.com
>> > To: rules-users@lists.jboss.org
>> > Subject: Re: [rules-users] unable to resolve method using strict-mode
>> > 
>> > The Java code in the archive just compiles a .drl file, and there's no
>> > reason this should fail. The class cast would only appear to be missing
>> > after a Map object is inserted into WM, and the session is run so that
>> the
>> > rule fires.
>> > 
>> > -W
>> > 
>> > 2009/10/2 Vladimir Perlov 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > It's compiled and working on Windows without any casting :)
>> > Check out the test project I attached. 
>> > You will see that the rule  will compile  from web application (Windows
>> > only) or with Java SE application. The  web application using JSF so in
>> > case to run it use application server with included JSF library.
>> > 
>> > 
>> > http://download.java.net/glassfish/v3/promoted/
>> > 
>> > 
>> > Date: Fri, 2 Oct 2009 19:48:17 +0200
>> > From: wolfgang.l...@gmail.com
>> > 
>> > To: rules-users@lists.jboss.org
>> > Subject: Re: [rules-users] unable to resolve method using strict-mode
>> > 
>> > Map() in the .drl file is bound to be interpreted as Map
>> so
>> > that a Map.get() returns an Object. To be able to call method
>> > getSomeMethod() you'd have to cast this result, according to
>> > 
>> > 
>> >  ((SomeClass)$map.get("x")).getSomeMethod()
>> > 
>> > 
>> > I fail to understand how this could ever be avoided - strict or no
>> strict,
>> > MVEL or not MVEL.
>> > 
>> > -W 
>> > 
>> > 2009/10/2 Vladimir Perlov 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > Hi Wolfgang,
>> > Thank you very much for quick response!
>> > 
>> > I tried your suggestion and still getting the following error:
>> > 
>> > Unable to build expression for 'consequence': Failed to compile: 1
>> > compilation error(s): - (1,29) unable to resolve method using
>> > strict-mode: java.lang.Object.getSomeMethod() '
>> > System.out.println($map.get("x").getSomeMethod());
>> > ' : [Rule name='TEST']
>> > At least now I have only 1 compilation error comparing to the previous
>> > variant.
>> > 
>> > modified rule:
>> > 
>> > rule "TEST"
>> > 
>> > 
>> > dialect "mvel"
>> > when
>> > $map : Map()
>> > 
>> > 
>> > then
>> > System.out.println($map.get("x").getSomeMethod());
>> > end
>> > 
>> > 
>> > 
>> > I believe that problem is related to strict-mode that somehow enforced
>> on
>> > Linux but not on Windows.
>> > I tried to remove the strict mode using the the following approach but
>> it
>> > seems don't have any effect.
>> > We have web application with many drools rules and it's working on
>> Windows
>> > but when we deployed the same application to   Linux we are getting
>> failed
>> > compile errors ;) 
>> > 
>> > 
>> > 
>> > KnowledgeBuilderConfiguration config =
>> > KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); 
>> > config.setProperty("drools.dialect.mvel.strict", "false");
>> > 
>> > 
>> > kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);
>> > 
>> > Please advise me.
>> > 
>> > By the way I'm using drools 5.0.1
>> > 
>> > 
>> > Date: Fri, 2 Oct 2009 18:30:25 +0200
>> > 
>> > 
>> > From: wolfgang.l...@gmail.com
>> > To: rules-users@lists.jboss.org
>> > Subject: Re: [rules-users] unable to resolve method using strict-mod