Hi, I am using drools i.e., a fire engine. Instead of writing the business logic in java i am using text based rules. Everything is fine but i have doubt how to assign the error messages or warning messages to the corresponding object which i am inserting in session. I want to set the error messages to the pojo class so that in UI i can display it. Please find the code below.
ServiceImplementation class. The problem is here. I am not understanding how to set error messages to UserLogin Pojo class. I have written one logic please correct me. I think what i have written is not setting the error messages to pojo class.
the code is working fine. I am getting the errors also and i am uning the condition that if the size of errors > 0 dont call save or update method. Upto here no problem. The problem is how to set the error message to pojo class so that in UI i can display it.
I didn't go through the classes but I'm curious, why would you think this is a Java problem and not some configuration in Drools?
Googling doesn't make you a genius. But not Googling makes you dumber.
Joined: Mar 12, 2011
I don't recommend setting an attribute on the object that is passed to the service. Better to return a collection of Messages from the service method. Also create a custom exception class that allows you to set your Message objects on it -- but be careful to differentiate these from the message attribute on the Throwable class. When you throw an exception, throw your custom exception type with the messages populated.