Search in sources :

Example 11 with IdsEntity

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

the class PatchDAOImpl method getCountNodesWithAspects.

@Override
public long getCountNodesWithAspects(Set<QName> qnames) {
    // Resolve QNames
    Set<Long> qnameIds = qnameDAO.convertQNamesToIds(qnames, false);
    if (qnameIds.size() == 0) {
        return 0L;
    }
    IdsEntity params = new IdsEntity();
    params.setIds(new ArrayList<Long>(qnameIds));
    Long count = template.selectOne(SELECT_COUNT_NODES_WITH_ASPECTS, params);
    if (count == null) {
        return 0L;
    } else {
        return count;
    }
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 12 with IdsEntity

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

the class ContentDataDAOImpl method getContentDataEntitiesForNodes.

@Override
protected List<ContentDataEntity> getContentDataEntitiesForNodes(Set<Long> nodeIds) {
    if (nodeIds.size() == 0) {
        // There will be no results
        return Collections.emptyList();
    }
    IdsEntity idsEntity = new IdsEntity();
    idsEntity.setIds(new ArrayList<Long>(nodeIds));
    return template.selectList(SELECT_CONTENT_DATA_BY_NODE_IDS, idsEntity);
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 13 with IdsEntity

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

the class NodeDAOImpl method selectNodePropertiesByDataType.

@SuppressWarnings("rawtypes")
@Override
public List<NodePropertyEntity> selectNodePropertiesByDataType(QName dataType, long minNodeId, long maxNodeId) {
    int typeOrdinal = NodePropertyValue.convertToTypeOrdinal(dataType);
    IdsEntity ids = new IdsEntity();
    ids.setIdOne((long) typeOrdinal);
    ids.setIdTwo(minNodeId);
    ids.setIdThree(maxNodeId);
    final List<NodePropertyEntity> properties = new ArrayList<NodePropertyEntity>();
    template.select(SELECT_PROPERTIES_BY_ACTUAL_TYPE, ids, new ResultHandler() {

        @Override
        public void handleResult(ResultContext context) {
            properties.add((NodePropertyEntity) context.getResultObject());
        }
    });
    return properties;
}
Also used : ResultContext(org.apache.ibatis.session.ResultContext) DefaultResultContext(org.apache.ibatis.executor.result.DefaultResultContext) IdsEntity(org.alfresco.ibatis.IdsEntity) NodePropertyEntity(org.alfresco.repo.domain.node.NodePropertyEntity) ArrayList(java.util.ArrayList) ResultHandler(org.apache.ibatis.session.ResultHandler)

Example 14 with IdsEntity

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

the class NodeDAOImpl method updateNodes.

@Override
protected int updateNodes(Long txnId, List<Long> nodeIds) {
    if (nodeIds.size() == 0) {
        return 0;
    }
    IdsEntity ids = new IdsEntity();
    ids.setIdOne(txnId);
    ids.setIds(nodeIds);
    return template.update(UPDATE_NODE_BULK_TOUCH, ids);
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 15 with IdsEntity

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

the class PatchDAOImpl method getCountNodesWithTypId.

@Override
public long getCountNodesWithTypId(QName typeQName) {
    // Resolve the QName
    Pair<Long, QName> qnameId = qnameDAO.getQName(typeQName);
    if (qnameId == null) {
        return 0L;
    }
    IdsEntity params = new IdsEntity();
    params.setIdOne(qnameId.getFirst());
    Long count = (Long) template.selectOne(SELECT_COUNT_NODES_WITH_TYPE_ID, params);
    if (count == null) {
        return 0L;
    } else {
        return count;
    }
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity) QName(org.alfresco.service.namespace.QName)

Aggregations

IdsEntity (org.alfresco.ibatis.IdsEntity)17 QName (org.alfresco.service.namespace.QName)4 DefaultResultContext (org.apache.ibatis.executor.result.DefaultResultContext)3 ResultContext (org.apache.ibatis.session.ResultContext)3 ResultHandler (org.apache.ibatis.session.ResultHandler)3 ArrayList (java.util.ArrayList)2 NodePropertyEntity (org.alfresco.repo.domain.node.NodePropertyEntity)2 HashSet (java.util.HashSet)1 NodeEntity (org.alfresco.repo.domain.node.NodeEntity)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 Pair (org.alfresco.util.Pair)1 ConcurrencyFailureException (org.springframework.dao.ConcurrencyFailureException)1