-
Notifications
You must be signed in to change notification settings - Fork 4
Finer Points of GSRS Validation
[This information is for developers.]
GSRS allows you to write validators that enforce business rules for your data
You have the option of examining the data attached to a new object, comparing it with the previous version,
flagging errors and warnings, as well making changes to the data.
In order to make changes to the data persist, you must follow a couple of steps
The first step is to create a GinasProcessingMessage object with the text of the rule flagged, and/or
the data change made.
For example,
GinasProcessingMessage mes = GinasProcessingMessage.WARNING_MESSAGE(String.format("Name %s standardized to %s",
n.name, newlyStandardizedName));
Then,set a flag on the object so that the change will persist
mes.appliableChange(true);
Finally, add the data change in form of a runnable lambda expression:
callback.addMessage(mes, () -> {n.name = minimallyStandardizedName.getResult();});
After this, the object name will be given the value of newlyStandardizedName.