From 5232e9fa697e05098fddfb02e8e80e1294077d06 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 13 Dec 2017 16:57:05 +0000 Subject: [PATCH] ref #10586: Enable SDMX export operation for DataSet only for the tables already shared with the whole VRE https://support.d4science.org/issues/10586 Added share git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@160456 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 +- distro/changelog.xml | 5 ++ pom.xml | 2 +- .../client/SDMXExportWizardTD.java | 48 +------------ .../client/SDMXRegistrySelectionCard.java | 71 +++++++++++++++++-- 5 files changed, 76 insertions(+), 56 deletions(-) diff --git a/.classpath b/.classpath index ef1deaa..8aac733 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -45,5 +45,5 @@ - + diff --git a/distro/changelog.xml b/distro/changelog.xml index 53250d0..a7f5b19 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,9 @@ + + Enable SDMX export operation for DataSet only for the tables + already shared with the whole VRE [ticket #10586] + + Added excel parameter for Template export [ticket #8781] diff --git a/pom.xml b/pom.xml index a55465c..c6f28ae 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.gcube.portlets.user tabular-data-sdmx-export-widget - 1.10.0-SNAPSHOT + 1.11.0-SNAPSHOT tabular-data-sdmx-export-widget diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java index f88d45f..7c31f43 100644 --- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java +++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java @@ -1,19 +1,9 @@ package org.gcube.portlets.user.td.sdmxexportwidget.client; -import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; -import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; -import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; -import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; -import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; -import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; -import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType; import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; -import com.allen_sauer.gwt.log.client.Log; -import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.web.bindery.event.shared.EventBus; -import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox; /** * @@ -41,47 +31,13 @@ public class SDMXExportWizardTD extends WizardWindow { exportSession = new SDMXExportSession(); - final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrieving Information, please wait..."); - box.setProgressText("Retrieving..."); - box.auto(); - box.show(); - - retrieveTabularDataInfo(box); - + SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(exportSession); addCard(sdmxRegistrySelectionCard); sdmxRegistrySelectionCard.setup(); } - private void retrieveTabularDataInfo(final AutoProgressMessageBox box) { - TDGWTServiceAsync.INSTANCE.getTabResourceInformation(new AsyncCallback() { - - public void onFailure(Throwable caught) { - if (caught instanceof TDGWTSessionExpiredException) { - eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER)); - } else { - if (caught instanceof TDGWTIsLockedException) { - Log.error(caught.getLocalizedMessage()); - showErrorAndHide("Error Locked", caught.getLocalizedMessage(), "", caught); - } else { - Log.error( - "No Tabular Resource Information retrived from server " + caught.getLocalizedMessage()); - box.hide(); - showErrorAndHide("Error", "Error retrieving tabular resource information: ", - caught.getLocalizedMessage(), caught); - } - } - } - - public void onSuccess(TabResource result) { - Log.debug("Tabular Resource Information retrived"); - exportSession.setTabResource(result); - exportSession.setExportType(TableType.getColumnDataTypeFromId(result.getTableTypeName())); - box.hide(); - - } - }); - } + } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java index 365d7d6..882230a 100644 --- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java @@ -4,11 +4,14 @@ package org.gcube.portlets.user.td.sdmxexportwidget.client; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; @@ -21,6 +24,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.VerticalPanel; import com.sencha.gxt.core.client.util.ToggleGroup; +import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox; import com.sencha.gxt.widget.core.client.container.MarginData; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; @@ -47,9 +51,15 @@ public class SDMXRegistrySelectionCard extends WizardCard { SDMXRegistrySource sdmxRegistrySource = new SDMXRegistrySource(); exportSession.setSource(sdmxRegistrySource); this.exportSession = exportSession; - retrieveDefaultRegistryURL(); + final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrieving Information, please wait..."); + box.setProgressText("Retrieving..."); + box.auto(); + box.show(); + + retrieveTabularDataInfo(box); } + private void create(String defaultRegistryUrl) { @@ -60,11 +70,11 @@ public class SDMXRegistrySelectionCard extends WizardCard { if (defaultRegistryUrl == null || defaultRegistryUrl.isEmpty()) { radioStandardRegistry.setBoxLabel("

Internal SDMX Registry" - + "
Select this if you want use the Internal Registry" + "

"); + + "
The export will be performed on the Internal Register" + "

"); } else { radioStandardRegistry.setBoxLabel("

Internal SDMX Registry" - + "
Select this if you want use the Internal Registry" - + "

"); + + "
The export will be performed on the Internal Registry" + "

"); } radioStandardRegistry.setValue(true); radioStandardRegistry.setName("Default"); @@ -115,7 +125,7 @@ public class SDMXRegistrySelectionCard extends WizardCard { Log.info("SDMXRegistry Url"); Log.info("Input value: " + url.getCurrentValue()); SDMXRegistrySource r = ((SDMXRegistrySource) exportSession.getSource()); - //TODO r.setUrl(url.getCurrentValue()); + // TODO r.setUrl(url.getCurrentValue()); r.setUrl(null); Log.info("" + exportSession.getSource()); } else { @@ -133,12 +143,61 @@ public class SDMXRegistrySelectionCard extends WizardCard { }); setCenterWidget(registrySelectionPanel, new MarginData(0)); + + if (exportSession != null && exportSession.getExportType() != null) { + switch (exportSession.getExportType()) { + case CODELIST: + break; + case DATASET: + Log.debug("Set caution for dataset"); + setFooter( + "Caution: when you publish a dataset on SDMX Registry, it will also be shared with all users of the current VRE!"); + break; + case GENERIC: + default: + break; + + } + } + forceLayout(); } + + + private void retrieveTabularDataInfo(final AutoProgressMessageBox box) { + TDGWTServiceAsync.INSTANCE.getTabResourceInformation(new AsyncCallback() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + getEventBus().fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + showErrorAndHide("Error Locked", caught.getLocalizedMessage(), "", caught); + } else { + Log.error( + "No Tabular Resource Information retrived from server " + caught.getLocalizedMessage()); + box.hide(); + showErrorAndHide("Error", "Error retrieving tabular resource information: ", + caught.getLocalizedMessage(), caught); + } + } + } + + public void onSuccess(TabResource result) { + Log.debug("Tabular Resource Information retrieved"); + exportSession.setTabResource(result); + exportSession.setExportType(TableType.getColumnDataTypeFromId(result.getTableTypeName())); + box.hide(); + retrieveDefaultRegistryURL(); + } + }); + } + private void retrieveDefaultRegistryURL() { mask("Please Wait..."); - + TDGWTServiceAsync.INSTANCE.getDefaultSDMXRegistryURL(new AsyncCallback() { @Override