Search in sources :

Example 1 with ChildAssocEntity

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

the class NodeDAOImpl method selectParentAssocs.

@Override
protected void selectParentAssocs(Long childNodeId, QName assocTypeQName, QName assocQName, Boolean isPrimary, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Child
    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);
    }
    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    template.select(SELECT_PARENT_ASSOCS_OF_CHILD, assoc, resultHandler);
    resultsCallback.done();
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 2 with ChildAssocEntity

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

the class NodeDAOImpl method updateChildAssocUniqueName.

@Override
protected int updateChildAssocUniqueName(Long assocId, String name) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    assoc.setId(assocId);
    // Name
    assoc.setChildNodeNameAll(null, null, name);
    return template.update(UPDATE_CHILD_ASSOC_UNIQUE_NAME, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity)

Example 3 with ChildAssocEntity

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

the class NodeDAOImpl method selectChildAssocsByChildTypes.

@Override
protected void selectChildAssocsByChildTypes(Long parentNodeId, Set<QName> childNodeTypeQNames, ChildAssocRefQueryCallback resultsCallback) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Parent
    NodeEntity parentNode = new NodeEntity();
    parentNode.setId(parentNodeId);
    assoc.setParentNode(parentNode);
    // Child Node Type QNames
    Set<Long> childNodeTypeQNameIds = qnameDAO.convertQNamesToIds(childNodeTypeQNames, false);
    if (childNodeTypeQNameIds.size() == 0) {
        resultsCallback.done();
        // Shortcut as they don't exist
        return;
    }
    assoc.setChildNodeTypeQNameIds(new ArrayList<Long>(childNodeTypeQNameIds));
    // 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 4 with ChildAssocEntity

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

the class NodeDAOImpl method selectPrimaryParentAssocs.

@Override
protected List<ChildAssocEntity> selectPrimaryParentAssocs(Long childNodeId) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Child
    NodeEntity childNode = new NodeEntity();
    childNode.setId(childNodeId);
    assoc.setChildNode(childNode);
    // Primary
    assoc.setPrimary(Boolean.TRUE);
    return template.selectList(SELECT_PARENT_ASSOCS_OF_CHILD, assoc);
}
Also used : ChildAssocEntity(org.alfresco.repo.domain.node.ChildAssocEntity) NodeEntity(org.alfresco.repo.domain.node.NodeEntity)

Example 5 with ChildAssocEntity

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

the class NodeDAOImpl method selectParentAssocs.

@Override
protected List<ChildAssocEntity> selectParentAssocs(Long childNodeId) {
    ChildAssocEntity assoc = new ChildAssocEntity();
    // Child
    NodeEntity childNode = new NodeEntity();
    childNode.setId(childNodeId);
    assoc.setChildNode(childNode);
    return template.selectList(SELECT_PARENT_ASSOCS_OF_CHILD, assoc);
}
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