From d45f7e87a8c2b2b8ca13dccb12982aa9164aee11 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 9 Apr 2021 15:39:48 +0200 Subject: [PATCH] merged with "task_20699" --- .classpath | 6 ++--- .../com.gwtplugins.gdt.eclipse.core.prefs | 3 ++- .settings/org.eclipse.wst.common.component | 12 +-------- CHANGELOG.md | 9 ++++++- pom.xml | 26 +++++++------------ .../GCubeCkanDataCatalog.gwt.xml | 2 +- .../client/CkanEventHandlerManager.java | 9 ++++--- .../client/GcubeCkanDataCatalogService.java | 2 +- .../GcubeCkanDataCatalogServiceAsync.java | 2 +- .../view/GCubeCkanDataCatalogPanel.java | 2 +- .../GcubeCkanDataCatalogServiceImpl.java | 23 +++++++--------- .../server/SessionUtil.java | 2 +- .../gcubeckandatacatalog/server/UserUtil.java | 7 ++--- .../thread/AddUserToOrganizationThread.java | 4 +-- .../thread/UpdateItemCatalogueResource.java | 5 ++-- .../shared/BeanUserInOrgGroupRole.java | 2 +- .../GCubeCkanDataCatalog.gwt.xml | 2 +- src/main/webapp/GCubeCkanDataCatalog.css | 8 ++++-- src/main/webapp/GCubeCkanDataCatalog.html | 14 ++++++---- 19 files changed, 71 insertions(+), 69 deletions(-) diff --git a/.classpath b/.classpath index 824e16f..e0384ed 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -13,7 +13,7 @@ - + @@ -36,5 +36,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index af9da94..6be4bd1 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,5 +1,6 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.9.3-SNAPSHOT +lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT +>>>>>>> refs/heads/task_20699 warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index cf90d59..3b80e47 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,20 +1,10 @@ - - - + - - - - - - - - diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce05f6..f61c489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,18 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.0-SNAPSHOT] - 2021-02-12 + +#### Enhancements + +[#20699] Migrate the gcube-ckan-datacatalog to catalogue-util-library + + ## [v1.9.3] - 2021-03-09 Just to include the ckan2zenodo-library 1.x - ## [v1.9.2] - 2021-02-08 #### Bug fixes diff --git a/pom.xml b/pom.xml index e363728..e2d90e2 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.gcubeckan gcube-ckan-datacatalog war - 1.9.3 + 2.0.0-SNAPSHOT gCube CKAN Data Catalog The gCube CKAN Data Catalog portlet @@ -101,22 +101,17 @@ [1.0.0, 2.0.0-SNAPSHOT) - + org.gcube.portlets.widgets grsf-manage-widget [1.0.0,2.0.0-SNAPSHOT) - - - org.gcube.data-catalogue - ckan-util-library - - + org.gcube.portlets.widgets ckan-metadata-publisher-widget - [1.0.0,2.0.0-SNAPSHOT) + [2.0.0-SNAPSHOT,3.0.0) compile @@ -125,15 +120,14 @@ ckan2zenodo-publisher-widget [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) compile + + + org.gcube.data-publishing + gcat-client + + - - - - - - - org.gcube.resources registry-publisher diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml index 0dea5be..db046d2 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml @@ -23,7 +23,7 @@ - + diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java index 7f0b218..b13066b 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java @@ -95,7 +95,7 @@ public class CkanEventHandlerManager { @Override public void onInsertMetadata(InsertMetadataEvent loadSelecteReleaseEvent) { - + GWT.log("loadSelecteReleaseEvent: "+loadSelecteReleaseEvent); final Modal modal = new Modal(true, true); modal.setTitle(WIDGET_CREATE_TITLE); @@ -104,16 +104,19 @@ public class CkanEventHandlerManager { ((Element)modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom"); modal.add(new CreateDatasetForm(eventBus)); modal.setCloseVisible(true); - modal.show(); - + // hide any popup panel opened modal.addHideHandler(new HideHandler() { @Override public void onHide(HideEvent hideEvent) { + GWT.log("HideEvent on modal fired"); eventBus.fireEvent(new CloseCreationFormEvent()); } }); + + GWT.log("show"); + modal.show(); } }); // bind on edit (TODO) diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java index 1f3ba95..e3790ab 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java @@ -2,7 +2,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; import java.util.List; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java index 92796bc..9731480 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java @@ -5,7 +5,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; import java.util.List; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java index 6b34968..ea23787 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevertOperationWidgetEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java index 516fb60..a9d72f4 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java @@ -17,11 +17,13 @@ import org.gcube.common.authorization.library.provider.UserInfo; import org.gcube.common.portal.PortalContext; import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean.Type; -import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; -import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods; -import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.server.DataCatalogue; +import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory; +import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods; +import org.gcube.datacatalogue.utillibrary.server.utils.SessionCatalogueAttributes; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanGroup; +import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanOrganization; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.thread.UpdateItemCatalogueResource; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole; @@ -34,8 +36,6 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; -import eu.trentorise.opendata.jackan.model.CkanGroup; -import eu.trentorise.opendata.jackan.model.CkanOrganization; /** * The server side implementation of the RPC service. * @@ -305,9 +305,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem try{ DataCatalogue catalogue = getCatalogue(context); - String apiKey = catalogue.getApiKeyFromUsername(username); toReturn = new ArrayList(); - Map> mapRoleGroup = catalogue.getUserRoleByGroup(username, apiKey); + Map> mapRoleGroup = catalogue.getUserRoleByGroup(username); Set>> set = mapRoleGroup.entrySet(); for (Entry> entry : set) { Set> subSet = entry.getValue().entrySet(); @@ -411,8 +410,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem }else{ logger.debug("Organizations list wasn't into session, retrieving them"); DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl); - String apiKey = catalogue.getApiKeyFromUsername(username); - Map> mapRoleGroup = catalogue.getUserRoleByOrganization(username, apiKey); + Map> mapRoleGroup = catalogue.getUserRoleByOrganization(username); Set>> set = mapRoleGroup.entrySet(); for (Entry> entry : set) { Set> subSet = entry.getValue().entrySet(); @@ -458,9 +456,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem }else{ logger.debug("Groups list wasn't into session, retrieving them"); DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl); - String apiKey = catalogue.getApiKeyFromUsername(username); - Map> mapRoleGroup = catalogue.getUserRoleByGroup(username, apiKey); + Map> mapRoleGroup = catalogue.getUserRoleByGroup(username); Set>> set = mapRoleGroup.entrySet(); for (Entry> entry : set) { Set> subSet = entry.getValue().entrySet(); diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/SessionUtil.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/SessionUtil.java index d39f63a..fa3ea10 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/SessionUtil.java @@ -8,7 +8,7 @@ import javax.servlet.http.HttpSession; import org.gcube.common.portal.PortalContext; import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.datacatalogue.ckanutillibrary.server.ApplicationProfileScopePerUrlReader; +import org.gcube.datacatalogue.utillibrary.server.ApplicationProfileScopePerUrlReader; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java index e98a587..30bb633 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java @@ -9,8 +9,9 @@ import java.util.Map; import javax.servlet.http.HttpSession; -import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.server.DataCatalogue; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanOrganization; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.thread.AddUserToOrganizationThread; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.vomanagement.usermanagement.GroupManager; @@ -30,7 +31,7 @@ import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; -import eu.trentorise.opendata.jackan.model.CkanOrganization; + /** diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java index 006c689..f3c2e5e 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/AddUserToOrganizationThread.java @@ -7,8 +7,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.server.DataCatalogue; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.UserUtil; import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.RoleManager; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/UpdateItemCatalogueResource.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/UpdateItemCatalogueResource.java index 1fb6a5e..e164770 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/UpdateItemCatalogueResource.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/thread/UpdateItemCatalogueResource.java @@ -16,7 +16,6 @@ import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean.Type; import org.gcube.informationsystem.publisher.RegistryPublisher; import org.gcube.informationsystem.publisher.RegistryPublisherFactory; -import org.gcube.portlets.widgets.ckandatapublisherwidget.server.threads.WritePostCatalogueManagerThread; import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.gcube.resources.discovery.client.queries.api.Query; import org.gcube.resources.discovery.client.queries.impl.QueryBox; @@ -36,6 +35,8 @@ public class UpdateItemCatalogueResource extends Thread{ private String currentScope; private String cleanUrl; private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UpdateItemCatalogueResource.class); + + public static final String APPLICATION_ID_CATALOGUE_MANAGER = "org.gcube.datacatalogue.ProductCatalogue"; /** @@ -71,7 +72,7 @@ public class UpdateItemCatalogueResource extends Thread{ // check if the resource is present Query q = new QueryBox("for $profile in collection('/db/Profiles/GenericResource')//Resource " + "where $profile/Profile/SecondaryType/string() eq 'ApplicationProfile' and $profile/Profile/Body/AppId/string() " + - " eq '" + WritePostCatalogueManagerThread.APPLICATION_ID_CATALOGUE_MANAGER + "'" + + " eq '" + APPLICATION_ID_CATALOGUE_MANAGER + "'" + "return $profile"); DiscoveryClient client = client(); diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/BeanUserInOrgGroupRole.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/BeanUserInOrgGroupRole.java index 5a08345..7e7592f 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/BeanUserInOrgGroupRole.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/BeanUserInOrgGroupRole.java @@ -2,7 +2,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared; import java.io.Serializable; -import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg; +import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg; /** * A bean that contains the tuple: diff --git a/src/main/resources/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml b/src/main/resources/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml index cda82dd..faf87aa 100644 --- a/src/main/resources/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml +++ b/src/main/resources/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/GCubeCkanDataCatalog.gwt.xml @@ -23,7 +23,7 @@ - + diff --git a/src/main/webapp/GCubeCkanDataCatalog.css b/src/main/webapp/GCubeCkanDataCatalog.css index f64590a..14e626a 100644 --- a/src/main/webapp/GCubeCkanDataCatalog.css +++ b/src/main/webapp/GCubeCkanDataCatalog.css @@ -48,7 +48,7 @@ h1 { } } -@media(min-height: 800px) { +@media(min-height: 500px) { .modal-body-custom { max-height: 500px !important; } @@ -58,6 +58,10 @@ h1 { top: 2% !important; } +.modal-body-custom { + max-height: 700px !important; +} + /** My Organizations panel **/ .my-organizations-container-style { background-attachment: scroll !important; @@ -90,7 +94,7 @@ h1 { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05) !important; position: relative !important; background-color: #fff !important; - padding-left: 5% !important !important; + padding-left: 5% !important; } .list-panel-organizations-style { diff --git a/src/main/webapp/GCubeCkanDataCatalog.html b/src/main/webapp/GCubeCkanDataCatalog.html index bf7aea1..b2e94f0 100644 --- a/src/main/webapp/GCubeCkanDataCatalog.html +++ b/src/main/webapp/GCubeCkanDataCatalog.html @@ -2,14 +2,18 @@ + + + + - - - + + +