[rules-users] New functionality not working?

Andrew Robinson andrew.rw.robinson at gmail.com
Tue Dec 18 01:10:28 EST 2007


I upgraed my jboss seam and got the new drools-core and
drools-compiler installed. In my maven pom.xml, I am loading 4.0.3 of
each. My rule is not loading though.

Rule from "entity-rules.drl":

// Resource type (this is line 16)
rule "Resource type changes"
  no-loop
  activation-group "permissions"
when
  check: PermissionCheck(name == "com.christws.entities.ResourceType",
granted == false)
  (
    Role(name == "christws-admin" || "site-admin" || "resource-type-admin")
    or
    (
      $rt: ResourceType( )
      $perm: ResourceTypePermission( accessType != AccessType.READ )
from $rt.permissions
      Role(id == $perm.role.id)
    )
  )
then
  check.grant();
end;

I am getting parsing errors with the Role line due to the ""||""||""
syntax and with the $perm line because of the "from". According to
[1], these should work.

23:06:49,082 ERROR [RuleBase] errors parsing rules in:
/META-INF/entity-rules.drl
23:06:49,083 ERROR [RuleBase] unknown:23:37 Unexpected token
'"site-admin"' (/META-INF/entity-rules.drl)
23:06:49,083 ERROR [RuleBase] unknown:23:37 Unexpected token
'"site-admin"' (/META-INF/entity-rules.drl)
23:06:49,083 ERROR [RuleBase] unknown:23:53 Unexpected token
'"resource-type-admin"' (/META-INF/entity-rules.drl)
23:06:49,083 ERROR [RuleBase] unknown:27:6 mismatched token:
[@170,739:743='$perm',<7>,27:6]; expecting type RIGHT_PAREN
(/META-INF/entity-rules.drl)
23:06:49,083 ERROR [RuleBase] unknown:29:4 mismatched token:
[@205,859:859=')',<12>,29:4]; expecting type THEN
(/META-INF/entity-rules.drl)

What am I doing wrong? I am trying to see if the user has one of the 3
admin roles or has a role whose permission is update or delete (not
read) (ResourceType has List<ResourceTypePermission> getPermissions()
which has getAccessType() and getRole()).

Thanks,
Andrew

[1] http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.html



More information about the rules-users mailing list