Search in sources :

Example 6 with IdsEntity

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

the class NodeDAOImpl method moveNodeData.

@Override
protected void moveNodeData(Long fromNodeId, Long toNodeId) {
    IdsEntity params = new IdsEntity();
    params.setIdOne(fromNodeId);
    params.setIdTwo(toNodeId);
    int countPA = template.update(UPDATE_MOVE_PARENT_ASSOCS, params);
    int countCA = template.update(UPDATE_MOVE_CHILD_ASSOCS, params);
    int countSA = template.update(UPDATE_MOVE_SOURCE_ASSOCS, params);
    int countTA = template.update(UPDATE_MOVE_TARGET_ASSOCS, params);
    int countP = template.update(UPDATE_MOVE_PROPERTIES, params);
    int countA = template.update(UPDATE_MOVE_ASPECTS, params);
    if (isDebugEnabled) {
        logger.debug("Moved node data: \n" + "   From: " + fromNodeId + "\n" + "   To:   " + toNodeId + "\n" + "   PA:   " + countPA + "\n" + "   CA:   " + countCA + "\n" + "   SA:   " + countSA + "\n" + "   TA:   " + countTA + "\n" + "   P:    " + countP + "\n" + "   A:    " + countA);
    }
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 7 with IdsEntity

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

the class NodeDAOImpl method deleteNodeAssocs.

@Override
protected int deleteNodeAssocs(List<Long> ids) {
    IdsEntity param = new IdsEntity();
    param.setIds(ids);
    return template.delete(DELETE_NODE_ASSOCS, param);
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 8 with IdsEntity

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

the class NodeDAOImpl method selectNodePropertiesByTypes.

@Override
@SuppressWarnings("rawtypes")
public List<NodePropertyEntity> selectNodePropertiesByTypes(Set<QName> qnames) {
    final List<NodePropertyEntity> properties = new ArrayList<NodePropertyEntity>();
    // qnames of properties that are encrypted
    Set<Long> qnameIds = qnameDAO.convertQNamesToIds(qnames, false);
    if (qnameIds.size() > 0) {
        IdsEntity param = new IdsEntity();
        param.setIds(new ArrayList<Long>(qnameIds));
        // TODO - use a callback approach
        template.select(SELECT_PROPERTIES_BY_TYPES, param, 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 9 with IdsEntity

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

the class NodeDAOImpl method deleteChildAssocs.

@Override
protected int deleteChildAssocs(List<Long> ids) {
    IdsEntity idsEntity = new IdsEntity();
    // IDs
    idsEntity.setIds(ids);
    return template.delete(DELETE_CHILD_ASSOCS, idsEntity);
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

Example 10 with IdsEntity

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

the class NodeDAOImpl method selectChildAssocsWithoutNodeAssocsOfTypes.

@Override
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(Long parentNodeId, Long minNodeId, Long maxNodeId, Set<QName> assocTypeQNames) {
    IdsEntity idsEntity = new IdsEntity();
    // Parent node id
    Assert.notNull(parentNodeId, "The parent node id must not be null.");
    idsEntity.setIdOne(parentNodeId);
    // Node ids selection interval
    idsEntity.setIdTwo(minNodeId);
    idsEntity.setIdThree(maxNodeId);
    // Associations types to exclude
    if (assocTypeQNames != null) {
        Set<Long> childNodeTypeQNameIds = qnameDAO.convertQNamesToIds(assocTypeQNames, false);
        if (childNodeTypeQNameIds.size() > 0) {
            idsEntity.setIds(new ArrayList<Long>(childNodeTypeQNameIds));
        }
    }
    return template.selectList(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE, idsEntity);
}
Also used : IdsEntity(org.alfresco.ibatis.IdsEntity)

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