Class ItemState

  • Direct Known Subclasses:
    NodeState, PropertyState

    public abstract class ItemState
    extends Object
    ItemState represents the state of an Item.
    • Method Detail

      • getHierarchyEntry

        public HierarchyEntry getHierarchyEntry()
        The HierarchyEntry corresponding to this ItemState.
        Returns:
        The HierarchyEntry corresponding to this ItemState.
      • isNode

        public abstract boolean isNode()
        Utility method: Determines if this item state represents a node.
        Returns:
        true if this item state represents a node, otherwise false.
      • getName

        public Name getName()
        Utility method: Returns the name of this state. Shortcut for calling 'getName' on the hierarchy entry.
        Returns:
        name of this state
      • getWorkspaceId

        public abstract ItemId getWorkspaceId()
                                       throws RepositoryException
        Utility method: Returns the identifier of this item state. Shortcut for calling 'getWorkspaceId' on the NodeEntry or PropertyEntry respectively.
        Returns:
        the identifier of this item state..
        Throws:
        RepositoryException
      • getStatus

        public final int getStatus()
        Returns the status of this item.
        Returns:
        the status of this item.
      • setStatus

        public void setStatus​(int newStatus)
        Sets the new status of this item.
        Parameters:
        newStatus - the new status
      • merge

        public abstract ItemState.MergeResult merge​(ItemState another,
                                                    boolean keepChanges)
        Merge all data from the given state into this state. If 'keepChanges' is true, transient modifications present on this state are not touched. Otherwise this state is completely reset according to the given other state.
        Parameters:
        another -
        keepChanges -
        Returns:
        a MergeResult instance which represent the result of the merge operation
      • revert

        public abstract boolean revert()
        Revert all transient modifications made to this ItemState.
        Returns:
        true if this state has been modified i.e. if there was anything to revert.
      • addListener

        public void addListener​(ItemStateLifeCycleListener listener)
        Add an ItemStateLifeCycleListener
        Parameters:
        listener - the new listener to be informed on modifications
      • removeListener

        public void removeListener​(ItemStateLifeCycleListener listener)
        Remove an ItemStateLifeCycleListener
        Parameters:
        listener - an existing listener
      • getListeners

        public Iterator<ItemStateLifeCycleListener> getListeners()
        Unmodifiable iterator over the listeners present on this item state.
        Returns:
        iterator over ItemStateLifeCycleListeners.