Search in sources :

Example 1 with HitCountDto

use of org.ff4j.springjdbc.store.dto.HitCountDto in project ff4j by ff4j.

the class EventRepositorySpringJdbc method computeHitCount.

/**
 * Compute over a column.
 *
 * @param query
 *      current query definition
 * @param colName
 *      column name
 * @return
 *      hit count for this value.
 */
private Map<String, MutableHitCount> computeHitCount(EventQueryDefinition query, String colName) {
    List<HitCountDto> rawResult = getJdbcTemplate().query(getQueryBuilder().getHitCount(colName), new HitCountRowMapper(colName), new Timestamp(query.getFrom()), new Timestamp(query.getTo()));
    Map<String, MutableHitCount> mapofHitCount = new HashMap<String, MutableHitCount>();
    for (HitCountDto dto : rawResult) {
        mapofHitCount.put(dto.getColumnName(), dto.getHitcount());
    }
    return mapofHitCount;
}
Also used : HitCountDto(org.ff4j.springjdbc.store.dto.HitCountDto) HashMap(java.util.HashMap) HitCountRowMapper(org.ff4j.springjdbc.store.rowmapper.HitCountRowMapper) Timestamp(java.sql.Timestamp) MutableHitCount(org.ff4j.audit.MutableHitCount)

Aggregations

Timestamp (java.sql.Timestamp)1 HashMap (java.util.HashMap)1 MutableHitCount (org.ff4j.audit.MutableHitCount)1 HitCountDto (org.ff4j.springjdbc.store.dto.HitCountDto)1 HitCountRowMapper (org.ff4j.springjdbc.store.rowmapper.HitCountRowMapper)1