| Author |
Not knowing how to catch Errors
|
Maganti Suryanarayana Murthy
Greenhorn
Joined: Apr 09, 2012
Posts: 10
|
|
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.
Message.java
DefaultMessage.java
ValidationReport.java
DefaultValidationReport.java
ReportFactory.java
DefaultReportFactory.java
SecurityRules.drl File
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.
|
Regards
Maganti Surya
|
 |
Prabaharan Gopalan
Ranch Hand
Joined: Oct 16, 2009
Posts: 66
|
|
|
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.
|
 |
dennis deems
Ranch Hand
Joined: Mar 12, 2011
Posts: 808
|
|
|
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.
|
 |
Maganti Suryanarayana Murthy
Greenhorn
Joined: Apr 09, 2012
Posts: 10
|
|
I can able to return the collection of messages in the service class. But the problem is that i want to set those messages to Object as it should be passed to VO.
|
 |
 |
|
|
subject: Not knowing how to catch Errors
|
|
|