Package org.hippoecm.repository.api
Class Document
- java.lang.Object
-
- org.hippoecm.repository.api.Document
-
- All Implemented Interfaces:
Serializable
public class Document extends Object implements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description 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(String identity)
Lightweight constructor of a Document only providing a identity.Document(javax.jcr.Node node)
Extended classes must honor this constructor!Document(Document document)
Copy constructor which allows to pass on a lightweight Document using its internal backing Node
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Boolean
getBooleanProperty(String relPath)
protected javax.jcr.Node
getCheckedOutNode()
javax.jcr.Node
getCheckedOutNode(javax.jcr.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)
String
getIdentity()
Obtain the identity, if known at this point, of a document.protected Long
getLongProperty(String relPath)
protected javax.jcr.Node
getNode()
javax.jcr.Node
getNode(javax.jcr.Session session)
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 javax.jcr.Node
getNodeProperty(String relPath)
protected String
getStringProperty(String relPath)
protected String[]
getStringsProperty(String relPath)
boolean
hasNode()
protected void
initialize(javax.jcr.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
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.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, javax.jcr.Node nodeValue)
protected void
setStringProperty(String relPath, String value)
protected void
setStringsProperty(String relPath, String[] values)
String
toString()
-
-
-
Constructor Detail
-
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
public Document(String identity)
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
public Document(Document 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
public Document(javax.jcr.Node node) throws javax.jcr.RepositoryException
Extended classes must honor this constructor!- Parameters:
node
- the backingNode
in the repository that this document instance represents.- Throws:
javax.jcr.RepositoryException
-
-
Method Detail
-
getNode
public javax.jcr.Node getNode(javax.jcr.Session session) throws javax.jcr.RepositoryException
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:
javax.jcr.RepositoryException
-
getCheckedOutNode
public javax.jcr.Node getCheckedOutNode(javax.jcr.Session session) throws javax.jcr.RepositoryException
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:
javax.jcr.RepositoryException
-
hasNode
public boolean hasNode()
- Returns:
- true if this document has a backing Node
-
getIdentity
public final String 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
protected javax.jcr.Node getNode()
-
getCheckedOutNode
protected javax.jcr.Node getCheckedOutNode() throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
initialize
protected final void initialize(javax.jcr.Node node) throws javax.jcr.RepositoryException
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:
javax.jcr.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
protected String getStringProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setStringProperty
protected void setStringProperty(String relPath, String value) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getStringsProperty
protected String[] getStringsProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setStringsProperty
protected void setStringsProperty(String relPath, String[] values) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getNodeProperty
protected javax.jcr.Node getNodeProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setNodeProperty
protected void setNodeProperty(String relPath, javax.jcr.Node nodeValue) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getDateProperty
protected Date getDateProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setDateProperty
protected void setDateProperty(String relPath, Date date) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getLongProperty
protected Long getLongProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setLongProperty
protected void setLongProperty(String relPath, Long newValue) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getBooleanProperty
protected Boolean getBooleanProperty(String relPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setBooleanProperty
protected void setBooleanProperty(String relPath, Boolean newValue) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
-