Difference between revisions of "OKMDocument"

From OpenKM Documentation
Jump to: navigation, search
(void setProperties(String token, Document doc))
(void setProperties(String token, Document doc))
Line 87: Line 87:
 
* ''RepositoryException'' - If there is any general repository problem.
 
* ''RepositoryException'' - If there is any general repository problem.
  
===== byte[] getContent(String token, String docPath, boolean checkout) =====
+
== 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.
 
Obtain document content from the repository.
  
Line 100: Line 119:
 
'''Throws'''
 
'''Throws'''
 
* ''IOException'' - An error when retrieving document data  from the repository.  
 
* ''IOException'' - An error when retrieving document data  from the repository.  
* ''ItemNotFoundException'' - If there is no document in this repository path.
+
* ''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.
  
===== void setContent(String token, String docPath, byte[] content) =====
+
== byte[] getContentByVersion(String token, String docPath, String versionId) ==
Set document content in the repository.
+
Obtain document content from the repository.
  
 
'''Parameters'''
 
'''Parameters'''
 
* ''token'' - The session authorization token.
 
* ''token'' - The session authorization token.
 
* ''docPath'' - The path that identifies an unique document.
 
* ''docPath'' - The path that identifies an unique document.
* ''content'' - The new document content.
+
* ''versionId'' - The version identification associated to the document content.
  
 
'''Returns'''
 
'''Returns'''
Line 115: Line 134:
  
 
'''Throws'''
 
'''Throws'''
* ''IOException'' - If there is any error setting the new content.
+
* ''IOException'' - An error when retrieving document data  from the repository.  
* ''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.
 
* ''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.
 
* ''RepositoryException'' - If there is any general repository problem.
 
  
 
[[Category: Webservices Guide]]
 
[[Category: Webservices Guide]]

Revision as of 11:18, 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.