[rules-users] Firing Rules from DB (Dynamic Rules)

2008-04-02 Thread hanumesh.m

Hi,

  As rules may keep on changing, I am using database to store the datails of
a rule. Say in table Transaction (ruleName, fileMask, fromQ, ToQ,transType).
An admin application may keep on adding/editing these rules as and when
required.

  I have a mule application, where in a mule Component will poll a specific
directory for a file. The file name will follow certain guidelines so that,
I can check the fileName against the fileMask in the database(Transaction
table. Assume there are rows as follows: 

'Rule ABC', 'ABC-834','ABC-834-edi','ABC-834.xml','834'  (indicates when
fileName has mask 'ABC-834' then the fromQueue for it is 'ABC-834.edi' and
toQueue is 'ABC-834.xml' 

'Rule XYZ', 'XYZ-834','XYZ-834.edi','XYZ-834.xml','834'

'Rule JIM', 'JIM-850','JIM-850.edi','JIM-850.xml','850'   so fileMask's r
('ABC-834','XYZ-834','JIM-850')


  The rules check will be in the .drl file, which will check the fileName
against each row(a bean repr. of eachrow) of the database and when ever
finds the match, obtains the fromQ and toQ of that matching row and updates
the fact object Message.

  Further activities of the Mule Component makes use of updated values(by
rules Engine) of Message object to decide on the target queues for the
content of the file.

  I have issues in implementing this and unable to fire the rules
successfully. Here I am facing issues of using the two objects in
WorkingMemory (Message and RuleVO-representing a rows information of DB)

 If anyone has worked in similar areas please help me out in solving this
problem. I am uploading the files Bean(Message,TransactionVO), Business
object(commonBO) (using applyRule() method), drl(Test.drl, and hardcoded
working version of Test_old.drl file )

 In Mule UMO Component I will call commonBo's applyRule();
/// here is the code in Mule Component

   cbo = new CommonBO();
   
LoadContextPath.setEdiFileName((String)msg.getProperty("originalFilename"));
cbo.applyRule();
  
Thanks in advance,
Hanumesh M
http://www.nabble.com/file/p16443580/DynRules.zip DynRules.zip 
-- 
View this message in context: 
http://www.nabble.com/Firing-Rules-from-DB-%28Dynamic-Rules%29-tp16443580p16443580.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


[rules-users] Drools Eclipse Plugin Problem

2008-04-02 Thread Seema Richard

Hi all,


I have added the Drools 4.0.6 plugin in my Eclipse v 3.2.2.
I have the plugin jar containing all the required classes in the
org.drools.eclipse_4.0.6.jar which is added to the plugins folder of
Eclipse. But I'm getting this error when I attempt to open a .drl file.

java.lang.ClassNotFoundException:
org.drools.eclipse.editors.DRLRuleEditor2
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLo
ader.java:402)

If I click on the 'Drools Preferences' page in Eclipse preferences, I
get
this error.
Plug-in org.drools.eclipse was unable to load class
org.drools.eclipse.preferences.DroolsPreferencePage.

I looked at the console log of Eclipse and saw the following errors when
Eclipse started loading.

Cannot throw the type DroolsParserException
compiledRules cannot be resolved
parsedRules cannot be resolved
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
parsedRules cannot be resolved
The type java.lang.Class cannot be resolved. It is indirectly
referenced
 from required .class files
The method getContent() is undefined for the type
AbstractRuleEditor
The method getContent() is undefined for the type
AbstractRuleEditor
String cannot be resolved to a type
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
String cannot be resolved to a type
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
compiledRules cannot be resolved
ruleInfoByClassNameMap cannot be resolved
The method getClassName() is undefined for the type
DRLInfo.RuleInfo
functionInfoByClassNameMap cannot be resolved
The method getClassName() is undefined for the type
DRLInfo.FunctionInfo

parsedRules cannot be resolved
Cannot throw the type DroolsParserException
String cannot be resolved to a type
Cannot throw the type DroolsParserException
The type java.lang.Thread cannot be resolved. It is indirectly
reference
d from required .class files
The type java.io.File cannot be resolved. It is indirectly
referenced fr
om required .class files
The type java.net.URL cannot be resolved. It is indirectly
referenced fr
om required .class files
String cannot be resolved to a type
String cannot be resolved to a type
The hierarchy of the type MyResourceVisitor is inconsistent
Implicit super constructor Object() is undefined for default
constructor
. Must define an explicit constructor
Cannot throw the type CoreException

at org.drools.eclipse.DroolsEclipsePlugin.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleAct
ivator(AbstractBundle.java:136)
... 72 more
Root exception:
java.lang.Error: Unresolved compilation problems:
The type java.io.InputStream cannot be resolved. It is
indirectly
refere
nced from required .class files
The type java.lang.ClassLoader cannot be resolved. It is
indirectly
refe
renced from required .class files
The type java.io.IOException cannot be resolved. It is
indirectly
refere
nced from required .class files
The type java.io.Reader cannot be resolved. It is indirectly
referenced
from required .class files
The type java.lang.Exception cannot be resolved. It is
indirectly
refere
nced from required .class files
The import java.io.Reader cannot be resolved
The import java.util.HashMap cannot be resolved
The import java.util.Iterator cannot be resolved
The import java.util.List cannot be resolved
The import java.util.Map cannot be resolved
The import java.util.MissingResourceException cannot be resolved
The import java.util.ResourceBundle cannot be resolved
The hierarchy of the type DroolsEclipsePlugin is inconsistent
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
ResourceBundle cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to a type
  

[rules-users] Problem with mvel trying to coerce a String to a number

2008-04-02 Thread Brett M. Bergquist

I have a fact that a Map of Strings:

   private Map property = new HashMap();

   /**
* Gets the property map
* @return The property map
*/
   public Map getProperty() {
   return property;
   }

   /**
* Sets the property map
* @param property The new property map
*/
   public void setProperty(Map property) {
   this.property = property;
   }
  
Inside a rule, I am trying to use this map and the rule looks like:


   rule "3-new Notificationcp9145Authentication"
   when
   notification : Notificationcp9145Authentication($againstId :
   targetID,
  
   $badHostString : badHostString,
  
   $applicationName : applicationName)

   not AlarmEventFact(type == AlarmType.ACTIVE,
  alarmName == "cp9145Authentication",
  againstId == $againstId,
  property['badHostString'] == $badHostString,
  property['applicationName'] ==
   $applicationName
  )
   then
   alarmEventKnowledge.create(drools, notification,
   "cp9145Authentication",
   new Pair("badHostString",
   $badHostString),
   new Pair("applicationName",
   $applicationName));

   end

The problem that I am having is that the result of the lookup of 
"property['badHostString']" is a string that looks like "192.168.1.19" 
(an IP address).  The "badHostString" property of the 
Notificationcp9145Authentication fact is a String.  I am getting an 
error when the rule is fired.  It appears that the 
"property['badHostString']" is trying to be interpreted as a number.  
Here is some of the stack traceback:


   Caused by: java.lang.NumberFormatException
   at java.math.BigDecimal.(BigDecimal.java:362)
   at java.math.BigDecimal.(BigDecimal.java:647)
   at
   
org.mvel.math.IEEEFloatingPointMath.getBigDecimalFromType(IEEEFloatingPointMath.java:373)
   at
   
org.mvel.math.IEEEFloatingPointMath._doOperations(IEEEFloatingPointMath.java:83)
   at
   
org.mvel.math.IEEEFloatingPointMath.doOperation(IEEEFloatingPointMath.java:40)
   at org.mvel.util.ParseTools.doOperations(ParseTools.java:753)
   at
   
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:20)
   at org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
   at
   org.mvel.CompiledExpression.getValue(CompiledExpression.java:98)
   at org.mvel.MVEL.executeExpression(MVEL.java:202)
   at
   org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)   
   at

   
org.drools.rule.PredicateConstraint.isAllowedCachedLeft(PredicateConstraint.java:206)

If I change the property value to be something like "abc" then this does 
not occur, so I am pretty user that it is trying to convert 
"192.168.1.19" to a number even though it is already a string and the 
$badHostString is a String as well.


How can I force this to not try to convert?

Any help will be greatly appreciated.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] and/or connectives using DSL

2008-04-02 Thread mpturkia

Hey everyone,

I've been trying to figure out a way to use the OR connective in a similar
manner as the AND connective using the DSL definition, but can't quite
figure out how this could be done. Currently I can do the following:

rule "Rule1"
when
MyObject
- value1 equals 5
- value2 equals 10
- value3 equals 15
then
System.out.println("Value1 is 5 and value2 is 10 and value3 is
15.");
end

DSL file looks like:
[when][]{obj}=$obj : {obj}()
[when][]- {var} equals {value}={var} == {value}

This results in the rule as:

rule "Rule1"
when
$obj : MyObject(value1 == 5, value2 == 10, value3 == 15)
then
System.out.println("Value1 is 5 and value2 is 10 and value3 is
15.");
end

What I would like to do is use OR as well instead of just and. So I would
like the rule to look like:

rule "Rule1"
when
MyObject
- value1 equals 5
- value2 equals 10
OR value3 equals 15
then
System.out.println("Value1 is 5 and value2 is 10 or value3 is 15.");
end

This I'd like to result in a rule like:

rule "Rule1"
when
$obj : MyObject(value1 == 5, value2 == 10 || value3 == 15)
then
System.out.println("Value1 is 5 and value2 is 10 or value3 is 15.");
end

I don't want to use the 'or' command since that splits the rule into two
rules. I'd like to use the connective or '||' with the DSL syntax. Does
anybody know a work-around to get this working?

I've tried using sentence fragments to get it done, but the parser doesn't
match the patterns quite like I need them to match.

And of course, if there's a syntax already available (',' = '-', '||' = ??)
I'd be thrilled if someone pointed it out to me :)

Thanks!
Markus

-- 
View this message in context: 
http://www.nabble.com/and-or-connectives-using-DSL-tp16448654p16448654.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


[rules-users] RuleAgent is not retrieving updated rule?

2008-04-02 Thread Andres Bonifacio
Here's how I did it:

1. I successfully deployed jbrms and insurance webapp (both using
Drools v 4.0.6) successfully to JBoss 4.0.5.

2. From the jbrms webapp, I modified the "Night Vehicle Place"
technical rule, just change the sysout statement.

3. Rebuild the binary package.  Recreate the snapshot deployment -
InsuranceDemo.

4. Retest using the insurance url and see if the new version (Remember
the sysout stmt change in #2.) of the rule will be picked up by the
RuleAgent.  Alas it did NOT.


Now this is of course inside a container environment.  What is strange
though is if you tried to run the InsuranceCalculateTest which is a
JUnit test it recognize the rule change immediately.  Which I think
should be the behavior exhibited on a container environment as well.
Right?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Eclipse Plugin Problem

2008-04-02 Thread Mark Proctor
There was poor QA on the last two releases by the release engineer. I 
will personally over see the next release and make sure this is all fixed.


Sorry

Mark
Seema Richard wrote:

Hi all,


I have added the Drools 4.0.6 plugin in my Eclipse v 3.2.2.
I have the plugin jar containing all the required classes in the
org.drools.eclipse_4.0.6.jar which is added to the plugins folder of
Eclipse. But I'm getting this error when I attempt to open a .drl file.

java.lang.ClassNotFoundException:
org.drools.eclipse.editors.DRLRuleEditor2
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLo
ader.java:402)

If I click on the 'Drools Preferences' page in Eclipse preferences, I
get
this error.
Plug-in org.drools.eclipse was unable to load class
org.drools.eclipse.preferences.DroolsPreferencePage.

I looked at the console log of Eclipse and saw the following errors when
Eclipse started loading.

Cannot throw the type DroolsParserException
compiledRules cannot be resolved
parsedRules cannot be resolved
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
parsedRules cannot be resolved
The type java.lang.Class cannot be resolved. It is indirectly
referenced
 from required .class files
The method getContent() is undefined for the type
AbstractRuleEditor
The method getContent() is undefined for the type
AbstractRuleEditor
String cannot be resolved to a type
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
String cannot be resolved to a type
Cannot throw the type DroolsParserException
compiledRules cannot be resolved
compiledRules cannot be resolved
ruleInfoByClassNameMap cannot be resolved
The method getClassName() is undefined for the type
DRLInfo.RuleInfo
functionInfoByClassNameMap cannot be resolved
The method getClassName() is undefined for the type
DRLInfo.FunctionInfo

parsedRules cannot be resolved
Cannot throw the type DroolsParserException
String cannot be resolved to a type
Cannot throw the type DroolsParserException
The type java.lang.Thread cannot be resolved. It is indirectly
reference
d from required .class files
The type java.io.File cannot be resolved. It is indirectly
referenced fr
om required .class files
The type java.net.URL cannot be resolved. It is indirectly
referenced fr
om required .class files
String cannot be resolved to a type
String cannot be resolved to a type
The hierarchy of the type MyResourceVisitor is inconsistent
Implicit super constructor Object() is undefined for default
constructor
. Must define an explicit constructor
Cannot throw the type CoreException

at org.drools.eclipse.DroolsEclipsePlugin.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleAct
ivator(AbstractBundle.java:136)
... 72 more
Root exception:
java.lang.Error: Unresolved compilation problems:
The type java.io.InputStream cannot be resolved. It is
indirectly
refere
nced from required .class files
The type java.lang.ClassLoader cannot be resolved. It is
indirectly
refe
renced from required .class files
The type java.io.IOException cannot be resolved. It is
indirectly
refere
nced from required .class files
The type java.io.Reader cannot be resolved. It is indirectly
referenced
from required .class files
The type java.lang.Exception cannot be resolved. It is
indirectly
refere
nced from required .class files
The import java.io.Reader cannot be resolved
The import java.util.HashMap cannot be resolved
The import java.util.Iterator cannot be resolved
The import java.util.List cannot be resolved
The import java.util.Map cannot be resolved
The import java.util.MissingResourceException cannot be resolved
The import java.util.ResourceBundle cannot be resolved
The hierarchy of the type DroolsEclipsePlugin is inconsistent
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
ResourceBundle cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to a type
Map cannot be resolved to a type
HashMap cannot be resolved to 

[rules-users] Problems using shadow proxies and Hibernate lazy initialization

2008-04-02 Thread Keith Bennett
I am currently using Drools to validate an extensive object graph.
When I validate a transient object graph (i.e., not persisted via
Hibernate) inside of a JUnit test method, validation occurs
successfully.  However, when I retrieve the same object graph from
Hibernate and subsequently validate it, I get the stack trace that
I've included below, but only when I use shadow proxies.  When I turn
shadow proxies off, validation runs successfully against the persisted
object graph again.  Of course, I'm utilizing lazy association
fetching to improve performance and want to continue utilizing it.
Has anyone run into this same problem, and if so, were you able to
work around it without turning shadow proxies off?  Before you ask, my
Hibernate session is open before and after I invoke Drools to perform
validation in the same unit of work (i.e., transaction), so it's not
an issue of not having an active Hibernate session available (I've
verified this through testing).

One more thing.  The user guide says that if shadow proxies are turned
off that modifyRetract() should be called before an object is modified
and modifyAssert() should be called after it is modifed.  First, what
is the method parameter to these two overloaded methods, Object or
FactHandle (both exist)?  Second, I don't see modifyAssert() available
in the library, just modifyInsert().  Should the documentation change
to read modifyInsert() instead of modifyAssert()?  If so, again with
which parameter?

I appreciate any insight you may have!

Here's the stack trace:

org.hibernate.LazyInitializationException: failed to lazily initialize
a collection, no session or session was closed
at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at 
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
at org.hibernate.collection.PersistentSet.addAll(PersistentSet.java:244)
at 
org.drools.util.ShadowProxyUtils.cloneObject(ShadowProxyUtils.java:76)
at 
com.cbi.domain.loan.indirect.IndirectLoanShadowProxy.getCustomers(Unknown
Source)
at 
org.drools.base.com.cbi.domain.loan.indirect.IndirectLoan28409161$getCustomers.getValue(Unknown
Source)
at 
org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:127)
at org.drools.rule.Declaration.getValue(Declaration.java:198)
at 
LoanValidationBusinessRules.Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.evaluate(Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.java:12)
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
at 
org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
at 
org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)
at 
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
at 
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at 
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at 
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
at 
com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.executeRules(DroolsBusinessRulesServiceHelper.java:77)
at 
com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.validate(DroolsBusinessRulesServiceHelper.java:66)
at 
com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceImpl.validate(DroolsBusinessRulesServiceImpl.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at 
org.springframework.transaction.interceptor.TransactionInterceptor.in

Re: [rules-users] Problems using shadow proxies and Hibernate lazy initialization

2008-04-02 Thread Edson Tirelli
   It seems the docs need to be updated. Would you plz open a JIRA to fix
the place you are seeing this info?

   For more current info, take a look at this blog post, specially the end
on "how to disable shadow facts":

http://blog.athico.com/2008/02/shadow-facts-what-you-always-wanted-to.html

   []s
   Edson

2008/4/2, Keith Bennett <[EMAIL PROTECTED]>:
>
> I am currently using Drools to validate an extensive object graph.
> When I validate a transient object graph (i.e., not persisted via
> Hibernate) inside of a JUnit test method, validation occurs
> successfully.  However, when I retrieve the same object graph from
> Hibernate and subsequently validate it, I get the stack trace that
> I've included below, but only when I use shadow proxies.  When I turn
> shadow proxies off, validation runs successfully against the persisted
> object graph again.  Of course, I'm utilizing lazy association
> fetching to improve performance and want to continue utilizing it.
> Has anyone run into this same problem, and if so, were you able to
> work around it without turning shadow proxies off?  Before you ask, my
> Hibernate session is open before and after I invoke Drools to perform
> validation in the same unit of work (i.e., transaction), so it's not
> an issue of not having an active Hibernate session available (I've
> verified this through testing).
>
> One more thing.  The user guide says that if shadow proxies are turned
> off that modifyRetract() should be called before an object is modified
> and modifyAssert() should be called after it is modifed.  First, what
> is the method parameter to these two overloaded methods, Object or
> FactHandle (both exist)?  Second, I don't see modifyAssert() available
> in the library, just modifyInsert().  Should the documentation change
> to read modifyInsert() instead of modifyAssert()?  If so, again with
> which parameter?
>
> I appreciate any insight you may have!
>
> Here's the stack trace:
>
> org.hibernate.LazyInitializationException: failed to lazily initialize
> a collection, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> at
> org.hibernate.collection.PersistentSet.addAll(PersistentSet.java:244)
> at
> org.drools.util.ShadowProxyUtils.cloneObject(ShadowProxyUtils.java:76)
> at
> com.cbi.domain.loan.indirect.IndirectLoanShadowProxy.getCustomers(Unknown
> Source)
> at
> org.drools.base.com.cbi.domain.loan.indirect.IndirectLoan28409161$getCustomers.getValue(Unknown
> Source)
> at
> org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:127)
> at org.drools.rule.Declaration.getValue(Declaration.java:198)
> at
> LoanValidationBusinessRules.Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.evaluate(Rule_A_Loan_must_have_at_least_one_Customer_0Eval0Invoker.java:12)
> at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
> at
> org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
> at
> org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)
> at
> org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
> at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
> at
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
> at org.drools.reteoo.Rete.assertObject(Rete.java:175)
> at
> org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
> at
> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
> at
> com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.executeRules(DroolsBusinessRulesServiceHelper.java:77)
> at
> com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceHelper.validate(DroolsBusinessRulesServiceHelper.java:66)
> at
> com.cbi.service.loan.indirect.impl.DroolsBusinessRulesServiceImpl.validate(DroolsBusinessRulesServiceImpl.java:97)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess

[rules-users] Running through Collection using DSL

2008-04-02 Thread Markus Helbig
Hi,

i'd like to do the following in consequence:


for (Iterator it = $collection.iterator(); it.hasNext(); $item = it.next()) {
  System.out.println($item);
}

But as always i'd like to use a DSL

[consequence][]For each {item} from {collection}=for (Iterator it =
{collection}.iterator(); it.hasNext(); {item} = it.next()) {
[consequence][]End=}

The Rule:

For each $item from $pli.getItems()
Show $item
End


The DRL Viewer exactly shows what i want to have. But compiling any
rulefile expanding this DSL (also the consequences are not used)
resolve into following errors:

line 68:0 mismatched character '' expecting '"'
[0,-1]: unknown:0:-1 mismatched token: [EMAIL PROTECTED],0:0='',<-1>,0:-1]; expecting type END

or

line 131:80 required (...)+ loop did not match anything at character '+'
line 15:74 no viable alternative at character '\'

The reason theems to be

[consequence][]End=}

But why?? Any suggestions, thans very much in advance

Cheers

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