|
|
|
@ -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
|
|
|
|
|