Package org.hippoecm.frontend.model
Class JcrItemModel<T extends javax.jcr.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 javax.jcr.Item> extends org.apache.wicket.model.LoadableDetachableModel<T>
Model for JCRItem
s. 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 Summary
Constructors Constructor Description JcrItemModel(String path, boolean property)
JcrItemModel(T item)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
boolean
equals(Object object)
boolean
exists()
Determine whether the Item exists.JcrItemModel<javax.jcr.Node>
getParentModel()
Retrieve the JcrItemModel for the parentNode
.String
getPath()
The absolute JCR path for the Item.String
getRelativePath()
Retrieve the JCR path for the Item, relative to the first referencable ancestorString
getUuid()
Retrieve the identifier (UUID) of the first referencable ancestor nodeint
hashCode()
protected T
load()
protected T
loadModel()
String
toString()
-
Methods inherited from class org.apache.wicket.model.LoadableDetachableModel
getObject, isAttached, of, onAttach, onDetach, setObject
-
-
-
-
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. usingIModel.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 parentNode
.- Returns:
- the parent JcrItemModel
-
load
protected T load()
- Specified by:
load
in classorg.apache.wicket.model.LoadableDetachableModel<T extends javax.jcr.Item>
-
loadModel
protected T loadModel()
-
detach
public void detach()
-
toString
public String toString()
- Overrides:
toString
in classorg.apache.wicket.model.LoadableDetachableModel<T extends javax.jcr.Item>
-
-