[rules-users] WorkingMemoryListener & Declared Types

Wolfgang Laun wolfgang.laun at gmail.com
Wed Aug 7 05:09:24 EDT 2013


On 07/08/2013, droolster <quant.coder at gmail.com> wrote:
> Hello,
>
> Please can the community help me.
>
> I am attaching a WorkingMemoryListener to a session. In my DRL file, I have
> a number of declared types for which I want to "watch" when the process is
> running. How can I implement a "toString()" method in the DRL file for a
> declared type?

You can't.

Why don't you declare Foo in a plain old Java class?

-W

> I have detailed the structure of my code below to make it
> clear what I am trying to do:
>
> DRL FILE
> --------
> declare Foo
>     low : double
>     high : double
>     score : int
> end
>
>
> Java Code
> ----------
> ksession.addEventListener(new WorkingMemoryEventListener()
>     {
> 		
> 		@Override
> 		public void objectInserted(ObjectInsertedEvent event) {
> 			System.out.println(*"Inserted: " + event.toString()*);
>                         /*// Here I would like to print out the data in the
> type Foo in a specific format.*/
> 			
> 		}
>
> 		@Override
> 		public void objectUpdated(ObjectUpdatedEvent event) {
> 			System.out.println("Updated");
> 		}
> 		
> 		@Override
> 		public void objectRetracted(ObjectRetractedEvent event) {
> 			System.out.println("Retracted");
> 			
> 		}
> 		
> 	});
>
> Thanks in advance for your help.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/WorkingMemoryListener-Declared-Types-tp4025391.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