Search in sources :

Example 16 with ChildAssocEntity

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

the class NodeDAOImpl method selectPrimaryChildAcls.

@Override
public List<NodeIdAndAclId> selectPrimaryChildAcls(Long nodeId) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(nodeId);
    assoc.setParentNode(parentNode);
    // Primary
    assoc.setPrimary(true);
    return template.selectList(SELECT_NODE_PRIMARY_CHILD_ACLS, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 17 with ChildAssocEntity

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

the class NodeDAOImpl method selectChildAssoc.

@Override
protected ChildAssocEntity selectChildAssoc(Long assocId) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    assoc.setId(assocId);
    return template.selectOne(SELECT_CHILD_ASSOC_BY_ID, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity)

Example 18 with ChildAssocEntity

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

the class NodeDAOImpl method selectChildAssocs.

@Override
protected void selectChildAssocs(Long parentNodeId, Set<QName> assocTypeQNames, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Type QNames
    Set<Long> assocTypeQNameIds = qnameDAO.convertQNamesToIds(assocTypeQNames, false);
    if (assocTypeQNameIds.size() == 0) {
        resultsCallback.done();
        // Shortcut as they don't exist
        return;
    }
    assoc.setTypeQNameIds(new ArrayList<Long>(assocTypeQNameIds));
    // Ordered
    assoc.setOrdered(resultsCallback.orderResults());
    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
    resultsCallback.done();
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 19 with ChildAssocEntity

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

the class NodeDAOImpl method selectChildAssocs.

@SuppressWarnings("unchecked")
@Override
public void selectChildAssocs(Long parentNodeId, QName assocTypeQName, QName assocQName, final int maxResults, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Type QName
    if (assocTypeQName != null) {
        if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
            resultsCallback.done();
            // Shortcut
            return;
        }
    }
    // QName
    if (assocQName != null) {
        if (!assoc.setQNameAll(qnameDAO, assocQName, false)) {
            resultsCallback.done();
            // Shortcut
            return;
        }
    }
    // Order
    assoc.setOrdered(resultsCallback.orderResults());
    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    RowBounds rowBounds = new RowBounds(0, maxResults);
    List<?> entities = template.selectList(SELECT_CHILD_ASSOCS_OF_PARENT_LIMITED, assoc, rowBounds);
    @SuppressWarnings("rawtypes") final DefaultResultContext resultContext = new DefaultResultContext();
    for (Object entity : entities) {
        resultContext.nextResultObject(entity);
        resultHandler.handleResult(resultContext);
    }
    resultsCallback.done();
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) RowBounds(org.apache.ibatis.session.RowBounds) DefaultResultContext(org.apache.ibatis.executor.result.DefaultResultContext) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 20 with ChildAssocEntity

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

the class NodeDAOImpl method selectChildAssocs.

@Override
protected void selectChildAssocs(Long parentNodeId, Long childNodeId, QName assocTypeQName, QName assocQName, Boolean isPrimary, Boolean sameStore, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Child
    if (childNodeId != null) {
        NodeEntity childNode = new NodeEntity();
        childNode.setId(childNodeId);
        assoc.setChildNode(childNode);
    }
    // Type QName
    if (assocTypeQName != null) {
        if (!assoc.setTypeQNameAll(qnameDAO, assocTypeQName, false)) {
            resultsCallback.done();
            // Shortcut
            return;
        }
    }
    // QName
    if (assocQName != null) {
        if (!assoc.setQNameAll(qnameDAO, assocQName, false)) {
            resultsCallback.done();
            // Shortcut
            return;
        }
    }
    // Primary
    if (isPrimary != null) {
        assoc.setPrimary(isPrimary);
    }
    // Same store
    if (sameStore != null) {
        assoc.setSameStore(sameStore);
    }
    // Ordered
    assoc.setOrdered(resultsCallback.orderResults());
    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
    resultsCallback.done();
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Aggregations

ChildAssocEntity (org.alfresco.repo.domain.node.ChildAssocEntity)20 NodeEntity (org.alfresco.repo.domain.node.NodeEntity)16 Serializable (java.io.Serializable)2 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)2 NodeRef (org.alfresco.service.cmr.repository.NodeRef)2 QName (org.alfresco.service.namespace.QName)2 RowBounds (org.apache.ibatis.session.RowBounds)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Locale (java.util.Locale)1 Node (org.alfresco.repo.domain.node.Node)1 NodeExistsException (org.alfresco.repo.domain.node.NodeExistsException)1 VisitedNode (org.alfresco.repo.node.db.NodeHierarchyWalker.VisitedNode)1 InvalidTypeException (org.alfresco.service.cmr.dictionary.InvalidTypeException)1 TypeDefinition (org.alfresco.service.cmr.dictionary.TypeDefinition)1 StoreRef (org.alfresco.service.cmr.repository.StoreRef)1 AccessPermission (org.alfresco.service.cmr.security.AccessPermission)1 Extend (org.alfresco.traitextender.Extend)1