Class JcrNodeModel

java.lang.Object
org.hippoecm.frontend.model.ItemModelWrapper<Node>
org.hippoecm.frontend.model.JcrNodeModel
All Implemented Interfaces:
Serializable, org.apache.wicket.model.IDetachable, org.apache.wicket.model.IModel<Node>, org.apache.wicket.util.io.IClusterable, IObservable

public class JcrNodeModel extends ItemModelWrapper<Node> implements IObservable
The model for a JCR Node. It maintains a reference to a (possibly null) Node object. In addition, it is IObservable, broadcasting JCR Events for property changes and child node additions or removals.

In general, no guarantees are made on the existence of the Node. I.e. the referenced node may disappear or it may even never have existed.

See Also:
  • Constructor Details

    • JcrNodeModel

      public JcrNodeModel(JcrItemModel model)
      Create a JcrNodeModel based on an JcrItemModel. The JcrItemModel should provide access to the Node to be wrapped by this model.
      Parameters:
      model - the Item model
    • JcrNodeModel

      public JcrNodeModel(Node node)
      Create a JcrNodeModel based on a JCR Node.
      Parameters:
      node - the node to wrap
    • JcrNodeModel

      public JcrNodeModel(String path)
      Create a JcrNodeModel based on an absolute JCR path.
      Parameters:
      path - the JCR path to the Node.
  • Method Details

    • getNode

      public Node getNode()
      Retrieve the node from the repository. May return null when the node no longer exists or the model was initially created with a null object.
    • getObject

      public Node getObject()
      Specified by:
      getObject in interface org.apache.wicket.model.IModel<Node>
      Overrides:
      getObject in class ItemModelWrapper<Node>
    • getParentModel

      public JcrNodeModel getParentModel()
      Retrieve a JcrNodeModel for the parent node.
      Returns:
      a model for the parent Node
    • detach

      public void detach()
      Specified by:
      detach in interface org.apache.wicket.model.IDetachable
      Specified by:
      detach in interface org.apache.wicket.model.IModel<Node>
      Overrides:
      detach in class ItemModelWrapper<Node>
    • setObservationContext

      public void setObservationContext(IObservationContext<? extends IObservable> context)
      Store the observation context to be used to dispatch events.
      Specified by:
      setObservationContext in interface IObservable
    • startObservation

      public void startObservation()
      Start the observation by listening to JCR Events.
      Specified by:
      startObservation in interface IObservable
    • stopObservation

      public void stopObservation()
      Stop listening to JCR Events.
      Specified by:
      stopObservation in interface IObservable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Description copied from interface: IObservable
      Equivalence of observables; observation will only be started on one instance.
      Specified by:
      equals in interface IObservable
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface IObservable
      Overrides:
      hashCode in class Object
      See Also: