use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class AbstractDbFileStorePlugin method getValue.
/**
* Retourne une valeur d'un champ à partir du DtObject.
* @param <V> Type de la valeur *
* @param dto DtObject
* @param fieldName Nom du champ
* @param valueClass Type du champ
* @return Valeur typé du champ
*/
protected static <V> V getValue(final DtObject dto, final DtFieldName fieldName, final Class<V> valueClass) {
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dto);
final DtField dtField = dtDefinition.getField(fieldName.name());
return valueClass.cast(dtField.getDataAccessor().getValue(dto));
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class AbstractDbFileStorePlugin method setValue.
/**
* Fixe une valeur d'un champ d'un DtObject.
*
* @param dto DtObject
* @param fieldName Nom du champs
* @param value Valeur
*/
protected static void setValue(final DtObject dto, final DtFieldName fieldName, final Object value) {
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dto);
final DtField dtField = dtDefinition.getField(fieldName.name());
dtField.getDataAccessor().setValue(dto, value);
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class FsFileStorePlugin method getValue.
/**
* Retourne une valeur d'un champ à partir du DtObject.
*
* @param dto DtObject
* @param field Nom du champs
* @return Valeur typé du champ
*/
private static <V> V getValue(final DtObject dto, final DtoFields field, final Class<V> valueClass) {
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dto);
final DtField dtField = dtDefinition.getField(field.name());
return valueClass.cast(dtField.getDataAccessor().getValue(dto));
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class FsFileStorePlugin method setIdValue.
private static void setIdValue(final DtObject dto, final Object value) {
final DtField dtField = DtObjectUtil.findDtDefinition(dto).getIdField().get();
dtField.getDataAccessor().setValue(dto, value);
}
use of io.vertigo.dynamo.domain.metamodel.DtField in project vertigo by KleeGroup.
the class ESFacetedQueryResultBuilder method build.
/**
* {@inheritDoc}
*/
@Override
public FacetedQueryResult<I, SearchQuery> build() {
final Map<I, Map<DtField, String>> resultHighlights = new HashMap<>();
final Map<FacetValue, DtList<I>> resultCluster;
final DtList<I> dtc = new DtList<>(indexDefinition.getIndexDtDefinition());
if (searchQuery.isClusteringFacet()) {
final Map<String, I> dtcIndex = new LinkedHashMap<>();
resultCluster = createCluster(dtcIndex, resultHighlights);
dtc.addAll(dtcIndex.values());
} else {
for (final SearchHit searchHit : queryResponse.getHits()) {
final SearchIndex<?, I> index = esDocumentCodec.searchHit2Index(indexDefinition, searchHit);
final I result = index.getIndexDtObject();
dtc.add(result);
final Map<DtField, String> highlights = createHighlight(searchHit, indexDefinition.getIndexDtDefinition());
resultHighlights.put(result, highlights);
}
resultCluster = Collections.emptyMap();
}
// On fabrique à la volée le résultat.
final List<Facet> facets = createFacetList(searchQuery, queryResponse);
final long count = queryResponse.getHits().getTotalHits();
return new FacetedQueryResult<>(searchQuery.getFacetedQuery(), count, dtc, facets, searchQuery.isClusteringFacet() ? Optional.of(searchQuery.getClusteringFacetDefinition()) : Optional.empty(), resultCluster, resultHighlights, searchQuery);
}
Aggregations