diff --git a/pom.xml b/pom.xml index 2d06cc7bb0..8e13cb7b9d 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ ${project.build.directory}/${project.build.finalName} - 514.0 + 521.0 2.11.0 5.3.37 6.0.0 diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java index b93e739ff4..fa0a6e22ed 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java @@ -210,6 +210,7 @@ import org.sagebionetworks.web.client.widget.login.LoginWidget; import org.sagebionetworks.web.client.widget.profile.ProfileCertifiedValidatedWidget; import org.sagebionetworks.web.client.widget.profile.UserProfileWidget; +import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability; import org.sagebionetworks.web.client.widget.provenance.v2.ProvenanceWidget; import org.sagebionetworks.web.client.widget.refresh.DiscussionThreadCountAlert; import org.sagebionetworks.web.client.widget.refresh.EntityRefreshAlert; @@ -900,4 +901,5 @@ public interface PortalGinInjector extends Ginjector { TrustCenterPresenter getTrustCenterPresenter(); ChatPresenter getChatPresenter(); PlansPresenter getPlansPresenter(); + ProjectDataAvailability getProjectDataAvailability(); } diff --git a/src/main/java/org/sagebionetworks/web/client/UserAccountService.java b/src/main/java/org/sagebionetworks/web/client/UserAccountService.java index 5704182978..eae4dbe805 100644 --- a/src/main/java/org/sagebionetworks/web/client/UserAccountService.java +++ b/src/main/java/org/sagebionetworks/web/client/UserAccountService.java @@ -10,8 +10,6 @@ @RemoteServiceRelativePath("users") public interface UserAccountService extends RemoteService { - void signTermsOfUse(String accessToken) throws RestServiceException; - void createUserStep1(NewUser newUser, String portalEndpoint) throws RestServiceException; diff --git a/src/main/java/org/sagebionetworks/web/client/UserAccountServiceAsync.java b/src/main/java/org/sagebionetworks/web/client/UserAccountServiceAsync.java index 5c9f1f879b..6ba3c2c30f 100644 --- a/src/main/java/org/sagebionetworks/web/client/UserAccountServiceAsync.java +++ b/src/main/java/org/sagebionetworks/web/client/UserAccountServiceAsync.java @@ -7,8 +7,6 @@ import org.sagebionetworks.web.shared.PublicPrincipalIds; public interface UserAccountServiceAsync { - void signTermsOfUse(String accessToken, AsyncCallback callback); - void createUserStep1( NewUser newUser, String portalEndpoint, diff --git a/src/main/java/org/sagebionetworks/web/client/security/AuthenticationController.java b/src/main/java/org/sagebionetworks/web/client/security/AuthenticationController.java index ed83151c69..f30b00550e 100644 --- a/src/main/java/org/sagebionetworks/web/client/security/AuthenticationController.java +++ b/src/main/java/org/sagebionetworks/web/client/security/AuthenticationController.java @@ -75,11 +75,6 @@ void initializeFromExistingAccessTokenCookie( */ public UserProfile getCurrentUserProfile(); - /** - * Signs the terms of use for a user - */ - public void signTermsOfUse(AsyncCallback callback); - public void updateCachedProfile(UserProfile updatedProfile); void checkForUserChange(); diff --git a/src/main/java/org/sagebionetworks/web/client/security/AuthenticationControllerImpl.java b/src/main/java/org/sagebionetworks/web/client/security/AuthenticationControllerImpl.java index f15553a4a6..e405b33fc8 100644 --- a/src/main/java/org/sagebionetworks/web/client/security/AuthenticationControllerImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/security/AuthenticationControllerImpl.java @@ -398,11 +398,6 @@ public String getCurrentUserAccessToken() { return currentUserAccessToken; } - @Override - public void signTermsOfUse(AsyncCallback callback) { - userAccountService.signTermsOfUse(getCurrentUserAccessToken(), callback); - } - @Override public void checkForUserChange() { checkForUserChange(null); diff --git a/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityMetadata.java b/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityMetadata.java index 3a70683996..a7a6caabb4 100644 --- a/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityMetadata.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityMetadata.java @@ -29,7 +29,7 @@ import org.sagebionetworks.web.client.widget.entity.controller.EntityActionControllerImpl; import org.sagebionetworks.web.client.widget.entity.menu.v3.Action; import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenu; -import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvaiilability; +import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability; public class EntityMetadata { @@ -40,7 +40,7 @@ public class EntityMetadata { private final SynapseJSNIUtils jsni; private final PortalGinInjector ginInjector; private final EntityModalWidget entityModalWidget; - private ProjectDataAvaiilability projectDataAvailabilityWidget; + private ProjectDataAvailability projectDataAvailabilityWidget; private boolean annotationsAreVisible = false; @Inject @@ -50,8 +50,7 @@ public EntityMetadata( SynapseJavascriptClient jsClient, SynapseJSNIUtils jsni, PortalGinInjector ginInjector, - EntityModalWidget entityModalWidget, - ProjectDataAvaiilability projectDataAvailabilityWidget + EntityModalWidget entityModalWidget ) { this.view = view; this.doiWidgetV2 = doiWidgetV2; @@ -59,10 +58,8 @@ public EntityMetadata( this.jsni = jsni; this.ginInjector = ginInjector; this.entityModalWidget = entityModalWidget; - this.projectDataAvailabilityWidget = projectDataAvailabilityWidget; this.view.setDoiWidget(doiWidgetV2); this.view.setEntityModalWidget(entityModalWidget); - this.view.setProjectDataAvailabilityWidget(projectDataAvailabilityWidget); } public Widget asWidget() { @@ -77,6 +74,15 @@ public VersionHistoryWidget getVersionHistoryWidget() { return versionHistoryWidget; } + public ProjectDataAvailability getProjectDataAvailabilityWidget() { + if (projectDataAvailabilityWidget == null) { + this.projectDataAvailabilityWidget = + ginInjector.getProjectDataAvailability(); + this.view.setProjectDataAvailabilityWidget(projectDataAvailabilityWidget); + } + return projectDataAvailabilityWidget; + } + public void configure( EntityBundle bundle, Long versionNumber, @@ -131,7 +137,7 @@ public void configure( } configureStorageLocation(en); - projectDataAvailabilityWidget.setProjectId(en.getId()); + getProjectDataAvailabilityWidget().setProjectId(en.getId()); // An unversioned DOI may not have been included in the (versioned) entity bundle, so we should see if one exists if ( bundle.getDoiAssociation() == null && // If a versioned DOI exists, we should show that diff --git a/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvaiilability.java b/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailability.java similarity index 76% rename from src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvaiilability.java rename to src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailability.java index d22c22b58e..dc62391e23 100755 --- a/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvaiilability.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailability.java @@ -4,12 +4,12 @@ import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; -public class ProjectDataAvaiilability implements IsWidget { +public class ProjectDataAvailability implements IsWidget { ProjectDataAvailabilityView view; @Inject - public ProjectDataAvaiilability(ProjectDataAvailabilityView view) { + public ProjectDataAvailability(ProjectDataAvailabilityView view) { this.view = view; } diff --git a/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailabilityViewImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailabilityViewImpl.java index 7c68ce9902..92ba932f13 100755 --- a/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailabilityViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/projectdataavailability/ProjectDataAvailabilityViewImpl.java @@ -1,6 +1,5 @@ package org.sagebionetworks.web.client.widget.projectdataavailability; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; diff --git a/src/main/java/org/sagebionetworks/web/server/servlet/UserAccountServiceImpl.java b/src/main/java/org/sagebionetworks/web/server/servlet/UserAccountServiceImpl.java index bff423b581..56f99b4f65 100644 --- a/src/main/java/org/sagebionetworks/web/server/servlet/UserAccountServiceImpl.java +++ b/src/main/java/org/sagebionetworks/web/server/servlet/UserAccountServiceImpl.java @@ -54,18 +54,6 @@ private void validateService() { } } - @Override - public void signTermsOfUse(String accessToken) throws RestServiceException { - validateService(); - - SynapseClient synapseClient = createSynapseClient(); - try { - synapseClient.signTermsOfUse(accessToken); - } catch (SynapseException e) { - throw ExceptionUtil.convertSynapseException(e); - } - } - @Override public void createUserStep1(NewUser newUser, String portalEndpoint) throws RestServiceException { diff --git a/src/test/java/org/sagebionetworks/web/unitclient/widget/entity/EntityMetadataTest.java b/src/test/java/org/sagebionetworks/web/unitclient/widget/entity/EntityMetadataTest.java index 5169537ce0..69b9045c75 100644 --- a/src/test/java/org/sagebionetworks/web/unitclient/widget/entity/EntityMetadataTest.java +++ b/src/test/java/org/sagebionetworks/web/unitclient/widget/entity/EntityMetadataTest.java @@ -47,7 +47,7 @@ import org.sagebionetworks.web.client.widget.entity.*; import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenu; import org.sagebionetworks.web.client.widget.entity.restriction.v2.RestrictionWidget; -import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvaiilability; +import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability; import org.sagebionetworks.web.test.helper.AsyncMockStubber; @RunWith(MockitoJUnitRunner.Silent.class) @@ -84,7 +84,7 @@ public class EntityMetadataTest { EntityModalWidget mockEntityModalWidget; @Mock - ProjectDataAvaiilability mockProjectDataAvaiilability; + ProjectDataAvailability mockProjectDataAvailability; String entityId = "syn123"; String entityName = "testEntity"; @@ -96,6 +96,8 @@ public class EntityMetadataTest { public void before() { when(mockGinInjector.getVersionHistoryWidget()) .thenReturn(mockFileHistoryWidget); + when(mockGinInjector.getProjectDataAvailability()) + .thenReturn(mockProjectDataAvailability); when(mockGinInjector.getCookieProvider()).thenReturn(mockCookies); widget = new EntityMetadata( @@ -104,8 +106,7 @@ public void before() { mockJsClient, mockJSNI, mockGinInjector, - mockEntityModalWidget, - mockProjectDataAvaiilability + mockEntityModalWidget ); } @@ -138,7 +139,7 @@ public void testSetEntityBundleProject() { widget.configure(bundle, null, mockActionMenuWidget); verify(mockView).setDetailedMetadataVisible(true); verify(mockDoiWidgetV2).configure(mockDoiAssociation); - verify(mockProjectDataAvaiilability).setProjectId(entityId); + verify(mockProjectDataAvailability).setProjectId(entityId); } @Test @@ -165,7 +166,7 @@ public void testSetEntityBundleProjectInAlphaMode() { widget.configure(bundle, null, mockActionMenuWidget); verify(mockView).setDetailedMetadataVisible(true); verify(mockDoiWidgetV2).configure(mockDoiAssociation); - verify(mockProjectDataAvaiilability).setProjectId(entityId); + verify(mockProjectDataAvailability).setProjectId(entityId); } @Test