Search in sources :

Example 1 with PropertyIdSearchRow

use of org.alfresco.repo.domain.propval.PropertyIdSearchRow in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method findPropertyById.

// ================================
// 'alf_prop_root' accessors
// ================================
@Override
protected List<PropertyIdSearchRow> findPropertyById(Long id) {
    PropertyValueEntity entity = new PropertyValueEntity();
    entity.setId(id);
    List<PropertyIdSearchRow> results = template.selectList(SELECT_PROPERTY_BY_ID, entity);
    return results;
}
Also used : PropertyIdSearchRow(org.alfresco.repo.domain.propval.PropertyIdSearchRow) PropertyValueEntity(org.alfresco.repo.domain.propval.PropertyValueEntity)

Example 2 with PropertyIdSearchRow

use of org.alfresco.repo.domain.propval.PropertyIdSearchRow 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

PropertyIdSearchRow (org.alfresco.repo.domain.propval.PropertyIdSearchRow)2 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 PropertyValueEntity (org.alfresco.repo.domain.propval.PropertyValueEntity)1 Configuration (org.apache.ibatis.session.Configuration)1 ResultContext (org.apache.ibatis.session.ResultContext)1 ResultHandler (org.apache.ibatis.session.ResultHandler)1