[
https://issues.jboss.org/browse/DROOLS-1470?page=com.atlassian.jira.plugi...
]
Geoffrey De Smet edited comment on DROOLS-1470 at 3/8/17 6:21 AM:
------------------------------------------------------------------
Pr with reproducing unit test submitted.
https://github.com/droolsjbpm/drools/pull/1131
was (Author: ge0ffrey):
Pr with reproducing unit test submitted.
Match.getObjects() should also include accumulate's objects
-----------------------------------------------------------
Key: DROOLS-1470
URL:
https://issues.jboss.org/browse/DROOLS-1470
Project: Drools
Issue Type: Enhancement
Components: core engine
Affects Versions: 7.0.0.Beta6
Reporter: Geoffrey De Smet
Assignee: Mario Fusco
Given this DRL:
{code}
global java.util.List list
rule R when
$t : CarType(id == \"roadster\")
accumulate(
$c : Car(type == $t);
$total : count($c)
)\
then
list.addAll(kcontext.getMatch().getObjects());
end
{code}
and then inserting the roadster type and 3 cars of that type:
{code}
CarType roadsterType = new CarType("roadster");
ksession.insert(roadsterType);
Car bmwZ4 = new Car("BMW Z4", roadsterType);
ksession.insert(bmwZ4);
Car lotusElise = new Car("Lotus Elise", roadsterType);
ksession.insert(lotusElise);
Car mazdaMx5 = new Car("Mazda MX-5", roadsterType);
ksession.insert(mazdaMx5);
{code}
then the Match.getObjects() (or getObjectsDeep()) should include every Car instance too.
Let's discuss. Maybe we need a new method getObjectsDeep() instead if we can't
change getObjects() for backwards compatibility reasons.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)