Package com.logicaldoc.zoho
Class ZohoClient
- java.lang.Object
 - 
- com.logicaldoc.zoho.ZohoClient
 
 
- 
public class ZohoClient extends Object
Facade for Zoho Docs.- Since:
 - 8.7
 - Author:
 - Marco Meschieri - LogicalDOC
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringCALLBACK_PATHCallback URI that Zoho will redirect to after successful authentication 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbuildAuthorizationUrl()com.logicaldoc.util.Pair<String,String>createDocument(String folderId, String filename)Creates a new document in Zoho.com.logicaldoc.util.Pair<String,String>createFolder(String parentId, String name)voiddelete(String docId)voiddownload(String docId, File out)static ZohoClientget(long userId)StringgetAccessToken()StringgetClientId()StringgetClientSecret()com.logicaldoc.util.Pair<String,String>getDocument(String docId)Gets the details of a document stored in ZoholonggetUserId()List<com.logicaldoc.util.Pair<String,String>>listFiles(String folderId)Lists the files inside a given folderList<com.logicaldoc.util.Pair<String,String>>listFolders(String parentId)voidloadSettings()StringobtainAccessToken(String grantCode)voidsaveSettings()voidsetClientId(String clientId)voidsetClientSecret(String clientSecret)com.logicaldoc.util.Pair<String,String>upload(String filename, File file, String folderId)Upload an existing file to the Zohocom.logicaldoc.util.Pair<String,String>upload(String filename, InputStream content, String folderId)Upload an existing file to the Zoho 
 - 
 
- 
- 
Field Detail
- 
CALLBACK_PATH
public static final String CALLBACK_PATH
Callback URI that Zoho will redirect to after successful authentication- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
get
public static ZohoClient get(long userId) throws ZohoException
- Throws:
 ZohoException
 
- 
saveSettings
public void saveSettings() throws ZohoException- Throws:
 ZohoException
 
- 
loadSettings
public void loadSettings() throws ZohoException- Throws:
 ZohoException
 
- 
buildAuthorizationUrl
public String buildAuthorizationUrl() throws ZohoException
- Throws:
 ZohoException
 
- 
obtainAccessToken
public String obtainAccessToken(String grantCode) throws ZohoException
- Throws:
 ZohoException
 
- 
listFiles
public List<com.logicaldoc.util.Pair<String,String>> listFiles(String folderId) throws ZohoException
Lists the files inside a given folder- Parameters:
 folderId- identifier of the folder or null for the root- Returns:
 - List of pairs docId-fileName
 - Throws:
 ZohoException- A generic exception communicating with Zoho
 
- 
listFolders
public List<com.logicaldoc.util.Pair<String,String>> listFolders(String parentId) throws ZohoException
- Throws:
 ZohoException
 
- 
createFolder
public com.logicaldoc.util.Pair<String,String> createFolder(String parentId, String name) throws ZohoException
- Throws:
 ZohoException
 
- 
delete
public void delete(String docId) throws ZohoException
- Throws:
 ZohoException
 
- 
createDocument
public com.logicaldoc.util.Pair<String,String> createDocument(String folderId, String filename) throws ZohoException
Creates a new document in Zoho.- Parameters:
 filename- The file namefolderId- The parent folder ID- Returns:
 - the ID of the new document and the URL to open
 - Throws:
 ZohoException- error in the Zoho server
 
- 
download
public void download(String docId, File out) throws ZohoException
- Throws:
 ZohoException
 
- 
upload
public com.logicaldoc.util.Pair<String,String> upload(String filename, File file, String folderId) throws ZohoException
Upload an existing file to the Zoho- Parameters:
 filename- name of the file to uploadfile- the file to uploadfolderId- identifier of the target folder- Returns:
 - a pair document ID - document name
 - Throws:
 ZohoException- An error communicating with Zoho
 
- 
upload
public com.logicaldoc.util.Pair<String,String> upload(String filename, InputStream content, String folderId) throws ZohoException
Upload an existing file to the Zoho- Parameters:
 filename- name of the file to uploadcontent- the file's contentfolderId- identifier of the target folder- Returns:
 - a pair document ID - document name
 - Throws:
 ZohoException- An error communicating with Zoho
 
- 
getDocument
public com.logicaldoc.util.Pair<String,String> getDocument(String docId) throws ZohoException
Gets the details of a document stored in Zoho- Parameters:
 docId- identifier of the document in Zoho- Returns:
 - a pair document ID - document name
 - Throws:
 ZohoException- An error communicating with Zoho
 
- 
getUserId
public long getUserId()
 
- 
getClientId
public String getClientId()
 
- 
setClientId
public void setClientId(String clientId)
 
- 
getClientSecret
public String getClientSecret()
 
- 
setClientSecret
public void setClientSecret(String clientSecret)
 
- 
getAccessToken
public String getAccessToken()
 
 - 
 
 -