Class JcrItemModel<T extends javax.jcr.Item>

  • All Implemented Interfaces:
    Serializable, org.apache.wicket.model.IDetachable, org.apache.wicket.model.IModel<T>, org.apache.wicket.util.io.IClusterable

    public class JcrItemModel<T extends javax.jcr.Item>
    extends org.apache.wicket.model.LoadableDetachableModel<T>
    Model for JCR Items. The model tracks the Item as well as it can, using the first referencable ancestor plus a relative path as the identification/retrieval method. When the Item (or one of its ancestors) is moved, this is transparent.

    In development, when the model is serialized, it checks whether it has been detached properly.

    See Also:
    Serialized Form
    • Constructor Detail

      • JcrItemModel

        public JcrItemModel​(T item)
      • JcrItemModel

        public JcrItemModel​(String path,
                            boolean property)
    • Method Detail

      • getUuid

        public String getUuid()
        Retrieve the identifier (UUID) of the first referencable ancestor node
        Returns:
        the UUID
      • getRelativePath

        public String getRelativePath()
        Retrieve the JCR path for the Item, relative to the first referencable ancestor
        Returns:
        the relative path
      • getPath

        public String getPath()
        The absolute JCR path for the Item.
        Returns:
        the absolute path
      • exists

        public boolean exists()
        Determine whether the Item exists. This will retrieve the Item from the repository. If the Item has been loaded in this request cycle (e.g. using IModel.getObject()), but has since been removed, the returned information may be incorrect.
        Returns:
        true when the Item exists
      • getParentModel

        public JcrItemModel<javax.jcr.Node> getParentModel()
        Retrieve the JcrItemModel for the parent Node.
        Returns:
        the parent JcrItemModel
      • load

        protected T load()
        Specified by:
        load in class org.apache.wicket.model.LoadableDetachableModel<T extends javax.jcr.Item>
      • loadModel

        protected T loadModel()
      • detach

        public void detach()
        Specified by:
        detach in interface org.apache.wicket.model.IDetachable
        Specified by:
        detach in interface org.apache.wicket.model.IModel<T extends javax.jcr.Item>
        Overrides:
        detach in class org.apache.wicket.model.LoadableDetachableModel<T extends javax.jcr.Item>
      • toString

        public String toString()
        Overrides:
        toString in class org.apache.wicket.model.LoadableDetachableModel<T extends javax.jcr.Item>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object