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()));
}
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;
}
Aggregations