Skip to content

Finer Points of GSRS Validation

ChemMitch edited this page Mar 1, 2022 · 2 revisions

[This information is for developers.]

GSRS Validation fine points

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.

Clone this wiki locally