OKMDocument
From OpenKM Documentation
Revision as of 10:16, 8 March 2010 by Pavila (talk | contribs) (→void setProperties(String token, Document doc))
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.
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.
- ItemNotFoundException - If there is no document in this repository path.
- 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.