Search in sources :

Example 1 with TrackedEntityInstanceRowCallbackHandler

use of org.hisp.dhis.dxf2.events.trackedentity.store.mapper.TrackedEntityInstanceRowCallbackHandler in project dhis2-core by dhis2.

the class DefaultTrackedEntityInstanceStore method getTrackedEntityInstancesPartitioned.

private Map<String, TrackedEntityInstance> getTrackedEntityInstancesPartitioned(List<Long> ids, AggregateContext ctx) {
    TrackedEntityInstanceRowCallbackHandler handler = new TrackedEntityInstanceRowCallbackHandler();
    if (!ctx.isSuperUser() && ctx.getTrackedEntityTypes().isEmpty()) {
        // empty list.
        return new HashMap<>();
    }
    String sql = getQuery(GET_TEIS_SQL, ctx, "tei.trackedentitytypeid in (:teiTypeIds)", FILTER_OUT_DELETED_TEIS);
    jdbcTemplate.query(applySortOrder(sql, StringUtils.join(ids, ","), "trackedentityinstanceid"), createIdsParam(ids).addValue("teiTypeIds", ctx.getTrackedEntityTypes()), handler);
    return handler.getItems();
}
Also used : TrackedEntityInstanceRowCallbackHandler(org.hisp.dhis.dxf2.events.trackedentity.store.mapper.TrackedEntityInstanceRowCallbackHandler) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 TrackedEntityInstanceRowCallbackHandler (org.hisp.dhis.dxf2.events.trackedentity.store.mapper.TrackedEntityInstanceRowCallbackHandler)1