[rules-users] Fully qualified name for generated classes

Davide Sottara dsotty at gmail.com
Wed Sep 4 12:33:01 EDT 2013


A declared class assumes the package of the drl containing the declaration.
You'll need to import it in other packages
Davide

On 09/04/2013 07:28 AM, Lance Leverich wrote:
> What would be the fully qualified name for a generated class, that is
> based upon a fact type (for example a type named "Foo") that is
> defined inside a declarative model? 
> How is the fully qualified name affected if the model resides in the
> Global Area, and is imported into multiple packages?
>
> The reason for my question is that I have the following issue:
>
> In the Global Area, I have a declarative model (named MyModel) with a
> definition like...
>    declare Foo
>       bar: String
>       version: String
>    end
>
> In a package (com.mypkg.a), I have imported MyModel from the Global
> Area. I have a rule like...
>
>    rule "myRuleA"
>    ruleflow-group "firstGroup"
>    when
>       not Foo( bar=="bar" )
>    then
>       Foo fact = new Foo();
>       fact.setBar("bar");
>       fact.setVersion("1");
>       insert(fact);
>
> In another package (com.mypkg.b), I have also imported MyModel from
> the Global Area. I have a rule like
>
>    rule "myRuleB"
>   ruleflow-group "secondGroup"
>   when
>      Foo()
>   then
>      System.out.println("got at least one Foo");
>
> Looking at logs, the rule myRuleA fires as is appropriate; however,
> the rule myRuleB does not fire, even though both ruleflow groups are
> represented in the ruleflow. I have verified that both of the ruleflow
> groups are activated, using the logs. My best guess at this point is
> that the class generated for fact type Foo is different for each
> package. So, how can I make sure that I am instantiating and checking
> for the same type across packages?
>
>
>
> Lance Leverich
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130904/d793b697/attachment.html 


More information about the rules-users mailing list