Integrated servlet mapping to ckanToZenodoZervlet and tested it

This commit is contained in:
Francesco Mangiacrapa 2019-12-09 12:33:01 +01:00
parent 857ee3bf08
commit d0c77fc262
8 changed files with 73 additions and 10 deletions

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="ckan2zenodo-publisher-widget-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan2zenodo-publisher-widget/ckan2zenodo-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>

View File

@ -114,6 +114,12 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan2zenodo-publisher-widget</artifactId>
<version>[0.0.1-SNAPSHOT,1.0.0-SNAPSHOT)</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.portlets.widgets</groupId> -->
<!-- <artifactId>session-checker</artifactId> -->

View File

@ -25,6 +25,9 @@
<inherits name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
<!-- Specify the app entry point class. -->
<entry-point

View File

@ -8,6 +8,8 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetada
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEvent;
@ -28,6 +30,9 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesE
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublisherWidget;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisher;
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
@ -251,6 +256,21 @@ public class CkanEventHandlerManager {
}
});
eventBus.addHandler(PublishOnZenodoEvent.TYPE, new PublishOnZenodoEventHandler() {
@Override
public void onPublishOnZenodo(PublishOnZenodoEvent publishOnZenodoEvent) {
CkanToZendoPublisherWidget publisherWidget;
if(publishOnZenodoEvent.getUuidItem()!=null) {
publisherWidget = new CkanToZendoPublisherWidget();
publisherWidget.publishOnZenodo(new CatalogueItem(publishOnZenodoEvent.getUuidItem(), null, CatalogueItem.ITEM_TYPE.DATASET));
}
}
});
}
/**

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowGroupsEvent;
@ -97,6 +98,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
statistics.setType(ButtonType.LINK);
shareLink.setType(ButtonType.LINK);
publishOnZenodoLink.setType(ButtonType.LINK);
insertMeta.setType(ButtonType.LINK);
editMeta.setType(ButtonType.LINK);
manageProduct.setType(ButtonType.PRIMARY);
@ -109,6 +111,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
items.setIcon(IconType.SITEMAP);
types.setIcon(IconType.FILE_TEXT);
shareLink.setIcon(IconType.SHARE);
publishOnZenodoLink.setIcon(IconType.ANCHOR);
myDatasets.setIcon(IconType.SITEMAP);
myOrganizations.setIcon(IconType.BUILDING);
myGroups.setIcon(IconType.GROUP);
@ -119,6 +122,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
// hide edit and insert
shareLink.setEnabled(false);
publishOnZenodoLink.setEnabled(false);
editMeta.setVisible(false);
insertMeta.setVisible(false);
manageProduct.setVisible(false);
@ -145,6 +149,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
separatorAdminButtons.setVisible(true);
nav.add(separatorAdminButtons);
nav.add(shareLink);
nav.add(publishOnZenodoLink);
nav.add(insertMeta);
nav.add(editMeta);
nav.add(manageProduct);
@ -295,7 +300,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new ShareLinkEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
eventBus.fireEvent(new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
}
@ -349,6 +354,16 @@ public class CkanMetadataManagementPanel extends FlowPanel{
shareLink.setEnabled(value);
}
/**
* Enable publish on zenodo button.
*
* @param value the value
*/
public void enablePublishOnZenodoButton(boolean value){
publishOnZenodoLink.setEnabled(value);
}
/**
* Show only home/statistics buttons.
*/
@ -357,6 +372,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
separatorMyInfo.setVisible(false);
separatorAdminButtons.setVisible(false);
shareLink.setVisible(false);
publishOnZenodoLink.setVisible(false);
insertMeta.setVisible(false);
editMeta.setVisible(false);
myDatasets.setVisible(false);

View File

@ -441,6 +441,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
if(!isProductKeyMissing){
latestSelectedProductIdentifier = productId.toString();
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
managementPanel.enableManageProductButton(productId != null && !productId.isEmpty() && isManageProductToShow);
}
} else {

View File

@ -26,6 +26,8 @@
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
@ -34,10 +35,10 @@
<!-- <servlet-class>org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.CkanLogout</servlet-class> -->
<!-- </servlet> -->
<!-- <servlet> -->
<!-- <servlet-name>checkServlet</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl</servlet-class> -->
<!-- </servlet> -->
<!-- <servlet> -->
<!-- <servlet-name>checkServlet</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl</servlet-class> -->
<!-- </servlet> -->
<servlet>
<servlet-name>ckanpublisherservices</servlet-name>
@ -54,6 +55,17 @@
<servlet-class>org.gcube.portlets_widgets.catalogue_sharing_widget.server.ShareServicesImpl</servlet-class>
</servlet>
<!-- Servlets -->
<servlet>
<servlet-name>ckanToZenodoServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoPublisherServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ckanToZenodoServlet</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/ckantozenodo</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>shareservices</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/shareservices</url-pattern>
@ -79,10 +91,10 @@
<!-- <url-pattern>/gCubeCkanDataCatalog/gcubeckanlogout</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>checkServlet</servlet-name> -->
<!-- <url-pattern>/gCubeCkanDataCatalog/checksession</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>checkServlet</servlet-name> -->
<!-- <url-pattern>/gCubeCkanDataCatalog/checksession</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- Default page to serve -->
<welcome-file-list>