sampling added
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98365 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0b85126f89
commit
e2c1826227
|
@ -33,6 +33,8 @@ public interface GWTdbManagerService extends RemoteService {
|
||||||
String query, boolean valueReadOnlyQuery,
|
String query, boolean valueReadOnlyQuery,
|
||||||
boolean smartCorrectionQuery, String language) throws Exception;
|
boolean smartCorrectionQuery, String language) throws Exception;
|
||||||
|
|
||||||
|
List<Result> sample(LinkedHashMap<String, String> dataInput) throws Exception;
|
||||||
|
|
||||||
List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -33,4 +33,7 @@ public interface GWTdbManagerServiceAsync {
|
||||||
void parseCVSString(List<Result> result, List<String> attrNames,
|
void parseCVSString(List<Result> result, List<String> attrNames,
|
||||||
AsyncCallback<List<Row>> callback);
|
AsyncCallback<List<Row>> callback);
|
||||||
|
|
||||||
|
void sample(LinkedHashMap<String, String> dataInput,
|
||||||
|
AsyncCallback<List<Result>> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
private static int ID = 0;
|
private static int ID = 0;
|
||||||
// private int id;
|
// private int id;
|
||||||
private boolean isExpanded = true;
|
private boolean isExpanded = true;
|
||||||
// private boolean isSchema = false;
|
// private boolean isSchema = false;
|
||||||
private boolean isLoaded = false;
|
private boolean isLoaded = false;
|
||||||
// private boolean isTable = false;
|
// private boolean isTable = false;
|
||||||
private boolean isDatabase = false;
|
private boolean isDatabase = false;
|
||||||
|
|
|
@ -4,6 +4,7 @@ public enum EventsTypeEnum {
|
||||||
|
|
||||||
SELECTED_ITEM_EVENT,
|
SELECTED_ITEM_EVENT,
|
||||||
SUBMIT_QUERY_EVENT,
|
SUBMIT_QUERY_EVENT,
|
||||||
SHOW_CREATE_TABLE_EVENT;
|
SHOW_CREATE_TABLE_EVENT,
|
||||||
|
SAMPLING_EVENT;
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.gcube.portlets.user.databasesmanager.client.events;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SamplingEventHandler;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
public class SamplingEvent extends GwtEvent<SamplingEventHandler> {
|
||||||
|
|
||||||
|
public static Type<SamplingEventHandler> TYPE = new Type<SamplingEventHandler>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<SamplingEventHandler> getAssociatedType() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(SamplingEventHandler handler) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
handler.onSampling(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventsTypeEnum getKey() {
|
||||||
|
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return EventsTypeEnum.SAMPLING_EVENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
//"SelectedItemEvent" event definition
|
//"SelectedItemEvent" event definition
|
||||||
|
|
||||||
public class SelectedItemEvent extends GwtEvent<SelectedItemEventHandler> {
|
public class SelectedItemEvent extends GwtEvent<SelectedItemEventHandler> {
|
||||||
|
|
||||||
public static Type<SelectedItemEventHandler> TYPE = new Type<SelectedItemEventHandler>();
|
public static Type<SelectedItemEventHandler> TYPE = new Type<SelectedItemEventHandler>();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.portlets.user.databasesmanager.client.events.interfaces;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.events.SamplingEvent;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface SamplingEventHandler extends EventHandler {
|
||||||
|
public void onSampling(SamplingEvent samplingEvent);
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package org.gcube.portlets.user.databasesmanager.client.panels;
|
package org.gcube.portlets.user.databasesmanager.client.panels;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,8 +11,10 @@ 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;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData;
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.events.SamplingEvent;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.SelectedItemEvent;
|
import org.gcube.portlets.user.databasesmanager.client.events.SelectedItemEvent;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
|
import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SamplingEventHandler;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedItemEventHandler;
|
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedItemEventHandler;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SubmitQueryEventHandler;
|
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SubmitQueryEventHandler;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.toolbar.GxtToolbarFunctionality;
|
import org.gcube.portlets.user.databasesmanager.client.toolbar.GxtToolbarFunctionality;
|
||||||
|
@ -76,6 +76,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// RPC service
|
// RPC service
|
||||||
private GWTdbManagerServiceAsync RPCservice = null;
|
private GWTdbManagerServiceAsync RPCservice = null;
|
||||||
|
|
||||||
|
// variable that keeps track of the managed event
|
||||||
|
private boolean submitQueryEventManaged = false;
|
||||||
|
|
||||||
public GxtBorderLayoutPanel(HandlerManager eBus,
|
public GxtBorderLayoutPanel(HandlerManager eBus,
|
||||||
GWTdbManagerServiceAsync service) throws Exception {
|
GWTdbManagerServiceAsync service) throws Exception {
|
||||||
|
|
||||||
|
@ -97,6 +100,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
private void initLayout() {
|
private void initLayout() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
north.setLayout(new FitLayout());
|
north.setLayout(new FitLayout());
|
||||||
north.setTopComponent(toolbar.getToolBar());
|
north.setTopComponent(toolbar.getToolBar());
|
||||||
north.add(toolbar.getToolBar());
|
north.add(toolbar.getToolBar());
|
||||||
|
@ -197,23 +202,23 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onSelectedItem(
|
public void onSelectedItem(
|
||||||
SelectedItemEvent selectedItemEvent) {
|
SelectedItemEvent selectedItemEvent) {
|
||||||
|
|
||||||
// System.out
|
// System.out
|
||||||
// .println("GxtBorderLayoutPanel: Event received");
|
// .println("GxtBorderLayoutPanel: Event received");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Event received");
|
rootLogger.log(Level.SEVERE, "Event received");
|
||||||
|
|
||||||
int DepthSelectedItem = treePanel
|
int DepthSelectedItem = treePanel
|
||||||
.getTreeDepthSelectedItem();
|
.getTreeDepthSelectedItem();
|
||||||
|
|
||||||
// System.out.println("GxtBorderLayoutPanel-> Depth: "
|
// System.out.println("GxtBorderLayoutPanel-> Depth: "
|
||||||
// + DepthSelectedItem);
|
// + DepthSelectedItem);
|
||||||
|
|
||||||
// element name selected
|
// element name selected
|
||||||
String text = treePanel.getValue();
|
String text = treePanel.getValue();
|
||||||
|
|
||||||
// System.out
|
// System.out
|
||||||
// .println("GxtBorderLayoutPanel-> item selected: "
|
// .println("GxtBorderLayoutPanel-> item selected: "
|
||||||
// + text);
|
// + text);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "item selected: " + text);
|
rootLogger.log(Level.INFO, "item selected: " + text);
|
||||||
|
|
||||||
|
@ -238,9 +243,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// show database information in the panel
|
// show database information in the panel
|
||||||
|
|
||||||
// List<FileModel> data = treePanel.getTreePanel()
|
// List<FileModel> data = treePanel.getTreePanel()
|
||||||
// .getSelectionModel().getSelectedItems();
|
// .getSelectionModel().getSelectedItems();
|
||||||
// FileModel selectedItem = data.get(0);
|
// FileModel selectedItem = data.get(0);
|
||||||
|
|
||||||
FileModel parent = treePanel.getTreeStore()
|
FileModel parent = treePanel.getTreeStore()
|
||||||
.getParent(selectedItem);
|
.getParent(selectedItem);
|
||||||
|
@ -252,9 +257,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//display the table name in the right panel when a table is selected
|
// display the table name in the right panel when a
|
||||||
|
// table is selected
|
||||||
|
|
||||||
if (DepthSelectedItem == 5){
|
if (DepthSelectedItem == 5) {
|
||||||
|
|
||||||
centerUpper.removeAll();
|
centerUpper.removeAll();
|
||||||
|
|
||||||
|
@ -264,7 +270,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((DepthSelectedItem == 4) && (data.get(0).isSchema() == false)){
|
if ((DepthSelectedItem == 4)
|
||||||
|
&& (data.get(0).isSchema() == false)) {
|
||||||
|
|
||||||
centerUpper.removeAll();
|
centerUpper.removeAll();
|
||||||
|
|
||||||
|
@ -274,8 +281,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out
|
// System.out
|
||||||
// .println("GxtBorderLayoutPanel: Event finished");
|
// .println("GxtBorderLayoutPanel: Event finished");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Event finished");
|
rootLogger.log(Level.SEVERE, "Event finished");
|
||||||
|
|
||||||
|
@ -290,24 +297,44 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
|
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
|
// submitQuery();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
submitQuery();
|
submitQuery();
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(SamplingEvent.TYPE, new SamplingEventHandler() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSampling(SamplingEvent samplingEvent) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
sample();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitQuery() throws Exception {
|
private void submitQuery() {
|
||||||
|
|
||||||
// System.out.println("Start RPC - submitQuery");
|
// System.out.println("Start RPC - submitQuery");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - submitQuery");
|
rootLogger.log(Level.SEVERE, "Start RPC - submitQuery");
|
||||||
|
|
||||||
|
// variable that keeps track of the managed event
|
||||||
|
submitQueryEventManaged = false;
|
||||||
|
|
||||||
// recover input data
|
// recover input data
|
||||||
|
|
||||||
LinkedHashMap<String, String> dataDB = treePanel
|
LinkedHashMap<String, String> dataDB = treePanel
|
||||||
|
@ -330,13 +357,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
if (selectedItem.isDatabase()) { // the selected item is a database
|
if (selectedItem.isDatabase()) { // the selected item is a database
|
||||||
|
|
||||||
// System.out.println("the selected item is a database");
|
// System.out.println("the selected item is a database");
|
||||||
rootLogger.log(Level.INFO, "the selected item is a database");
|
rootLogger.log(Level.INFO, "the selected item is a database");
|
||||||
|
|
||||||
// determine the dialect recovering the dialect
|
// determine the dialect recovering the dialect
|
||||||
dialect = selectedItem.getDBInfo().get(2).getValue();
|
dialect = selectedItem.getDBInfo().get(2).getValue();
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "determined Dialect for smart correction: " + dialect);
|
rootLogger.log(Level.INFO,
|
||||||
|
"determined Dialect for smart correction: " + dialect);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FileModel parent1 = treePanel.getTreeStore()
|
FileModel parent1 = treePanel.getTreeStore()
|
||||||
|
@ -344,20 +372,21 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
if (parent1.isDatabase()) { // the selected item is a schema
|
if (parent1.isDatabase()) { // the selected item is a schema
|
||||||
|
|
||||||
// System.out.println("the selected item is a schema");
|
// System.out.println("the selected item is a schema");
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "the selected item is a schema");
|
rootLogger.log(Level.INFO, "the selected item is a schema");
|
||||||
|
|
||||||
// determine the dialect recovering the dialect
|
// determine the dialect recovering the dialect
|
||||||
dialect = parent1.getDBInfo().get(2).getValue();
|
dialect = parent1.getDBInfo().get(2).getValue();
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "determined Dialect for smart correction: " + dialect);
|
rootLogger.log(Level.INFO,
|
||||||
|
"determined Dialect for smart correction: " + dialect);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else { // the selected item is a table
|
else { // the selected item is a table
|
||||||
|
|
||||||
// System.out.println("the selected item is a table");
|
// System.out.println("the selected item is a table");
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "the selected item is a table");
|
rootLogger.log(Level.INFO, "the selected item is a table");
|
||||||
|
|
||||||
|
@ -366,7 +395,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// determine the dialect recovering the dialect
|
// determine the dialect recovering the dialect
|
||||||
dialect = parent2.getDBInfo().get(2).getValue();
|
dialect = parent2.getDBInfo().get(2).getValue();
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "determined Dialect for smart correction: " + dialect);
|
rootLogger.log(Level.INFO,
|
||||||
|
"determined Dialect for smart correction: " + dialect);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +414,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
language = ConstantsPortlet.MYSQL;
|
language = ConstantsPortlet.MYSQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "Dialect used for smart correction: " + language);
|
rootLogger.log(Level.INFO, "Dialect used for smart correction: "
|
||||||
|
+ language);
|
||||||
|
|
||||||
RPCservice.submitQuery(dataDB, dataQuery.getQuery(), true,
|
RPCservice.submitQuery(dataDB, dataQuery.getQuery(), true,
|
||||||
dataQuery.getSmartCorrection(), language,
|
dataQuery.getSmartCorrection(), language,
|
||||||
|
@ -399,32 +430,33 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
|
|
||||||
// System.out.println("FAILURE submitQuery");
|
// System.out.println("FAILURE submitQuery");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC submitQuery");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC submitQuery");
|
||||||
|
|
||||||
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||||
public void handleEvent(MessageBoxEvent ce) {
|
public void handleEvent(MessageBoxEvent ce) {
|
||||||
// Button btn = ce.getButtonClicked();
|
// Button btn = ce.getButtonClicked();
|
||||||
// Info.display("MessageBox", "The '{0}' button was pressed", btn.getHtml());
|
// Info.display("MessageBox",
|
||||||
|
// "The '{0}' button was pressed",
|
||||||
|
// btn.getHtml());
|
||||||
|
|
||||||
// Button btn = ce.getButtonClicked();
|
// Button btn = ce.getButtonClicked();
|
||||||
|
|
||||||
Dialog form = toolbar.getDialogForm();
|
Dialog form = toolbar.getDialogForm();
|
||||||
|
|
||||||
if (form.isMasked())
|
if (form.isMasked())
|
||||||
form.unmask();
|
form.unmask();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// MessageBox.alert("Error "," <br/>Cause:"+caught.getCause()+"<br/>Message:"+caught.getMessage(), l);
|
// MessageBox.alert("Error "," <br/>Cause:"+caught.getCause()+"<br/>Message:"+caught.getMessage(),
|
||||||
MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(), l);
|
// l);
|
||||||
|
MessageBox.alert("Error ",
|
||||||
|
"<br/>Message:" + caught.getMessage(), l);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,21 +464,20 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onSuccess(List<Result> result) {
|
public void onSuccess(List<Result> result) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
// System.out.println("SUCCESS submitQuery");
|
// System.out.println("SUCCESS submitQuery");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
||||||
|
|
||||||
rows = new ArrayList<Row>();
|
rows = new ArrayList<Row>();
|
||||||
|
|
||||||
|
// System.out.println("result size: " + result.size());
|
||||||
|
|
||||||
// System.out.println("result size: " + result.size());
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"output size: " + result.size());
|
||||||
rootLogger.log(Level.SEVERE, "output size: " + result.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;
|
||||||
|
|
||||||
|
@ -463,7 +494,112 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// remove the header in order to parse only the result
|
// remove the header in order to parse only the result
|
||||||
result.remove(0);
|
result.remove(0);
|
||||||
|
|
||||||
//parse the result in order to obtain a table
|
// variable that keeps track of the managed event
|
||||||
|
submitQueryEventManaged = true;
|
||||||
|
|
||||||
|
// parse the result in order to obtain a table
|
||||||
|
parseResult(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sample() {
|
||||||
|
|
||||||
|
// this.mask();
|
||||||
|
|
||||||
|
// System.out.println("Start RPC - submitQuery");
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "Start RPC - sample");
|
||||||
|
|
||||||
|
// get the selected table
|
||||||
|
|
||||||
|
List<FileModel> data = treePanel.getTreePanel().getSelectionModel()
|
||||||
|
.getSelectedItems();
|
||||||
|
|
||||||
|
// the selected item is a table
|
||||||
|
FileModel selectedItem = data.get(0);
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "the selected table is: " + selectedItem);
|
||||||
|
|
||||||
|
// recover data inputs
|
||||||
|
|
||||||
|
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
|
// check if the table has an associated schema
|
||||||
|
FileModel schema;
|
||||||
|
FileModel database;
|
||||||
|
FileModel resource;
|
||||||
|
|
||||||
|
if (treePanel.getTreeStore().getParent(selectedItem).isSchema()) {
|
||||||
|
schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
database = treePanel.getTreeStore().getParent(schema);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", schema.getName());
|
||||||
|
dataInput.put("TableName", selectedItem.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// the table has not a schema
|
||||||
|
database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
dataInput.put("TableName", selectedItem.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// call remote service
|
||||||
|
|
||||||
|
RPCservice.sample(dataInput, new AsyncCallback<List<Result>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
|
// System.out.println("FAILURE");
|
||||||
|
rootLogger.log(Level.SEVERE, "FAILURE RPC sample");
|
||||||
|
|
||||||
|
MessageBox.alert("Error ",
|
||||||
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Result> result) {
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC sample");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rows = new ArrayList<Row>();
|
||||||
|
|
||||||
|
// System.out.println("result size: " + result.size());
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "output size: " + result.size());
|
||||||
|
|
||||||
|
// get the attributes list for the result table
|
||||||
|
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
|
||||||
parseResult(result);
|
parseResult(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -475,6 +611,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// 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) {
|
private void parseResult(List<Result> result) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RPCservice.parseCVSString(result, listAttributes,
|
RPCservice.parseCVSString(result, listAttributes,
|
||||||
new AsyncCallback<List<Row>>() {
|
new AsyncCallback<List<Row>>() {
|
||||||
|
|
||||||
|
@ -483,7 +621,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
Window.alert(caught.getMessage());
|
Window.alert(caught.getMessage());
|
||||||
// System.out.println("FAILURE StartParse");
|
// System.out.println("FAILURE StartParse");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC parseResult");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC parseResult");
|
||||||
|
|
||||||
|
@ -492,22 +630,37 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<Row> rows) {
|
public void onSuccess(List<Row> rows) {
|
||||||
|
|
||||||
// System.out.println("Success StartParse");
|
|
||||||
|
|
||||||
|
// System.out.println("Success StartParse");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC parseResult");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC parseResult");
|
||||||
|
|
||||||
if (rows != null) {
|
if (submitQueryEventManaged == true) {
|
||||||
|
|
||||||
Dialog form = toolbar.getDialogForm();
|
Dialog form = toolbar.getDialogForm();
|
||||||
|
|
||||||
if (form.isMasked())
|
if (form.isMasked())
|
||||||
form.unmask();
|
form.unmask();
|
||||||
|
|
||||||
|
|
||||||
form.hide();
|
form.hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// else {
|
||||||
|
|
||||||
|
if (rows != null) {
|
||||||
|
|
||||||
|
// Dialog form = toolbar.getDialogForm();
|
||||||
|
//
|
||||||
|
// if (form.isMasked())
|
||||||
|
// form.unmask();
|
||||||
|
//
|
||||||
|
// form.hide();
|
||||||
|
|
||||||
// Display the submit query result as a table
|
// Display the submit query result as a table
|
||||||
Dialog submitResult = new Dialog();
|
Dialog submitResult = new Dialog();
|
||||||
submitResult.setLayout(new FitLayout());
|
submitResult.setLayout(new FitLayout());
|
||||||
|
@ -550,6 +703,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
submitResult.show();
|
submitResult.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -585,23 +740,22 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// recover attribute fields fo the result table
|
// recover attribute fields fo the result table
|
||||||
String headers = value;
|
String headers = value;
|
||||||
|
|
||||||
// System.out.println("headers: " + headers);
|
// System.out.println("headers: " + headers);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "Headers fields table: " + headers);
|
rootLogger.log(Level.INFO, "Headers fields table: " + headers);
|
||||||
|
|
||||||
listAttributes = parseAttributesTableResult(headers);
|
listAttributes = parseAttributesTableResult(headers);
|
||||||
|
|
||||||
|
// System.out.println("attributes number: " + listAttributes.size());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO,
|
||||||
// System.out.println("attributes number: " + listAttributes.size());
|
"attributes number: " + listAttributes.size());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "attributes number: " + listAttributes.size());
|
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "attributes list: ");
|
rootLogger.log(Level.INFO, "attributes list: ");
|
||||||
|
|
||||||
for (int i = 0; i < listAttributes.size(); i++) {
|
for (int i = 0; i < listAttributes.size(); i++) {
|
||||||
|
|
||||||
// System.out.println(listAttributes.get(i));
|
// System.out.println(listAttributes.get(i));
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "attribute: " + listAttributes.get(i));
|
rootLogger.log(Level.INFO, "attribute: " + listAttributes.get(i));
|
||||||
|
|
||||||
|
@ -625,7 +779,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
for (int i = 0; i < listAttributes.size(); i++) {
|
for (int i = 0; i < listAttributes.size(); i++) {
|
||||||
|
|
||||||
// System.out.println("attribute: " + listAttributes.get(i));
|
// System.out.println("attribute: " + listAttributes.get(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));
|
||||||
|
@ -702,7 +856,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
private void displayDBInfo(FileModel element) {
|
private void displayDBInfo(FileModel element) {
|
||||||
|
|
||||||
// System.out.println("GxtBorderLayout->displaying info");
|
// System.out.println("GxtBorderLayout->displaying info");
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "displaying info");
|
rootLogger.log(Level.INFO, "displaying info");
|
||||||
|
|
||||||
|
@ -710,7 +864,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
List<Result> dataDB = element.getDBInfo();
|
List<Result> dataDB = element.getDBInfo();
|
||||||
|
|
||||||
// System.out.println("GxtBorderLayout->size info: " + dataDB.size());
|
// System.out.println("GxtBorderLayout->size info: " + dataDB.size());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "info size: " + dataDB.size());
|
rootLogger.log(Level.INFO, "info size: " + dataDB.size());
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.gcube.portlets.user.databasesmanager.client.panels;
|
package org.gcube.portlets.user.databasesmanager.client.panels;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -151,7 +149,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
public void selectionChanged(
|
public void selectionChanged(
|
||||||
SelectionChangedEvent<FileModel> se) {
|
SelectionChangedEvent<FileModel> se) {
|
||||||
|
|
||||||
// System.out.println("SelectionChangedListener");
|
// System.out.println("SelectionChangedListener");
|
||||||
|
|
||||||
dataDBInfo = null;
|
dataDBInfo = null;
|
||||||
|
|
||||||
|
@ -174,21 +172,27 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// element
|
// element
|
||||||
// selected
|
// selected
|
||||||
|
|
||||||
|
FileModel selectedItem = data.get(0);
|
||||||
|
|
||||||
value = data.get(0).get("name");
|
value = data.get(0).get("name");
|
||||||
|
|
||||||
// System.out.println("GxtTreePanel Value: "
|
// System.out.println("GxtTreePanel Value: "
|
||||||
// + data.get(0).get("name"));
|
// + data.get(0).get("name"));
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "GxtTreePanel-> selectedItem value: " + value);
|
rootLogger.log(Level.INFO,
|
||||||
|
"GxtTreePanel-> selectedItem value: " + value);
|
||||||
|
|
||||||
// System.out.println("GxtTreePanel Depth: "
|
// System.out.println("GxtTreePanel Depth: "
|
||||||
// + store.getDepth(data.get(0)));
|
// + store.getDepth(data.get(0)));
|
||||||
|
|
||||||
treeDepthSelectedItem = store.getDepth(data.get(0));
|
treeDepthSelectedItem = store.getDepth(data.get(0));
|
||||||
|
|
||||||
// rootLogger.log(Level.INFO, "GxtTreePanel-> selectedItem level depth: " + treeDepthSelectedItem);
|
// rootLogger.log(Level.INFO,
|
||||||
|
// "GxtTreePanel-> selectedItem level depth: " +
|
||||||
|
// treeDepthSelectedItem);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "selectedItem level depth: " + treeDepthSelectedItem);
|
rootLogger.log(Level.INFO, "selectedItem level depth: "
|
||||||
|
+ treeDepthSelectedItem);
|
||||||
|
|
||||||
int numChildrenFolder = store.getChildCount(data.get(0));
|
int numChildrenFolder = store.getChildCount(data.get(0));
|
||||||
|
|
||||||
|
@ -197,9 +201,12 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
setInfoOnSelectedItem(data.get(0));
|
setInfoOnSelectedItem(data.get(0));
|
||||||
|
|
||||||
|
// check to make the RPC call once
|
||||||
if ((numChildrenFolder == 0)
|
if ((numChildrenFolder == 0)
|
||||||
&& (data.get(0).isLoaded() != true)) {
|
&& (data.get(0).isLoaded() != true)) {
|
||||||
|
|
||||||
treePanel.mask("Loading", "x-mask-loading");
|
treePanel.mask("Loading", "x-mask-loading");
|
||||||
|
// selectedItem.setIsSchema(false);
|
||||||
|
|
||||||
switch (treeDepthSelectedItem) {
|
switch (treeDepthSelectedItem) {
|
||||||
// case 1:
|
// case 1:
|
||||||
|
@ -208,20 +215,27 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
// selectedItem.setIsSchema(false);
|
||||||
loadDBInfo(data.get(0));
|
loadDBInfo(data.get(0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
// selectedItem.setIsSchema(false);
|
||||||
loadSchema(data.get(0));
|
loadSchema(data.get(0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
// selectedItem.setIsSchema(false);
|
||||||
loadTables(data.get(0));
|
loadTables(data.get(0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
setInfoOnSelectedItem(data.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
// fire event
|
// fire event
|
||||||
eventBus.fireEvent(new SelectedItemEvent());
|
eventBus.fireEvent(new SelectedItemEvent());
|
||||||
|
|
||||||
|
@ -232,11 +246,10 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
private void loadRootItemTree() throws Exception {
|
private void loadRootItemTree() throws Exception {
|
||||||
|
|
||||||
// treePanel.mask("Loading", "x-mask-loading");
|
// treePanel.mask("Loading", "x-mask-loading");
|
||||||
|
|
||||||
this.mask("Loading", "x-mask-loading");
|
this.mask("Loading", "x-mask-loading");
|
||||||
|
|
||||||
|
|
||||||
final FileModel root = new FileModel("Resources");
|
final FileModel root = new FileModel("Resources");
|
||||||
store.insert(root, 0, true);
|
store.insert(root, 0, true);
|
||||||
|
|
||||||
|
@ -259,9 +272,10 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
private void loadResources(final FileModel element, final GxtTreePanel tree) {
|
private void loadResources(final FileModel element, final GxtTreePanel tree) {
|
||||||
|
|
||||||
// System.out.println("Start RPC - getResources");
|
// System.out.println("Start RPC - getResources");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getResource");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> Start RPC - getResource");
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getResource");
|
rootLogger.log(Level.SEVERE, "Start RPC - getResource");
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
@ -271,14 +285,16 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
// System.out.println("FAILURE");
|
// System.out.println("FAILURE");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> FAILURE RPC getResource");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> FAILURE RPC getResource");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC getResource");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC getResource");
|
||||||
|
|
||||||
MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(), null);
|
MessageBox.alert("Error ",
|
||||||
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,23 +304,26 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
if (tree.isMasked())
|
if (tree.isMasked())
|
||||||
tree.unmask();
|
tree.unmask();
|
||||||
|
|
||||||
// if (treePanel.isMasked())
|
// if (treePanel.isMasked())
|
||||||
// treePanel.unmask();
|
// treePanel.unmask();
|
||||||
|
|
||||||
// System.out.println("SUCCESS");
|
// System.out.println("SUCCESS");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> SUCCESS RPC getResource");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> SUCCESS RPC getResource");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC getResource");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC getResource");
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
for (int i = 0; i < result.size(); i++) {
|
for (int i = 0; i < result.size(); i++) {
|
||||||
|
|
||||||
// System.out.println(result.get(i).getName());
|
// System.out.println(result.get(i).getName());
|
||||||
|
|
||||||
// rootLogger.log(Level.INFO, "GxtTreePanel-> Resource: " + result.get(i).getName());
|
// rootLogger.log(Level.INFO, "GxtTreePanel-> Resource: " +
|
||||||
|
// result.get(i).getName());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "Resource: " + result.get(i).getName());
|
rootLogger.log(Level.INFO, "Resource: "
|
||||||
|
+ result.get(i).getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,22 +337,21 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// System.out.println("End RPC - getResources");
|
// System.out.println("End RPC - getResources");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getResource");
|
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getResource");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "End RPC - getResource");
|
rootLogger.log(Level.SEVERE, "End RPC - getResource");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDBInfo(final FileModel element) {
|
private void loadDBInfo(final FileModel element) {
|
||||||
|
|
||||||
// System.out.println("Start RPC - getDBInfo");
|
// System.out.println("Start RPC - getDBInfo");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getDBInfo");
|
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getDBInfo");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getDBInfo");
|
rootLogger.log(Level.SEVERE, "Start RPC - getDBInfo");
|
||||||
|
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
|
||||||
RPCservice.getDBInfo(element.getName(),
|
RPCservice.getDBInfo(element.getName(),
|
||||||
|
@ -342,15 +360,16 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
// System.out.println("FAILURE");
|
// System.out.println("FAILURE");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> FAILURE RPC getDBInfo");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> FAILURE RPC getDBInfo");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC getDBInfo");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC getDBInfo");
|
||||||
|
|
||||||
MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(), null);
|
MessageBox.alert("Error ",
|
||||||
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,9 +380,10 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
if (treePanel.isMasked())
|
if (treePanel.isMasked())
|
||||||
treePanel.unmask();
|
treePanel.unmask();
|
||||||
|
|
||||||
// System.out.println("SUCCESS");
|
// System.out.println("SUCCESS");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> SUCCESS RPC getDBInfo");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> SUCCESS RPC getDBInfo");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC getDBInfo");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC getDBInfo");
|
||||||
|
|
||||||
|
@ -375,7 +395,8 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
Object[] array = keys.toArray();
|
Object[] array = keys.toArray();
|
||||||
|
|
||||||
// System.out.println("array size: " + array.length);
|
// System.out.println("array size: " +
|
||||||
|
// array.length);
|
||||||
|
|
||||||
// recover information for each database
|
// recover information for each database
|
||||||
|
|
||||||
|
@ -465,12 +486,17 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("children number: "
|
// System.out.println("children number: "
|
||||||
// + store.getChildCount(element));
|
// + store.getChildCount(element));
|
||||||
|
|
||||||
// rootLogger.log(Level.INFO, "GxtTreePanel-> children number: " + store.getChildCount(element));
|
// rootLogger.log(Level.INFO,
|
||||||
|
// "GxtTreePanel-> children number: " +
|
||||||
|
// store.getChildCount(element));
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "children number: " + store.getChildCount(element));
|
rootLogger.log(
|
||||||
|
Level.INFO,
|
||||||
|
"children number: "
|
||||||
|
+ store.getChildCount(element));
|
||||||
|
|
||||||
element.setIsLoaded(true);
|
element.setIsLoaded(true);
|
||||||
|
|
||||||
|
@ -481,9 +507,9 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// System.out.println("End RPC - getDBInfo");
|
// System.out.println("End RPC - getDBInfo");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getDBInfo");
|
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getDBInfo");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "End RPC - getDBInfo");
|
rootLogger.log(Level.SEVERE, "End RPC - getDBInfo");
|
||||||
|
|
||||||
|
@ -491,9 +517,10 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
private void loadSchema(final FileModel element) {
|
private void loadSchema(final FileModel element) {
|
||||||
|
|
||||||
// System.out.println("Start RPC - getSchema");
|
// System.out.println("Start RPC - getSchema");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getDBSchema");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> Start RPC - getDBSchema");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getDBSchema");
|
rootLogger.log(Level.SEVERE, "Start RPC - getDBSchema");
|
||||||
|
|
||||||
|
@ -512,37 +539,42 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
// System.out.println("FAILURE");
|
// System.out.println("FAILURE");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> FAILURE RPC getDBSchema");
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> FAILURE RPC getDBSchema");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC getDBSchema");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC getDBSchema");
|
||||||
|
|
||||||
MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(), null);
|
MessageBox.alert("Error ",
|
||||||
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<FileModel> result) {
|
public void onSuccess(List<FileModel> result) {
|
||||||
|
|
||||||
if (treePanel.isMasked())
|
|
||||||
treePanel.unmask();
|
|
||||||
|
|
||||||
// System.out.println("SUCCESS");
|
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> SUCCESS RPC getDBSchema");
|
// System.out.println("SUCCESS");
|
||||||
|
|
||||||
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
// "GxtTreePanel-> SUCCESS RPC getDBSchema");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC getDBSchema");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC getDBSchema");
|
||||||
|
|
||||||
|
|
||||||
if (result.size() == 0) { // the database has not schema
|
if (result.size() == 0) { // the database has not schema
|
||||||
|
|
||||||
|
// element.setIsSchema(false);
|
||||||
|
// element.setIsLoaded(false);
|
||||||
loadTables(element);
|
loadTables(element);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (treePanel.isMasked())
|
||||||
|
treePanel.unmask();
|
||||||
|
|
||||||
// // print check
|
// // print check
|
||||||
// for (int i = 0; i < result.size(); i++) {
|
// for (int i = 0; i < result.size(); i++) {
|
||||||
// System.out.println(result.get(i).getName());
|
// System.out.println(result.get(i).getName());
|
||||||
|
@ -563,9 +595,9 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// System.out.println("End RPC - getSchema");
|
// System.out.println("End RPC - getSchema");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getDBSchema");
|
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> End RPC - getDBSchema");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "End RPC - getDBSchema");
|
rootLogger.log(Level.SEVERE, "End RPC - getDBSchema");
|
||||||
|
|
||||||
|
@ -573,9 +605,9 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
private void loadTables(final FileModel element) {
|
private void loadTables(final FileModel element) {
|
||||||
|
|
||||||
// System.out.println("Start RPC - getTables");
|
// System.out.println("Start RPC - getTables");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getTables");
|
// rootLogger.log(Level.SEVERE, "GxtTreePanel-> Start RPC - getTables");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getTables");
|
rootLogger.log(Level.SEVERE, "Start RPC - getTables");
|
||||||
|
|
||||||
|
@ -583,20 +615,70 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
|
LinkedHashMap<String, String> dataInput = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
FileModel parent = store.getParent(element);
|
// check if the element is a schema or a database
|
||||||
FileModel parent1 = store.getParent(parent);
|
|
||||||
|
|
||||||
dataInput.put("ResourceName", parent1.getName());
|
// System.out.println("element is a schema: " + element.isSchema());
|
||||||
dataInput.put("DatabaseName", parent.getName());
|
//
|
||||||
|
// if (element.isSchema()) {
|
||||||
|
//
|
||||||
|
// System.out.println("element is a schema: " + element.isSchema());
|
||||||
|
//
|
||||||
|
// FileModel database = store.getParent(element);
|
||||||
|
// FileModel resource = store.getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", element.getName());
|
||||||
|
//
|
||||||
|
// System.out.println("schema name: " + element.getName());
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + element.getName());
|
||||||
|
//
|
||||||
|
// // System.out.println(parent1.getName());
|
||||||
|
// // System.out.println(parent.getName());
|
||||||
|
// // System.out.println(element.getName());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (element.isDatabase()) {
|
||||||
|
//
|
||||||
|
// System.out.println("element is a database: " + element.isDatabase());
|
||||||
|
//
|
||||||
|
// FileModel resource = store.getParent(element);
|
||||||
|
// // FileModel parent1 = store.getParent(parent);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", element.getName());
|
||||||
|
// dataInput.put("SchemaName", "");
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + element.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
//
|
||||||
|
// // System.out.println(parent1.getName());
|
||||||
|
// // System.out.println(parent.getName());
|
||||||
|
// // System.out.println(element.getName());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
FileModel database = store.getParent(element);
|
||||||
|
FileModel resource = store.getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
dataInput.put("SchemaName", element.getName());
|
dataInput.put("SchemaName", element.getName());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + parent1.getName());
|
System.out.println("schema name: " + element.getName());
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + parent.getName());
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + element.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + element.getName());
|
||||||
|
|
||||||
// System.out.println(parent1.getName());
|
// System.out.println(parent1.getName());
|
||||||
// System.out.println(parent.getName());
|
// System.out.println(parent.getName());
|
||||||
// System.out.println(element.getName());
|
// System.out.println(element.getName());
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
|
||||||
|
@ -604,11 +686,25 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
// System.out.println("FAILURE");
|
// System.out.println("FAILURE");
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC getTables");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC getTables");
|
||||||
|
|
||||||
MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(), null);
|
// no tables are available
|
||||||
|
if (caught.getMessage().equals(
|
||||||
|
"java.lang.Exception: Result not available")) {
|
||||||
|
|
||||||
|
element.setIsExpanded(false);
|
||||||
|
|
||||||
|
treePanel.setExpanded(element, false);
|
||||||
|
|
||||||
|
if (treePanel.isMasked())
|
||||||
|
treePanel.unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(),
|
||||||
|
// null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,13 +714,13 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
if (treePanel.isMasked())
|
if (treePanel.isMasked())
|
||||||
treePanel.unmask();
|
treePanel.unmask();
|
||||||
|
|
||||||
// System.out.println("SUCCESS");
|
// System.out.println("SUCCESS");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC getTables");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC getTables");
|
||||||
|
|
||||||
if (result.size() == 0) { // the database has not tables
|
if (result.size() == 0) { // the database has not tables
|
||||||
|
|
||||||
// System.out.println("the database has not tables");
|
// System.out.println("the database has not tables");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "the database has not tables");
|
rootLogger.log(Level.SEVERE, "the database has not tables");
|
||||||
|
|
||||||
|
@ -638,15 +734,23 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
for (int i = 0; i < result.size(); i++) {
|
for (int i = 0; i < result.size(); i++) {
|
||||||
|
|
||||||
result.get(i).setIsExpanded(false);
|
result.get(i).setIsExpanded(false);
|
||||||
|
|
||||||
result.get(i).setIsLoaded(true);
|
result.get(i).setIsLoaded(true);
|
||||||
|
|
||||||
// System.out.println(result.get(i).getName());
|
result.get(i).setIsSchema(false);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "table: " + result.get(i).getName());
|
// element.setIsLoaded(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println(result.get(i).getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "table: "
|
||||||
|
+ result.get(i).getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// int numChildrenFolder = store.getChildCount(element);
|
// int numChildrenFolder = store.getChildCount(element);
|
||||||
|
|
||||||
// if (numChildrenFolder == 0) {
|
// if (numChildrenFolder == 0) {
|
||||||
|
|
||||||
|
@ -657,11 +761,10 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
element.setIsLoaded(true);
|
element.setIsLoaded(true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// System.out.println("End RPC - getTables");
|
// System.out.println("End RPC - getTables");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "End RPC getTables");
|
rootLogger.log(Level.SEVERE, "End RPC getTables");
|
||||||
|
|
||||||
|
@ -689,7 +792,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
store.add(parent, children, true);
|
store.add(parent, children, true);
|
||||||
|
|
||||||
// System.out.println("Added children in store");
|
// System.out.println("Added children in store");
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "Added children in store");
|
rootLogger.log(Level.INFO, "Added children in store");
|
||||||
}
|
}
|
||||||
|
@ -730,7 +833,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// a
|
// a
|
||||||
// schema
|
// schema
|
||||||
|
|
||||||
// System.out.println("is a schema");
|
// System.out.println("is a schema");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "setInfo for selected item schema");
|
rootLogger.log(Level.SEVERE, "setInfo for selected item schema");
|
||||||
|
|
||||||
|
@ -766,7 +869,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// mysql
|
// mysql
|
||||||
// type
|
// type
|
||||||
|
|
||||||
// System.out.println("is a table");
|
// System.out.println("is a table");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "setInfo for selected item table");
|
rootLogger.log(Level.SEVERE, "setInfo for selected item table");
|
||||||
|
|
||||||
|
@ -790,7 +893,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// so the database is
|
// so the database is
|
||||||
// postgres type
|
// postgres type
|
||||||
|
|
||||||
// System.out.println("is a table");
|
// System.out.println("is a table");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "setInfo for selected item table");
|
rootLogger.log(Level.SEVERE, "setInfo for selected item table");
|
||||||
|
|
||||||
|
@ -818,7 +921,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
} else if (treeDepthSelectedItem == 3) { // the selected item is a
|
} else if (treeDepthSelectedItem == 3) { // the selected item is a
|
||||||
// database
|
// database
|
||||||
|
|
||||||
// System.out.println("is a database");
|
// System.out.println("is a database");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "setInfo for selected item database");
|
rootLogger.log(Level.SEVERE, "setInfo for selected item database");
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.gcube.portlets.user.databasesmanager.client.GWTdbManagerServiceAsync;
|
import org.gcube.portlets.user.databasesmanager.client.GWTdbManagerServiceAsync;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData;
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.events.SamplingEvent;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
|
import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.form.GxtFormSubmitQuery;
|
import org.gcube.portlets.user.databasesmanager.client.form.GxtFormSubmitQuery;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
||||||
|
@ -211,26 +212,32 @@ public class GxtToolbarFunctionality {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
// TODO: insert the result of the sample operation
|
|
||||||
|
|
||||||
// TODO: manage the exception case (returned from
|
//fire event
|
||||||
// algorithm "Simple Sample") with an alert
|
|
||||||
|
|
||||||
// System.out.println("simple sample event");
|
eventBus.fireEvent(new SamplingEvent());
|
||||||
|
|
||||||
Dialog d = new Dialog();
|
|
||||||
d.setHeading("Simple Sample");
|
|
||||||
|
|
||||||
// d.setBodyStyle("fontWeight:bold;padding:13px;");
|
// // TODO: insert the result of the sample operation
|
||||||
|
//
|
||||||
d.setBodyStyle("padding:9px;");
|
// // TODO: manage the exception case (returned from
|
||||||
d.setSize(600, 400);
|
// // algorithm "Simple Sample") with an alert
|
||||||
d.setScrollMode(Scroll.AUTO);
|
//
|
||||||
d.setHideOnButtonClick(true);
|
// // System.out.println("simple sample event");
|
||||||
d.setModal(true);
|
//
|
||||||
d.setMaximizable(true);
|
// Dialog d = new Dialog();
|
||||||
d.addText("Result Table 1");
|
// d.setHeading("Simple Sample");
|
||||||
d.show();
|
//
|
||||||
|
// // d.setBodyStyle("fontWeight:bold;padding:13px;");
|
||||||
|
//
|
||||||
|
// d.setBodyStyle("padding:9px;");
|
||||||
|
// d.setSize(600, 400);
|
||||||
|
// d.setScrollMode(Scroll.AUTO);
|
||||||
|
// d.setHideOnButtonClick(true);
|
||||||
|
// d.setModal(true);
|
||||||
|
// d.setMaximizable(true);
|
||||||
|
// d.addText("Result Table 1");
|
||||||
|
// d.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.gcube.portlets.user.databasesmanager.server;
|
package org.gcube.portlets.user.databasesmanager.server;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -465,9 +463,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
// retrieve data
|
// retrieve data
|
||||||
|
|
||||||
// System.out.println("output data retrieved");
|
// System.out.println("output data retrieved");
|
||||||
|
|
||||||
// System.out.println("size outputMap: " + outputMap.size());
|
// System.out.println("size outputMap: " + outputMap.size());
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "output data retrieved");
|
rootLogger.log(Level.SEVERE, "output data retrieved");
|
||||||
rootLogger.log(Level.SEVERE, "output data size: " + outputMap.size());
|
rootLogger.log(Level.SEVERE, "output data size: " + outputMap.size());
|
||||||
|
@ -501,6 +499,84 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Result> sample(LinkedHashMap<String, String> dataInput)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
List<Parameter> inputParameters = new ArrayList<Parameter>();
|
||||||
|
|
||||||
|
// sample result
|
||||||
|
List<Result> output = new ArrayList<Result>();
|
||||||
|
|
||||||
|
// get list of algorithms
|
||||||
|
|
||||||
|
List<String> algorithms = new ArrayList<String>();
|
||||||
|
|
||||||
|
algorithms = getDatabaseManagerAlgorithms();
|
||||||
|
|
||||||
|
// get algorithmId
|
||||||
|
|
||||||
|
String algorithmId = null;
|
||||||
|
|
||||||
|
for (int i = 0; i < algorithms.size(); i++) {
|
||||||
|
|
||||||
|
if (algorithms.get(i).equals("SAMPLEONTABLE")) {
|
||||||
|
|
||||||
|
algorithmId = algorithms.get(i);
|
||||||
|
|
||||||
|
// System.out.println("algorithmId: " + algorithmId);
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "algorithmId: " + algorithmId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// get input parameters of the algorithm
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "getting input parameters");
|
||||||
|
|
||||||
|
inputParameters = getParameters(algorithmId);
|
||||||
|
|
||||||
|
for (int i = 0; i < inputParameters.size(); i++) {
|
||||||
|
|
||||||
|
// System.out.println(inputParameters.get(i).getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
|
||||||
|
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||||
|
inputParameters.get(2).setValue(dataInput.get("SchemaName"));
|
||||||
|
inputParameters.get(3).setValue(dataInput.get("TableName"));
|
||||||
|
|
||||||
|
// System.out.println("size outputMap pre computation: "
|
||||||
|
// + outputMap.size());
|
||||||
|
|
||||||
|
String computationId = startComputation(algorithmId, inputParameters);
|
||||||
|
|
||||||
|
// retrieve data
|
||||||
|
|
||||||
|
// System.out.println("output data retrieved");
|
||||||
|
|
||||||
|
// System.out.println("size outputMap: " + outputMap.size());
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "output data retrieved");
|
||||||
|
rootLogger.log(Level.SEVERE, "output data size: " + outputMap.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < outputMap.size(); i++) {
|
||||||
|
|
||||||
|
Result row = new Result(outputKey.get(String.valueOf(i)),
|
||||||
|
outputMap.get(String.valueOf(i)));
|
||||||
|
|
||||||
|
output.add(row);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
public List<Row> parseCVSString(List<Result> result, List<String> attrNames)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
|
@ -557,7 +633,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
String delimiter = ",";
|
String delimiter = ",";
|
||||||
|
|
||||||
// System.out.println("row: " + row);
|
// System.out.println("row: " + row);
|
||||||
|
|
||||||
List<String> elements = new ArrayList<String>();
|
List<String> elements = new ArrayList<String>();
|
||||||
String phrase = row;
|
String phrase = row;
|
||||||
|
@ -602,7 +678,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
elements.add(phrase);
|
elements.add(phrase);
|
||||||
|
|
||||||
// System.out.println("size: " + elements.size());
|
// System.out.println("size: " + elements.size());
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
|
|
||||||
|
@ -617,10 +693,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
SMListGroupedAlgorithms groups = factory.getAlgorithms();
|
SMListGroupedAlgorithms groups = factory.getAlgorithms();
|
||||||
|
|
||||||
if (groups == null)
|
if (groups == null)
|
||||||
// System.out.println("GROUPS OF ALGORITHMS IS NULL!");
|
// System.out.println("GROUPS OF ALGORITHMS IS NULL!");
|
||||||
rootLogger.log(Level.SEVERE,"GROUPS OF ALGORITHMS IS NULL!");
|
rootLogger.log(Level.SEVERE, "GROUPS OF ALGORITHMS IS NULL!");
|
||||||
else
|
else
|
||||||
// System.out.println("GROUPS OF ALGORITHMS IS NOT NULL!");
|
// System.out.println("GROUPS OF ALGORITHMS IS NOT NULL!");
|
||||||
rootLogger.log(Level.SEVERE, "GROUPS OF ALGORITHMS IS NOT NULL!");
|
rootLogger.log(Level.SEVERE, "GROUPS OF ALGORITHMS IS NOT NULL!");
|
||||||
|
|
||||||
// get list categories
|
// get list categories
|
||||||
|
@ -662,23 +738,20 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
String defaultValue = smParam.defaultValue();
|
String defaultValue = smParam.defaultValue();
|
||||||
String objectType = smType.values().get(0);
|
String objectType = smType.values().get(0);
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl->parameters");
|
// System.out.println("GWTdbManagerServiceImpl->parameters");
|
||||||
|
|
||||||
|
// CHECK
|
||||||
|
// rootLogger.log(Level.INFO, "parameters: ");
|
||||||
|
|
||||||
//CHECK
|
// rootLogger.log(Level.INFO, paramName);
|
||||||
// rootLogger.log(Level.INFO, "parameters: ");
|
// rootLogger.log(Level.INFO, paramDescription);
|
||||||
|
// rootLogger.log(Level.INFO, objectType);
|
||||||
|
// rootLogger.log(Level.INFO, defaultValue);
|
||||||
|
|
||||||
// rootLogger.log(Level.INFO, paramName);
|
// System.out.println(paramName);
|
||||||
// rootLogger.log(Level.INFO, paramDescription);
|
// System.out.println(paramDescription);
|
||||||
// rootLogger.log(Level.INFO, objectType);
|
// System.out.println(objectType);
|
||||||
// rootLogger.log(Level.INFO, defaultValue);
|
// System.out.println(defaultValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// System.out.println(paramName);
|
|
||||||
// System.out.println(paramDescription);
|
|
||||||
// System.out.println(objectType);
|
|
||||||
// System.out.println(defaultValue);
|
|
||||||
|
|
||||||
Parameter objectParam = new Parameter(paramName, paramDescription,
|
Parameter objectParam = new Parameter(paramName, paramDescription,
|
||||||
objectType, defaultValue);
|
objectType, defaultValue);
|
||||||
|
@ -727,7 +800,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -751,7 +824,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
if (status == SMOperationStatus.RUNNING) {
|
if (status == SMOperationStatus.RUNNING) {
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl->RUNNING");
|
// System.out.println("GWTdbManagerServiceImpl->RUNNING");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "RUNNING");
|
rootLogger.log(Level.SEVERE, "RUNNING");
|
||||||
|
|
||||||
|
@ -766,7 +839,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
} else if ((status == SMOperationStatus.COMPLETED)
|
} else if ((status == SMOperationStatus.COMPLETED)
|
||||||
|| (status == SMOperationStatus.FAILED)) {
|
|| (status == SMOperationStatus.FAILED)) {
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl->COMPLETED OR FAILED");
|
// System.out.println("GWTdbManagerServiceImpl->COMPLETED OR FAILED");
|
||||||
rootLogger.log(Level.SEVERE, "COMPLETED OR FAILED");
|
rootLogger.log(Level.SEVERE, "COMPLETED OR FAILED");
|
||||||
|
|
||||||
SMAbstractResource abstractResource = computation
|
SMAbstractResource abstractResource = computation
|
||||||
|
@ -775,31 +848,32 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
int resourceTypeIndex = smResource.resourceType();
|
int resourceTypeIndex = smResource.resourceType();
|
||||||
SMResourceType smResType = SMResourceType.values()[resourceTypeIndex];
|
SMResourceType smResType = SMResourceType.values()[resourceTypeIndex];
|
||||||
|
|
||||||
//TODO: ECXEPTION MANAGEMENT
|
// TODO: ECXEPTION MANAGEMENT
|
||||||
// if (SMResourceType.ERROR){
|
// if (SMResourceType.ERROR){
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
//throws(smResource.description());
|
// throws(smResource.description());
|
||||||
displayOutput(smResource, smResType);
|
displayOutput(smResource, smResType);
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl-> SM resource Name: "
|
// System.out.println("GWTdbManagerServiceImpl-> SM resource Name: "
|
||||||
// + smResource.name());
|
// + smResource.name());
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SM resource Name: " + smResource.name());
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"SM resource Name: " + smResource.name());
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl-> SM resource ID: "
|
// System.out.println("GWTdbManagerServiceImpl-> SM resource ID: "
|
||||||
// + smResource.resourceId());
|
// + smResource.resourceId());
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SM resource ID: " + smResource.resourceId());
|
rootLogger.log(Level.SEVERE,
|
||||||
|
"SM resource ID: " + smResource.resourceId());
|
||||||
// System.out
|
|
||||||
// .println("GWTdbManagerServiceImpl-> SM resource Description: "
|
|
||||||
// + smResource.description());
|
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "SM resource Description: " + smResource.description());
|
|
||||||
|
|
||||||
|
// System.out
|
||||||
|
// .println("GWTdbManagerServiceImpl-> SM resource Description: "
|
||||||
|
// + smResource.description());
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "SM resource Description: "
|
||||||
|
+ smResource.description());
|
||||||
|
|
||||||
percentage = 100;
|
percentage = 100;
|
||||||
|
|
||||||
|
@ -811,7 +885,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private void displayOutput(SMResource smResource, SMResourceType smResType)
|
private void displayOutput(SMResource smResource, SMResourceType smResType)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
// System.out.println("displayOutput");
|
// System.out.println("displayOutput");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "displayOutput");
|
rootLogger.log(Level.SEVERE, "displayOutput");
|
||||||
|
|
||||||
|
@ -827,23 +901,23 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// case OBJECT:
|
// case OBJECT:
|
||||||
SMObject objRes = (SMObject) smResource;
|
SMObject objRes = (SMObject) smResource;
|
||||||
if (objRes.name().contentEquals(PrimitiveTypes.MAP.toString())) {
|
if (objRes.name().contentEquals(PrimitiveTypes.MAP.toString())) {
|
||||||
// System.out.println("Output is a map");
|
// System.out.println("Output is a map");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Output is a map");
|
rootLogger.log(Level.SEVERE, "Output is a map");
|
||||||
// Map<String, String> outputMap = getMap(objRes);
|
// Map<String, String> outputMap = getMap(objRes);
|
||||||
this.outputMap = (LinkedHashMap<String, String>) getMap(objRes);
|
this.outputMap = (LinkedHashMap<String, String>) getMap(objRes);
|
||||||
} else if (objRes.name().contentEquals(
|
} else if (objRes.name().contentEquals(
|
||||||
PrimitiveTypes.IMAGES.toString())) {
|
PrimitiveTypes.IMAGES.toString())) {
|
||||||
// System.out.println("Output are images");
|
// System.out.println("Output are images");
|
||||||
rootLogger.log(Level.SEVERE, "Output are images");
|
rootLogger.log(Level.SEVERE, "Output are images");
|
||||||
} else
|
} else
|
||||||
// System.out.println("Output is other");
|
// System.out.println("Output is other");
|
||||||
rootLogger.log(Level.SEVERE, "Output is other");
|
rootLogger.log(Level.SEVERE, "Output is other");
|
||||||
}
|
}
|
||||||
|
|
||||||
//EXCEPTION MANAGEMENT
|
// EXCEPTION MANAGEMENT
|
||||||
|
|
||||||
if(smResType.equals(SMResourceType.ERROR)) {
|
if (smResType.equals(SMResourceType.ERROR)) {
|
||||||
throw new Exception(smResource.description());
|
throw new Exception(smResource.description());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -857,7 +931,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
private Map<String, String> getMap(SMObject objRes) throws Exception {
|
private Map<String, String> getMap(SMObject objRes) throws Exception {
|
||||||
|
|
||||||
// System.out.println("getMap");
|
// System.out.println("getMap");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "getMap");
|
rootLogger.log(Level.SEVERE, "getMap");
|
||||||
|
|
||||||
|
@ -896,8 +970,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
int resourceTypeIndex = smres.resourceType();
|
int resourceTypeIndex = smres.resourceType();
|
||||||
SMResourceType smsubResType = SMResourceType.values()[resourceTypeIndex];
|
SMResourceType smsubResType = SMResourceType.values()[resourceTypeIndex];
|
||||||
|
|
||||||
// System.out.println("GWTdbManagerServiceImpl-> ResourceType:"
|
// System.out.println("GWTdbManagerServiceImpl-> ResourceType:"
|
||||||
// + smsubResType);
|
// + smsubResType);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "ResourceType: " + smsubResType);
|
rootLogger.log(Level.INFO, "ResourceType: " + smsubResType);
|
||||||
|
|
||||||
|
@ -905,14 +979,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
SMObject obje = (SMObject) smres;
|
SMObject obje = (SMObject) smres;
|
||||||
String outstring = obje.url();
|
String outstring = obje.url();
|
||||||
|
|
||||||
// System.out.println("key :" + key);
|
// System.out.println("key :" + key);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "key: " + smsubResType);
|
rootLogger.log(Level.INFO, "key: " + smsubResType);
|
||||||
|
|
||||||
// System.out.println("Object:"
|
// System.out.println("Object:"
|
||||||
// + new String(outstring.getBytes(), "UTF-8"));
|
// + new String(outstring.getBytes(), "UTF-8"));
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "Object: " + new String(outstring.getBytes(), "UTF-8"));
|
rootLogger.log(Level.INFO,
|
||||||
|
"Object: " + new String(outstring.getBytes(), "UTF-8"));
|
||||||
|
|
||||||
// outputmap.put(key, outstring);
|
// outputmap.put(key, outstring);
|
||||||
|
|
||||||
|
@ -922,9 +997,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("Map retrieved with size: " + smMap.size());
|
// System.out.println("Map retrieved with size: " + smMap.size());
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Map retrieved with size: " + smMap.size());
|
rootLogger
|
||||||
|
.log(Level.SEVERE, "Map retrieved with size: " + smMap.size());
|
||||||
return outputmap;
|
return outputmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,4 +1031,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue