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(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 Node
getCheckedOutNode()
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)
String
getIdentity()
Obtain the identity, if known at this point, of a document.protected Long
getLongProperty(String relPath)
protected Node
getNode()
Node
getNode(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 Node
getNodeProperty(String relPath)
protected String
getStringProperty(String relPath)
protected String[]
getStringsProperty(String relPath)
boolean
hasNode()
protected 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
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, 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(Node node) throws RepositoryException
Extended classes must honor this constructor!- Parameters:
node
- the backingNode
in the repository that this document instance represents.- Throws:
RepositoryException
-
-
Method Detail
-
getNode
public Node getNode(Session session) throws 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:
RepositoryException
-
getCheckedOutNode
public Node getCheckedOutNode(Session session) throws 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:
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 Node getNode()
-
getCheckedOutNode
protected Node getCheckedOutNode() throws RepositoryException
- Throws:
RepositoryException
-
initialize
protected final void initialize(Node node) throws 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:
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 RepositoryException
- Throws:
RepositoryException
-
setStringProperty
protected void setStringProperty(String relPath, String value) throws RepositoryException
- Throws:
RepositoryException
-
getStringsProperty
protected String[] getStringsProperty(String relPath) throws RepositoryException
- Throws:
RepositoryException
-
setStringsProperty
protected void setStringsProperty(String relPath, String[] values) throws RepositoryException
- Throws:
RepositoryException
-
getNodeProperty
protected Node getNodeProperty(String relPath) throws RepositoryException
- Throws:
RepositoryException
-
setNodeProperty
protected void setNodeProperty(String relPath, Node nodeValue) throws RepositoryException
- Throws:
RepositoryException
-
getDateProperty
protected Date getDateProperty(String relPath) throws RepositoryException
- Throws:
RepositoryException
-
setDateProperty
protected void setDateProperty(String relPath, Date date) throws RepositoryException
- Throws:
RepositoryException
-
getLongProperty
protected Long getLongProperty(String relPath) throws RepositoryException
- Throws:
RepositoryException
-
setLongProperty
protected void setLongProperty(String relPath, Long newValue) throws RepositoryException
- Throws:
RepositoryException
-
getBooleanProperty
protected Boolean getBooleanProperty(String relPath) throws RepositoryException
- Throws:
RepositoryException
-
setBooleanProperty
protected void setBooleanProperty(String relPath, Boolean newValue) throws RepositoryException
- Throws:
RepositoryException
-
-