Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Path


            else {
                stale = true;

                NodeId parentId = parent.getId();
                Name propertyName = NameFactoryImpl.getInstance().create(Name.NS_DEFAULT_URI, this.name);
                Path path = PathFactoryImpl.getInstance().create(parentId.getPath(), propertyName, true);
                PropertyId id = IdFactoryImpl.getInstance().createPropertyId(parentId, propertyName);

                propertyInfo = new PropertyInfoImpl(path, id, type, isMultivalued,
                        values.toArray(new QValue[values.size()]));
View Full Code Here


     * Inserts the element at the beginning of the path to be built.
     *
     * @param elem
     */
    public void addFirst(Path.Element elem) {
        Path first = factory.create(elem);
        if (path != null) {
            path = first.resolve(path);
        } else {
            path = first;
        }
    }
View Full Code Here

             * <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
             * </ul>
             */
            public int cancel(CancelableOperation other) throws RepositoryException {
                if (other instanceof Remove) {
                    Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
                    return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath)
                        ? CANCEL_THIS
                        : CANCEL_NONE;
                }
                if (other instanceof SetMixins) {
                    SetMixins setMixin = (SetMixins) other;
                    if (mixinNodeTypeNames.length == setMixin.mixinNodeTypeNames.length) {
                        Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                        Path otherPath = ConsolidatingChangeLog.getPath(setMixin.nodeId);
                        if (thisPath.equals(otherPath)) {
                            for (int k = 0; k < mixinNodeTypeNames.length; k++) {
                                if (!mixinNodeTypeNames[k].equals(setMixin.mixinNodeTypeNames[k])) {
                                    return CANCEL_NONE;
                                }
View Full Code Here

             * <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
             * </ul>
             */
            public int cancel(CancelableOperation other) throws RepositoryException {
                if (other instanceof Remove) {
                    Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
                    return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath)
                        ? CANCEL_THIS
                        : CANCEL_NONE;
                }
                if (other instanceof SetPrimaryType) {
                    SetPrimaryType setPrimaryType = (SetPrimaryType) other;
                    if (primaryTypeName.equals(setPrimaryType.primaryTypeName)) {
                        Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
                        Path otherPath = ConsolidatingChangeLog.getPath(setPrimaryType.nodeId);
                        if (thisPath.equals(otherPath)) {
                            return CANCEL_THIS;
                        }
                    }
                }
View Full Code Here

             * <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
             * </ul>
             */
            public int cancel(CancelableOperation other) throws RepositoryException {
                if (other instanceof Remove) {
                    Path thisPath = ConsolidatingChangeLog.getPath(propertyId);
                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
                    return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath)
                        ? CANCEL_THIS
                        : CANCEL_NONE;
                }
                if (other instanceof SetValue) {
                    Path thisPath = ConsolidatingChangeLog.getPath(propertyId);
                    Path otherPath = ConsolidatingChangeLog.getPath(((SetValue) other).propertyId);
                    if (thisPath.equals(otherPath)) {
                        return CANCEL_THIS;
                    }
                }
                return CANCEL_NONE;
View Full Code Here

            });
        }

        private NodeId calcRemoveNodeId(ItemId itemId) throws MalformedPathException {
            NodeId nodeId = (NodeId) itemId;
            Path p = itemId.getPath();
            if (p != null) {
                removedNodeIds.add(nodeId);
                int index = p.getNameElement().getNormalizedIndex();
                if (index > Path.INDEX_DEFAULT) {
                    Path.Element[] elems = p.getElements();
                    PathBuilder pb = new PathBuilder();
                    for (int i = 0; i <= elems.length - 2; i++) {
                        pb.addLast(elems[i]);
                    }
                    pb.addLast(p.getNameElement().getName(), index - 1);

                    NodeId prevSibling = idFactory.createNodeId(itemId.getUniqueID(), pb.getPath());
                    if (removedNodeIds.contains(prevSibling)) {
                        nodeId = prevSibling;
                    }
View Full Code Here

            NodeId nId = operation.getNodeId();
            if (nId == null) {
                service.restore(sessionInfo, operation.getVersionIds(), operation.removeExisting());
            } else {
                NodeId targetId;
                Path relPath = operation.getRelativePath();
                if (relPath != null) {
                    targetId = idFactory.createNodeId(nId, relPath);
                } else {
                    targetId = nId;
                }
View Full Code Here

        }
        String msg = "No ancestor at depth = " + depth;
        try {
            // Path.getAncestor requires relative degree, i.e. we need
            // to convert absolute to relative ancestor degree
            Path path = getQPath();
            int relDegree = path.getAncestorCount() - depth;
            if (relDegree < 0) {
                throw new ItemNotFoundException(msg);
            }
            Path ancestorPath = path.getAncestor(relDegree);
            if (relDegree == 0) {
                return this;
            } else {
                return getItemManager().getNode(ancestorPath);
            }
View Full Code Here

        StringBuffer bf = new StringBuffer();
        String uid = id.getUniqueID();
        if (uid != null) {
            bf.append(uid);
        }
        Path p = id.getPath();
        if (p != null) {
            if (resolver == null) {
                bf.append(p.toString());
            } else {
                try {
                    bf.append(resolver.getJCRPath(p));
                } catch (NamespaceException e) {
                    bf.append(p.toString());
                }
            }
        }
        return bf.toString();
    }
View Full Code Here

    }

    private List<PropertyInfo> buildPropertyInfos(NodeInfo nInfo) throws RepositoryException {
        List<PropertyInfo> l = new ArrayList<PropertyInfo>(3);
        NodeId nid = nInfo.getId();
        Path nPath = nInfo.getPath();

        if (nid.getPath() == null) {
            PropertyId id = getIdFactory().createPropertyId(nid, NameConstants.JCR_UUID);
            QValue[] vs = new QValue[] {getQValueFactory().create(nid.getUniqueID(), PropertyType.STRING)};
            Path p = getPathFactory().create(nPath, NameConstants.JCR_UUID, true);
            PropertyInfo pi = new PropertyInfoImpl(id, p, PropertyType.STRING, false, vs);
            l.add(pi);
        }

        Name pName = NameConstants.JCR_PRIMARYTYPE;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.Path

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.