Examples of NodeBuilder


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

        }
    }

    private void applyResolution(Resolution resolution, ConflictType conflictType, PropertyState ours) {
        String name = ours.getName();
        NodeBuilder conflictMarker = getConflictMarker(conflictType);
        if (resolution == Resolution.OURS) {
            if (DELETE_CHANGED_PROPERTY == conflictType) {
                target.removeProperty(name);
            }
            else {
                target.setProperty(ours);
            }

        }
        conflictMarker.removeProperty(name);
    }

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

        }
        conflictMarker.removeProperty(name);
    }

    private void applyResolution(Resolution resolution, ConflictType conflictType, String name, NodeState ours) {
        NodeBuilder conflictMarker = getConflictMarker(conflictType);
        if (resolution == Resolution.OURS) {
            if (DELETE_CHANGED_NODE == conflictType) {
                removeChild(target, name);
            }
            else {
                addChild(target, name, ours);
            }
        }
        conflictMarker.getChildNode(name).remove();
    }

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

        }
    }

    private static void preAsyncRun(NodeStore store, String name,
            AsyncIndexStats stats) throws CommitFailedException {
        NodeBuilder builder = store.getRoot().builder();
        preAsyncRunStatus(builder, stats);
        store.merge(builder, EmptyHook.INSTANCE, null);
    }

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

    }

    private NodeBuilder getConflictMarker(ConflictType conflictType) {
        final String conflictName = conflictType.getName();
        if (target.hasChildNode(CONFLICT)) {
            NodeBuilder conflict = target.child(CONFLICT);
            if (conflict.hasChildNode(conflictName)) {
                return conflict.child(conflictName);
            }
        }

        return null;
    }

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

    private Namespaces() {
    }

    public static void setupNamespaces(NodeBuilder system) {
        if (!system.hasChildNode(REP_NAMESPACES)) {
            NodeBuilder namespaces = createStandardMappings(system);
            buildIndexNode(namespaces); // index node for faster lookup
        }
    }

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

    }

    public static NodeBuilder createStandardMappings(NodeBuilder system) {
        checkState(!system.hasChildNode(REP_NAMESPACES));

        NodeBuilder namespaces = system.setChildNode(REP_NAMESPACES);
        namespaces.setProperty(JCR_PRIMARYTYPE, NodeTypeConstants.NT_REP_UNSTRUCTURED, NAME);

        // Standard namespace specified by JCR (default one not included)
        namespaces.setProperty(escapePropertyKey(PREFIX_EMPTY), NAMESPACE_EMPTY);
        namespaces.setProperty(PREFIX_JCR, NAMESPACE_JCR);
        namespaces.setProperty(PREFIX_NT,  NAMESPACE_NT);
        namespaces.setProperty(PREFIX_MIX, NAMESPACE_MIX);
        namespaces.setProperty(PREFIX_XML, NAMESPACE_XML);

        // Namespace included in Jackrabbit 2.x
        namespaces.setProperty(PREFIX_SV, NAMESPACE_SV);
        namespaces.setProperty(PREFIX_REP, NAMESPACE_REP);

        return namespaces;
    }

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

                uris.add(uri);
                reverse.put(escapePropertyKey(uri), prefix);
            }
        }

        NodeBuilder data = namespaces.setChildNode(REP_NSDATA);
        data.setProperty(JCR_PRIMARYTYPE, NodeTypeConstants.NT_REP_UNSTRUCTURED, Type.NAME);
        data.setProperty(REP_PREFIXES, prefixes, Type.STRINGS);
        data.setProperty(REP_URIS, uris, Type.STRINGS);
        for (Entry<String, String> e : reverse.entrySet()) {
            data.setProperty(encodeUri(e.getKey()), e.getValue());
        }
    }

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

    }

    // testing

    public static Tree setupTestNamespaces(Map<String, String> global) {
        NodeBuilder root = EmptyNodeState.EMPTY_NODE.builder();
        NodeBuilder namespaces = root.child(JCR_SYSTEM).child(REP_NAMESPACES);
        namespaces.setProperty(JCR_PRIMARYTYPE, NodeTypeConstants.NT_REP_UNSTRUCTURED, NAME);
        for (Entry<String, String> entry : global.entrySet()) {
            namespaces.setProperty(escapePropertyKey(entry.getKey()),
                    entry.getValue());
        }
        buildIndexNode(namespaces);
        return new ImmutableTree(root.getNodeState());
    }

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

                                 NodeBuilder dest,
                                 VersionSelector selector)
            throws RepositoryException, CommitFailedException {
        // 15.7.6 Restoring Child Nodes
        for (String name : src.getChildNodeNames()) {
            NodeBuilder srcChild = src.getChildNode(name);
            int action = getOPV(dest, srcChild, name);
            if (action == COPY) {
                // replace on destination
                dest.getChildNode(name).remove();
                restoreCopiedNode(srcChild, dest.child(name), selector);
            } else if (action == VERSION) {
                restoreState(srcChild, dest, name, selector);
            }
        }
        for (String name : dest.getChildNodeNames()) {
            if (src.hasChildNode(name)) {
                continue;
            }
            NodeBuilder destChild = dest.getChildNode(name);
            int action = getOPV(dest, destChild, name);
            if (action == COPY || action == VERSION || action == ABORT) {
                dest.getChildNode(name).remove();
            } else if (action == IGNORE) {
                // no action

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

            }
        }, true);

        // add the frozen children and histories
        for (String name : src.getChildNodeNames()) {
            NodeBuilder child = src.getChildNode(name);
            String childId = getChildId(srcId, child, name);
            int opv = getOPV(src, child, name);

            if (opv == OnParentVersionAction.ABORT) {
                throw new CommitFailedException(CommitFailedException.VERSION,
                        VersionExceptionCode.OPV_ABORT_ITEM_PRESENT.ordinal(),
                        "Checkin aborted due to OPV abort in " + name);
            }
            if (opv == OnParentVersionAction.VERSION) {
                if (ntMgr.isNodeType(new ImmutableTree(child.getNodeState()), MIX_VERSIONABLE)) {
                    // create frozen versionable child
                    versionedChild(child, dest.child(name));
                } else {
                    // else copy
                    copy(child, childId, dest.child(name));
TOP
Copyright © 2018 www.massapi.com. 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.