Package org.apache.jackrabbit.core.state

Examples of org.apache.jackrabbit.core.state.ItemState


        if (data == null) {
            // not yet in cache, need to create instance:
            // - retrieve item state
            // - create instance of item data
            // NOTE: permission check & caching within createItemData
            ItemState state;
            try {
                state = sism.getItemState(itemId);
            } catch (NoSuchItemStateException nsise) {
                throw new ItemNotFoundException(itemId.toString());
            } catch (ItemStateException ise) {
View Full Code Here


     * @throws AccessDeniedException
     * @throws RepositoryException
     */
    private boolean canRead(ItemData data, Path path) throws AccessDeniedException, RepositoryException {
        // JCR-1601: cached item may just have been invalidated
        ItemState state = data.getState();
        if (state == null) {
            throw new InvalidItemStateException(data.getId() + ": the item does not exist anymore");
        }
        if (state.getStatus() == ItemState.STATUS_NEW) {
            if (!data.getDefinition().isProtected()) {
                /*
                NEW items can always be read as long they have been added through
                the API and NOT by the system (i.e. protected items).
                */
 
View Full Code Here

                /**
                 * persistent item that has been transiently removed
                 */
                case ItemState.STATUS_EXISTING_REMOVED:
                case ItemState.STATUS_EXISTING_MODIFIED:
                    ItemState persistentState = discarded.getOverlayedState();
                    // the state is a transient wrapper for the underlying
                    // persistent state, therefore restore the persistent state
                    // and resurrect this item instance if necessary
                    SessionItemStateManager stateMgr =
                        sessionContext.getItemStateManager();
View Full Code Here

                return false;
            }
            if (!iter1.hasNext() && iter2.hasNext()) {
                return false;
            }
            ItemState state1 = (ItemState) iter1.next();
            ItemState state2 = (ItemState) iter2.next();
            return state1.getId().equals(state2.getId());
        }
    }
View Full Code Here

     * definitively remove each one
     */
    private void removeTransientItems(
            SessionItemStateManager sism, Iterable<ItemState> states) {
        for (ItemState transientState : states) {
            ItemState persistentState = transientState.getOverlayedState();
            // remove persistent state
            // this will indirectly (through stateDestroyed listener method)
            // permanently invalidate all Item instances wrapping it
            sism.destroy(persistentState);
        }
View Full Code Here

        if (data == null) {
            // not yet in cache, need to create instance:
            // - retrieve item state
            // - create instance of item data
            // NOTE: permission check & caching within createItemData
            ItemState state;
            try {
                state = sism.getItemState(itemId);
            } catch (NoSuchItemStateException nsise) {
                throw new ItemNotFoundException(itemId.toString());
            } catch (ItemStateException ise) {
View Full Code Here

     * @throws AccessDeniedException
     * @throws RepositoryException
     */
    private boolean canRead(ItemData data, Path path) throws AccessDeniedException, RepositoryException {
        // JCR-1601: cached item may just have been invalidated
        ItemState state = data.getState();
        if (state == null) {
            throw new InvalidItemStateException(data.getId() + ": the item does not exist anymore");
        }
        if (state.getStatus() == ItemState.STATUS_NEW) {
            if (!data.getDefinition().isProtected()) {
                /*
                NEW items can always be read as long they have been added through
                the API and NOT by the system (i.e. protected items).
                */
 
View Full Code Here

                /**
                 * persistent item that has been transiently removed
                 */
                case ItemState.STATUS_EXISTING_REMOVED:
                case ItemState.STATUS_EXISTING_MODIFIED:
                    ItemState persistentState = discarded.getOverlayedState();
                    // the state is a transient wrapper for the underlying
                    // persistent state, therefore restore the persistent state
                    // and resurrect this item instance if necessary
                    SessionItemStateManager stateMgr =
                        sessionContext.getItemStateManager();
View Full Code Here

        if (status == STATUS_INVALIDATED || status == STATUS_DESTROYED) {
            // this instance is already 'invalid', get outta here
            return;
        }

        ItemState transientState = getOrCreateTransientItemState();
        if (transientState.getStatus() == ItemState.STATUS_NEW) {
            // this is a 'new' item, simply dispose the transient state
            // (it is no longer used); this will indirectly (through
            // stateDiscarded listener method) invalidate this instance permanently
            stateMgr.disposeTransientItemState(transientState);
        } else {
            // this is an 'existing' item (i.e. it is backed by persistent
            // state), mark it as 'removed'
            transientState.setStatus(ItemState.STATUS_EXISTING_REMOVED);
            // transfer the transient state to the attic
            stateMgr.moveTransientItemStateToAttic(transientState);

            // set state of this instance to 'invalid'
            data.setStatus(STATUS_INVALIDATED);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isNew() {
        final ItemState state = getItemState();
        return state.isTransient() && state.getOverlayedState() == null;
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.state.ItemState

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.