use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class UiErrorBuilder method checkFieldLongAfter.
/**
* Vérifie que le Long du champ 2 est après (strictement) le Long du champ 1.
* @param dto Object a tester
* @param fieldName1 Champs 1
* @param fieldName2 Champs 2
* @param messageText Message à appliquer si erreur
*/
public void checkFieldLongAfter(final DtObject dto, final String fieldName1, final String fieldName2, final MessageText messageText) {
final DtField dtField1 = getDtField(dto, fieldName1);
final DtField dtField2 = getDtField(dto, fieldName2);
// la valeur typée peut être null
final Long value1 = (Long) getValue(dto, dtField1);
final Long value2 = (Long) getValue(dto, dtField2);
if (value1 != null && value2 != null && !(value2.compareTo(value1) > 0)) {
addError(dto, dtField2, messageText);
}
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class UiErrorBuilder method checkFieldEquals.
/**
* Vérifie l'égalité des champs.
* @param dto Object a tester
* @param fieldName1 Champs 1
* @param fieldName2 Champs 2
* @param messageText Message à appliquer si erreur
*/
public void checkFieldEquals(final DtObject dto, final String fieldName1, final String fieldName2, final MessageText messageText) {
final DtField dtField1 = getDtField(dto, fieldName1);
final DtField dtField2 = getDtField(dto, fieldName2);
final Object value1 = getValue(dto, dtField1);
final Object value2 = getValue(dto, dtField2);
// value1 et value2 == null ou value1 equals value2, sinon error
if ((value1 != null && !value1.equals(value2)) || value2 != null) {
addError(dto, dtField2, messageText);
}
}
Aggregations