@Deprecated
public interface DLOpenerGoogleDriveManager
FileEntry
.
When a file entry is linked to a Google Drive file, both represent the same
contents. The file entry keeps some state regarding its linked Google Drive
file. The methods in this interface automatically perform this linking and
unlinking. The links are represented by DLOpenerGoogleDriveFileReference
.
Modifier and Type | Method and Description |
---|---|
DLOpenerGoogleDriveFileReference |
checkOut(long userId,
com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
Deprecated.
Creates a new file in Google Drive with the same content as a file entry,
and returns a reference to that Google Drive file.
|
DLOpenerGoogleDriveFileReference |
create(long userId,
com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
Deprecated.
Creates a new empty Google Drive file that is linked to a file entry, and
returns a reference to that Google Drive file.
|
void |
delete(long userId,
com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
Deprecated.
Deletes the Google Drive file linked to a file entry.
|
java.lang.String |
getAuthorizationURL(long companyId,
java.lang.String state,
java.lang.String redirectUri)
Deprecated.
Returns the Google Drive authorization URL for use with OAuth 2.
|
boolean |
hasValidCredential(long companyId,
long userId)
Deprecated.
Returns
true if the user has a valid credential. |
boolean |
isConfigured(long companyId)
Deprecated.
Returns
true if the Google Drive connection is configured. |
boolean |
isGoogleDriveFile(com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
Deprecated.
Returns
true if a file entry is linked to a Google Drive file. |
void |
requestAuthorizationToken(long companyId,
long userId,
java.lang.String code,
java.lang.String redirectUri)
Deprecated.
Requests an authorization token.
|
DLOpenerGoogleDriveFileReference |
requestEditAccess(long userId,
com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
Deprecated.
Requests Google Drive permissions to edit a file entry.
|
default void |
setAuthorizationToken(long companyId,
long userId,
java.lang.String authorizationToken)
Deprecated.
Sets an authorization token.
|
DLOpenerGoogleDriveFileReference checkOut(long userId, com.liferay.portal.kernel.repository.model.FileEntry fileEntry) throws com.liferay.portal.kernel.exception.PortalException
Note that this method does not check out the file entry in the portal. To
do so, see com.liferay.document.library.kernel.service.DLAppService#checkOutFileEntry(
long, ServiceContext)
.
userId
- the primary key of the user performing the operationfileEntry
- the file entrycom.liferay.portal.kernel.exception.PortalException
- if an error occurs while performing the operationDLOpenerGoogleDriveFileReference create(long userId, com.liferay.portal.kernel.repository.model.FileEntry fileEntry) throws com.liferay.portal.kernel.exception.PortalException
This operation is similar to checkOut(long, FileEntry)
, but
doesn't copy the file entry's content to Google Drive. When you know the
file entry is empty (e.g., you're creating a new one), this operation is
much more efficient than checkOut(long, FileEntry)
.
userId
- the primary key of the user performing the operationfileEntry
- the file entrycom.liferay.portal.kernel.exception.PortalException
void delete(long userId, com.liferay.portal.kernel.repository.model.FileEntry fileEntry) throws com.liferay.portal.kernel.exception.PortalException
userId
- the primary key of the user performing the operationfileEntry
- the file entrycom.liferay.portal.kernel.exception.PortalException
- if a portal exception occurredjava.lang.String getAuthorizationURL(long companyId, java.lang.String state, java.lang.String redirectUri) throws com.liferay.portal.kernel.exception.PortalException
companyId
- the ID of the companystate
- the user interaction's current stateredirectUri
- the URL to redirect to when authorization completescom.liferay.portal.kernel.exception.PortalException
boolean hasValidCredential(long companyId, long userId) throws java.io.IOException, com.liferay.portal.kernel.exception.PortalException
true
if the user has a valid credential. The credential
is stored as part of the OAuth 2 authorization flow.companyId
- userId
- the primary key of the usertrue
if the user has a valid credential; false
otherwisejava.io.IOException
- if an error occurs while checking for the credentialcom.liferay.portal.kernel.exception.PortalException
boolean isConfigured(long companyId)
true
if the Google Drive connection is configured. If
this method returns false
, the rest of the method's behavior is
undefined.companyId
- the ID of the companytrue
if the Google Drive connection is configured; false
otherwiseboolean isGoogleDriveFile(com.liferay.portal.kernel.repository.model.FileEntry fileEntry)
true
if a file entry is linked to a Google Drive file.fileEntry
- the file entrytrue
if the file entry is linked to a Google Drive file;
false
otherwisevoid requestAuthorizationToken(long companyId, long userId, java.lang.String code, java.lang.String redirectUri) throws java.io.IOException, com.liferay.portal.kernel.exception.PortalException
companyId
- userId
- the primary key of the user in the OAuth 2 authorization
flowcode
- the code received as part of the OAuth 2 authorization flowredirectUri
- the redirect URIjava.io.IOException
- if an error occurs during the OAuth 2 authorization
flowcom.liferay.portal.kernel.exception.PortalException
DLOpenerGoogleDriveFileReference requestEditAccess(long userId, com.liferay.portal.kernel.repository.model.FileEntry fileEntry) throws com.liferay.portal.kernel.exception.PortalException
For this method to succeed, the user must have completed the OAuth 2
authorization flow and have a valid credential (see hasValidCredential(long, long)
).
userId
- the primary key of the user requesting edit accessfileEntry
- the file entrycom.liferay.portal.kernel.exception.PortalException
- if the user doesn't have permission to edit the
filedefault void setAuthorizationToken(long companyId, long userId, java.lang.String authorizationToken) throws java.io.IOException, com.liferay.portal.kernel.exception.PortalException
companyId
- userId
- the primary key of the user in the OAuth 2 authorization
flowauthorizationToken
- the authorization tokenjava.io.IOException
com.liferay.portal.kernel.exception.PortalException