[rules-users] Updating a user defined error object using drools

Wolfgang Laun wolfgang.laun at gmail.com
Sun May 6 14:56:13 EDT 2012


You would write rules for checking the fields of Employes, e.g.,

rule "must have department"
when
   $e: Employee( department == null )
then
   Errors e = new Errors();
   e.setFieldName( "department" );
   e.setMessage( "missing value" );
   e.setEmployee( $e );
   insert( e );
end

You might not have to insert e. You might want to retract the Employee fact.
-W

On 6 May 2012 20:46, Ini <inder.14 at gmail.com> wrote:

> Hi Laune...Thanks for the quick reply..i believe i was not clear about my
> while asking....let me give an example..
> say i have an employee bean with properties the name, id, age, department
> etc and i have an error bean say Errors with properties like fieldName,
> message, expectedValue etc..
> Now as per my requirement i have to validate all the properties of my
> employee bean and in case some properties don't meet the expectation then
> update the Errors object with suitable values and use the update Errors
> bean
> for different purposes...
>
> I could not see any example on this line..
> Hope i am making some sense here
>
> How can i achieve above mentioned scenario.
>
> Thanks in advance..
> Ini
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Updating-a-user-defined-error-object-using-drools-tp3966631p3966753.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120506/d039805d/attachment.html 


More information about the rules-users mailing list