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
This commit is contained in:
Giancarlo Panichi 2017-12-13 16:57:05 +00:00 committed by Giancarlo Panichi
parent 43748d0ba1
commit 5232e9fa69
5 changed files with 76 additions and 56 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -45,5 +45,5 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/> <attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </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> </classpath>

View File

@ -1,4 +1,9 @@
<ReleaseNotes> <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"> <Changeset component="${groupId}.${artifactId}.1-10-0" date="2017-07-01">
<Change>Added excel parameter for Template export [ticket #8781] <Change>Added excel parameter for Template export [ticket #8781]
</Change> </Change>

View File

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-sdmx-export-widget</artifactId> <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> <name>tabular-data-sdmx-export-widget</name>

View File

@ -1,19 +1,9 @@
package org.gcube.portlets.user.td.sdmxexportwidget.client; 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.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 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.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(); 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); SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(exportSession);
addCard(sdmxRegistrySelectionCard); addCard(sdmxRegistrySelectionCard);
sdmxRegistrySelectionCard.setup(); 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();
}
});
}
} }

View File

@ -4,11 +4,14 @@
package org.gcube.portlets.user.td.sdmxexportwidget.client; 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.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.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; 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.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.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; 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 org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log; 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.HasValue;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.core.client.util.ToggleGroup; 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.MarginData;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
@ -47,9 +51,15 @@ public class SDMXRegistrySelectionCard extends WizardCard {
SDMXRegistrySource sdmxRegistrySource = new SDMXRegistrySource(); SDMXRegistrySource sdmxRegistrySource = new SDMXRegistrySource();
exportSession.setSource(sdmxRegistrySource); exportSession.setSource(sdmxRegistrySource);
this.exportSession = exportSession; 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) { private void create(String defaultRegistryUrl) {
@ -60,11 +70,11 @@ public class SDMXRegistrySelectionCard extends WizardCard {
if (defaultRegistryUrl == null || defaultRegistryUrl.isEmpty()) { if (defaultRegistryUrl == null || defaultRegistryUrl.isEmpty()) {
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>" 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 { } else {
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>" 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>" + "<br>The export will be performed on the <a href='" + defaultRegistryUrl
+ "</p>"); + "'>Internal Registry</a>" + "</p>");
} }
radioStandardRegistry.setValue(true); radioStandardRegistry.setValue(true);
radioStandardRegistry.setName("Default"); radioStandardRegistry.setName("Default");
@ -115,7 +125,7 @@ public class SDMXRegistrySelectionCard extends WizardCard {
Log.info("SDMXRegistry Url"); Log.info("SDMXRegistry Url");
Log.info("Input value: " + url.getCurrentValue()); Log.info("Input value: " + url.getCurrentValue());
SDMXRegistrySource r = ((SDMXRegistrySource) exportSession.getSource()); SDMXRegistrySource r = ((SDMXRegistrySource) exportSession.getSource());
//TODO r.setUrl(url.getCurrentValue()); // TODO r.setUrl(url.getCurrentValue());
r.setUrl(null); r.setUrl(null);
Log.info("" + exportSession.getSource()); Log.info("" + exportSession.getSource());
} else { } else {
@ -133,12 +143,61 @@ public class SDMXRegistrySelectionCard extends WizardCard {
}); });
setCenterWidget(registrySelectionPanel, new MarginData(0)); 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(); 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() { private void retrieveDefaultRegistryURL() {
mask("Please Wait..."); mask("Please Wait...");
TDGWTServiceAsync.INSTANCE.getDefaultSDMXRegistryURL(new AsyncCallback<String>() { TDGWTServiceAsync.INSTANCE.getDefaultSDMXRegistryURL(new AsyncCallback<String>() {
@Override @Override