Search in sources :

Example 1 with ArchivedNodesCannedQueryBuilder

use of org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder in project alfresco-remote-api by Alfresco.

the class DeletedNodesImpl method listDeleted.

@Override
public CollectionWithPagingInfo<Node> listDeleted(Parameters parameters) {
    PagingRequest pagingRequest = Util.getPagingRequest(parameters.getPaging());
    NodeRef archiveStoreRootNodeRef = nodeService.getStoreArchiveNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    // Create canned query
    ArchivedNodesCannedQueryBuilder queryBuilder = new ArchivedNodesCannedQueryBuilder.Builder(archiveStoreRootNodeRef, pagingRequest).sortOrderAscending(false).build();
    // Query the DB
    PagingResults<NodeRef> result = nodeArchiveService.listArchivedNodes(queryBuilder);
    Integer totalItems = result.getTotalResultCount().getFirst();
    List<Node> nodesFound = new ArrayList<Node>(result.getPage().size());
    Map mapUserInfo = new HashMap<>();
    for (NodeRef nRef : result.getPage()) {
        Node foundNode = nodes.getFolderOrDocument(nRef, null, null, parameters.getInclude(), mapUserInfo);
        mapArchiveInfo(foundNode, mapUserInfo);
        nodesFound.add(foundNode);
    }
    return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodesFound, result.hasMoreItems(), (totalItems == null ? null : totalItems.intValue()));
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) ArchivedNodesCannedQueryBuilder(org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder) HashMap(java.util.HashMap) ArchivedNodesCannedQueryBuilder(org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder) Node(org.alfresco.rest.api.model.Node) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) PagingRequest(org.alfresco.query.PagingRequest)

Example 2 with ArchivedNodesCannedQueryBuilder

use of org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder in project alfresco-remote-api by Alfresco.

the class AbstractArchivedNodeWebScript method getArchivedNodesFrom.

/**
 * * This method gets all nodes from the archive which were originally
 * contained within the specified StoreRef.
 *
 * @param storeRef mandatory store ref
 * @param paging mandatory paging
 * @param filter optional filter
 */
protected PagingResults<NodeRef> getArchivedNodesFrom(StoreRef storeRef, ScriptPagingDetails paging, String filter) {
    NodeService nodeService = serviceRegistry.getNodeService();
    NodeRef archiveStoreRootNodeRef = nodeService.getStoreArchiveNode(storeRef);
    // Create canned query
    ArchivedNodesCannedQueryBuilder queryBuilder = new ArchivedNodesCannedQueryBuilder.Builder(archiveStoreRootNodeRef, paging).filter(filter).sortOrderAscending(false).build();
    // Query the DB
    PagingResults<NodeRef> result = nodeArchiveService.listArchivedNodes(queryBuilder);
    return result;
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) ArchivedNodesCannedQueryBuilder(org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder) NodeService(org.alfresco.service.cmr.repository.NodeService)

Aggregations

ArchivedNodesCannedQueryBuilder (org.alfresco.repo.node.archive.ArchivedNodesCannedQueryBuilder)2 NodeRef (org.alfresco.service.cmr.repository.NodeRef)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 PagingRequest (org.alfresco.query.PagingRequest)1 Node (org.alfresco.rest.api.model.Node)1 NodeService (org.alfresco.service.cmr.repository.NodeService)1