I would like to be able to share a declarative model between two packages.
When I attempt to do this by creating my model in Guvnor's Global Area and
then importing it into each package, I find that instances of the declared
types that are created by rules in one package are not recognized by rules
in the other package.
For example, suppose I create a model in the global area with a declared
type:
declare MyType
field1: String
end
I then import this model into packages "p1" and "p2". I add the
following
rule into package "p1":
rule "create it"
when
eval(true)
then
MyType m = new MyType();
insert(m);
end
and I add the following rule into package "p2":
rule "find it"
when
$m : MyType()
then
System.out.println("found it");
end
At runtime, the "create it" rule fires and inserts a "MyType" object.
However, the "find it" rule never fires.
If I add a WorkingMemoryEventListener and look at exactly what is being
inserted, I can see that the "create it" rule is inserting an instance of
p1.MyType. I assume that the "find it" rule is looking for an instance of
p2.MyType and that is why it never fires.
Is there a different way to accomplish this? Or, are declarative models
simply not intended to be shared across packages?
--
View this message in context:
http://drools.46999.n3.nabble.com/Problem-sharing-declarative-model-betwe...
Sent from the Drools: User forum mailing list archive at
Nabble.com.