use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class VegaUiObject method setInputValue.
/**
* {@inheritDoc}
*/
@Override
public void setInputValue(final String fieldName, final String stringValue) {
Assertion.checkArgNotEmpty(fieldName);
Assertion.checkNotNull(stringValue, "formatted value can't be null, but may be empty : {0}", fieldName);
// -----
final DtField dtField = getDtField(fieldName);
inputBuffer.put(fieldName, formatValue(dtField, stringValue));
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class VegaUiObject method setTypedValue.
@Override
public final void setTypedValue(final String fieldName, final Serializable value) {
final DtField dtField = getDtField(fieldName);
isChecked = false;
// on a trois choix :
// 1) soit on ne fait pas de controle ici (sera fait par le check plus tard)
// 2) soit on fait un check et on remplit la stack d'erreur
// 3) soit on check et on lance une Runtime si erreur (comme dans DtObject)
// 100924 NPI : choix retenu 1
doSetTypedValue(dtField, value);
inputBuffer.put(fieldName, getInputValue(fieldName));
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class FacetedQueryResultJsonSerializerV4 method serializeHighLight.
private static JsonArray serializeHighLight(final DtList<?> dtList, final FacetedQueryResult<DtObject, ?> facetedQueryResult) {
final JsonArray jsonHighlightList = new JsonArray();
final Map<DtField, String> ccFieldNames = new HashMap<>();
for (final DtObject document : dtList) {
final Map<DtField, String> highlights = (facetedQueryResult).getHighlights(document);
final JsonObject jsonHighlight = new JsonObject();
for (final Map.Entry<DtField, String> entry : highlights.entrySet()) {
final String ccFieldName = obtainCcFieldName(entry.getKey(), ccFieldNames);
jsonHighlight.addProperty(ccFieldName, entry.getValue());
}
jsonHighlightList.add(jsonHighlight);
}
return jsonHighlightList;
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class SwaggerApiBuilder method appendPropertiesDtObject.
private void appendPropertiesDtObject(final Map<String, Object> entity, final Class<? extends DtObject> objectClass) {
// can't be a primitive nor array nor DtListDelta
final Map<String, Object> properties = new LinkedHashMap<>();
// mandatory fields
final List<String> required = new ArrayList<>();
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(objectClass);
for (final DtField dtField : dtDefinition.getFields()) {
final String fieldName = StringUtil.constToLowerCamelCase(dtField.getName());
final Type fieldType = getFieldType(dtField);
// not Nullable
final Map<String, Object> fieldSchema = createSchemaObject(fieldType);
fieldSchema.put("title", dtField.getLabel().getDisplay());
if (dtField.isRequired()) {
required.add(fieldName);
}
// could add enum on field to specify all values authorized
properties.put(fieldName, fieldSchema);
}
putIfNotEmpty(entity, REQUIRED, required);
putIfNotEmpty(entity, "properties", properties);
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class UiErrorBuilder method checkFieldDateAfter.
/**
* Vérifie que la date du champ 2 est après (strictement) la date du champ 1.
* @param dto Object a tester
* @param fieldName1 Champs 1
* @param fieldName2 Champs 2
* @param messageText Message à appliquer si erreur
*/
public void checkFieldDateAfter(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 Date value1 = (Date) getValue(dto, dtField1);
final Date value2 = (Date) getValue(dto, dtField2);
if (value1 != null && value2 != null && !value2.after(value1)) {
addError(dto, dtField2, messageText);
}
}
Aggregations