Package org.apache.jackrabbit.jcr2spi.state

Examples of org.apache.jackrabbit.jcr2spi.state.PropertyState


     * @throws ItemNotFoundException
     * @throws RepositoryException
     */
    private PropertyEntry loadPropertyEntry(PropertyId childId) throws RepositoryException {
        try {
            PropertyState state = factory.getItemStateFactory().createDeepPropertyState(childId, this);
            return (PropertyEntry) state.getHierarchyEntry();
        } catch (ItemNotFoundException e) {
            return null;
        }
    }
View Full Code Here


     * @param child
     */
    private void notifyUUIDorMIXINModified(PropertyEntry child) {
        try {
            if (NameConstants.JCR_UUID.equals(child.getName())) {
                PropertyState ps = child.getPropertyState();
                setUniqueID(ps.getValue().getString());
            } else if (NameConstants.JCR_MIXINTYPES.equals(child.getName())) {
                NodeState state = (NodeState) internalGetItemState();
                if (state != null) {
                    PropertyState ps = child.getPropertyState();
                    state.setMixinTypeNames(StateUtility.getMixinNames(ps));
                } // nodestate not yet loaded -> ignore change
            }
        } catch (ItemNotFoundException e) {
            log.debug("Property with name " + child.getName() + " does not exist (anymore)");
View Full Code Here

        if (pe != null && pe.getStatus() == Status.NEW) {
            switch (operation.getStatus()) {
                case Operation.STATUS_PERSISTED:
                    // for autocreated/protected props, mark to be reloaded
                    // upon next access.
                    PropertyState addedState = (PropertyState) ((PropertyEntryImpl) pe).internalGetItemState();
                    addedState.setStatus(Status.EXISTING);
                    QPropertyDefinition pd = addedState.getDefinition();
                    if (pd.isAutoCreated() || pd.isProtected()) {
                        pe.invalidate(true);
                    } // else: assume added property is up to date.
                    break;
                case Operation.STATUS_UNDO:
View Full Code Here

        if (operation.getNodeState().getHierarchyEntry() != this) {
            throw new IllegalArgumentException();
        }
        PropertyEntry pe = getPropertyEntry(NameConstants.JCR_MIXINTYPES);
        if (pe != null) {
            PropertyState pState = pe.getPropertyState();
            switch (operation.getStatus()) {
                case Operation.STATUS_PERSISTED:
                    Name[] mixins = StateUtility.getMixinNames(pState);
                    getNodeState().setMixinTypeNames(mixins);
                    if (pState.getStatus() == Status.NEW || pState.getStatus() == Status.EXISTING_MODIFIED) {
                        pState.setStatus(Status.EXISTING);
                    }
                    break;
                case Operation.STATUS_UNDO:
                    pe.revert();
                    break;
View Full Code Here

                    // reached root state without finding a jcr:isCheckedOut property
                    return true;
                }
                nodeEntry = parent;
            }
            PropertyState propState = nodeEntry.getPropertyEntry(NameConstants.JCR_ISCHECKEDOUT).getPropertyState();
            Boolean b = Boolean.valueOf(propState.getValue().getString());
            return b.booleanValue();
        } catch (ItemNotFoundException e) {
            // error while accessing jcr:isCheckedOut property state.
            // -> assume that checkedOut status is ok. see above for general
            // notes about the capabilities of the jcr2spi implementation.
View Full Code Here

    public void resolveMergeConflict(NodeState nodeState, NodeState versionState,
                                     boolean done) throws RepositoryException {
        NodeId vId = versionState.getNodeId();

        PropertyState mergeFailedState = nodeState.getPropertyState(NameConstants.JCR_MERGEFAILED);
        QValue[] vs = mergeFailedState.getValues();

        NodeId[] mergeFailedIds = new NodeId[vs.length - 1];
        for (int i = 0, j = 0; i < vs.length; i++) {
            NodeId id = workspaceManager.getIdFactory().createNodeId(vs[i].getString());
            if (!id.equals(vId)) {
                mergeFailedIds[j] = id;
                j++;
            }
            // else: the version id is being solved by this call and not
            // part of 'jcr:mergefailed' any more
        }

        PropertyState predecessorState = nodeState.getPropertyState(NameConstants.JCR_PREDECESSORS);
        vs = predecessorState.getValues();

        int noOfPredecessors = (done) ? vs.length + 1 : vs.length;
        NodeId[] predecessorIds = new NodeId[noOfPredecessors];

        int i = 0;
View Full Code Here

        return op.getFailedIds();
    }

    public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
        NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
        PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);
        String uniqueID = ps.getValue().getString();

        NodeId versionableId = workspaceManager.getIdFactory().createNodeId(uniqueID);
        return workspaceManager.getHierarchyManager().getNodeEntry(versionableId);
    }
View Full Code Here

        NodeId versionableId = workspaceManager.getIdFactory().createNodeId(uniqueID);
        return workspaceManager.getHierarchyManager().getNodeEntry(versionableId);
    }

    public NodeEntry getVersionHistoryEntry(NodeState versionableState) throws RepositoryException {
        PropertyState ps = versionableState.getPropertyState(NameConstants.JCR_VERSIONHISTORY);
        String uniqueID = ps.getValue().getString();
        NodeId vhId = workspaceManager.getIdFactory().createNodeId(uniqueID);
        return workspaceManager.getHierarchyManager().getNodeEntry(vhId);
    }
View Full Code Here

     * @see HierarchyManager#getPropertyState(Path)
     */
    public PropertyState getPropertyState(Path qPath) throws PathNotFoundException, RepositoryException {
        PropertyEntry entry = getPropertyEntry(qPath);
        try {
            PropertyState state = entry.getPropertyState();
            if (state.isValid()) {
                return state;
            } else {
                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
            }
        } catch (ItemNotFoundException e) {
View Full Code Here

     * @see ItemManager#propertyExists(Path)
     */
    public boolean propertyExists(Path path) throws RepositoryException {
        try {
            // session-sanity & permissions are checked upon itemExists(ItemState)
            PropertyState propState = hierMgr.getPropertyState(path);
            return itemExists(propState);
        } catch (PathNotFoundException pnfe) {
            return false;
        } catch (ItemNotFoundException infe) {
            return false;
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.jcr2spi.state.PropertyState

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.