yeah its a current restriction we will be getting rid of in a future version, for sure.
On 10/25/06, Steven Williams <[EMAIL PROTECTED]> wrote:
I don't believe you can use eval with column constraints (ie. with "-"). I think your DSL should be:[when]There is a Policy=policy : PolicyStatus(expiresOn : expiresOn)
[when]Today is {n} days before or {m} days after expiration=eval(
expiresOn != null && inDateRange(subtractDays(expiresOn, {n}),
addDays(expiresOn, {m}), now()) )
[when]Today is {n} days after expiration=eval( expiresOn != null &&
expiresOn.compareTo(subtractDays(now(), {n})) <= 0 )
[when]- with status "{status}"=status == "{status}"
[then]Notify {notification}=policy.addMessage({notification});
The "- with status" constraint would always have to be before either of the "Today" constraints.--On 10/25/06, jwheeler1 <[EMAIL PROTECTED] > wrote:
Ugh, it appears to have something to do with binding expiresOn on the first
line. I need to bind it there otherwise my evals won't work on lines 2 and
3. Seems like a bug. no?
jwheeler1 wrote:
>
> I am having a problem with what appears to be the 4th line down. the
> 'status' field.
>
> [when]There is a Policy=policy : PolicyStatus(expiresOn : expiresOn)
> [when]- today is {n} days before or {m} days after expiration=eval(
> expiresOn != null && inDateRange(subtractDays(expiresOn, {n}),
> addDays(expiresOn, {m}), now()) )
> [when]- today is {n} days after expiration=eval( expiresOn != null &&
> expiresOn.compareTo(subtractDays(now(), {n})) <= 0 )
> [when]- with status "{status}"=status == "{status}"
> [then]Notify {notification}=policy.addMessage({notification});
>
> I have read one other similar thread, that boiled down to not having a
> space after the dash. I do have a space.
> I am getting
>
> java.lang.ExceptionInInitializerError
> at
> com.pgac.mypolicy.model.TestPolicyStatusRulesEngine.testPolicyExpiresIn24Days(TestPolicyStatusRulesEngine.java:37)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:60)
> at java.lang.reflect.Method.invoke(Method.java:391)
> at junit.framework.TestCase.runTest(TestCase.java:164)
> at junit.framework.TestCase.runBare (TestCase.java:130)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run ( TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:120)
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java :311)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> Caused by: java.lang.RuntimeException: org.drools.rule.InvalidRulePackage:
> unknown:33:9 Unexpected token '=='
>
> at
> com.pgac.mypolicy.model.PolicyStatusRulesEngine.<clinit>(PolicyStatusRulesEngine.java:46)
> ... 17 more
> Caused by: org.drools.rule.InvalidRulePackage: unknown:33:9 Unexpected
> token '=='
>
> at org.drools.rule.Package.checkValidity(Unknown Source)
> at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
> at
> com.pgac.mypolicy.model.PolicyStatusRulesEngine .<clinit>(PolicyStatusRulesEngine.java:44)
> ... 17 more
>
>
>
--
View this message in context: http://www.nabble.com/Error-with-new-dsl-field-constraint-syntax-tf2501764.html#a6975141
Sent from the drools - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
