Package org.apache.jackrabbit.oak.spi.state

Examples of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry


        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n2));
        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n3));

        String searchFor = n3;

        ChildNodeEntry item = OrderedContentMirrorStoreStrategy.seek(index.getNodeState(),
            new OrderedContentMirrorStoreStrategy.PredicateLessThan(searchFor));

        assertNull("we should have not found an item", item);
    }
View Full Code Here


        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n2));
        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n3));

        String searchFor = n2;

        ChildNodeEntry item = OrderedContentMirrorStoreStrategy.seek(index.getNodeState(),
            new OrderedContentMirrorStoreStrategy.PredicateLessThan(searchFor));

        assertNotNull("we should have found an item", item);
        assertEquals(n0, item.getName());
    }
View Full Code Here

        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n1));
        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n2));

        String searchFor = KEYS[0];

        ChildNodeEntry item = OrderedContentMirrorStoreStrategy.seek(index.getNodeState(),
            new OrderedContentMirrorStoreStrategy.PredicateLessThan(searchFor, true));

        assertNull("we should have not found an item", item);
    }
View Full Code Here

        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n1));
        store.update(index, "/a/b", EMPTY_KEY_SET, newHashSet(n2));

        String searchFor = n2;

        ChildNodeEntry item = OrderedContentMirrorStoreStrategy.seek(index.getNodeState(),
            new OrderedContentMirrorStoreStrategy.PredicateLessThan(searchFor, true));

        assertNotNull("we should have found an item", item);
        assertEquals(n2, item.getName());
    }
View Full Code Here

        @Override
        public ChildNodeEntry next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            ChildNodeEntry entry = current.next();
            previousName = entry.getName();
            currentRemaining--;
            return entry;
        }
View Full Code Here

                return;
            } else if (node.exists()) {
                if (node.hasProperty(NEXT)) {
                    // it's an index key and we have to relink the list
                    // (1) find the previous element
                    ChildNodeEntry previous = findPrevious(
                            index.getNodeState(), node.getNodeState());
                    LOG.debug("previous: {}", previous);
                    // (2) find the next element
                    String next = node.getString(NEXT);
                    if (next == null) {
                        next = "";
                    }
                    // (3) re-link the previous to the next
                    index.getChildNode(previous.getName()).setProperty(NEXT, next);
                }
                node.remove();
            }
        }
    }
View Full Code Here

     * @param node the node we want to compare
     * @return the previous item or null if not found.
     */
    @Nullable
    ChildNodeEntry findPrevious(@Nonnull final NodeState index, @Nonnull final NodeState node) {
        ChildNodeEntry previous = null;
        ChildNodeEntry current = null;
        boolean found = false;
        Iterator<? extends ChildNodeEntry> it = getChildNodeEntries(index, true).iterator();

        while (!found && it.hasNext()) {
            current = it.next();
            if (previous == null) {
                // first iteration
                previous = current;
            } else {
                found = node.equals(current.getNodeState());
                if (!found) {
                    previous = current;
                }
            }
        }
View Full Code Here

        final NodeState index = indexMeta.getChildNode(indexStorageNodeName);

        if (pr.first != null && !pr.first.equals(pr.last)) {
            // '>' & '>=' use case
            ChildNodeEntry firstValueableItem = seek(index,
                new PredicateGreaterThan(pr.first.getValue(Type.STRING), pr.firstIncluding));
            Iterable<String> it = Collections.emptyList();
            if (firstValueableItem != null) {
                Iterable<ChildNodeEntry> childrenIterable = (pr.last == null) ? new SeekedIterable(
                    index, firstValueableItem) : new BetweenIterable(index, firstValueableItem,
                    pr.last.getValue(Type.STRING), pr.lastIncluding);
                it = new QueryResultsWrapper(filter, indexName, childrenIterable);
            }
            return it;
        } else if (pr.last != null && !pr.last.equals(pr.first)) {
            // '<' & '<=' use case
            ChildNodeEntry firstValueableItem = seek(index,
                new PredicateLessThan(pr.last.getValue(Type.STRING), pr.lastIncluding));
            Iterable<String> it = Collections.emptyList();
            if (firstValueableItem != null) {
                it = new QueryResultsWrapper(filter, indexName, new SeekedIterable(index,
                    firstValueableItem));
View Full Code Here

                                      @Nonnull Predicate<ChildNodeEntry> condition) {
       
        // TODO the FullIterable will have to be replaced with something else once we'll have the
        // Skip part of the list implemented.
        Iterable<ChildNodeEntry> children = new FullIterable(index, false);
        ChildNodeEntry entry = null;
        for (ChildNodeEntry child : children) {
            if (condition.apply(child)) {
                entry = child;
                break;
            }
View Full Code Here

                   || (!includeStart && !Strings.isNullOrEmpty(current.getString(NEXT)));
        }

        @Override
        public ChildNodeEntry next() {
            ChildNodeEntry entry = null;
            if (includeStart && start.equals(current)) {
                entry = new OrderedChildNodeEntry(START, current);
                // let's set it to false. We just included it.
                includeStart = false;
            } else {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.state.ChildNodeEntry

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.