code cleaned up removing commented lines.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98809 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-18 16:05:55 +00:00
parent b411ad0574
commit f5d142ef6b
6 changed files with 66 additions and 380 deletions

View File

@ -1,25 +1,18 @@
/**
*
*/
package org.gcube.portlets.user.databasesmanager.client.resources;
import org.gcube.portlets.user.databasesmanager.client.DatabasesManager;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
/**
* @author ceras
*
*/
public class Images {
public static AbstractImagePrototype iconSearch() {
return AbstractImagePrototype.create(DatabasesManager.resources.iconSearch());
}
public static AbstractImagePrototype iconCancel() {
return AbstractImagePrototype.create(DatabasesManager.resources.iconCancel());
return AbstractImagePrototype.create(DatabasesManager.resources
.iconSearch());
}
public static AbstractImagePrototype iconCancel() {
return AbstractImagePrototype.create(DatabasesManager.resources
.iconCancel());
}
}

View File

@ -1,9 +1,5 @@
/**
*
*/
package org.gcube.portlets.user.databasesmanager.client.resources;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;

View File

@ -15,16 +15,8 @@ import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedTableEventHandler;
import org.gcube.portlets.user.databasesmanager.client.form.GxtFormSubmitQuery;
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
//import org.gcube.portlets.user.dbmanager.client.GWTdbManagerServiceAsync;
//import org.gcube.portlets.user.dbmanager.client.datamodel.SubmitQueryData;
//import org.gcube.portlets.user.dbmanager.client.events.SubmitQueryEvent;
//import org.gcube.portlets.user.dbmanager.client.form.GxtFormSubmitQuery;
//import org.gcube.portlets.user.dbmanager.client.utils.ConstantsPortlet;
import com.extjs.gxt.ui.client.Style.ButtonArrowAlign;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
@ -34,13 +26,13 @@ import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.event.shared.HandlerManager;
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.event.Listener;
//toolbar to contain buttons
public class GxtToolbarFunctionality {
// event bus
private HandlerManager eventBus = null;
// buttons
private Button btnTablesList;
private Button btnSubmitQuery;
// private Button btnGetInfo;
@ -50,17 +42,16 @@ public class GxtToolbarFunctionality {
private Button btnRandomSample;
private SubmitQueryData data;
// toolbar
private ToolBar toolBar;
// the dialog that contains the form
// private Dialog dialog = new Dialog();
private Dialog dialog;
private MessageBox sample;
// RPC service
private GWTdbManagerServiceAsync RPCservice = null;
// GWT logger
private static Logger rootLogger = Logger
.getLogger("GxtToolbarFunctionality");
@ -69,12 +60,10 @@ public class GxtToolbarFunctionality {
eventBus = eBus;
RPCservice = service;
toolBar = new ToolBar();
initToolBar();
addHandler();
addSelectionListenersOnToolBar();
}
private void initToolBar() {
@ -106,28 +95,24 @@ public class GxtToolbarFunctionality {
btnShowCreateTable.setScale(ButtonScale.SMALL);
btnShowCreateTable.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnShowCreateTable);
toolBar.add(new SeparatorToolItem());
// Button for Simple Sample
btnSimpleSample = new Button(ConstantsPortlet.SAMPLING);
btnSimpleSample.setScale(ButtonScale.SMALL);
btnSimpleSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnSimpleSample);
// Button for Smart Sample
btnSmartSample = new Button(ConstantsPortlet.SMARTSAMPLING);
btnSmartSample.setScale(ButtonScale.SMALL);
btnSmartSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnSmartSample);
// button fro Random Sample
// button for Random Sample
btnRandomSample = new Button(ConstantsPortlet.RANDOMSAMPLING);
btnRandomSample.setScale(ButtonScale.SMALL);
btnRandomSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnRandomSample);
// add(toolBar, new FlowData(10));
@ -141,29 +126,28 @@ public class GxtToolbarFunctionality {
btnRandomSample.disable();
}
private void addHandler() {
eventBus.addHandler(SelectedTableEvent.TYPE, new SelectedTableEventHandler() {
@Override
public void onSelectedTable(SelectedTableEvent selectedTableEvent) {
// TODO Auto-generated method stub
//enable button for tabele details and sampling operation
btnTablesList.enable();
btnSubmitQuery.enable();
btnShowCreateTable.enable();
btnSimpleSample.enable();
btnSmartSample.enable();
btnRandomSample.enable();
}
});
eventBus.addHandler(SelectedTableEvent.TYPE,
new SelectedTableEventHandler() {
@Override
public void onSelectedTable(
SelectedTableEvent selectedTableEvent) {
// TODO Auto-generated method stub
// enable button for table details and sampling
// operation
btnTablesList.enable();
btnSubmitQuery.enable();
btnShowCreateTable.enable();
btnSimpleSample.enable();
btnSmartSample.enable();
btnRandomSample.enable();
}
});
}
private void addSelectionListenersOnToolBar() {
@ -174,31 +158,26 @@ public class GxtToolbarFunctionality {
@Override
public void componentSelected(ButtonEvent ce) {
// clear variable
data = null;
// dialog to insert inputs in order to submit a query
// final Dialog dialog = new Dialog();
dialog = new Dialog();
dialog.setLayout(new FitLayout());
dialog.setModal(true);
dialog.setBlinkModal(true);
dialog.setButtons(Dialog.OKCANCEL);
// dialog.setPlain(true);
// dialog.setCollapsible(false);
dialog.setResizable(false);
dialog.setMaximizable(true);
dialog.setHeading("Submit Query");
dialog.setSize(600, 500);
// dialog.setWidth(290);
// dialog.setHeight(250);
// dialog.setWidth(290);
// dialog.setHeight(250);
// form to submit a query
final GxtFormSubmitQuery form = new GxtFormSubmitQuery();
dialog.add(form);
dialog.show();
@ -208,22 +187,11 @@ public class GxtToolbarFunctionality {
@Override
public void componentSelected(ButtonEvent ce) {
// System.out.println("button OK event");
// dialog.mask("Loading",
// "x-mask-loading");
// dialog.hide();
// recover info from dialog
setInfoOnSubmitQuery(form);
// System.out
// .println("GxtToolbarFunctionality-> query submitted");
rootLogger.log(Level.SEVERE,
"query submitted");
}
});
@ -235,17 +203,12 @@ public class GxtToolbarFunctionality {
public void componentSelected(
ButtonEvent ce) {
// System.out
// .println("button Cancel event");
rootLogger.log(Level.INFO,
"button Cancel event");
dialog.hide();
}
});
}
});
@ -289,28 +252,6 @@ public class GxtToolbarFunctionality {
// fire event
eventBus.fireEvent(new SamplingEvent());
// // TODO: insert the result of the sample operation
//
// // TODO: manage the exception case (returned from
// // algorithm "Simple Sample") with an alert
//
// // System.out.println("simple sample event");
//
// Dialog d = new Dialog();
// d.setHeading("Simple Sample");
//
// // 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();
}
});
@ -324,28 +265,6 @@ public class GxtToolbarFunctionality {
// fire event
eventBus.fireEvent(new SmartSamplingEvent());
// TODO: insert the result of the sample operation
// TODO: manage the exception case (returned from
// algorithm "Smart Sample") with an alert
// System.out.println("simple sample event");
// Dialog d = new Dialog();
// d.setHeading("Smart Sample");
//
// // 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 2");
// d.show();
}
});
@ -359,28 +278,6 @@ public class GxtToolbarFunctionality {
// fire event
eventBus.fireEvent(new RandomSamplingEvent());
// TODO: insert the result of the sample operation
// TODO: manage the exception case (returned from
// algorithm "Random Sample") with an alert
// System.out.println("simple sample event");
// Dialog d = new Dialog();
// d.setHeading("Random Sample");
//
// // 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 3");
// d.show();
}
});
@ -408,19 +305,15 @@ public class GxtToolbarFunctionality {
// fire event
eventBus.fireEvent(new LoadTablesEvent());
}
});
}
//selection buttons depending from the item selected in the tree
public void enableButtonOnToolbar(int infoTreeDepthSelectedItem,
boolean infoSelectedItemIsSchema, String databaseType) {
// System.out.println("GxtToolbarFunctionality-> depth: "
// + infoTreeDepthSelectedItem);
rootLogger.log(Level.INFO, "selectedItem depth: "
+ infoTreeDepthSelectedItem);
@ -512,14 +405,14 @@ public class GxtToolbarFunctionality {
}
}
public void disableButtonsOperationsOnTable(){
public void disableButtonsOperationsOnTable() {
btnShowCreateTable.disable();
btnSimpleSample.disable();
btnSmartSample.disable();
btnRandomSample.disable();
btnRandomSample.disable();
}
public ToolBar getToolBar() {
@ -539,7 +432,7 @@ public class GxtToolbarFunctionality {
} else {
dialog.mask("Loading", "x-mask-loading");
//fire event
eventBus.fireEvent(new SubmitQueryEvent());
}

View File

@ -4,16 +4,12 @@ public class ConstantsPortlet {
// Div Gwt
public static final String CONTENTDIV = "contentDiv";
//Toolbar button
public static final String TABLESLIST = "Tables List";
public static final String SUBMITQUERY = "Submit Query";
public static final String GETINFO = "Get Info";
public static final String TABLEDETAILS = "Table Details";
// public static final String SIMPLESAMPLE = "Simple Sample";
// public static final String SMARTSAMPLE = "Smart Sample";
// public static final String RANDOMSAMPLE = "Random Sample";
public static final String SAMPLING = "Sampling";
public static final String SMARTSAMPLING = "Smart Sampling";
public static final String RANDOMSAMPLING = "Random Sampling";

View File

@ -7,14 +7,10 @@ import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
public class DatabasesManager extends GenericPortlet {
// protected GCUBELog logger = new GCUBELog(StatisticalManager.class);
/**
* JSP folder name
*/
@ -32,13 +28,8 @@ public class DatabasesManager extends GenericPortlet {
* @throws PortletException .
*/
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
// logger.trace("StatisticalManager loading from JSP: "+VIEW_JSP);
// logger.trace("setting context using ScopeHelper");
ScopeHelper.setContext(request);
// logger.trace("passing to the render");
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
rd.include(request,response);
}

View File

@ -13,9 +13,7 @@ import java.net.URLConnection;
import java.net.URLStreamHandler;
import javax.servlet.http.HttpSession;
import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPURLConnection;
import org.gcube.data.analysis.statisticalmanager.proxies.StatisticalManagerDSL;
@ -47,13 +45,6 @@ import org.gcube.portlets.user.databasesmanager.client.datamodel.Parameter;
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
//import org.gcube.portlets.user.dbmanager.client.GWTdbManagerService;
//import org.gcube.portlets.user.dbmanager.client.datamodel.FileModel;
//import org.gcube.portlets.user.dbmanager.client.datamodel.Parameter;
//import org.gcube.portlets.user.dbmanager.client.datamodel.Result;
//import org.gcube.portlets.user.dbmanager.client.datamodel.Row;
//import org.gcube.portlets.user.dbmanager.server.util.SessionUtil;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
@ -65,7 +56,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
private LinkedHashMap<String, String> outputMap;
private LinkedHashMap<String, String> outputKey;
//the result generated in the LoadTables method
private List<Result> result = null;
//information about a database
private String currentDB = "";
private String previousDB = "";
//information about a schema
private String currentSchema="";
private String previousSchema="";
//GWT logger
private static Logger rootLogger = Logger
.getLogger("GWTdbManagerServiceImpl");
@ -76,19 +77,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
public List<FileModel> getResource() throws Exception {
List<Parameter> inputParameters = new ArrayList<Parameter>();
// List<String> outputParameters = new ArrayList<String>();
List<FileModel> outputParameters = new ArrayList<FileModel>();
// Parameter data = new Parameter();
// 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++) {
@ -98,7 +93,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
algorithmId = algorithms.get(i);
// System.out.println("algorithmId: " + algorithmId);
rootLogger.log(Level.SEVERE, "algorithmId: " + algorithmId);
}
@ -106,17 +100,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
// get input parameters of the algorithm
inputParameters = getParameters(algorithmId);
// System.out.println("getting input parameters");
rootLogger.log(Level.SEVERE, "getting input parameters");
for (int i = 0; i < inputParameters.size(); i++) {
// System.out.println(inputParameters.get(i).getName());
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
}
@ -124,21 +115,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String computationId = startComputation(algorithmId, inputParameters);
// retrieve data
// System.out.println("output data retrieved");
rootLogger.log(Level.SEVERE, "output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
// outputParameters.add(outputMap.get(String.valueOf(i)));
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// obj.setIsLoaded(true);
outputParameters.add(obj);
}
return outputParameters;
@ -150,21 +134,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
throws Exception {
List<Parameter> inputParameters = new ArrayList<Parameter>();
// List<String> outputParameters = new ArrayList<String>();
// List<FileModel> outputParameters = new ArrayList<FileModel>();
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
// 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++) {
@ -174,59 +150,41 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
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());
inputParameters.get(i).setValue(resourceName);
// rootLogger.log(Level.INFO, "ResourceName: " + resourceName);
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
}
String computationId = startComputation(algorithmId, inputParameters);
// retrieve data
// System.out.println("output data retrieved");
rootLogger.log(Level.SEVERE, "output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// obj.setIsLoaded(true);
// outputParameters.add(obj);
// System.out.println("value: " + outputMap.get(String.valueOf(i)));
// System.out.println("key: " + outputKey.get(String.valueOf(i)));
outputParameters.put(outputKey.get(String.valueOf(i)), obj);
}
return outputParameters;
}
@Override
@ -234,18 +192,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
throws Exception {
List<Parameter> inputParameters = new ArrayList<Parameter>();
// List<String> outputParameters = new ArrayList<String>();
List<FileModel> outputParameters = new ArrayList<FileModel>();
// 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++) {
@ -255,11 +208,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
algorithmId = algorithms.get(i);
// System.out.println("algorithmId: " + algorithmId);
rootLogger.log(Level.SEVERE, "algorithmId: " + algorithmId);
}
}
// get input parameters of the algorithm
@ -270,9 +220,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
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"));
@ -287,47 +235,31 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String computationId = startComputation(algorithmId, inputParameters);
// retrieve data
// System.out.println("output data retrieved");
rootLogger.log(Level.SEVERE, "output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// obj.setIsSchema(true);
// obj.setIsLoaded(true);
outputParameters.add(obj);
}
return outputParameters;
}
private List<Result> getTables(LinkedHashMap<String, String> dataInput)
throws Exception {
List<Parameter> inputParameters = new ArrayList<Parameter>();
// List<String> outputParameters = new ArrayList<String>();
List<Result> outputParameters = 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++) {
@ -337,25 +269,18 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
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"));
@ -369,55 +294,36 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
rootLogger.log(Level.SEVERE,
"SchemaName: " + dataInput.get("SchemaName"));
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// retrieve data
// System.out.println("output data retrieved");
rootLogger.log(Level.SEVERE, "output data retrieved");
rootLogger.log(Level.SEVERE, "output data size: " + outputMap.size());
// System.out.println("size outputMap: " + outputMap.size());
for (int i = 0; i < outputMap.size(); i++) {
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
// FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// obj.setIsLoaded(true);
// obj.setIsTable(true);
Result row = new Result(String.valueOf(i), outputMap.get(String
.valueOf(i)));
outputParameters.add(row);
}
return outputParameters;
}
private List<Result> result = null;
private String currentDB = "";
private String previousDB = "";
private String currentSchema="";
private String previousSchema="";
@Override
public PagingLoadResult<Result> LoadTables(PagingLoadConfig config,
LinkedHashMap<String, String> dataInput, boolean SearchTable,
String keyword) throws Exception {
//check on a database
currentDB = dataInput.get("DatabaseName");
if (!currentDB.equals(previousDB)) {
result = null;
@ -426,6 +332,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
previousDB = currentDB;
//check on a schema
currentSchema=dataInput.get("SchemaName");
if (!currentSchema.equals(previousSchema)){
result = null;
@ -440,9 +347,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// Create a sublist and add data to list according
// to the limit and offset value of the config
List<Result> sublist = new ArrayList<Result>();
BasePagingLoadResult loadResult = null;
rootLogger.log(Level.INFO, "Searching in the table: " + SearchTable);
@ -483,132 +388,58 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
}
// print check
rootLogger.log(Level.INFO, "result size: " + totalNumber);
rootLogger.log(Level.INFO, "limit: " + limit);
rootLogger.log(Level.INFO, "offset: " + config.getOffset());
rootLogger.log(Level.INFO, "start: " + start);
// // print check
// rootLogger.log(Level.INFO, "result size: " + totalNumber);
// rootLogger.log(Level.INFO, "limit: " + limit);
// rootLogger.log(Level.INFO, "offset: " + config.getOffset());
// rootLogger.log(Level.INFO, "start: " + start);
loadResult = new BasePagingLoadResult<Result>(sublist,
config.getOffset(), totalNumber);
//
// if (totalNumber==0){
// loadResult=new BasePagingLoadResult<>(sublist);
// }
return loadResult;
}
// @Override
// public PagingLoadResult<Result> SearchTable(PagingLoadConfig config,
// LinkedHashMap<String, String> dataInput, String keyword)
// throws Exception {
// // TODO Auto-generated method stub
//
// // get tables
// List<Result> result = getTables(dataInput);
//
// // Create a sublist and add data to list according
// // to the limit and offset value of the config
//
// ArrayList<Result> sublist = new ArrayList<Result>();
//
// // search the table
//
// for (int i = 0; i < result.size(); i++) {
//
// if ((result.get(i).getValue().toLowerCase()).startsWith(keyword
// .toLowerCase())) {
//
// sublist.add(result.get(i));
//
// }
//
// }
//
// BasePagingLoadResult loadResult = new
// BasePagingLoadResult<Result>(sublist, sublist.size(),
// sublist.size());;
//
// if (sublist.size()!=0){
// //if there are tables that start with the specified keyword
//
// loadResult = new BasePagingLoadResult<Result>(sublist, sublist.size(),
// sublist.size());
//
// }
// // else{
// // //no tables exist
// //
// //
// // }
//
//
// return loadResult;
//
// }
@Override
public List<Result> submitQuery(LinkedHashMap<String, String> dataDB,
String query, boolean valueReadOnlyQuery,
boolean smartCorrectionQuery, String language) throws Exception {
// System.out.println("language detected: " + language);
rootLogger.log(Level.SEVERE, "language used for query conversion: "
+ language);
List<Parameter> inputParameters = new ArrayList<Parameter>();
// LinkedHashMap<String, String> output = new LinkedHashMap<String,
// String>();
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("SUBMITQUERY")) {
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());
// System.out.println(inputParameters.get(i).getDefaultValue());
//
// }
//print check
for (int i = 0; i < inputParameters.size(); i++) {
// System.out.println(inputParameters.get(i).getName());
// System.out.println(inputParameters.get(i).getDefaultValue());
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
}
inputParameters.get(0).setValue(dataDB.get("ResourceName"));
@ -626,13 +457,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// 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");
@ -647,22 +475,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
// FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// outputParameters.add(obj);
}
// for (int i = 0; i < outputMap.size(); i++) {
//
// // outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// // + outputMap.get(String.valueOf(i)));
//
// FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
// outputParameters.add(obj);
//
// }
return output;
}