Search in sources :

Example 1 with RollupResultHandler

use of org.alfresco.ibatis.RollupResultHandler in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method findPropertiesByIds.

@Override
protected void findPropertiesByIds(List<Long> ids, final PropertyFinderCallback callback) {
    ResultHandler valueResultHandler = new ResultHandler() {

        public void handleResult(ResultContext context) {
            PropertyIdQueryResult result = (PropertyIdQueryResult) context.getResultObject();
            Long id = result.getPropId();
            // Make the serializable value
            List<PropertyIdSearchRow> rows = result.getPropValues();
            Serializable value = convertPropertyIdSearchRows(rows);
            callback.handleProperty(id, value);
        }
    };
    // A row handler to roll up individual rows
    Configuration configuration = template.getConfiguration();
    RollupResultHandler rollupResultHandler = new RollupResultHandler(configuration, KEY_COLUMNS_FINDBYIDS, "propValues", valueResultHandler);
    // Query using the IDs
    PropertyIdQueryParameter params = new PropertyIdQueryParameter();
    params.setRootPropIds(ids);
    template.select(SELECT_PROPERTIES_BY_IDS, params, rollupResultHandler);
    // Process any remaining results
    rollupResultHandler.processLastResults();
// Done
}
Also used : ResultContext(org.apache.ibatis.session.ResultContext) PropertyIdQueryResult(org.alfresco.repo.domain.propval.PropertyIdQueryResult) Serializable(java.io.Serializable) Configuration(org.apache.ibatis.session.Configuration) RollupResultHandler(org.alfresco.ibatis.RollupResultHandler) PropertyIdQueryParameter(org.alfresco.repo.domain.propval.PropertyIdQueryParameter) RollupResultHandler(org.alfresco.ibatis.RollupResultHandler) ResultHandler(org.apache.ibatis.session.ResultHandler) PropertyIdSearchRow(org.alfresco.repo.domain.propval.PropertyIdSearchRow)

Aggregations

Serializable (java.io.Serializable)1 RollupResultHandler (org.alfresco.ibatis.RollupResultHandler)1 PropertyIdQueryParameter (org.alfresco.repo.domain.propval.PropertyIdQueryParameter)1 PropertyIdQueryResult (org.alfresco.repo.domain.propval.PropertyIdQueryResult)1 PropertyIdSearchRow (org.alfresco.repo.domain.propval.PropertyIdSearchRow)1 Configuration (org.apache.ibatis.session.Configuration)1 ResultContext (org.apache.ibatis.session.ResultContext)1 ResultHandler (org.apache.ibatis.session.ResultHandler)1