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
master
Giancarlo Panichi 6 years ago committed by Giancarlo Panichi
parent 43748d0ba1
commit 5232e9fa69

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/tabular-data-sdmx-export-widget-1.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/tabular-data-sdmx-export-widget-1.11.0-SNAPSHOT/WEB-INF/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/tabular-data-sdmx-export-widget-1.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/tabular-data-sdmx-export-widget-1.11.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -45,5 +45,5 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/tabular-data-sdmx-export-widget-1.10.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/tabular-data-sdmx-export-widget-1.11.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

@ -1,4 +1,9 @@
<ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.1-11-0" date="2017-12-13">
<Change>Enable SDMX export operation for DataSet only for the tables
already shared with the whole VRE [ticket #10586]
</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.1-10-0" date="2017-07-01">
<Change>Added excel parameter for Template export [ticket #8781]
</Change>

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-sdmx-export-widget</artifactId>
<version>1.10.0-SNAPSHOT</version>
<version>1.11.0-SNAPSHOT</version>
<name>tabular-data-sdmx-export-widget</name>

@ -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<TabResource>() {
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();
}
});
}
}

@ -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("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
+ "<br>Select this if you want use the Internal Registry" + "</p>");
+ "<br>The export will be performed on the Internal Register" + "</p>");
} else {
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
+ "<br>Select this if you want use the <a href='" + defaultRegistryUrl + "'>Internal Registry</a>"
+ "</p>");
+ "<br>The export will be performed on the <a href='" + defaultRegistryUrl
+ "'>Internal Registry</a>" + "</p>");
}
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<TabResource>() {
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<String>() {
@Override

Loading…
Cancel
Save