Difference between revisions of "OKMDocument"
(→byte[] getContentByVersion(String token, String docPath, String versionId)) |
(→Version checkin(String token, String docPath, String comment)) |
||
Line 185: | Line 185: | ||
* ''PathNotFoundException'' - If there is no document in this repository path. | * ''PathNotFoundException'' - If there is no document in this repository path. | ||
* ''AccessDeniedException'' - If there is any security problem: you can't modify the document because of lack of permissions. | * ''AccessDeniedException'' - If there is any security problem: you can't modify the document because of lack of permissions. | ||
+ | * ''RepositoryException'' - If there is any general repository problem. | ||
+ | |||
+ | == VersionArray getVersionHistory(String token, String docPath) == | ||
+ | Get the document version history. | ||
+ | |||
+ | '''Parameters''' | ||
+ | * ''token'' - The session authorization token. | ||
+ | * ''docPath'' - The path that identifies an unique document. | ||
+ | |||
+ | '''Returns''' | ||
+ | * A Collection of Versions with every document version. | ||
+ | |||
+ | '''Throws''' | ||
+ | * ''PathNotFoundException'' - If there is no document in this repository path. | ||
* ''RepositoryException'' - If there is any general repository problem. | * ''RepositoryException'' - If there is any general repository problem. | ||
Revision as of 10:26, 8 March 2010
Methods related to document management.
Document create(String token, Document doc, byte[] content)
Create a new document in the repository.
Parameters
- token - The session authorization token.
- doc - A document object with the new document properties.
- content - The document content in bytes.
Returns
- A document object with the properties of the new created document.
Throws
- IOException - An error when inserting document data into the repository.
- UnsupportedMimeTypeException - If the uploaded file has an unsupported MIME type.
- FileSizeExceededException - If the document content is biggest than the maximum accepted.
- VirusDetectedException - If the document is infected by a virus.
- PathNotFoundException - If the parent folder doesn't exist.
- ItemExistsException - If there is already a document in the repository with the same name.
- AccessDeniedException - If there is any security problem: you can't modify the parent document folder because of lack of permissions.
- RepositoryException - If there is any general repository problem.
void delete(String token, String docId)
Removes a document from the repository and move it to the user trash.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- none
Throws
- LockException - Can't delete a locked document.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
Document rename(String token, String docPath, String newName)
Rename a document in the repository.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
- newName - The new document name.
Returns
- A document object with the new document properties.
Throws
- PathNotFoundException - If there is no document in this repository path.
- ItemExistsException - If there is already a document in the repository with the same name in the same path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
Document getProperties(String token, String docPath)
Obtain document properties from the repository.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- The document properties.
Throws
- PathNotFoundException - If there is no document in this repository path.
- RepositoryException - If there is any general repository problem.
void setProperties(String token, Document doc)
Set the properties of a repository document.
Parameters
- token - The session authorization token.
- doc - An document object with the properties.
Returns
- none
Throws
- LockException - A locked document can't be modified.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
void setContent(String token, String docPath, byte[] content)
Set document content in the repository.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
- content - The new document content.
Returns
- none
Throws
- IOException - If there is any error setting the new content.
- VersionException - A document checked in can't be modified.
- LockException - A locked document can't be modified.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
byte[] getContent(String token, String docPath, boolean checkout)
Obtain document content from the repository.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
- checkout - If the content is retrieved after a check-out or not.
Returns
- none
Throws
- IOException - An error when retrieving document data from the repository.
- PathNotFoundException - If there is no document in this repository path.
- RepositoryException - If there is any general repository problem.
byte[] getContentByVersion(String token, String docPath, String versionId)
Obtain document content from the repository.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
- versionId - The version identification associated to the document content.
Returns
- none
Throws
- IOException - An error when retrieving document data from the repository.
- PathNotFoundException - If there is no document in this repository path.
- RepositoryException - If there is any general repository problem.
void checkout(String token, String docPath)
Checkout the document to edit it. The document can't be edited by another user until it is checked in o the checkout is cancelled.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- A Collection with the child documents.
Throws
- LockException - A locked document can't be modified.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
void cancelCheckout(String token, String docPath)
Cancel a previous checked out state in a document.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- A Collection with the child documents.
Throws
- LockException - A locked document can't be modified.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
Version checkin(String token, String docPath, String comment)
Check in the document to create a new version.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- A version object with the properties of the new generated version.
Throws
- LockException - A locked document can't be modified.
- VersionException - If the nodes was not previously checked out.
- PathNotFoundException - If there is no document in this repository path.
- AccessDeniedException - If there is any security problem: you can't modify the document because of lack of permissions.
- RepositoryException - If there is any general repository problem.
VersionArray getVersionHistory(String token, String docPath)
Get the document version history.
Parameters
- token - The session authorization token.
- docPath - The path that identifies an unique document.
Returns
- A Collection of Versions with every document version.
Throws
- PathNotFoundException - If there is no document in this repository path.
- RepositoryException - If there is any general repository problem.
DocumentArray getChilds(String token, String fldId)
Retrieve a list of child documents from an existing folder.
Parameters
- token - The session authorization token.
- fldPath - The path that identifies an unique folder.
Returns
- A Collection with the child documents.
Throws
- PathNotFoundException - If there is no document in this repository path.
- RepositoryException If there is any general repository problem.