It could be worth using the REST API to browse to the source of each package. It would be telling if the DRL included imports for com.mypkg.a.Foo and com.mypkg.b.Foo depending on which package it was in.

Steve


On 4 Sep 2013, at 18:43, Lance Leverich <lance.leverich@gmail.com> wrote:

The issue isn't that Foo cannot be resolved, as it was imported into both packages from the Global Area. The packages compile just fine. I believe what might be happening, though, is that each package is creating its own version of Foo.
For example, am I experiencing something like...
    com.mypkg.a generates a class with a fully qualified name of drools.com.mypkg.a.Foo
    com.mypkg.b generates a class with a fully qualified name of drools.com.mypkg.b.Foo
?

If this is the case, is there someway within Guvnor to refer to a particular version? I'm beginning to think that my best option might be to create a POJO and import it. At least that way, I can make sure I know the fully qualified (i.e. canonical) class name.

~ Lance


Cc: 
Date: Wed, 4 Sep 2013 15:41:55 +0100
Subject: Re: [rules-users] Fully qualified name for generated classes
Guvnor's Global Area has no affect on fully qualified type names; it's just a container for things you want to share.

If Foo could not be resolved in myRuleB the rule would fail to compile.

What do you observations show if you don't have any rule flow?


On 4 September 2013 15:28, Lance Leverich <lance.leverich@gmail.com> 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@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