-
Notifications
You must be signed in to change notification settings - Fork 3
story/VSPC-189 #364
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
Girik1105
wants to merge
32
commits into
develop
Choose a base branch
from
story/VSPC-189
base: develop
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
story/VSPC-189 #364
Changes from 23 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
91b6b70
VSPC-189 added citeshpere connection
ajay3568yadav b33d13c
VSPC-189 manager class fix
ajay3568yadav 8c6002b
VSPC-189 added mapping
ajay3568yadav 79b105b
VSPC-189 moved citesphere option to references
ajay3568yadav 4c3b30e
VSPC-189 edit slide
ajay3568yadav 2d855d3
VSPC-189 editing the reference blocks
ajay3568yadav 5e63907
VSPC-189 filed selection fix
ajay3568yadav 179306f
VSPC-189 citesphere manager
ajay3568yadav 07c444e
VSPC-189 citation manager fixes
ajay3568yadav 5e26a16
[VSPC-189] created citesphere controller to handle calls to citesphere
Girik1105 e8fca0a
[VSPC-189] Added auoth flow to connect with citesphere
Girik1105 6194bba
[VSPC-189] Added debug print, fixed endpoints, added implmentation in…
Girik1105 6478a4a
[VSPC-189] Fixed oauth flow and citesphere controller
Girik1105 fe55e98
[VSPC-189] shows connection status to frontend
Girik1105 fb8a44b
[VSPC-189] Groups now show after connecting to citesphere - need to f…
Girik1105 2e2989d
[VSPC-189] Groups to collections to item workflow for references impo…
Girik1105 e79aeb5
[VSPC-189] Successfully implemented reference import from citesphere …
Girik1105 c0ce36c
[VSPC-189] Removed debug comments, debug logs, cleaneed code
Girik1105 1a645b5
[VSPC-189] Citesphere config update
Girik1105 ff11d73
[VSPC-189] revert config properties to orignal
Girik1105 cdcc35d
[VSPC-189] code cleanup
Girik1105 c5575fe
[VSPC-189] added comments that were removed unintentionally
Girik1105 f930bff
[VSPC-189] Resolved Merged Conflicts
Girik1105 87f6289
[VSPC-189] Removed basic auth support, auth validation and header cre…
Girik1105 925a953
[VSPC-189] refactored duplicate error handling method, added http sta…
Girik1105 e09516f
[VSPC-189] PR comments
Girik1105 29a6162
[VSPC-189] Fixed endpoints
Girik1105 e6df999
[VSPC-189] Fixed multiple
Girik1105 49a6ece
[VSPC-189] Restored gitignore
Girik1105 8abe14b
[VSPC-189] Fixed correct gitignore
Girik1105 979fe6f
[VSPC-189] fixed gitignore and classpath final
Girik1105 c126f6f
[VSPC-189] Removed all debug comments, improved comments
Girik1105 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 |
|---|---|---|
|
|
@@ -2,6 +2,3 @@ | |
| vspace/.factorypath | ||
| vspace/.project | ||
| vspace/.classpath | ||
| /target/ | ||
| .settings/ | ||
| **/.settings/ | ||
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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
| <attributes> | ||
| <attribute name="optional" value="true"/> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| <attribute name="test" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
| <attributes> | ||
| <attribute name="test" value="true"/> | ||
| <attribute name="optional" value="true"/> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
| <attributes> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
| <attributes> | ||
| <attribute name="optional" value="true"/> | ||
| <attribute name="test" value="true"/> | ||
| <attribute name="maven.pomderived" value="true"/> | ||
| <attribute name="ignore_optional_problems" value="true"/> | ||
| <attribute name="m2e-apt" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="src" path="target/generated-sources/annotations"> | ||
| <attributes> | ||
| <attribute name="optional" value="true"/> | ||
| </attributes> | ||
| </classpathentry> | ||
| <classpathentry kind="output" path="target/classes"/> | ||
| </classpath> |
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
43 changes: 43 additions & 0 deletions
43
vspace/src/main/java/edu/asu/diging/vspace/core/exception/CitesphereTokenException.java
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 |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package edu.asu.diging.vspace.core.exception; | ||
|
|
||
| /** | ||
| * Exception thrown when there are issues with Citesphere authentication tokens | ||
| */ | ||
| public class CitesphereTokenException extends Exception { | ||
|
|
||
| private static final long serialVersionUID = 1L; | ||
| private final int statusCode; | ||
| private final boolean isTokenExpired; | ||
|
|
||
| public CitesphereTokenException(String message) { | ||
| super(message); | ||
| this.statusCode = 0; | ||
| this.isTokenExpired = false; | ||
| } | ||
|
|
||
| public CitesphereTokenException(String message, int statusCode) { | ||
| super(message); | ||
| this.statusCode = statusCode; | ||
| this.isTokenExpired = (statusCode == 401 || statusCode == 403); | ||
| } | ||
|
|
||
| public CitesphereTokenException(String message, Throwable cause) { | ||
| super(message, cause); | ||
| this.statusCode = 0; | ||
| this.isTokenExpired = false; | ||
| } | ||
|
|
||
| public CitesphereTokenException(String message, int statusCode, boolean isTokenExpired) { | ||
| super(message); | ||
| this.statusCode = statusCode; | ||
| this.isTokenExpired = isTokenExpired; | ||
| } | ||
|
|
||
| public int getStatusCode() { | ||
| return statusCode; | ||
| } | ||
|
|
||
| public boolean isTokenExpired() { | ||
| return isTokenExpired; | ||
| } | ||
| } |
115 changes: 115 additions & 0 deletions
115
vspace/src/main/java/edu/asu/diging/vspace/core/services/CitesphereAuthToken.java
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 |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| package edu.asu.diging.vspace.core.services; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Authentication token object for Citesphere API | ||
| */ | ||
| public class CitesphereAuthToken { | ||
|
|
||
| private String authType; | ||
| private Map<String, String> headers; | ||
| private String accessToken; | ||
| private String refreshToken; | ||
| private String username; | ||
| private String password; | ||
|
Member
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. there should be no password needed here. |
||
| private long tokenExpiryTime; | ||
|
|
||
| /** | ||
| * Constructor for OAuth authentication | ||
| * @param accessToken OAuth access token | ||
| */ | ||
| public CitesphereAuthToken(String accessToken) { | ||
| this.authType = "oauth"; | ||
| this.accessToken = accessToken; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor for OAuth authentication with refresh token | ||
| * @param accessToken OAuth access token | ||
| * @param refreshToken OAuth refresh token | ||
| * @param expiryTime Token expiry time in milliseconds | ||
| */ | ||
| public CitesphereAuthToken(String accessToken, String refreshToken, long expiryTime) { | ||
| this.authType = "oauth"; | ||
| this.accessToken = accessToken; | ||
| this.refreshToken = refreshToken; | ||
| this.tokenExpiryTime = expiryTime; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor for Basic authentication | ||
| * @param username Username | ||
| * @param password Password | ||
| */ | ||
| public CitesphereAuthToken(String username, String password) { | ||
| this.authType = "basic"; | ||
| this.username = username; | ||
| this.password = password; | ||
| } | ||
|
|
||
| // Getters and setters | ||
| public String getAuthType() { | ||
| return authType; | ||
| } | ||
|
|
||
| public void setAuthType(String authType) { | ||
| this.authType = authType; | ||
| } | ||
|
|
||
| public Map<String, String> getHeaders() { | ||
| return headers; | ||
| } | ||
|
|
||
| public void setHeaders(Map<String, String> headers) { | ||
| this.headers = headers; | ||
| } | ||
|
|
||
| public String getAccessToken() { | ||
| return accessToken; | ||
| } | ||
|
|
||
| public void setAccessToken(String accessToken) { | ||
| this.accessToken = accessToken; | ||
| } | ||
|
|
||
| public String getUsername() { | ||
| return username; | ||
| } | ||
|
|
||
| public void setUsername(String username) { | ||
| this.username = username; | ||
| } | ||
|
|
||
| public String getPassword() { | ||
| return password; | ||
| } | ||
|
|
||
| public void setPassword(String password) { | ||
| this.password = password; | ||
| } | ||
|
|
||
| public String getRefreshToken() { | ||
| return refreshToken; | ||
| } | ||
|
|
||
| public void setRefreshToken(String refreshToken) { | ||
| this.refreshToken = refreshToken; | ||
| } | ||
|
|
||
| public long getTokenExpiryTime() { | ||
| return tokenExpiryTime; | ||
| } | ||
|
|
||
| public void setTokenExpiryTime(long tokenExpiryTime) { | ||
| this.tokenExpiryTime = tokenExpiryTime; | ||
| } | ||
|
|
||
| /** | ||
| * Check if the access token is expired | ||
| * @return true if token is expired, false otherwise | ||
| */ | ||
| public boolean isTokenExpired() { | ||
| return tokenExpiryTime > 0 && System.currentTimeMillis() > tokenExpiryTime; | ||
| } | ||
| } | ||
118 changes: 118 additions & 0 deletions
118
vspace/src/main/java/edu/asu/diging/vspace/core/services/ICitesphereManager.java
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 |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| package edu.asu.diging.vspace.core.services; | ||
|
|
||
| import java.util.Map; | ||
| import edu.asu.diging.vspace.core.exception.CitesphereTokenException; | ||
|
|
||
| /** | ||
| * Service interface for Citesphere API operations | ||
| */ | ||
| public interface ICitesphereManager { | ||
|
|
||
| /** | ||
| * Get user information | ||
| * @return User data as Map | ||
| */ | ||
| Map<String, Object> getUser(); | ||
|
|
||
| /** | ||
| * Check test endpoint | ||
| * @return Test response as Map | ||
| */ | ||
| Map<String, Object> checkTest(); | ||
|
|
||
| /** | ||
| * Check access for a document | ||
| * @param documentId Document ID to check access for | ||
| * @return Access check response as Map | ||
| */ | ||
| Map<String, Object> checkAccess(String documentId); | ||
|
|
||
| /** | ||
| * Get data by endpoint | ||
| * @param endpoint API endpoint path | ||
| * @return Data response as Map | ||
| */ | ||
| Map<String, Object> getDataByEndpoint(String endpoint); | ||
|
|
||
| /** | ||
| * Get all groups | ||
| * @return Groups data as Map | ||
| */ | ||
| Map<String, Object> getGroups(); | ||
|
|
||
| /** | ||
| * Get group information | ||
| * @param groupId Group ID | ||
| * @return Group information as Map | ||
| */ | ||
| Map<String, Object> getGroupInfo(String groupId); | ||
|
|
||
| /** | ||
| * Get group items | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @return Group items as Map | ||
| */ | ||
| Map<String, Object> getGroupItems(String zoteroGroupId); | ||
|
|
||
| /** | ||
| * Get collections | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @return Collections as Map | ||
| */ | ||
| Map<String, Object> getCollections(String zoteroGroupId); | ||
|
|
||
| /** | ||
| * Get collection items | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @param collectionId Collection ID | ||
| * @param pageNumber Page number (optional, defaults to 0) | ||
| * @return Collection items as Map | ||
| */ | ||
| Map<String, Object> getCollectionItems(String zoteroGroupId, String collectionId, int pageNumber); | ||
|
|
||
| /** | ||
| * Get collection items (overloaded method without page number) | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @param collectionId Collection ID | ||
| * @return Collection items as Map | ||
| */ | ||
| Map<String, Object> getCollectionItems(String zoteroGroupId, String collectionId); | ||
|
|
||
| /** | ||
| * Get item information | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @param itemId Item ID | ||
| * @return Item information as Map | ||
| */ | ||
| Map<String, Object> getItemInfo(String zoteroGroupId, String itemId); | ||
|
|
||
| /** | ||
| * Get collections by collection ID | ||
| * @param zoteroGroupId Zotero group ID | ||
| * @param collectionId Collection ID | ||
| * @return Collections as Map | ||
| */ | ||
| Map<String, Object> getCollectionsByCollectionId(String zoteroGroupId, String collectionId); | ||
|
|
||
| /** | ||
| * Add item to group | ||
| * @param groupId Group ID | ||
| * @param data Item data | ||
| * @param filePath Path to file to upload | ||
| * @return Response from API | ||
| */ | ||
| Object addItem(String groupId, Map<String, Object> data, String filePath); | ||
|
|
||
| /** | ||
| * Refresh the access token using refresh token | ||
| * @return New CitesphereAuthToken with refreshed access token | ||
| * @throws CitesphereTokenException if refresh fails | ||
| */ | ||
| CitesphereAuthToken refreshToken() throws CitesphereTokenException; | ||
|
|
||
| /** | ||
| * Validate if current token is still valid | ||
| * @return true if token is valid, false otherwise | ||
| */ | ||
| boolean isTokenValid(); | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those entries should probably not be removed