Package com.logicaldoc.gdrive
Class GDriveClient
- java.lang.Object
-
- com.logicaldoc.gdrive.GDriveClient
-
public class GDriveClient extends Object
Facade for Google Drive. To handle the API: https://console.developers.google.com- Since:
- 7.3
- Author:
- Marco Meschieri - LogicalDOC
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(com.google.api.client.auth.oauth2.Credential credential)
void
convertFile(String fileId, File dest)
String
create(String fileName)
String
createFolder(String name)
void
deleteFile(String fileId)
void
downloadFile(String fileId, File dest)
static GDriveClient
get(long userId)
com.google.api.client.auth.oauth2.Credential
getCredential()
com.google.api.services.drive.model.File
getFile(String fileId)
long
getUserId()
boolean
isConnected()
List<com.google.api.services.drive.model.File>
search(String expression)
String
uploadFile(com.google.api.client.http.AbstractInputStreamContent mediaContent, String fileName, boolean convert)
String
uploadFile(File file, String fileName, boolean convert)
String
uploadFile(InputStream is, String fileName, boolean convert)
-
-
-
Method Detail
-
get
public static GDriveClient get(long userId) throws Exception
- Throws:
Exception
-
isConnected
public boolean isConnected()
-
getFile
public com.google.api.services.drive.model.File getFile(String fileId) throws IOException
- Throws:
IOException
-
uploadFile
public String uploadFile(InputStream is, String fileName, boolean convert) throws IOException
- Throws:
IOException
-
uploadFile
public String uploadFile(File file, String fileName, boolean convert) throws IOException
- Throws:
IOException
-
uploadFile
public String uploadFile(com.google.api.client.http.AbstractInputStreamContent mediaContent, String fileName, boolean convert) throws IOException
- Throws:
IOException
-
create
public String create(String fileName) throws IOException
- Throws:
IOException
-
createFolder
public String createFolder(String name) throws IOException
- Throws:
IOException
-
downloadFile
public void downloadFile(String fileId, File dest) throws IOException
- Throws:
IOException
-
convertFile
public void convertFile(String fileId, File dest) throws IOException
- Throws:
IOException
-
deleteFile
public void deleteFile(String fileId) throws IOException
- Throws:
IOException
-
search
public List<com.google.api.services.drive.model.File> search(String expression) throws IOException
- Throws:
IOException
-
getCredential
public com.google.api.client.auth.oauth2.Credential getCredential()
-
connect
public void connect(com.google.api.client.auth.oauth2.Credential credential)
-
getUserId
public long getUserId()
-
-