ref 6078:TDM - Create a new widget to support operations's invocation on DataMiner
https://support.d4science.org/issues/6078 Updated to support DataMiner git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-statistical-widget@144883 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
43f0b44588
commit
29d367ed69
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src/main/java">
|
<classpathentry kind="src" output="target/tabular-data-statistical-widget-1.5.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" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/tabular-data-statistical-widget-1.5.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>
|
||||||
|
@ -42,8 +42,7 @@
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/tabular-data-statistical-widget-1.4.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/tabular-data-statistical-widget-1.5.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -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-statistical-widget</artifactId>
|
<artifactId>tabular-data-statistical-widget</artifactId>
|
||||||
<version>1.4.0-SNAPSHOT</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
|
||||||
<name>tabular-data-statistical-widget</name>
|
<name>tabular-data-statistical-widget</name>
|
||||||
|
@ -122,10 +122,10 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- statistical-manager-algorithms -->
|
<!-- data-miner-manager-widget -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>statistical-manager-algorithms</artifactId>
|
<artifactId>data-miner-manager-widget</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
package org.gcube.portlets.user.td.statisticalwidget.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.ColumnItem;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.statisticalwidget.client.stat.TDSubmissionHandler;
|
||||||
|
import org.gcube.portlets.user.td.statisticalwidget.client.utils.UtilsGXT3;
|
||||||
|
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.TRId;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
||||||
|
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManagerDialog;
|
||||||
|
import org.gcube.portlets.widgets.dataminermanagerwidget.client.tr.TabularResourceData;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* DataMiner Widget
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DataMinerWidget {
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String type;
|
||||||
|
private ArrayList<ColumnItem> columns;
|
||||||
|
|
||||||
|
protected EventBus eventBus;
|
||||||
|
protected TRId trId;
|
||||||
|
protected DataMinerManagerDialog dataMinerManagerDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @param eventBus
|
||||||
|
*/
|
||||||
|
public DataMinerWidget(TRId trId, EventBus eventBus) {
|
||||||
|
this.trId = trId;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
Log.debug("DataMinerWidget: " + trId);
|
||||||
|
|
||||||
|
retrieveTabularResourceInfo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveTabularResourceInfo() {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(trId,
|
||||||
|
new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Log.error("Error retrieving tabular resource informations: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Error",
|
||||||
|
"Error retrieving tabular resource informations");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(TabResource tabResource) {
|
||||||
|
Log.debug("TabResouce: " + tabResource);
|
||||||
|
createTableInfo(tabResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createTableInfo(TabResource tabResource) {
|
||||||
|
id = tabResource.getTrId().getTableId();
|
||||||
|
name = tabResource.getName();
|
||||||
|
description = tabResource.getDescription();
|
||||||
|
type = tabResource.getTableTypeName();
|
||||||
|
|
||||||
|
retrieveTabularResourceColumns();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveTabularResourceColumns() {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumnsForStatistical(trId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Log.error("Error retrieving columns informations: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
"Error retrieving columns informations");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(ArrayList<ColumnData> columnsResult) {
|
||||||
|
Log.debug("Columns: " + columnsResult);
|
||||||
|
createColumnsInfo(columnsResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createColumnsInfo(ArrayList<ColumnData> columnsList) {
|
||||||
|
columns = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ColumnData columnData : columnsList) {
|
||||||
|
ColumnItem columnItem = new ColumnItem(columnData.getColumnId(),
|
||||||
|
columnData.getLabel());
|
||||||
|
columns.add(columnItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
openDataMinerWidget();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void openDataMinerWidget() {
|
||||||
|
TabularResourceData tabularResourceData = new TabularResourceData(id,
|
||||||
|
name, description, type, columns);
|
||||||
|
|
||||||
|
dataMinerManagerDialog = new DataMinerManagerDialog();
|
||||||
|
dataMinerManagerDialog.setTabularResourceData(tabularResourceData);
|
||||||
|
|
||||||
|
TDSubmissionHandler tdSubmissionHandler = new TDSubmissionHandler(this,
|
||||||
|
trId, eventBus);
|
||||||
|
|
||||||
|
dataMinerManagerDialog
|
||||||
|
.addExternalExecutionEventHandler(tdSubmissionHandler);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeDataMinerWidget() {
|
||||||
|
dataMinerManagerDialog.hide();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,145 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.statisticalwidget.client;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|
||||||
import org.gcube.portlets.user.td.statisticalwidget.client.stat.TDExternalTable;
|
|
||||||
import org.gcube.portlets.user.td.statisticalwidget.client.stat.TDSubmissionHandler;
|
|
||||||
import org.gcube.portlets.user.td.statisticalwidget.client.utils.UtilsGXT3;
|
|
||||||
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.TRId;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
|
||||||
import org.gcube.portlets.widgets.StatisticalManagerAlgorithmsWidget.client.ExternalTable;
|
|
||||||
import org.gcube.portlets.widgets.StatisticalManagerAlgorithmsWidget.client.StatisticalManagerExperimentsWidget;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Statistical Widget
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi" <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class StatisticalWidget {
|
|
||||||
private String id;
|
|
||||||
private String label;
|
|
||||||
private Map<String,String> columns;
|
|
||||||
|
|
||||||
protected EventBus eventBus;
|
|
||||||
protected TRId trId;
|
|
||||||
protected StatisticalManagerExperimentsWidget statisticalManagerExperimentsWidget;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param trId
|
|
||||||
* @param eventBus
|
|
||||||
*/
|
|
||||||
public StatisticalWidget(TRId trId, EventBus eventBus) {
|
|
||||||
this.trId = trId;
|
|
||||||
this.eventBus = eventBus;
|
|
||||||
Log.debug("Statistical Widget: " + trId);
|
|
||||||
|
|
||||||
retrieveTabularResourceInfo();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void retrieveTabularResourceInfo() {
|
|
||||||
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(trId,
|
|
||||||
new AsyncCallback<TabResource>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Log.error("Error retrieving tabular resource informations: "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
UtilsGXT3.alert("Error", "Error retrieving tabular resource informations");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(TabResource tabResource) {
|
|
||||||
Log.debug("TabResouce: " + tabResource);
|
|
||||||
createTableInfo(tabResource);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void createTableInfo(TabResource tabResource){
|
|
||||||
id=tabResource.getTrId().getTableId();
|
|
||||||
label=tabResource.getName();
|
|
||||||
|
|
||||||
retrieveTabularResourceColumns();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void retrieveTabularResourceColumns() {
|
|
||||||
TDGWTServiceAsync.INSTANCE.getColumnsForStatistical(trId, new AsyncCallback<ArrayList<ColumnData>>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Log.error("Error retrieving columns informations: "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
UtilsGXT3.alert("Error", "Error retrieving columns informations");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(ArrayList<ColumnData> columnsResult) {
|
|
||||||
Log.debug("Columns: " + columnsResult);
|
|
||||||
createColumnsMap(columnsResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void createColumnsMap(ArrayList<ColumnData> columnsList){
|
|
||||||
columns= new HashMap<String, String>();
|
|
||||||
|
|
||||||
for(ColumnData columnData:columnsList){
|
|
||||||
columns.put(columnData.getColumnId(), columnData.getLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
openStatisticalWidget();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void openStatisticalWidget(){
|
|
||||||
ArrayList<ExternalTable> tables = new ArrayList<ExternalTable>();
|
|
||||||
TDExternalTable tdExternalTable=new TDExternalTable(trId, eventBus, id, label,columns);
|
|
||||||
tables.add(tdExternalTable);
|
|
||||||
TDSubmissionHandler tdSubmissionHandler = new TDSubmissionHandler(this, trId,
|
|
||||||
eventBus);
|
|
||||||
|
|
||||||
|
|
||||||
statisticalManagerExperimentsWidget = new StatisticalManagerExperimentsWidget(
|
|
||||||
null, tables, "ExecutionComputationDefault",
|
|
||||||
tdSubmissionHandler);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void closeStatisticalWidget(){
|
|
||||||
statisticalManagerExperimentsWidget.hide();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -27,7 +27,7 @@ public class StatisticalWidgetEntry implements EntryPoint {
|
||||||
trId.setId("7");
|
trId.setId("7");
|
||||||
trId.setTableId("402");
|
trId.setTableId("402");
|
||||||
|
|
||||||
new StatisticalWidget(trId,eventBus);
|
new DataMinerWidget(trId,eventBus);
|
||||||
|
|
||||||
|
|
||||||
Log.info("Hello!");
|
Log.info("Hello!");
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.statisticalwidget.client.stat;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
||||||
import org.gcube.portlets.widgets.StatisticalManagerAlgorithmsWidget.client.ExternalTable;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author giancarlo
|
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TDExternalTable implements ExternalTable {
|
|
||||||
protected EventBus eventBus;
|
|
||||||
protected TRId trId;
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String label;
|
|
||||||
private Map<String,String> columns;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param trId
|
|
||||||
* @param eventBus
|
|
||||||
* @param id
|
|
||||||
* @param label
|
|
||||||
* @param columns
|
|
||||||
*/
|
|
||||||
public TDExternalTable(TRId trId, EventBus eventBus,String id, String label, Map<String,String> columns) {
|
|
||||||
Log.debug("TDExternalTable: "+trId);
|
|
||||||
this.trId=trId;
|
|
||||||
this.eventBus=eventBus;
|
|
||||||
this.id=id;
|
|
||||||
this.label=label;
|
|
||||||
this.columns=columns;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return "TableId [value="+id+"]";
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getColumnsNameAndLabels() {
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "TDExternalTable [trId=" + trId + ", id=" + id + ", label="
|
|
||||||
+ label + ", columns=" + columns + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ package org.gcube.portlets.user.td.statisticalwidget.client.stat;
|
||||||
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.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.statistical.StatisticalOperationSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.statistical.DataMinerOperationSession;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.statisticalwidget.client.StatisticalWidget;
|
import org.gcube.portlets.user.td.statisticalwidget.client.DataMinerWidget;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||||
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.ChangeTableRequestType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||||
|
@ -15,8 +15,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||||
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.OperationResult;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
import org.gcube.portlets.widgets.StatisticalManagerAlgorithmsWidget.client.SubmissionHandler;
|
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionEvent;
|
||||||
import org.gcube.portlets.widgets.StatisticalManagerAlgorithmsWidget.client.SubmissionParameters;
|
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ExternalExecutionEvent.ExternalExecutionEventHandler;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -28,43 +28,42 @@ import com.google.web.bindery.event.shared.EventBus;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDSubmissionHandler implements SubmissionHandler,
|
public class TDSubmissionHandler implements ExternalExecutionEventHandler,
|
||||||
MonitorDialogListener {
|
MonitorDialogListener {
|
||||||
|
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
protected TRId trId;
|
protected TRId trId;
|
||||||
protected StatisticalWidget statisticalWidget;
|
protected DataMinerWidget dataMinerWidget;
|
||||||
|
|
||||||
public TDSubmissionHandler(StatisticalWidget statisticalWidget, TRId trId, EventBus eventBus) {
|
public TDSubmissionHandler(DataMinerWidget dataMinerWidget, TRId trId,
|
||||||
this.statisticalWidget=statisticalWidget;
|
EventBus eventBus) {
|
||||||
|
this.dataMinerWidget = dataMinerWidget;
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubmit(SubmissionParameters params) {
|
public void onSubmit(ExternalExecutionEvent event) {
|
||||||
Log.debug("SUBMITTED :" + params);
|
Log.debug("SUBMITTED :" + event);
|
||||||
if (params == null) {
|
if (event == null || event.getOp() == null) {
|
||||||
Log.error("Invalid params null");
|
Log.error("Invalid params null");
|
||||||
UtilsGXT3.alert("Error", "Invalid params null");
|
UtilsGXT3.alert("Error", "Invalid params null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statisticalWidget.closeStatisticalWidget();
|
dataMinerWidget.closeDataMinerWidget();
|
||||||
|
|
||||||
StatisticalOperationSession statisticalOperationSession = new StatisticalOperationSession(
|
DataMinerOperationSession statisticalOperationSession = new DataMinerOperationSession(
|
||||||
trId, params.getParametersMap(), params.getDescription(),
|
trId, event.getOp());
|
||||||
params.getTitle(), params.getOp().getId(), params.getOp()
|
|
||||||
.getName(), params.getOp().getBriefDescription());
|
|
||||||
|
|
||||||
callStatisticalOperation(statisticalOperationSession);
|
callDataMinerOperation(statisticalOperationSession);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callStatisticalOperation(
|
protected void callDataMinerOperation(
|
||||||
StatisticalOperationSession statisticalOperationSession) {
|
DataMinerOperationSession dataMinerOperationSession) {
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.startStatisticalOperation(
|
TDGWTServiceAsync.INSTANCE.startDataMinerOperation(
|
||||||
statisticalOperationSession, new AsyncCallback<String>() {
|
dataMinerOperationSession, new AsyncCallback<String>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
@ -76,10 +75,10 @@ public class TDSubmissionHandler implements SubmissionHandler,
|
||||||
UtilsGXT3.alert("Error Locked",
|
UtilsGXT3.alert("Error Locked",
|
||||||
caught.getLocalizedMessage());
|
caught.getLocalizedMessage());
|
||||||
} else {
|
} else {
|
||||||
Log.error("Error in statistical operation: "
|
Log.error("Error in DataMiner operation: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
UtilsGXT3.alert(
|
UtilsGXT3.alert(
|
||||||
"Error in statistical operation",
|
"Error in DataMiner operation",
|
||||||
"Error: "
|
"Error: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
@ -107,7 +106,8 @@ public class TDSubmissionHandler implements SubmissionHandler,
|
||||||
public void operationComplete(OperationResult operationResult) {
|
public void operationComplete(OperationResult operationResult) {
|
||||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
ChangeTableRequestType.STATISTICALOPERATION, operationResult.getTrId(), why);
|
ChangeTableRequestType.STATISTICALOPERATION,
|
||||||
|
operationResult.getTrId(), why);
|
||||||
eventBus.fireEvent(changeTableRequestEvent);
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,12 @@ public class TDSubmissionHandler implements SubmissionHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
public void operationStopped(OperationResult operationResult,
|
||||||
|
String reason, String details) {
|
||||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
ChangeTableRequestType.STATISTICALOPERATION, operationResult.getTrId(), why);
|
ChangeTableRequestType.STATISTICALOPERATION,
|
||||||
|
operationResult.getTrId(), why);
|
||||||
eventBus.fireEvent(changeTableRequestEvent);
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue