forked from xwiki-contrib/application-googleapps
-
Notifications
You must be signed in to change notification settings - Fork 7
Java ize2 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
polx
wants to merge
17
commits into
xwikisas:master
Choose a base branch
from
polx:java-ize2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Java ize2 #39
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
861f2b8
Style comments on the PR.
polx 80ac30e
Forgotten to address this request. Thanks for the reminder.
polx 38eeefa
Readability comments from @acotiuga and @mflorea. Thanks.
polx a5a6938
Introducing GoogleAppsException and thus removing the API-level depen…
polx 0f0139b
Changing package to com.xwiki.googleapps.
polx cc89974
Moved a few components to the internal package (and making their role…
polx bda0e8e
Code-style automatic adjustments with correct (XWiki) style.
polx 782b36d
Unstability for complete classes.
polx 70368b2
Do use the GoogleAppsListener!
polx 48c0b31
Indenting.
polx 4e44d34
Indenting and normalising spaces.
polx 1927504
Refactoring methods to fetch drive-documents to get rid of gdata and …
polx 8bc27e8
Refactoring for complexity and syntax style.
polx c823813
Comments' fixes: mostly cleaned up code a bit (see https://github.co…
polx 643fb3c
Comments' fixes: do not fix version in the POM and do not make half b…
polx d810949
Removing complex constructors in favor of internal components.
polx 0952fbd
The redirect URL is not OAuth anymore.
polx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,4 +38,6 @@ nbproject | |
| *.log.* | ||
| *.log | ||
| .sonar-ide.properties | ||
| .clover | ||
| .clover | ||
| .DS_Store | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,16 +19,11 @@ | |
| */ | ||
| package com.xwiki.googleapps; | ||
|
|
||
| import java.util.Date; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import org.xwiki.component.annotation.Role; | ||
| import org.xwiki.stability.Unstable; | ||
|
|
||
| import com.google.api.client.auth.oauth2.Credential; | ||
| import com.google.api.services.drive.model.File; | ||
| import com.google.api.services.drive.model.FileList; | ||
| import com.xpn.xwiki.doc.XWikiDocument; | ||
| import com.xpn.xwiki.objects.BaseObject; | ||
|
|
||
|
|
@@ -64,44 +59,16 @@ public interface GoogleAppsManager | |
| @Unstable | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be moved to the interface. |
||
| int getConfigCookiesTTL(); | ||
|
|
||
| /** | ||
| * Finds when the JAR file was assembled by maven. | ||
| * | ||
| * @return the build date. | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| Date getBuildTime(); | ||
|
|
||
| /** | ||
| * Finds the version of the JAR file. | ||
| * | ||
| * @return the build version. | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| String getBuildVersion(); | ||
|
|
||
| /** | ||
| * Inspects the stored information to see if an authorization or a redirect needs to be pronounced. | ||
| * | ||
| * @return found credential | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| Credential authorize() throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Inspects the stored information to see if an authorization or a redirect needs to be pronounced. | ||
| * | ||
| * @param redirect If a redirect can be done | ||
| * @return found credential | ||
| * @return if found a credential | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| Credential authorize(boolean redirect) throws GoogleAppsException; | ||
| boolean authorize(boolean redirect) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Performs the necessary communication with Google-Services to fetch identity and update the XWiki-user object or | ||
|
|
@@ -113,16 +80,6 @@ public interface GoogleAppsManager | |
| @Unstable | ||
| String updateUser(); | ||
|
|
||
| /** | ||
| * Get the list of all documents in the user's associated account. | ||
| * | ||
| * @return A list of max 10 documents. | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| List<File> getDocumentList() throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Fetches a list of Google Drive document matching a substring query in the filename. | ||
| * | ||
|
|
@@ -133,33 +90,21 @@ public interface GoogleAppsManager | |
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| List<File> listDriveDocumentsWithTypes(String query, int nbResults) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Fetches a list of Google Drive document matching a given query. | ||
| * | ||
| * @param query the expected filename substring | ||
| * @param nbResults max number of results | ||
| * @return The list of files at Google Drive. | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| FileList listDocuments(String query, int nbResults) throws GoogleAppsException; | ||
| List<DriveDocMetadata> listDriveDocuments(String query, int nbResults) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Fetches the google-drive document's representation and stores it as attachment. | ||
| * | ||
| * @param page attach to this page | ||
| * @param name attach using this file name | ||
| * @param id store object attached to this attachment using this id (for later sync) | ||
| * @param url fetch from this URL | ||
| * @return true if successful | ||
| * @param page attach to this page | ||
| * @param name attach using this file name | ||
| * @param id store object attached to this attachment using this id (for later sync) | ||
| * @param mediaType content-type of the file to be fetched (or "unknown"; in this case the mediaType is read from | ||
| * Tika. | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| boolean retrieveFileFromGoogle(String page, String name, String id, String url) throws GoogleAppsException; | ||
| void retrieveFileFromGoogle(String page, String name, String id, String mediaType) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Extracts metadata about the Google Drive document corresponding to the named attachment. | ||
|
|
@@ -171,18 +116,8 @@ public interface GoogleAppsManager | |
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| DriveDocMetadata getGoogleDocument(String pageName, String fileName) throws GoogleAppsException; | ||
| DriveDocMetadata getSyncDocMetadata(String pageName, String fileName) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Reads the extension and document name. | ||
| * | ||
| * @param docName the raw docName | ||
| * @param elink the link where to read the extension name | ||
| * @return an array with extension and simplified document name | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| String[] getExportLink(String docName, String elink); | ||
|
|
||
| /** | ||
| * Inserts the current information on the document to be embedded. | ||
|
|
@@ -204,21 +139,10 @@ BaseObject createOrUpdateEmbedObject(String docId, XWikiDocument doc, BaseObject | |
| * | ||
| * @param page the XWiki page name | ||
| * @param name the attachment name | ||
| * @return a record with the keys fileName, exportLink, version, editLink, embedLink, and google-user's | ||
| * email-address | ||
| * @return a metadata about the file | ||
| * @throws GoogleAppsException if a communication problem with the other components occured | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| Map<String, Object> saveAttachmentToGoogle(String page, String name) throws GoogleAppsException; | ||
|
|
||
| /** | ||
| * Reads the google user-info attached to the current user as stored in the request. | ||
| * | ||
| * @return the google user-info with keys displayName, emails (array of type,value pairs), etag, id, image (map with | ||
| * keys isDefault and url), kind, language, name (map with keys familyName and givenName). | ||
| * @since 3.0 | ||
| */ | ||
| @Unstable | ||
| Map<String, Object> getGoogleUser(); | ||
| DriveDocMetadata saveAttachmentToGoogle(String page, String name) throws GoogleAppsException; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.