Class JcrNodeModel

  • All Implemented Interfaces:
    Serializable, org.apache.wicket.model.IDetachable, org.apache.wicket.model.IModel<javax.jcr.Node>, org.apache.wicket.util.io.IClusterable, IObservable

    public class JcrNodeModel
    extends ItemModelWrapper<javax.jcr.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:
    Serialized Form
    • Constructor Detail

      • 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​(javax.jcr.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 Detail

      • getNode

        public javax.jcr.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 javax.jcr.Node getObject()
        Specified by:
        getObject in interface org.apache.wicket.model.IModel<javax.jcr.Node>
        Overrides:
        getObject in class ItemModelWrapper<javax.jcr.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<javax.jcr.Node>
        Overrides:
        detach in class ItemModelWrapper<javax.jcr.Node>
      • 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
      • 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