Class JcrItemModel<T extends Item>

java.lang.Object
org.apache.wicket.model.LoadableDetachableModel<T>
org.hippoecm.frontend.model.JcrItemModel<T>
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 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:
  • Constructor Details

    • JcrItemModel

      public JcrItemModel(T item)
    • JcrItemModel

      public JcrItemModel(String path, boolean property)
  • Method Details

    • 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<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 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 Item>
      Overrides:
      detach in class org.apache.wicket.model.LoadableDetachableModel<T extends Item>
    • toString

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

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object