Package org.hippoecm.repository.api
Class Document
java.lang.Object
org.hippoecm.repository.api.Document
- All Implemented Interfaces:
Serializable
A Plain Old Java Object (POJO) representing a document in a JCR repository.
Instances of this object can be returned by workflow calls to indicate to the callee which document has been created or otherwise affected.
- See Also:
-
Constructor Summary
ConstructorDescriptionDocument()
Constructor that should be considered to have a protected signature rather than public and may be used for extending classes to create a new Document.Lightweight constructor of a Document only providing a identity.Extended classes must honor this constructor!Copy constructor which allows to pass on a lightweight Document using its internal backing Node -
Method Summary
Modifier and TypeMethodDescriptionprotected Boolean
getBooleanProperty
(String relPath) protected Node
getCheckedOutNode
(Session session) Returns the ensured to be checked out backing Node of this Document, either directly if available and already tied to the provided Session or else retrieved from the provided Session based on itsgetIdentity()
.protected Date
getDateProperty
(String relPath) final String
Obtain the identity, if known at this point, of a document.protected Long
getLongProperty
(String relPath) protected Node
getNode()
Returns the backing Node of this Document, either directly if available and already tied to the provided Session or else retrieved from the provided Session based on itsgetIdentity()
.protected Node
getNodeProperty
(String relPath) protected String
getStringProperty
(String relPath) protected String[]
getStringsProperty
(String relPath) boolean
hasNode()
protected final void
initialize
(Node node) Extended classes which need custom/extra initialization based on the backing Node should use theinitialized()
method to get wired into the initialization chain.protected void
Extended classes which need custom/extra initialization based on the backing Node can use this method which will get called afterinitialize(javax.jcr.Node)
has been called.protected void
setBooleanProperty
(String relPath, Boolean newValue) protected void
setDateProperty
(String relPath, Date date) protected void
setLongProperty
(String relPath, Long newValue) protected void
setNodeProperty
(String relPath, Node nodeValue) protected void
setStringProperty
(String relPath, String value) protected void
setStringsProperty
(String relPath, String[] values) toString()
-
Constructor Details
-
Document
public Document()Constructor that should be considered to have a protected signature rather than public and may be used for extending classes to create a new Document. -
Document
Lightweight constructor of a Document only providing a identity.- Parameters:
identity
- the identifier of a backingNode
in the repository that this document instance represents.
-
Document
Copy constructor which allows to pass on a lightweight Document using its internal backing Node- Parameters:
document
- source document to copy the identity and possible the internal backing Node from
-
Document
Extended classes must honor this constructor!- Parameters:
node
- the backingNode
in the repository that this document instance represents.- Throws:
RepositoryException
-
-
Method Details
-
getNode
Returns the backing Node of this Document, either directly if available and already tied to the provided Session or else retrieved from the provided Session based on itsgetIdentity()
.- Parameters:
session
- The session for which to return the backing Node- Returns:
- the backing Node of this Document or null if this Document doesn't contain a identity
- Throws:
RepositoryException
-
getCheckedOutNode
Returns the ensured to be checked out backing Node of this Document, either directly if available and already tied to the provided Session or else retrieved from the provided Session based on itsgetIdentity()
.- Parameters:
session
- The session for which to return the backing Node- Returns:
- the ensured to be checked out backing Node of this Document or null if this Document doesn't contain a identity
- Throws:
RepositoryException
-
hasNode
public boolean hasNode()- Returns:
- true if this document has a backing Node
-
getIdentity
Obtain the identity, if known at this point, of a document. The identity of a Document is the identity of the primaryNode
used in persisting the data of the document. A Document returned for example by a workflow step can be accessed using:Node node = session.getNodeByIdentifier(document.getIdentity());
or even easier and possibly more efficient:Node node = document.getNode(session);
- Returns:
- a string containing the UUID of the Node representing the Document.
or
null
if not available.
-
getNode
-
getCheckedOutNode
- Throws:
RepositoryException
-
initialize
Extended classes which need custom/extra initialization based on the backing Node should use theinitialized()
method to get wired into the initialization chain.- Parameters:
node
- the backingNode
in the repository that this document instance represents.- Throws:
RepositoryException
-
initialized
protected void initialized()Extended classes which need custom/extra initialization based on the backing Node can use this method which will get called afterinitialize(javax.jcr.Node)
has been called. -
getStringProperty
- Throws:
RepositoryException
-
setStringProperty
- Throws:
RepositoryException
-
getStringsProperty
- Throws:
RepositoryException
-
setStringsProperty
- Throws:
RepositoryException
-
getNodeProperty
- Throws:
RepositoryException
-
setNodeProperty
- Throws:
RepositoryException
-
getDateProperty
- Throws:
RepositoryException
-
setDateProperty
- Throws:
RepositoryException
-
getLongProperty
- Throws:
RepositoryException
-
setLongProperty
- Throws:
RepositoryException
-
getBooleanProperty
- Throws:
RepositoryException
-
setBooleanProperty
- Throws:
RepositoryException
-
toString
-