Package org.modeshape.jcr.query.NodeSequence

Examples of org.modeshape.jcr.query.NodeSequence.Batch


    public void shouldCreateFilteringSequenceThatIncludesOnlyNonSystemNodes() {
        RowFilter nonSysFilter = rowFilterOfNodesWithKeysHavingWorkspaceKey(0, NodeKey.keyForWorkspaceName(workspaceName()));
        NodeSequence seq = NodeSequence.filter(allNodes(), nonSysFilter);
        try {
            // Iterate over the batches ...
            Batch batch = null;
            while ((batch = seq.nextBatch()) != null) {
                while (batch.hasNext()) {
                    batch.nextRow();
                    CachedNode node = batch.getNode();
                    if (node != null) {
                        Path path = node.getPath(cache);
                        boolean isSystem = path.getSegment(0).getName().equals(JcrLexicon.SYSTEM);
                        assertTrue(path.isRoot() || !isSystem);
                    }
View Full Code Here


    public NodeSequence allNodes( float score,
                                  long nodeCount ) {
        // Use a single batch for the workspace content ...
        NodeCacheIterator iter = nodes(workspaceName, null);
        assert iter != null;
        Batch mainBatch = NodeSequence.batchOfKeys(iter, nodeCount, score, workspaceName, repo);

        // Nothing else to use ...
        return NodeSequence.withBatch(mainBatch);
    }
View Full Code Here

                    if (!more) return null;
                    readBatch();
                }
                if (writer != null) {
                    // Return a preloaded batch if there is one ...
                    Batch preloaded = writer.popPreloadedBatch();
                    if (preloaded != null) return preloaded;
                }
                try {
                    return writer.convertToBatch(!more);
                } finally {
View Full Code Here

        }

        protected boolean consumeOperation( Index.Results operation ) {
            if (keys != null && !keys.isEmpty()) {
                // We've already read some, but have to get ready to read more ...
                Batch batch = convertToBatch(false);
                if (batch.isEmpty()) return false;
                if (preloadedBatches == null) preloadedBatches = new LinkedList<>();
                preloadedBatches.add(batch);
            }
            keys = new ArrayList<NodeKey>(batchSize);
            scores = new ArrayList<Float>(batchSize);
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.NodeSequence.Batch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.