Search in sources :

Example 76 with DtField

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);
    }
}
Also used : DtField(io.vertigo.dynamo.domain.metamodel.DtField)

Example 77 with DtField

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);
    }
}
Also used : DtObject(io.vertigo.dynamo.domain.model.DtObject) DtField(io.vertigo.dynamo.domain.metamodel.DtField)

Aggregations

DtField (io.vertigo.dynamo.domain.metamodel.DtField)77 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)28 DtObject (io.vertigo.dynamo.domain.model.DtObject)14 DtList (io.vertigo.dynamo.domain.model.DtList)13 URI (io.vertigo.dynamo.domain.model.URI)12 HashMap (java.util.HashMap)11 Map (java.util.Map)8 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)7 Task (io.vertigo.dynamo.task.model.Task)7 ArrayList (java.util.ArrayList)7 Entity (io.vertigo.dynamo.domain.model.Entity)6 TaskEngineSelect (io.vertigo.dynamox.task.TaskEngineSelect)6 Serializable (java.io.Serializable)6 LinkedHashMap (java.util.LinkedHashMap)6 List (java.util.List)6 MessageText (io.vertigo.core.locale.MessageText)5 FacetValue (io.vertigo.dynamo.collections.model.FacetValue)5 Date (java.util.Date)4 SearchHit (org.elasticsearch.search.SearchHit)4 JsonObject (com.google.gson.JsonObject)3