Search in sources :

Example 16 with NodeEntity

use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method selectChildAssoc.

@Override
protected ChildAssocEntity selectChildAssoc(Long parentNodeId, QName assocTypeQName, String childName) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Type QName
    if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
        // Shortcut
        return null;
    }
    // Child name
    assoc.setChildNodeNameAll(null, assocTypeQName, childName);
    // Ordered
    assoc.setOrdered(false);
    // Note: This single results was assumed from inception of the original method.  It's correct.
    return template.selectOne(SELECT_CHILD_ASSOC_OF_PARENT_BY_NAME, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 17 with NodeEntity

use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method selectChildAssoc.

@Override
protected List<ChildAssocEntity> selectChildAssoc(Long parentNodeId, Long childNodeId, QName assocTypeQName, QName assocQName) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Child
    NodeEntity childNode = new NodeEntity();
    childNode.setId(childNodeId);
    assoc.setChildNode(childNode);
    // Type QName
    if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
        // Shortcut
        return Collections.emptyList();
    }
    // QName
    if (!assoc.setQNameAll(qnameDAO, assocQName, false)) {
        // Shortcut
        return Collections.emptyList();
    }
    // Ordered
    assoc.setOrdered(false);
    return template.selectList(SELECT_CHILD_ASSOCS_OF_PARENT, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 18 with NodeEntity

use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method selectChildAssocsWithoutParentAssocsOfType.

@Override
protected void selectChildAssocsWithoutParentAssocsOfType(Long parentNodeId, QName assocTypeQName, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Type QName
    if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
        resultsCallback.done();
        // Shortcut
        return;
    }
    // Ordered
    assoc.setOrdered(resultsCallback.orderResults());
    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    template.select(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE, assoc, resultHandler);
    resultsCallback.done();
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 19 with NodeEntity

use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method selectNodeAssocs.

@Override
protected List<NodeAssocEntity> selectNodeAssocs(Long nodeId) {
    // Node
    NodeEntity node = new NodeEntity();
    node.setId(nodeId);
    return template.selectList(SELECT_NODE_ASSOCS, node);
}
Also used : NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 20 with NodeEntity

use of org.alfresco.repo.domain.node.NodeEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method updateChildAssocIndex.

@Override
protected int updateChildAssocIndex(Long parentNodeId, Long childNodeId, QName assocTypeQName, QName assocQName, int index) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Child
    NodeEntity childNode = new NodeEntity();
    childNode.setId(childNodeId);
    assoc.setChildNode(childNode);
    // Type QName
    assoc.setTypeQNameAll(qnameDAO, assocTypeQName, true);
    // QName
    assoc.setQNameAll(qnameDAO, assocQName, true);
    // Index
    assoc.setAssocIndex(index);
    return template.update(UPDATE_CHILD_ASSOCS_INDEX, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Aggregations

NodeEntity (org.alfresco.repo.domain.node.NodeEntity)29 ChildAssocEntity (org.alfresco.repo.domain.node.ChildAssocEntity)16 NodeAssocEntity (org.alfresco.repo.domain.node.NodeAssocEntity)5 ArrayList (java.util.ArrayList)4 NodeRef (org.alfresco.service.cmr.repository.NodeRef)4 Serializable (java.io.Serializable)3 HashMap (java.util.HashMap)3 Random (java.util.Random)3 CannedQueryDAOTest (org.alfresco.repo.domain.query.CannedQueryDAOTest)3 QName (org.alfresco.service.namespace.QName)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 NodeDAO (org.alfresco.repo.domain.node.NodeDAO)2 Pair (org.alfresco.util.Pair)2 DefaultResultContext (org.apache.ibatis.executor.result.DefaultResultContext)2 RowBounds (org.apache.ibatis.session.RowBounds)2 IdsEntity (org.alfresco.ibatis.IdsEntity)1 StoreEntity (org.alfresco.repo.domain.node.StoreEntity)1 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)1 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)1