[rules-users] Setting and extracting different values for the same object using rules

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jul 13 09:01:37 EDT 2012


This is a curious example. With "ID" (= identifier) one usually
associates a single non-volatile value that's not to be changed. If an
object indeed has multiple "identifiers" (like a person's name, nick
name, pen name, alias,...) then custID would have to be a Collection
and you can store multiple values at the same time.

For logging *changes" of a single-valued attribute, a listener is one
way to go, but the listener doesn't tell you *what*  was changed.

Alternatively, you can implement your *own* listener mechanism
triggering notifications when certain setters are called. That's
pretty basic Java stuff, however.

-W


On 13/07/2012, abhinay_agarwal <abhinay_agarwal at infosys.com> wrote:
> suppose i have an object Customer and i insert the object of customer in
> the
> session...
>
> class Customer
> {
> custID;
> //getter and setter
> }
>
> Customer customer = new Customer()
> ksession.insert(customer)
>
>
> now i fire a couple of rules on this object..
>
> and within the rules, the custID is set with three different values. Ex -
> 001,002,003
>
> is there a way by which i can get all the three values ??
>
> if I use a factHandle like
>
> FactHandle fh = ksession.insert(customer)
> syso(((Customer)ksession.getObject(fh)).getCustID)
>
> //output is only 003..
>
>
> i need all the three values..what can be done !!??
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Setting-and-extracting-different-values-for-the-same-object-using-rules-tp4018660.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list