Search in sources :

Example 1 with RelationshipRowCallbackHandler

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

the class AbstractStore method getRelationshipsByIdsPartitioned.

private Multimap<String, Relationship> getRelationshipsByIdsPartitioned(List<Long> ids) {
    if (!ids.isEmpty()) {
        RelationshipRowCallbackHandler handler = new RelationshipRowCallbackHandler();
        jdbcTemplate.query(GET_RELATIONSHIP_BY_RELATIONSHIP_ID, createIdsParam(ids), handler);
        return handler.getItems();
    }
    return ArrayListMultimap.create();
}
Also used : RelationshipRowCallbackHandler(org.hisp.dhis.dxf2.events.trackedentity.store.mapper.RelationshipRowCallbackHandler)

Example 2 with RelationshipRowCallbackHandler

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

the class AbstractStore method getRelationshipsPartitioned.

private Multimap<String, Relationship> getRelationshipsPartitioned(List<Long> ids) {
    String getRelationshipsHavingIdSQL = String.format(GET_RELATIONSHIP_ID_BY_ENTITY_ID_SQL, getRelationshipEntityColumn(), getRelationshipEntityColumn());
    // Get all the relationship ids that have at least one relationship item
    // having
    // the ids in the tei|pi|psi column (depending on the subclass)
    List<Long> relationshipIds = getRelationshipIds(getRelationshipsHavingIdSQL, createIdsParam(ids));
    if (!relationshipIds.isEmpty()) {
        RelationshipRowCallbackHandler handler = new RelationshipRowCallbackHandler();
        jdbcTemplate.query(GET_RELATIONSHIP_BY_RELATIONSHIP_ID, createIdsParam(relationshipIds), handler);
        return handler.getItems();
    }
    return ArrayListMultimap.create();
}
Also used : RelationshipRowCallbackHandler(org.hisp.dhis.dxf2.events.trackedentity.store.mapper.RelationshipRowCallbackHandler)

Aggregations

RelationshipRowCallbackHandler (org.hisp.dhis.dxf2.events.trackedentity.store.mapper.RelationshipRowCallbackHandler)2