Search in sources :

Example 1 with ChildAssociatedNodeFinder

use of org.alfresco.repo.transfer.ChildAssociatedNodeFinder in project alfresco-repository by Alfresco.

the class ReplicationActionExecutor method expandPayload.

/**
 * Takes a {@link ReplicationDefinition}, which contains one or
 *  more payloads {@link NodeRef}s, and expands them into a
 *  full list of nodes to be transfered.
 */
protected Set<NodeRef> expandPayload(ReplicationDefinition replicationDef) {
    // Turn our payload list of root nodes into something that
    // the transfer service can work with
    Set<NodeRef> toTransfer = new HashSet<NodeRef>(89);
    NodeCrawler crawler = nodeCrawlerFactory.getNodeCrawler();
    crawler.setNodeFinders(new ChildAssociatedNodeFinder(ContentModel.ASSOC_CONTAINS, RenditionModel.ASSOC_RENDITION));
    crawler.setNodeFilters(new ContentClassFilter(ContentModel.TYPE_FOLDER, ContentModel.TYPE_CONTENT, ContentModel.TYPE_THUMBNAIL));
    for (NodeRef payload : replicationDef.getPayload()) {
        if (nodeService.exists(payload)) {
            Set<NodeRef> crawledNodes = crawler.crawl(payload);
            toTransfer.addAll(crawledNodes);
        } else {
            logger.warn("Skipping replication of non-existant node " + payload);
        }
    }
    return toTransfer;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) ChildAssociatedNodeFinder(org.alfresco.repo.transfer.ChildAssociatedNodeFinder) NodeCrawler(org.alfresco.service.cmr.transfer.NodeCrawler) ContentClassFilter(org.alfresco.repo.transfer.ContentClassFilter) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 ChildAssociatedNodeFinder (org.alfresco.repo.transfer.ChildAssociatedNodeFinder)1 ContentClassFilter (org.alfresco.repo.transfer.ContentClassFilter)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 NodeCrawler (org.alfresco.service.cmr.transfer.NodeCrawler)1