Difference between revisions of "GetDocument"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE: | {{DISPLAYTITLE:getDocument}} | ||
Retrieves a document specified by its ID. | |||
;Syntax: | ;Syntax: | ||
:<syntaxhighlight lang="java" enclose="div"> | :<syntaxhighlight lang="java" enclose="div"> | ||
Result result = Functions. | Result result = Functions.getDocument(String documentID); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
;Parameters: | ;Parameters: | ||
: | :'''documentID -''' The ID of a document stored in the platform. | ||
;Returns: | ;Returns: | ||
Line 22: | Line 15: | ||
;Usage: | ;Usage: | ||
:# Use <tt>result.getParameters()</tt> to get the params from the Result object. | :# Use <tt>result.getParameters()</tt> to get the params from the Result object. | ||
:# Call <tt>getPlatformFileBean()<tt> on the params, passing the document ID as a string. | :# Call <tt>getPlatformFileBean()</tt> on the params, passing the document ID as a string. | ||
:# If needed, call <tt>getBytes()</tt> on the PlatformFileBean to get document content in a byte array. | :# If needed, call <tt>getBytes()</tt> on the PlatformFileBean to get document content in a byte array. | ||
;Example:This example logs the size and name associated with a document. | ;Example:This example logs the size and name associated with a document. | ||
:<syntaxhighlight lang="java" enclose="div"> | :<syntaxhighlight lang="java" enclose="div"> | ||
Result result = getDocument(documentId); | Result result = Functions.getDocument(documentId); | ||
Parameters params = result.getParameters(); | Parameters params = result.getParameters(); | ||
PlatformFileBean file = params.getPlatformFileBean(documentId); | PlatformFileBean file = params.getPlatformFileBean(documentId); |
Latest revision as of 00:37, 17 January 2014
Retrieves a document specified by its ID.
- Syntax
- <syntaxhighlight lang="java" enclose="div">
Result result = Functions.getDocument(String documentID); </syntaxhighlight>
- Parameters
- documentID - The ID of a document stored in the platform.
- Returns
- Result object that contains the document in the form of a PlatformFileBean.
- Usage
-
- Use result.getParameters() to get the params from the Result object.
- Call getPlatformFileBean() on the params, passing the document ID as a string.
- If needed, call getBytes() on the PlatformFileBean to get document content in a byte array.
- Example
- This example logs the size and name associated with a document.
- <syntaxhighlight lang="java" enclose="div">
Result result = Functions.getDocument(documentId); Parameters params = result.getParameters(); PlatformFileBean file = params.getPlatformFileBean(documentId); byte[] bytes = file.getBytes(); String msg = "Name:"+file.getName()+", size:"+file.getEncodedFileContent().length(); Logger.info(msg, "Document"); </syntaxhighlight>