the dialog that shows the submit query result has been realized with the pagination. Further, the two hashmap on the server are refreshed when this dialog is closed from the user removing the not useful data related to the submit query
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99351 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
94c8594bf2
commit
8e641ab117
|
@ -23,9 +23,10 @@ public interface GWTdbManagerService extends RemoteService {
|
||||||
List<FileModel> getDBSchema(LinkedHashMap<String, String> dataInput)
|
List<FileModel> getDBSchema(LinkedHashMap<String, String> dataInput)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
List<Result> submitQuery(LinkedHashMap<String, String> dataDB,
|
List<String> submitQuery(LinkedHashMap<String, String> dataDB,
|
||||||
String query, boolean valueReadOnlyQuery,
|
String query, boolean valueReadOnlyQuery,
|
||||||
boolean smartCorrectionQuery, String language, String UID) throws Exception;
|
boolean smartCorrectionQuery, String language, String UID)
|
||||||
|
throws Exception;
|
||||||
|
|
||||||
List<Result> sample(LinkedHashMap<String, String> dataInput)
|
List<Result> sample(LinkedHashMap<String, String> dataInput)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
@ -46,8 +47,10 @@ public interface GWTdbManagerService extends RemoteService {
|
||||||
LinkedHashMap<String, String> dataInput, boolean SearchTable,
|
LinkedHashMap<String, String> dataInput, boolean SearchTable,
|
||||||
String keyword) throws Exception;
|
String keyword) throws Exception;
|
||||||
|
|
||||||
Boolean removeComputation(String uidSubmitQuery) throws Exception;
|
PagingLoadResult<Row> loadSubmitResult(PagingLoadConfig config,
|
||||||
|
List<String> listAttributes, String UID) throws Exception;
|
||||||
|
|
||||||
|
Boolean removeComputation(String submitQueryUID) throws Exception;
|
||||||
|
|
||||||
|
void refreshDataOnServer(String submitQueryUID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.databasesmanager.client;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
|
||||||
|
@ -23,7 +22,7 @@ public interface GWTdbManagerServiceAsync {
|
||||||
|
|
||||||
void submitQuery(LinkedHashMap<String, String> dataDB, String query,
|
void submitQuery(LinkedHashMap<String, String> dataDB, String query,
|
||||||
boolean valueReadOnlyQuery, boolean smartCorrectionQuery,
|
boolean valueReadOnlyQuery, boolean smartCorrectionQuery,
|
||||||
String language, String UID, AsyncCallback<List<Result>> callback);
|
String language, String UID, AsyncCallback<List<String>> callback);
|
||||||
|
|
||||||
void parseCVSString(List<Result> result, List<String> attrNames,
|
void parseCVSString(List<Result> result, List<String> attrNames,
|
||||||
AsyncCallback<List<Row>> callback);
|
AsyncCallback<List<Row>> callback);
|
||||||
|
@ -46,4 +45,10 @@ public interface GWTdbManagerServiceAsync {
|
||||||
|
|
||||||
void removeComputation(String uidSubmitQuery,
|
void removeComputation(String uidSubmitQuery,
|
||||||
AsyncCallback<Boolean> callback);
|
AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
void loadSubmitResult(PagingLoadConfig config,
|
||||||
|
List<String> listAttributes, String UID,
|
||||||
|
AsyncCallback<PagingLoadResult<Row>> callback);
|
||||||
|
|
||||||
|
void refreshDataOnServer(String submitQueryUID, AsyncCallback<Void> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// top toolbar that contains the buttons
|
// top toolbar that contains the buttons
|
||||||
private GxtToolbarFunctionality toolbar;
|
private GxtToolbarFunctionality toolbar;
|
||||||
|
|
||||||
private List<String> listAttributes;
|
// private List<String> listAttributes;
|
||||||
// bus to manage events
|
// bus to manage events
|
||||||
private HandlerManager eventBus = null;
|
private HandlerManager eventBus = null;
|
||||||
// RPC service
|
// RPC service
|
||||||
|
@ -114,7 +114,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
west = new ContentPanel();
|
west = new ContentPanel();
|
||||||
center = new LayoutContainer();
|
center = new LayoutContainer();
|
||||||
treePanel = new GxtTreePanel(eventBus, service);
|
treePanel = new GxtTreePanel(eventBus, service);
|
||||||
// toolbar = new GxtToolbarFunctionality(eventBus);
|
// toolbar = new GxtToolbarFunctionality(eventBus);
|
||||||
toolbar = new GxtToolbarFunctionality(eventBus, RPCservice);
|
toolbar = new GxtToolbarFunctionality(eventBus, RPCservice);
|
||||||
|
|
||||||
this.setHeaderVisible(false); // hide the header of the panel
|
this.setHeaderVisible(false); // hide the header of the panel
|
||||||
|
@ -260,7 +260,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(LoadTablesEvent.TYPE, new LoadTablesEventHandler() {
|
eventBus.addHandler(LoadTablesEvent.TYPE, new LoadTablesEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadTables(LoadTablesEvent loadTablesEvent) {
|
public void onLoadTables(LoadTablesEvent loadTablesEvent) {
|
||||||
// load tables
|
// load tables
|
||||||
|
@ -270,7 +269,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
eventBus.addHandler(SubmitQueryEvent.TYPE,
|
eventBus.addHandler(SubmitQueryEvent.TYPE,
|
||||||
new SubmitQueryEventHandler() {
|
new SubmitQueryEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
|
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
|
||||||
Integer dialogID = new Integer(submitQueryEvent
|
Integer dialogID = new Integer(submitQueryEvent
|
||||||
|
@ -281,7 +279,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(SamplingEvent.TYPE, new SamplingEventHandler() {
|
eventBus.addHandler(SamplingEvent.TYPE, new SamplingEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSampling(SamplingEvent samplingEvent) {
|
public void onSampling(SamplingEvent samplingEvent) {
|
||||||
sample();
|
sample();
|
||||||
|
@ -290,7 +287,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
eventBus.addHandler(SmartSamplingEvent.TYPE,
|
eventBus.addHandler(SmartSamplingEvent.TYPE,
|
||||||
new SmartSamplingEventHandler() {
|
new SmartSamplingEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSmartSampling(
|
public void onSmartSampling(
|
||||||
SmartSamplingEvent smartSamplingEvent) {
|
SmartSamplingEvent smartSamplingEvent) {
|
||||||
|
@ -300,7 +296,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
eventBus.addHandler(RandomSamplingEvent.TYPE,
|
eventBus.addHandler(RandomSamplingEvent.TYPE,
|
||||||
new RandomSamplingEventHandler() {
|
new RandomSamplingEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRandomSampling(
|
public void onRandomSampling(
|
||||||
RandomSamplingEvent randomSamplingEvent) {
|
RandomSamplingEvent randomSamplingEvent) {
|
||||||
|
@ -310,7 +305,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
eventBus.addHandler(ShowCreateTableEvent.TYPE,
|
eventBus.addHandler(ShowCreateTableEvent.TYPE,
|
||||||
new ShowCreateTableEventHandler() {
|
new ShowCreateTableEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowCreateTable(
|
public void onShowCreateTable(
|
||||||
ShowCreateTableEvent showCreateTableEvent) {
|
ShowCreateTableEvent showCreateTableEvent) {
|
||||||
|
@ -363,7 +357,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
String schema = "";
|
String schema = "";
|
||||||
|
|
||||||
if (element.isDatabase()) { // the selected item is a database
|
if (element.isDatabase()) { // the selected item is a database
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "selected element is a database ");
|
rootLogger.log(Level.INFO, "selected element is a database ");
|
||||||
|
|
||||||
database = element.getName();
|
database = element.getName();
|
||||||
|
@ -373,9 +366,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
dataInput.put("ResourceName", resource);
|
dataInput.put("ResourceName", resource);
|
||||||
dataInput.put("DatabaseName", database);
|
dataInput.put("DatabaseName", database);
|
||||||
dataInput.put("SchemaName", "");
|
dataInput.put("SchemaName", "");
|
||||||
|
|
||||||
} else { // the selected item is a schema
|
} else { // the selected item is a schema
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "selected element is a schema ");
|
rootLogger.log(Level.INFO, "selected element is a schema ");
|
||||||
|
|
||||||
FileModel db = treePanel.getTreeStore().getParent(element);
|
FileModel db = treePanel.getTreeStore().getParent(element);
|
||||||
|
@ -388,7 +379,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
dataInput.put("ResourceName", resource);
|
dataInput.put("ResourceName", resource);
|
||||||
dataInput.put("DatabaseName", database);
|
dataInput.put("DatabaseName", database);
|
||||||
dataInput.put("SchemaName", schema);
|
dataInput.put("SchemaName", schema);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
|
@ -402,8 +392,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
@Override
|
@Override
|
||||||
protected void load(Object loadConfig,
|
protected void load(Object loadConfig,
|
||||||
final AsyncCallback<PagingLoadResult<Result>> callback) {
|
final AsyncCallback<PagingLoadResult<Result>> callback) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getTables");
|
rootLogger.log(Level.SEVERE, "Start RPC - getTables");
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "keyword rpc: " + keyword);
|
rootLogger.log(Level.INFO, "keyword rpc: " + keyword);
|
||||||
|
@ -414,7 +402,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
RPCservice.LoadTables((PagingLoadConfig) loadConfig, dataInput,
|
RPCservice.LoadTables((PagingLoadConfig) loadConfig, dataInput,
|
||||||
startSearchTable, keyword,
|
startSearchTable, keyword,
|
||||||
new AsyncCallback<PagingLoadResult<Result>>() {
|
new AsyncCallback<PagingLoadResult<Result>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
rootLogger.log(Level.SEVERE,
|
rootLogger.log(Level.SEVERE,
|
||||||
|
@ -440,7 +427,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
startSearchTable = false;
|
startSearchTable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(
|
public void onSuccess(
|
||||||
PagingLoadResult<Result> result) {
|
PagingLoadResult<Result> result) {
|
||||||
|
@ -531,7 +517,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
toolBarTop.add(cancel);
|
toolBarTop.add(cancel);
|
||||||
|
|
||||||
searchButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
searchButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
// start search calling the rpc
|
// start search calling the rpc
|
||||||
|
@ -566,7 +551,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
cancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
cancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
// clear variables
|
// clear variables
|
||||||
|
@ -596,7 +580,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// listener to manage the table selection in the grid
|
// listener to manage the table selection in the grid
|
||||||
grid.getSelectionModel().addSelectionChangedListener(
|
grid.getSelectionModel().addSelectionChangedListener(
|
||||||
new SelectionChangedListener<Result>() {
|
new SelectionChangedListener<Result>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(
|
public void selectionChanged(
|
||||||
SelectionChangedEvent<Result> se) {
|
SelectionChangedEvent<Result> se) {
|
||||||
|
@ -609,7 +592,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// listener to manage the table selection in the grid
|
// listener to manage the table selection in the grid
|
||||||
grid.addListener(Events.RowClick, new Listener<GridEvent<Result>>() {
|
grid.addListener(Events.RowClick, new Listener<GridEvent<Result>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(final GridEvent<Result> be) {
|
public void handleEvent(final GridEvent<Result> be) {
|
||||||
|
|
||||||
|
@ -634,7 +616,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
|
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(final GridEvent<Result> be) {
|
public void handleEvent(final GridEvent<Result> be) {
|
||||||
rootLogger.log(Level.INFO, "table edited: "
|
rootLogger.log(Level.INFO, "table edited: "
|
||||||
|
@ -650,7 +631,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
grid.addListener(Events.Attach, new Listener<GridEvent<Result>>() {
|
grid.addListener(Events.Attach, new Listener<GridEvent<Result>>() {
|
||||||
public void handleEvent(GridEvent<Result> be) {
|
public void handleEvent(GridEvent<Result> be) {
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "event Attach handled");
|
rootLogger.log(Level.INFO, "event Attach handled");
|
||||||
|
|
||||||
// disable the top toolbar at the first tables loading in such a
|
// disable the top toolbar at the first tables loading in such a
|
||||||
|
@ -732,7 +712,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
keyword = null;
|
keyword = null;
|
||||||
startSearchTable = false;
|
startSearchTable = false;
|
||||||
|
|
||||||
|
@ -746,10 +725,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
canc.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
canc.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
keyword = null;
|
keyword = null;
|
||||||
startSearchTable = false;
|
startSearchTable = false;
|
||||||
// refresh the database information panel
|
// refresh the database information panel
|
||||||
|
@ -758,7 +735,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
tablesLoaded.hide();
|
tablesLoaded.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tablesLoaded.add(grid);
|
tablesLoaded.add(grid);
|
||||||
tablesLoaded.show();
|
tablesLoaded.show();
|
||||||
}
|
}
|
||||||
|
@ -792,11 +768,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// get the data form related to the ID
|
// get the data form related to the ID
|
||||||
final SubmitQueryData dataQuery = submitQueryDataList.get(dialogID);
|
final SubmitQueryData dataQuery = submitQueryDataList.get(dialogID);
|
||||||
|
|
||||||
|
// get the UID related to submitQuery operation
|
||||||
//get the UID related to submitQuery operation
|
LinkedHashMap<Integer, String> uidSubmitQueryList = toolbar
|
||||||
LinkedHashMap<Integer, String> uidSubmitQueryList = toolbar.getUIDSubmitQueryList();
|
.getUIDSubmitQueryList();
|
||||||
String UID = uidSubmitQueryList.get(dialogID);
|
final String UID = uidSubmitQueryList.get(dialogID);
|
||||||
|
|
||||||
|
|
||||||
// rootLogger.log(Level.INFO, "query: "+ dataQuery.getQuery() +
|
// rootLogger.log(Level.INFO, "query: "+ dataQuery.getQuery() +
|
||||||
// "submitquery->dialogID: "
|
// "submitquery->dialogID: "
|
||||||
|
@ -849,7 +824,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
if (dialect.toUpperCase().contains(ConstantsPortlet.POSTGRES)) {
|
if (dialect.toUpperCase().contains(ConstantsPortlet.POSTGRES)) {
|
||||||
language = ConstantsPortlet.POSTGRES;
|
language = ConstantsPortlet.POSTGRES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialect.toUpperCase().contains(ConstantsPortlet.MYSQL)) {
|
if (dialect.toUpperCase().contains(ConstantsPortlet.MYSQL)) {
|
||||||
language = ConstantsPortlet.MYSQL;
|
language = ConstantsPortlet.MYSQL;
|
||||||
}
|
}
|
||||||
|
@ -857,14 +831,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "Dialect used for smart correction: "
|
rootLogger.log(Level.INFO, "Dialect used for smart correction: "
|
||||||
+ language);
|
+ language);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// remote rpc
|
// remote rpc
|
||||||
RPCservice.submitQuery(dataForSubmitQuery, dataQuery.getQuery(), true,
|
RPCservice.submitQuery(dataForSubmitQuery, dataQuery.getQuery(), true,
|
||||||
dataQuery.getSmartCorrection(), language, UID,
|
dataQuery.getSmartCorrection(), language, UID,
|
||||||
new AsyncCallback<List<Result>>() {
|
new AsyncCallback<List<String>>() {
|
||||||
|
|
||||||
// TO REMOVE data "true" as input if you manage the
|
// TO REMOVE data "true" as input if you manage the
|
||||||
// read-only query in the form
|
// read-only query in the form
|
||||||
|
@ -886,51 +856,249 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
form.getBody().unmask();
|
form.getBody().unmask();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// MessageBox.alert("Error "," <br/>Cause:"+caught.getCause()+"<br/>Message:"+caught.getMessage(),
|
|
||||||
// l);
|
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ",
|
||||||
"<br/>Message:" + caught.getMessage(), l);
|
"<br/>Message:" + caught.getMessage(), l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Result> result) {
|
public void onSuccess(List<String> listAttributes) {
|
||||||
|
|
||||||
if (result == null){
|
|
||||||
|
|
||||||
if (form.getBody().isMasked())
|
if (form.getBody().isMasked())
|
||||||
form.getBody().unmask();
|
form.getBody().unmask();
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "No results have been returned");
|
if ((listAttributes == null)
|
||||||
|
|| (listAttributes.size() == 0)) {
|
||||||
|
|
||||||
|
// if (form.getBody().isMasked())
|
||||||
|
// form.getBody().unmask();
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"No results have been returned");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
||||||
rootLogger.log(Level.SEVERE,
|
rootLogger.log(Level.SEVERE, "output size: "
|
||||||
"output size: " + result.size());
|
+ listAttributes.size());
|
||||||
|
|
||||||
// recover query
|
// recover query
|
||||||
// Result query = result.remove(0);
|
// Result query = result.remove(0);
|
||||||
// recover converted query
|
// recover converted query
|
||||||
// Result convertedQuery;
|
// Result convertedQuery;
|
||||||
|
|
||||||
if (dataQuery.getSmartCorrection() == true) {
|
// if (dataQuery.getSmartCorrection() == true) {
|
||||||
result.remove(0);
|
// result.remove(0);
|
||||||
// convertedQuery = result.get(1);
|
// // convertedQuery = result.get(1);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// get the attributes list for the result table
|
// get the attributes list for the result table
|
||||||
getListAttributes(result.get(0).getValue());
|
// List<String> listAttributes = new
|
||||||
// remove the header in order to parse only the result
|
// ArrayList<String>();
|
||||||
result.remove(0);
|
// listAttributes = getListAttributes(result.get(0)
|
||||||
|
// .getValue());
|
||||||
|
// // remove the header in order to parse only the
|
||||||
|
// result
|
||||||
|
// result.remove(0);
|
||||||
|
|
||||||
// parse the result in order to obtain a table
|
// parse the result in order to obtain a table
|
||||||
boolean submitQueryEventManaged = true;
|
// boolean submitQueryEventManaged = true;
|
||||||
parseResult(result, form, dialogID,
|
// parseResult(result, form, dialogID,
|
||||||
submitQueryEventManaged);
|
// submitQueryEventManaged);
|
||||||
|
|
||||||
|
// parseSubmitQueryResult(result, form, dialogID,
|
||||||
|
// listAttributes, dataQuery.getQuery());
|
||||||
|
|
||||||
|
parseSubmitQueryResult(form, dialogID, listAttributes,
|
||||||
|
UID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start the parsing of the submit result in order to obtain a table
|
||||||
|
private void parseSubmitQueryResult(Dialog dialog, final int dialogID,
|
||||||
|
final List<String> listAttributes, final String UID) {
|
||||||
|
|
||||||
|
final Dialog form = dialog;
|
||||||
|
|
||||||
|
// define the proxy and create the grid to display in the dialog
|
||||||
|
// create RpcProxy object to use the load configuration
|
||||||
|
RpcProxy<PagingLoadResult<Row>> proxy = new RpcProxy<PagingLoadResult<Row>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void load(Object loadConfig,
|
||||||
|
final AsyncCallback<PagingLoadResult<Row>> callback) {
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"Start RPC - loadSubmitQueryResult");
|
||||||
|
|
||||||
|
// remote rpc
|
||||||
|
RPCservice.loadSubmitResult((PagingLoadConfig) loadConfig,
|
||||||
|
listAttributes, UID,
|
||||||
|
new AsyncCallback<PagingLoadResult<Row>>() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"FAILURE RPC loadSubmitQueryResult");
|
||||||
|
MessageBox.alert("Error ", "<br/>Message:"
|
||||||
|
+ caught.getMessage(), null);
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onSuccess(PagingLoadResult<Row> result) {
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"SUCCESS RPC loadSubmitQueryResult");
|
||||||
|
callback.onSuccess(result);
|
||||||
|
List<Row> rows = result.getData();
|
||||||
|
if (form.getBody().isMasked())
|
||||||
|
form.getBody().unmask();
|
||||||
|
|
||||||
|
if ((rows == null) || (rows.size() == 0)) {
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"No results have been returned");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if (result != null) {
|
||||||
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "rows not null");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// loader to load page enabled set of data
|
||||||
|
final PagingLoader<PagingLoadResult<Row>> loader = new BasePagingLoader<PagingLoadResult<Row>>(
|
||||||
|
proxy);
|
||||||
|
|
||||||
|
// to create the listStore using the loader
|
||||||
|
final ListStore<Row> store = new ListStore<Row>(loader);
|
||||||
|
|
||||||
|
// bind the loader with a PagingToolBar.
|
||||||
|
final PagingToolBar toolBar = new PagingToolBar(100);
|
||||||
|
toolBar.bind(loader);
|
||||||
|
|
||||||
|
// create the grid with a result list and the column model
|
||||||
|
|
||||||
|
Grid<Row> grid;
|
||||||
|
grid = new Grid<Row>(store, createColumnModel(listAttributes));
|
||||||
|
|
||||||
|
grid.setLoadMask(true);
|
||||||
|
grid.setBorders(true);
|
||||||
|
grid.setStripeRows(true);
|
||||||
|
// to manage the table selection in the grid
|
||||||
|
grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
|
grid.addListener(Events.Attach, new Listener<GridEvent<Row>>() {
|
||||||
|
public void handleEvent(GridEvent<Row> be) {
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "event Attach handled");
|
||||||
|
|
||||||
|
// disable the top toolbar at the first tables loading in such a
|
||||||
|
// way to disallow a user the search. It will be enabled in the
|
||||||
|
// rpc when the tables are retrieved.
|
||||||
|
// toolBarTop.disable();
|
||||||
|
|
||||||
|
PagingLoadConfig config = new BasePagingLoadConfig();
|
||||||
|
// The offset for the first record to retrieve.
|
||||||
|
config.setOffset(0);
|
||||||
|
// The number of records being requested.
|
||||||
|
config.setLimit(100);
|
||||||
|
|
||||||
|
// if (state.containsKey("offset")) {
|
||||||
|
// // rootLogger.log(Level.INFO, "state contains offset");
|
||||||
|
// int offset = (Integer) state.get("offset");
|
||||||
|
// rootLogger.log(Level.INFO, "offset: " + offset);
|
||||||
|
// int limit = (Integer) state.get("limit");
|
||||||
|
// rootLogger.log(Level.INFO, "limit: " + limit);
|
||||||
|
// config.setOffset(offset);
|
||||||
|
// config.setLimit(limit);
|
||||||
|
// }
|
||||||
|
// if (state.containsKey("sortField")) {
|
||||||
|
// config.setSortField((String) state.get("sortField"));
|
||||||
|
// config.setSortDir(SortDir.valueOf((String) state
|
||||||
|
// .get("sortDir")));
|
||||||
|
// }
|
||||||
|
loader.load(config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// // Display the submit query result as a table
|
||||||
|
// Dialog submitResult = new Dialog();
|
||||||
|
// submitResult.setLayout(new FitLayout());
|
||||||
|
//
|
||||||
|
// //TODO DA MODIFICARE
|
||||||
|
// submitResult.setHeading("Result");
|
||||||
|
// submitResult.setSize(600, 400);
|
||||||
|
//
|
||||||
|
// submitResult.add(grid);
|
||||||
|
// submitResult.show();
|
||||||
|
|
||||||
|
// Display the submit query result as a table
|
||||||
|
Dialog submitResult = new Dialog() {
|
||||||
|
// override the maximize event modifying it with
|
||||||
|
// a different behaviour if the mimimize event
|
||||||
|
// occurs
|
||||||
|
public void maximize() {
|
||||||
|
if (isCollapsed()) {
|
||||||
|
expand();
|
||||||
|
} else {
|
||||||
|
super.maximize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
submitResult.setLayout(new FitLayout());
|
||||||
|
submitResult.setHeading("Result Query " + dialogID);
|
||||||
|
submitResult.setResizable(false);
|
||||||
|
submitResult.setSize(600, 400);
|
||||||
|
submitResult.setScrollMode(Scroll.NONE);
|
||||||
|
submitResult.setHideOnButtonClick(true);
|
||||||
|
submitResult.setMaximizable(true);
|
||||||
|
submitResult.setMinimizable(true);
|
||||||
|
submitResult.setBottomComponent(toolBar);
|
||||||
|
|
||||||
|
// mimimize event handled
|
||||||
|
submitResult.addListener(Events.Minimize, new Listener<WindowEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(WindowEvent be) {
|
||||||
|
// collapse the dialog
|
||||||
|
be.getWindow().collapse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// maximize event handled
|
||||||
|
submitResult.addListener(Events.Maximize, new Listener<WindowEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(WindowEvent be) {
|
||||||
|
// expand the dialog
|
||||||
|
if (be.getWindow().isCollapsed()) {
|
||||||
|
be.getWindow().expand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
submitResult.addListener(Events.Hide, new Listener<WindowEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(WindowEvent be) {
|
||||||
|
// call rpc to remove the stored result
|
||||||
|
RPCservice.refreshDataOnServer(UID, new AsyncCallback<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"FAILURE RPC refreshDataOnServer");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"SUCCESS RPC refreshDataOnServer");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
submitResult.add(grid);
|
||||||
|
submitResult.show();
|
||||||
|
}
|
||||||
|
|
||||||
// method to perform the sample table
|
// method to perform the sample table
|
||||||
private void sample() {
|
private void sample() {
|
||||||
|
|
||||||
|
@ -1008,13 +1176,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
getListAttributes(result.get(0).getValue());
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
listAttributes = getListAttributes(result.get(0).getValue());
|
||||||
// remove the header in order to parse only
|
// remove the header in order to parse only
|
||||||
// the result
|
// the result
|
||||||
result.remove(0);
|
result.remove(0);
|
||||||
// parse the result in order to obtain a
|
// parse the result in order to obtain a
|
||||||
// table
|
// table
|
||||||
parseResult(result, null, 0, false);
|
parseResult(result, listAttributes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1090,13 +1259,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
getListAttributes(result.get(0).getValue());
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
listAttributes = getListAttributes(result.get(0).getValue());
|
||||||
// remove the header in order to parse only
|
// remove the header in order to parse only
|
||||||
// the result
|
// the result
|
||||||
result.remove(0);
|
result.remove(0);
|
||||||
// parse the result in order to obtain a
|
// parse the result in order to obtain a
|
||||||
// table
|
// table
|
||||||
parseResult(result, null, 0, false);
|
parseResult(result, listAttributes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1325,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
RPCservice.randomSample(dataInput, new AsyncCallback<List<Result>>() {
|
RPCservice.randomSample(dataInput, new AsyncCallback<List<Result>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
|
@ -1166,7 +1335,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Result> result) {
|
public void onSuccess(List<Result> result) {
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC randomSample");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC randomSample");
|
||||||
|
@ -1174,28 +1342,28 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
getListAttributes(result.get(0).getValue());
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
listAttributes = getListAttributes(result.get(0).getValue());
|
||||||
// remove the header in order to parse only
|
// remove the header in order to parse only
|
||||||
// the result
|
// the result
|
||||||
result.remove(0);
|
result.remove(0);
|
||||||
// parse the result in order to obtain a
|
// parse the result in order to obtain a
|
||||||
// table
|
// table
|
||||||
parseResult(result, null, 0, false);
|
parseResult(result, listAttributes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the parsing of the submit result in order to obtain a table
|
// start the parsing of the submit result in order to obtain a table
|
||||||
private void parseResult(List<Result> result, Dialog dialog,
|
private void parseResult(List<Result> result,
|
||||||
final int dialogID, final boolean submitQueryEventManaged) {
|
final List<String> listAttributes) {
|
||||||
|
|
||||||
// to unmask the entire content panel
|
// to unmask the entire content panel
|
||||||
final GxtBorderLayoutPanel obj = this;
|
final GxtBorderLayoutPanel obj = this;
|
||||||
final Dialog form = dialog;
|
// final Dialog form = dialog;
|
||||||
|
|
||||||
RPCservice.parseCVSString(result, listAttributes,
|
RPCservice.parseCVSString(result, listAttributes,
|
||||||
new AsyncCallback<List<Row>>() {
|
new AsyncCallback<List<Row>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
|
@ -1206,24 +1374,26 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// if the submit query event has been performed the
|
// if the submit query event has been performed the
|
||||||
// dialog form is unmasked otherwise if a sampling
|
// dialog form is unmasked otherwise if a sampling
|
||||||
// operation is performed the entire panel is masked.
|
// operation is performed the entire panel is masked.
|
||||||
if (submitQueryEventManaged == true) {
|
|
||||||
|
|
||||||
if (form.getBody().isMasked())
|
|
||||||
form.getBody().unmask();
|
|
||||||
} else {
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
|
// if (submitQueryEventManaged == true) {
|
||||||
|
//
|
||||||
|
// if (form.getBody().isMasked())
|
||||||
|
// form.getBody().unmask();
|
||||||
|
// } else {
|
||||||
|
// if (obj.isMasked()) {
|
||||||
|
// obj.unmask();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Row> rows) {
|
public void onSuccess(List<Row> rows) {
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC parseResult");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC parseResult");
|
||||||
|
|
||||||
if (rows != null) {
|
if (rows != null) {
|
||||||
// Display the submit query result as a table
|
// Display the submit query result as a table
|
||||||
Dialog submitResult = new Dialog() {
|
Dialog sampleResult = new Dialog() {
|
||||||
// override the maximize event modifying it with
|
// override the maximize event modifying it with
|
||||||
// a different behaviour if the mimimize event
|
// a different behaviour if the mimimize event
|
||||||
// occurs
|
// occurs
|
||||||
|
@ -1235,35 +1405,37 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
submitResult.setLayout(new FitLayout());
|
|
||||||
|
|
||||||
if (submitQueryEventManaged == true) {
|
// if (submitQueryEventManaged == true) {
|
||||||
submitResult.setHeading("Result Query "
|
// submitResult.setHeading("Result Query "
|
||||||
+ dialogID);
|
// + dialogID);
|
||||||
} else {
|
// } else {
|
||||||
submitResult.setHeading("Result");
|
// submitResult.setHeading("Result");
|
||||||
}
|
// }
|
||||||
|
|
||||||
submitResult.setResizable(false);
|
sampleResult.setLayout(new FitLayout());
|
||||||
|
sampleResult.setHeading("Result");
|
||||||
|
sampleResult.setResizable(false);
|
||||||
// submitResult.setHeading("Submit Query");
|
// submitResult.setHeading("Submit Query");
|
||||||
// submitResult.setWidth(290);
|
// submitResult.setWidth(290);
|
||||||
// submitResult.setHeight(250);
|
// submitResult.setHeight(250);
|
||||||
// submitResult.setModal(true);
|
// submitResult.setModal(true);
|
||||||
// submitResult.setBlinkModal(true);
|
// submitResult.setBlinkModal(true);
|
||||||
// submitResult.setBodyStyle("padding:9px;");
|
// submitResult.setBodyStyle("padding:9px;");
|
||||||
submitResult.setSize(600, 400);
|
sampleResult.setSize(600, 400);
|
||||||
// submitResult.setScrollMode(Scroll.AUTO);
|
// submitResult.setScrollMode(Scroll.AUTO);
|
||||||
submitResult.setScrollMode(Scroll.NONE);
|
sampleResult.setScrollMode(Scroll.NONE);
|
||||||
submitResult.setHideOnButtonClick(true);
|
sampleResult.setHideOnButtonClick(true);
|
||||||
submitResult.setMaximizable(true);
|
sampleResult.setMaximizable(true);
|
||||||
submitResult.setMinimizable(true);
|
sampleResult.setMinimizable(true);
|
||||||
// submitResult.addText("Result Table");
|
// submitResult.addText("Result Table");
|
||||||
|
|
||||||
ListStore<Row> store = new ListStore<Row>();
|
ListStore<Row> store = new ListStore<Row>();
|
||||||
store.add(rows);
|
store.add(rows);
|
||||||
|
|
||||||
Grid<Row> grid;
|
Grid<Row> grid;
|
||||||
grid = new Grid<Row>(store, createColumnModel());
|
grid = new Grid<Row>(store,
|
||||||
|
createColumnModel(listAttributes));
|
||||||
|
|
||||||
// grid.setAutoExpandColumn("value");
|
// grid.setAutoExpandColumn("value");
|
||||||
grid.setBorders(true);
|
grid.setBorders(true);
|
||||||
|
@ -1273,7 +1445,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
data.setMargins(new Margins(6));
|
data.setMargins(new Margins(6));
|
||||||
|
|
||||||
// mimimize event handled
|
// mimimize event handled
|
||||||
submitResult.addListener(Events.Minimize,
|
sampleResult.addListener(Events.Minimize,
|
||||||
new Listener<WindowEvent>() {
|
new Listener<WindowEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1283,7 +1455,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// maximize event handled
|
// maximize event handled
|
||||||
submitResult.addListener(Events.Maximize,
|
sampleResult.addListener(Events.Maximize,
|
||||||
new Listener<WindowEvent>() {
|
new Listener<WindowEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1295,55 +1467,67 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
submitResult.add(grid, data);
|
sampleResult.add(grid, data);
|
||||||
submitResult.show();
|
sampleResult.show();
|
||||||
|
|
||||||
// if the submit query event has been performed the
|
// if the submit query event has been performed the
|
||||||
// dialog form is unmasked otherwise if a sampling
|
// dialog form is unmasked otherwise if a sampling
|
||||||
// operation is performed the entire panel is
|
// operation is performed the entire panel is
|
||||||
// masked.
|
// masked.
|
||||||
|
|
||||||
if (submitQueryEventManaged == true) {
|
// if (submitQueryEventManaged == true) {
|
||||||
if (form.getBody().isMasked())
|
// if (form.getBody().isMasked())
|
||||||
form.getBody().unmask();
|
// form.getBody().unmask();
|
||||||
} else {
|
// } else {
|
||||||
|
// if (obj.isMasked()) {
|
||||||
|
// obj.unmask();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (submitQueryEventManaged == true) {
|
|
||||||
if (form.getBody().isMasked())
|
|
||||||
form.getBody().unmask();
|
|
||||||
} else {
|
} else {
|
||||||
|
// if (submitQueryEventManaged == true) {
|
||||||
|
// if (form.getBody().isMasked())
|
||||||
|
// form.getBody().unmask();
|
||||||
|
// } else {
|
||||||
|
// if (obj.isMasked()) {
|
||||||
|
// obj.unmask();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// get attributes list for display the result in a table
|
// get attributes list for display the result in a table
|
||||||
private void getListAttributes(String value) {
|
private List<String> getListAttributes(String value) {
|
||||||
|
|
||||||
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
// recover attribute fields for the result table
|
// recover attribute fields for the result table
|
||||||
String headers = value;
|
String headers = value;
|
||||||
rootLogger.log(Level.INFO, "Headers fields table: " + headers);
|
// rootLogger.log(Level.INFO, "Headers fields table: " + headers);
|
||||||
|
|
||||||
listAttributes = parseAttributesTableResult(headers);
|
listAttributes = parseAttributesTableResult(headers);
|
||||||
rootLogger.log(Level.INFO,
|
rootLogger.log(Level.INFO,
|
||||||
"attributes number: " + listAttributes.size());
|
"attributes number: " + listAttributes.size());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "attributes list: ");
|
// rootLogger.log(Level.INFO, "attributes list: ");
|
||||||
for (int i = 0; i < listAttributes.size(); i++) {
|
// print check
|
||||||
rootLogger.log(Level.INFO, "attribute: " + listAttributes.get(i));
|
// for (int i = 0; i < listAttributes.size(); i++) {
|
||||||
}
|
// rootLogger.log(Level.INFO, "attribute: " + listAttributes.get(i));
|
||||||
|
// }
|
||||||
|
|
||||||
|
return listAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create column configuration for the grid
|
// create column configuration for the grid
|
||||||
private ColumnModel createColumnModel() {
|
private ColumnModel createColumnModel(List<String> listAttributes) {
|
||||||
|
|
||||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
ColumnConfig column;
|
ColumnConfig column;
|
||||||
|
@ -1357,7 +1541,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
for (int i = 0; i < listAttributes.size(); i++) {
|
for (int i = 0; i < listAttributes.size(); i++) {
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "attribute: " + listAttributes.get(i));
|
// rootLogger.log(Level.INFO, "attribute: " +
|
||||||
|
// listAttributes.get(i));
|
||||||
column = new ColumnConfig();
|
column = new ColumnConfig();
|
||||||
column.setId(listAttributes.get(i));
|
column.setId(listAttributes.get(i));
|
||||||
// column.setId("\"" + fields.get(i) + "\"");
|
// column.setId("\"" + fields.get(i) + "\"");
|
||||||
|
@ -1640,7 +1825,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayTableName(String tableName) {
|
private void displayTableName(String tableName) {
|
||||||
rootLogger.log(Level.INFO, "displaying table name" + tableName
|
rootLogger.log(Level.INFO, "displaying table name " + tableName
|
||||||
+ " in the panel");
|
+ " in the panel");
|
||||||
|
|
||||||
Result table = new Result("Selected table", tableName);
|
Result table = new Result("Selected table", tableName);
|
||||||
|
|
|
@ -174,7 +174,6 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnSubmitQuery
|
btnSubmitQuery
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
@ -219,7 +218,6 @@ public class GxtToolbarFunctionality {
|
||||||
// minimize event handled
|
// minimize event handled
|
||||||
dialog.addListener(Events.Minimize,
|
dialog.addListener(Events.Minimize,
|
||||||
new Listener<WindowEvent>() {
|
new Listener<WindowEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(WindowEvent be) {
|
public void handleEvent(WindowEvent be) {
|
||||||
// collapse the dialog
|
// collapse the dialog
|
||||||
|
@ -230,7 +228,6 @@ public class GxtToolbarFunctionality {
|
||||||
// override maximize event
|
// override maximize event
|
||||||
dialog.addListener(Events.Maximize,
|
dialog.addListener(Events.Maximize,
|
||||||
new Listener<WindowEvent>() {
|
new Listener<WindowEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(WindowEvent be) {
|
public void handleEvent(WindowEvent be) {
|
||||||
// expand the dialog
|
// expand the dialog
|
||||||
|
@ -243,10 +240,8 @@ public class GxtToolbarFunctionality {
|
||||||
// listener on the dialog "ok" button
|
// listener on the dialog "ok" button
|
||||||
dialog.getButtonById(Dialog.OK).addSelectionListener(
|
dialog.getButtonById(Dialog.OK).addSelectionListener(
|
||||||
new SelectionListener<ButtonEvent>() {
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// recover info from dialog
|
// recover info from dialog
|
||||||
setInfoOnSubmitQuery(form, dialog,
|
setInfoOnSubmitQuery(form, dialog,
|
||||||
dialogID);
|
dialogID);
|
||||||
|
@ -259,13 +254,15 @@ public class GxtToolbarFunctionality {
|
||||||
dialog.getButtonById(Dialog.CANCEL)
|
dialog.getButtonById(Dialog.CANCEL)
|
||||||
.addSelectionListener(
|
.addSelectionListener(
|
||||||
new SelectionListener<ButtonEvent>() {
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(
|
public void componentSelected(
|
||||||
ButtonEvent ce) {
|
ButtonEvent ce) {
|
||||||
rootLogger.log(Level.INFO,
|
rootLogger.log(Level.INFO,
|
||||||
"button Cancel event");
|
"button Cancel event");
|
||||||
|
|
||||||
|
if (uidSubmitQueryList
|
||||||
|
.get(dialogID)!=null){
|
||||||
|
|
||||||
// remove computation
|
// remove computation
|
||||||
RPCservice.removeComputation(
|
RPCservice.removeComputation(
|
||||||
uidSubmitQueryList
|
uidSubmitQueryList
|
||||||
|
@ -287,7 +284,6 @@ public class GxtToolbarFunctionality {
|
||||||
+ uidSubmitQueryList
|
+ uidSubmitQueryList
|
||||||
.get(dialogID));
|
.get(dialogID));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -298,6 +294,7 @@ public class GxtToolbarFunctionality {
|
||||||
"FAILURE RPC removeComputation");
|
"FAILURE RPC removeComputation");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}
|
}
|
||||||
|
@ -307,10 +304,8 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnSimpleSample
|
btnSimpleSample
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new SamplingEvent());
|
eventBus.fireEvent(new SamplingEvent());
|
||||||
}
|
}
|
||||||
|
@ -318,10 +313,8 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnSmartSample
|
btnSmartSample
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new SmartSamplingEvent());
|
eventBus.fireEvent(new SmartSamplingEvent());
|
||||||
}
|
}
|
||||||
|
@ -329,10 +322,8 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnRandomSample
|
btnRandomSample
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new RandomSamplingEvent());
|
eventBus.fireEvent(new RandomSamplingEvent());
|
||||||
}
|
}
|
||||||
|
@ -340,10 +331,8 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnShowCreateTable
|
btnShowCreateTable
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new ShowCreateTableEvent());
|
eventBus.fireEvent(new ShowCreateTableEvent());
|
||||||
}
|
}
|
||||||
|
@ -351,10 +340,8 @@ public class GxtToolbarFunctionality {
|
||||||
|
|
||||||
btnTablesList
|
btnTablesList
|
||||||
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new LoadTablesEvent());
|
eventBus.fireEvent(new LoadTablesEvent());
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,22 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
List<Result> result = new ArrayList<Result>();
|
List<Result> result = new ArrayList<Result>();
|
||||||
session.setAttribute("TablesResult", result);
|
session.setAttribute("TablesResult", result);
|
||||||
|
|
||||||
|
// map that contains the submit query result and the related uid
|
||||||
|
HashMap<String, List<Result>> submitQueryResult = new HashMap<String, List<Result>>();
|
||||||
|
session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
|
||||||
|
// map that contains the the submit query result parsed and the related
|
||||||
|
// uid
|
||||||
|
HashMap<String, List<Row>> submitQueryResultParsed = new HashMap<String, List<Row>>();
|
||||||
|
session.setAttribute("submitQueryResultParsed", submitQueryResultParsed);
|
||||||
|
|
||||||
|
// List<Result> submitQueryResult = new ArrayList<Result>();
|
||||||
|
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
|
||||||
|
// attributes name for a result of a submit query operation
|
||||||
|
// List<String> attributeNames = new ArrayList<String>();
|
||||||
|
// session.setAttribute("attributeNames", attributeNames);
|
||||||
|
|
||||||
// information about a database
|
// information about a database
|
||||||
String currentDB = "";
|
String currentDB = "";
|
||||||
session.setAttribute("currentDB", currentDB);
|
session.setAttribute("currentDB", currentDB);
|
||||||
|
@ -108,6 +124,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
HashMap<String, String> JobStatusMap = new HashMap<String, String>();
|
HashMap<String, String> JobStatusMap = new HashMap<String, String>();
|
||||||
session.setAttribute("JobStatusList", JobStatusMap);
|
session.setAttribute("JobStatusList", JobStatusMap);
|
||||||
|
|
||||||
|
// information about query submitted
|
||||||
|
// String currentQuerySubmitted = "";
|
||||||
|
// session.setAttribute("currentQuerySubmitted", currentQuerySubmitted);
|
||||||
|
// String previousQuerySubmitted = "";
|
||||||
|
// session.setAttribute("previousQuerySubmitted",
|
||||||
|
// previousQuerySubmitted);
|
||||||
|
|
||||||
|
// HashMap<String, List<Result>> obj = new HashMap<String,
|
||||||
|
// List<Result>>();
|
||||||
|
// session.setAttribute("", obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// to get resources from IS
|
// to get resources from IS
|
||||||
|
@ -488,7 +515,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
// to submit a query
|
// to submit a query
|
||||||
@Override
|
@Override
|
||||||
public List<Result> submitQuery(LinkedHashMap<String, String> dataDB,
|
public List<String> submitQuery(LinkedHashMap<String, String> dataDB,
|
||||||
String query, boolean valueReadOnlyQuery,
|
String query, boolean valueReadOnlyQuery,
|
||||||
boolean smartCorrectionQuery, String language, String UID)
|
boolean smartCorrectionQuery, String language, String UID)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -501,6 +528,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// List<Result> output = new ArrayList<Result>();
|
// List<Result> output = new ArrayList<Result>();
|
||||||
List<Result> output = null;
|
List<Result> output = null;
|
||||||
|
|
||||||
|
// list that contains table attributes
|
||||||
|
List<String> listAttributes = null;
|
||||||
|
|
||||||
// get list of algorithms
|
// get list of algorithms
|
||||||
List<String> algorithms = new ArrayList<String>();
|
List<String> algorithms = new ArrayList<String>();
|
||||||
algorithms = getDatabaseManagerAlgorithms();
|
algorithms = getDatabaseManagerAlgorithms();
|
||||||
|
@ -573,17 +603,23 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
mapValues.get(String.valueOf(i)));
|
mapValues.get(String.valueOf(i)));
|
||||||
output.add(row);
|
output.add(row);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// get the attributes list for the result table
|
||||||
|
listAttributes = new ArrayList<String>();
|
||||||
|
listAttributes = getListAttributes(output.get(0).getValue());
|
||||||
|
// remove the header in order to parse only the result
|
||||||
|
output.remove(0);
|
||||||
|
|
||||||
|
// store the result of the submit query operation
|
||||||
|
updateSubmitQueryResultMap(UID, output);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
return listAttributes;
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Result> sample(LinkedHashMap<String, String> dataInput)
|
public List<Result> sample(LinkedHashMap<String, String> dataInput)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -879,6 +915,90 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
return outputParameters;
|
return outputParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parse result for Submit query
|
||||||
|
public PagingLoadResult<Row> loadSubmitResult(PagingLoadConfig config,
|
||||||
|
List<String> listAttributes, String UID) throws Exception {
|
||||||
|
|
||||||
|
// check to verify if the submit query result has been already parsed
|
||||||
|
// boolean checkOnDataParsed = checkOnSubmitQueryResultParsed(UID);
|
||||||
|
|
||||||
|
// data parsed
|
||||||
|
List<Row> data = new ArrayList<Row>();
|
||||||
|
// submit query result
|
||||||
|
List<Result> result = new ArrayList<Result>();
|
||||||
|
//get parsed data
|
||||||
|
data = getSubmitQueryResultParsed(UID);
|
||||||
|
|
||||||
|
if ((data == null)) {
|
||||||
|
// parse the submit query result
|
||||||
|
result = getSubmitQueryResult(UID);
|
||||||
|
|
||||||
|
if ((result != null) && (result.size() != 0)) {
|
||||||
|
data = parseCVSString(result, listAttributes);
|
||||||
|
updateSubmitQueryResultParsed(UID, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a sublist and add data to list according
|
||||||
|
// to the limit and offset value of the config
|
||||||
|
List<Row> sublist = new ArrayList<Row>();
|
||||||
|
BasePagingLoadResult loadResult = null;
|
||||||
|
|
||||||
|
int start = config.getOffset();
|
||||||
|
int limit = data.size();
|
||||||
|
|
||||||
|
if (config.getLimit() > 0) {
|
||||||
|
limit = Math.min(start + config.getLimit(), limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalNumber = data.size();
|
||||||
|
sublist = new ArrayList<Row>(data.subList(start, limit));
|
||||||
|
loadResult = new BasePagingLoadResult<Row>(sublist, config.getOffset(),
|
||||||
|
totalNumber);
|
||||||
|
|
||||||
|
// System.out.println("start: " + start);
|
||||||
|
// System.out.println("limit: " + limit);
|
||||||
|
// System.out.println("sublist size: " + sublist.size());
|
||||||
|
|
||||||
|
return loadResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get attributes list for display the result in a table
|
||||||
|
private List<String> getListAttributes(String value) {
|
||||||
|
|
||||||
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
|
||||||
|
// recover attribute fields for the result table
|
||||||
|
String headers = value;
|
||||||
|
// logger.info("Headers fields table: " + headers);
|
||||||
|
|
||||||
|
listAttributes = parseAttributesTableResult(headers);
|
||||||
|
// logger.info("attributes number: " + listAttributes.size());
|
||||||
|
|
||||||
|
// logger.info("attributes list: ");
|
||||||
|
// print check
|
||||||
|
// for (int i = 0; i < listAttributes.size(); i++) {
|
||||||
|
// logger.info("attribute: " + listAttributes.get(i));
|
||||||
|
// }
|
||||||
|
|
||||||
|
return listAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> parseAttributesTableResult(String phrase) {
|
||||||
|
String delimiter = ",";
|
||||||
|
List<String> elements = new ArrayList<String>();
|
||||||
|
int idxdelim = -1;
|
||||||
|
phrase = phrase.trim();
|
||||||
|
|
||||||
|
while ((idxdelim = phrase.indexOf(delimiter)) >= 0) {
|
||||||
|
elements.add(phrase.substring(0, idxdelim));
|
||||||
|
phrase = phrase.substring(idxdelim + 1).trim();
|
||||||
|
}
|
||||||
|
elements.add(phrase);
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
// parse a csv row in a list of values
|
// parse a csv row in a list of values
|
||||||
@Override
|
@Override
|
||||||
public List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
public List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
||||||
|
@ -1002,7 +1122,86 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
//update job with the related status
|
private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
|
.getAttribute("submitQueryResult");
|
||||||
|
if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||||
|
return submitQueryResult.get(submitQueryUID);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized List<Row> getSubmitQueryResultParsed(
|
||||||
|
String submitQueryUID) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
|
||||||
|
if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||||
|
return submitQueryResultParsed.get(submitQueryUID);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void updateSubmitQueryResultParsed(
|
||||||
|
String submitQueryUID, List<Row> data) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
// add data
|
||||||
|
if (data.size() != 0) {
|
||||||
|
submitQueryResultParsed.put(submitQueryUID, data);
|
||||||
|
session.setAttribute("submitQueryResultParsed",
|
||||||
|
submitQueryResultParsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void removeResultParsed(String submitQueryUID) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||||
|
// remove data parsed
|
||||||
|
submitQueryResultParsed.remove(submitQueryUID);
|
||||||
|
// update
|
||||||
|
session.setAttribute("submitQueryResultParsed",
|
||||||
|
submitQueryResultParsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void updateSubmitQueryResultMap(String submitQueryUID,
|
||||||
|
List<Result> result) {
|
||||||
|
if (submitQueryUID != null) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
|
.getAttribute("submitQueryResult");
|
||||||
|
submitQueryResult.put(submitQueryUID, result);
|
||||||
|
session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void removeResult(String submitQueryUID) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
|
.getAttribute("submitQueryResult");
|
||||||
|
if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||||
|
// remove data parsed
|
||||||
|
submitQueryResult.remove(submitQueryUID);
|
||||||
|
// update
|
||||||
|
session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update job with the related status
|
||||||
private synchronized void updateJobStatus(String jobID, String status) {
|
private synchronized void updateJobStatus(String jobID, String status) {
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// add the job status
|
// add the job status
|
||||||
|
@ -1013,26 +1212,32 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
JobStatusMap.put(jobID, status);
|
JobStatusMap.put(jobID, status);
|
||||||
session.setAttribute("JobStatusList", JobStatusMap);
|
session.setAttribute("JobStatusList", JobStatusMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove job with the related status
|
// remove job with the related status
|
||||||
private synchronized void removeJobStatus(String jobID) {
|
private synchronized void removeJobStatus(String jobID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
|
|
||||||
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
||||||
.getAttribute("JobStatusList");
|
.getAttribute("JobStatusList");
|
||||||
|
|
||||||
String status = JobStatusMap.get(jobID);
|
String status = JobStatusMap.get(jobID);
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
|
|
||||||
JobStatusMap.remove(jobID);
|
JobStatusMap.remove(jobID);
|
||||||
session.setAttribute("JobStatusList", JobStatusMap);
|
session.setAttribute("JobStatusList", JobStatusMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//update job with the computation id
|
// get job status
|
||||||
|
private synchronized String getJobStatus(String jobID) {
|
||||||
|
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
|
.getSession());
|
||||||
|
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
||||||
|
.getAttribute("JobStatusList");
|
||||||
|
String status = JobStatusMap.get(jobID);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update job with the computation id
|
||||||
private synchronized void updateJob(String jobID, String computationId) {
|
private synchronized void updateJob(String jobID, String computationId) {
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// add the computation in the map
|
// add the computation in the map
|
||||||
|
@ -1045,7 +1250,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove job with the computation id
|
// remove job with the computation id
|
||||||
private synchronized String removeJob(String jobID) {
|
private synchronized String removeJob(String jobID) {
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// System.out.println("remove jobID " + job);
|
// System.out.println("remove jobID " + job);
|
||||||
|
@ -1287,7 +1492,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
return SessionUtil.getScope(httpSession);
|
return SessionUtil.getScope(httpSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove the computation
|
// remove the computation
|
||||||
public Boolean removeComputation(String uidSubmitQuery) throws Exception {
|
public Boolean removeComputation(String uidSubmitQuery) throws Exception {
|
||||||
|
|
||||||
// System.out.println("server UID: " + uidSubmitQuery);
|
// System.out.println("server UID: " + uidSubmitQuery);
|
||||||
|
@ -1296,11 +1501,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
if ((uidSubmitQuery != null) && (!(uidSubmitQuery.equals("")))) {
|
if ((uidSubmitQuery != null) && (!(uidSubmitQuery.equals("")))) {
|
||||||
// get job status
|
// get job status
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
// ASLSession session = WsUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
// .getThreadLocalRequest().getSession());
|
||||||
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
// HashMap<String, String> JobStatusMap = (HashMap<String, String>)
|
||||||
.getAttribute("JobStatusList");
|
// session
|
||||||
String status = JobStatusMap.get(uidSubmitQuery);
|
// .getAttribute("JobStatusList");
|
||||||
|
// String status = JobStatusMap.get(uidSubmitQuery);
|
||||||
|
|
||||||
|
String status = getJobStatus(uidSubmitQuery);
|
||||||
|
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
// the computation has not started
|
// the computation has not started
|
||||||
|
@ -1332,4 +1540,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
return (new Boolean(true));
|
return (new Boolean(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refreshDataOnServer(String submitQueryUID) {
|
||||||
|
|
||||||
|
if ((submitQueryUID != null) && (!submitQueryUID.equals(""))) {
|
||||||
|
removeResultParsed(submitQueryUID);
|
||||||
|
removeResult(submitQueryUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue