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 voidconnect(com.google.api.client.auth.oauth2.Credential credential)voidconvertFile(String fileId, File dest)Stringcreate(String fileName)StringcreateFolder(String name)voiddeleteFile(String fileId)voiddownloadFile(String fileId, File dest)static GDriveClientget(long userId)com.google.api.client.auth.oauth2.CredentialgetCredential()com.google.api.services.drive.model.FilegetFile(String fileId)longgetUserId()booleanisConnected()List<com.google.api.services.drive.model.File>search(String expression)StringuploadFile(com.google.api.client.http.AbstractInputStreamContent mediaContent, String fileName, boolean convert)StringuploadFile(File file, String fileName, boolean convert)StringuploadFile(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()
-
-