- bug fixed in class GWTdbManagerServiceImpl modified adding the class ComputationOutput to manage the mapValues and the mapKey related to an algorithm computation.

- bug fixed for multiple submit query dialogs and associated dialog results.ID added in the header of these two dialog types (passed in the SubmitQueryEvent). "Dialog.getBody" masked and unmasked.(in GxtBorderLyoutPanel and GxtToolbarFunctionality classes)

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99021 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-25 18:03:14 +00:00
parent 3913c2d6cf
commit e219cfcb11
5 changed files with 396 additions and 225 deletions

View File

@ -0,0 +1,34 @@
package org.gcube.portlets.user.databasesmanager.client.datamodel;
import java.util.LinkedHashMap;
public class ComputationOutput {
private LinkedHashMap<String, String> mapValues;
private LinkedHashMap<String, String> mapKeys;
public ComputationOutput() {
mapKeys = new LinkedHashMap<String, String>();
mapValues = new LinkedHashMap<String, String>();
}
public void setMapValues(LinkedHashMap<String, String> mapValues) {
this.mapValues = mapValues;
}
public void setmapKeys(LinkedHashMap<String, String> mapKeys) {
this.mapKeys = mapKeys;
}
public LinkedHashMap<String, String> getMapValues() {
return mapValues;
}
public LinkedHashMap<String, String> getmapKeys() {
return mapKeys;
}
}

View File

@ -6,6 +6,11 @@ import com.google.gwt.event.shared.GwtEvent;
public class SubmitQueryEvent extends GwtEvent<SubmitQueryEventHandler> {
public static Type<SubmitQueryEventHandler> TYPE = new Type<SubmitQueryEventHandler>();
private int dialogID;
public SubmitQueryEvent(int ID){
dialogID=ID;
}
@Override
public Type<SubmitQueryEventHandler> getAssociatedType() {
@ -27,4 +32,8 @@ public class SubmitQueryEvent extends GwtEvent<SubmitQueryEventHandler> {
return EventsTypeEnum.SUBMIT_QUERY_EVENT;
}
public int getDialogID(){
return dialogID;
}
}

View File

@ -344,9 +344,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
public void onSubmitQuery(SubmitQueryEvent submitQueryEvent) {
// TODO Auto-generated method stub
Integer dialogID = toolbar.getDialogID();
// Integer dialogID = toolbar.getDialogID();
Integer dialogID = new Integer(submitQueryEvent.getDialogID());
rootLogger.log(Level.INFO, "dialogID: "
+ dialogID);
submitQuery(dialogID);
@ -1047,7 +1050,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
// method to submit a query
private void submitQuery(Integer dialogID) {
private void submitQuery(final Integer dialogID) {
// clear variable that keeps track of the managed event
// boolean submitQueryEventManaged = false;
@ -1084,9 +1087,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
final SubmitQueryData dataQuery = submitQueryDataList.get(dialogID);
// rootLogger.log(Level.INFO, "query: "+ dataQuery.getQuery() + "submitquery->dialogID: "
// + dialogID);
// determine the language
@ -1183,8 +1185,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// Dialog form = toolbar.getDialogForm();
if (form.isMasked())
form.unmask();
if (form.getBody().isMasked())
form.getBody().unmask();
}
};
@ -1235,7 +1237,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// parse the result in order to obtain a table
boolean submitQueryEventManaged = true;
parseResult(result, form, submitQueryEventManaged);
parseResult(result, form, dialogID, submitQueryEventManaged);
}
@ -1357,7 +1359,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// parse the result in order to obtain a
// table
parseResult(result, null, false);
parseResult(result, null, 0, false);
}
@ -1489,7 +1491,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// parse the result in order to obtain a
// table
parseResult(result, null, false);
parseResult(result, null, 0, false);
}
@ -1620,7 +1622,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// parse the result in order to obtain a
// table
parseResult(result, null, false);
parseResult(result, null, 0, false);
}
@ -1638,7 +1640,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}
// start the parsing of the submit result in order to obtain a table
private void parseResult(List<Result> result, Dialog dialog, final boolean submitQueryEventManaged) {
private void parseResult(List<Result> result, Dialog dialog, final int dialogID, final boolean submitQueryEventManaged) {
// to unmask the entire content panel
final GxtBorderLayoutPanel obj = this;
@ -1675,8 +1677,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// Dialog form = toolbar.getDialogForm();
//
if (form.isMasked())
form.unmask();
if (form.getBody().isMasked())
form.getBody().unmask();
// form.hide();
@ -1703,7 +1705,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// Display the submit query result as a table
Dialog submitResult = new Dialog();
submitResult.setLayout(new FitLayout());
if (submitQueryEventManaged==true){
submitResult.setHeading("Result Query " + dialogID);
}
else{
submitResult.setHeading("Result");
}
submitResult.setResizable(false);
// submitResult.setHeading("Submit Query");
// submitResult.setWidth(290);
@ -1746,8 +1754,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// Dialog form = toolbar.getDialogForm();
//
if (form.isMasked())
form.unmask();
if (form.getBody().isMasked())
form.getBody().unmask();
//
// form.hide();
@ -1763,8 +1771,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// submitQueryEventManaged = false;
// Dialog form = toolbar.getDialogForm();
if (form.isMasked())
form.unmask();
if (form.getBody().isMasked())
form.getBody().unmask();
//
// form.hide();
} else {

View File

@ -199,6 +199,8 @@ public class GxtToolbarFunctionality {
}
};
ID++;
final int dialogID = ID;
dialog.setLayout(new FitLayout());
// dialog.setModal(true);
// dialog.setBlinkModal(true);
@ -208,7 +210,7 @@ public class GxtToolbarFunctionality {
dialog.setResizable(false);
dialog.setMaximizable(true);
dialog.setMinimizable(true);
dialog.setHeading("Submit Query");
dialog.setHeading("Submit Query " + dialogID);
dialog.setSize(600, 500);
// dialog.setConstrain(false);
@ -221,6 +223,8 @@ public class GxtToolbarFunctionality {
dialog.add(form);
dialog.show();
//mimimize event handled
dialog.addListener(Events.Minimize,
new Listener<WindowEvent>() {
@ -258,7 +262,7 @@ public class GxtToolbarFunctionality {
public void componentSelected(ButtonEvent ce) {
// recover info from dialog
setInfoOnSubmitQuery(form, dialog);
setInfoOnSubmitQuery(form, dialog, dialogID);
rootLogger.log(Level.SEVERE,
"query submitted");
@ -492,7 +496,7 @@ public class GxtToolbarFunctionality {
}
private void setInfoOnSubmitQuery(GxtFormSubmitQuery form,
Dialog SubmtQueryDialog) {
Dialog SubmtQueryDialog, int dialogID) {
SubmitQueryData data = form.getSubmitQueryData();
@ -505,13 +509,13 @@ public class GxtToolbarFunctionality {
} else {
dialogList.put(new Integer(ID), SubmtQueryDialog);
submitQueryDataList.put(new Integer(ID), data);
dialogList.put(new Integer(dialogID), SubmtQueryDialog);
submitQueryDataList.put(new Integer(dialogID), data);
SubmtQueryDialog.mask("Loading", "x-mask-loading");
SubmtQueryDialog.getBody().mask("Loading", "x-mask-loading");
// fire event
eventBus.fireEvent(new SubmitQueryEvent());
eventBus.fireEvent(new SubmitQueryEvent(dialogID));
}
}

View File

@ -40,6 +40,7 @@ import org.gcube.data.analysis.statisticalmanager.stubs.types.schema.SMTable;
import org.gcube.data.analysis.statisticalmanager.stubs.types.schema.StatisticalServiceType;
import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.PrimitiveTypes;
import org.gcube.portlets.user.databasesmanager.client.GWTdbManagerService;
import org.gcube.portlets.user.databasesmanager.client.datamodel.ComputationOutput;
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
import org.gcube.portlets.user.databasesmanager.client.datamodel.Parameter;
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
@ -56,8 +57,8 @@ import org.apache.log4j.Logger;
public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
GWTdbManagerService {
private LinkedHashMap<String, String> outputMap;
private LinkedHashMap<String, String> outputKey;
// private LinkedHashMap<String, String> outputMap;
// private LinkedHashMap<String, String> outputKey;
// the result generated in the LoadTables method
private List<Result> result = null;
@ -73,8 +74,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// .getLogger("GWTdbManagerServiceImpl");
// logger
private static Logger logger = Logger.getLogger(GWTdbManagerServiceImpl.class);
private static Logger logger = Logger
.getLogger(GWTdbManagerServiceImpl.class);
public GWTdbManagerServiceImpl() {
@ -122,7 +123,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
//
// }
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// print check
// retrieve data
@ -130,9 +135,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// rootLogger.log(Level.SEVERE, "output data retrieved");
// logger.info("output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
for (int i = 0; i < mapValues.size(); i++) {
FileModel obj = new FileModel(mapValues.get(String.valueOf(i)));
// obj.setIsLoaded(true);
outputParameters.add(obj);
}
@ -184,23 +193,33 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// rootLogger.log(Level.INFO, inputParameters.get(i).getName());
}
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// //print check
// retrieve data
// System.out.println("output data retrieved");
// rootLogger.log(Level.SEVERE, "output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
FileModel obj = new FileModel(mapValues.get(String.valueOf(i)));
// obj.setIsLoaded(true);
// System.out.println("value: " + outputMap.get(String.valueOf(i)));
// System.out.println("key: " + outputKey.get(String.valueOf(i)));
// System.out.println("value: " + mapValues.get(String.valueOf(i)));
// System.out.println("key: " + mapKeys.get(String.valueOf(i)));
outputParameters.put(outputKey.get(String.valueOf(i)), obj);
outputParameters.put(mapKeys.get(String.valueOf(i)), obj);
}
return outputParameters;
}
@ -258,17 +277,26 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters);
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// print check
// retrieve data
// System.out.println("output data retrieved");
// rootLogger.log(Level.SEVERE, "output data retrieved");
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
FileModel obj = new FileModel(mapValues.get(String.valueOf(i)));
// obj.setIsSchema(true);
// obj.setIsLoaded(true);
@ -330,16 +358,27 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
logger.info("SchemaName: " + dataInput.get("SchemaName"));
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// print check
// retrieve data
// System.out.println("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());
// System.out.println("size outputMap: " + outputMap.size());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
@ -347,7 +386,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// obj.setIsLoaded(true);
// obj.setIsTable(true);
Result row = new Result(String.valueOf(i), outputMap.get(String
Result row = new Result(String.valueOf(i), mapValues.get(String
.valueOf(i)));
outputParameters.add(row);
@ -489,16 +528,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check
// rootLogger
// .log(Level.INFO, "ResourceName " + dataDB.get("ResourceName"));
// rootLogger.log(Level.INFO, "DatabaseName" + dataDB.get("DatabaseName"));
// rootLogger.log(Level.INFO, "DatabaseName" +
// dataDB.get("DatabaseName"));
// rootLogger.log(Level.INFO, "Query" + query);
// rootLogger.log(Level.INFO, "SmartCorrections check:" + smartCorrectionQuery);
// rootLogger.log(Level.INFO, "SmartCorrections check:" +
// smartCorrectionQuery);
logger.info("ResourceName: " + dataDB.get("ResourceName"));
logger.info("DatabaseName: " + dataDB.get("DatabaseName"));
logger.info("Query: " + query);
logger.info("SmartCorrections check: " + smartCorrectionQuery);
inputParameters.get(2).setValue(String.valueOf(valueReadOnlyQuery));
inputParameters.get(3).setValue(String.valueOf(smartCorrectionQuery));
@ -507,7 +547,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// print check
// retrieve data
@ -515,12 +560,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap: " + outputMap.size());
// 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());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
Result row = new Result(outputKey.get(String.valueOf(i)),
outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
Result row = new Result(mapKeys.get(String.valueOf(i)),
mapValues.get(String.valueOf(i)));
output.add(row);
@ -590,17 +642,16 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// "ResourceName " + dataInput.get("ResourceName"));
// rootLogger.log(Level.INFO,
// "DatabaseName " + dataInput.get("DatabaseName"));
// rootLogger.log(Level.INFO, "SchemaName " + dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " + dataInput.get("TableName"));
// rootLogger.log(Level.INFO, "SchemaName " +
// dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " +
// dataInput.get("TableName"));
logger.info("ResourceName: " + dataInput.get("ResourceName"));
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
logger.info("SchemaName: " + dataInput.get("SchemaName"));
logger.info("TableName: " + dataInput.get("TableName"));
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
inputParameters.get(2).setValue(dataInput.get("SchemaName"));
@ -609,7 +660,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// retrieve data
// System.out.println("output data retrieved");
@ -617,12 +672,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check
// 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());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
Result row = new Result(outputKey.get(String.valueOf(i)),
outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
Result row = new Result(mapKeys.get(String.valueOf(i)),
mapValues.get(String.valueOf(i)));
output.add(row);
@ -687,8 +749,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// "ResourceName " + dataInput.get("ResourceName"));
// rootLogger.log(Level.INFO,
// "DatabaseName " + dataInput.get("DatabaseName"));
// rootLogger.log(Level.INFO, "SchemaName " + dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " + dataInput.get("TableName"));
// rootLogger.log(Level.INFO, "SchemaName " +
// dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " +
// dataInput.get("TableName"));
logger.info("ResourceName: " + dataInput.get("ResourceName"));
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
@ -703,7 +767,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// retrieve data
// System.out.println("output data retrieved");
@ -711,12 +778,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check
// 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());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
Result row = new Result(outputKey.get(String.valueOf(i)),
outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
Result row = new Result(mapKeys.get(String.valueOf(i)),
mapValues.get(String.valueOf(i)));
output.add(row);
@ -781,8 +855,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// "ResourceName " + dataInput.get("ResourceName"));
// rootLogger.log(Level.INFO,
// "DatabaseName " + dataInput.get("DatabaseName"));
// rootLogger.log(Level.INFO, "SchemaName " + dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " + dataInput.get("TableName"));
// rootLogger.log(Level.INFO, "SchemaName " +
// dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " +
// dataInput.get("TableName"));
logger.info("ResourceName: " + dataInput.get("ResourceName"));
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
@ -797,7 +873,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// retrieve data
// System.out.println("output data retrieved");
@ -805,12 +885,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check
// 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());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
Result row = new Result(outputKey.get(String.valueOf(i)),
outputMap.get(String.valueOf(i)));
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
Result row = new Result(mapKeys.get(String.valueOf(i)),
mapValues.get(String.valueOf(i)));
output.add(row);
@ -875,9 +962,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// "ResourceName " + dataInput.get("ResourceName"));
// rootLogger.log(Level.INFO,
// "DatabaseName " + dataInput.get("DatabaseName"));
// rootLogger.log(Level.INFO, "SchemaName " + dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " + dataInput.get("TableName"));
// rootLogger.log(Level.INFO, "SchemaName " +
// dataInput.get("SchemaName"));
// rootLogger.log(Level.INFO, "TableName " +
// dataInput.get("TableName"));
logger.info("ResourceName: " + dataInput.get("ResourceName"));
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
@ -892,7 +980,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("size outputMap pre computation: "
// + outputMap.size());
String computationId = startComputation(algorithmId, inputParameters);
// create data structure
ComputationOutput outputData = new ComputationOutput();
String computationId = startComputation(algorithmId, inputParameters,
outputData);
// retrieve data
// System.out.println("output data retrieved");
@ -900,14 +992,21 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check
// 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());
for (int i = 0; i < outputMap.size(); i++) {
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
mapValues = outputData.getMapValues();
mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) {
// outputParameters.add(outputKey.get(String.valueOf(i)) + " "
// + outputMap.get(String.valueOf(i)));
FileModel obj = new FileModel(outputMap.get(String.valueOf(i)));
FileModel obj = new FileModel(mapValues.get(String.valueOf(i)));
// obj.setIsLoaded(true);
@ -917,7 +1016,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("key: " + outputKey.get(String.valueOf(i)));
outputParameters.put(outputKey.get(String.valueOf(i)), obj);
outputParameters.put(mapKeys.get(String.valueOf(i)), obj);
}
@ -1047,7 +1146,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("GROUPS OF ALGORITHMS IS NULL!");
else
// 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!");
logger.info("GROUPS OF ALGORITHMS IS NOT NULL!");
// get list categories
@ -1115,7 +1215,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
private String startComputation(String algorithmName,
List<Parameter> parameters) throws Exception{
List<Parameter> parameters, ComputationOutput outputData)
throws Exception {
SMComputationConfig config = new SMComputationConfig();
@ -1143,7 +1244,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
while (percentage < 100) {
percentage = checkComputationStatus(scope, computationId,
username);
username, outputData);
Thread.sleep(1000);
}
@ -1157,7 +1258,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
private float checkComputationStatus(String scope, String computationId,
String user) throws Exception {
String user, ComputationOutput outputData) throws Exception {
ScopeProvider.instance.set(scope);
@ -1175,9 +1276,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
if (status == SMOperationStatus.RUNNING) {
// System.out.println("GWTdbManagerServiceImpl->RUNNING");
// rootLogger.log(Level.SEVERE, "RUNNING");
// logger.info("RUNNING");
SMOperationInfo infos = factory.getComputationInfo(computationId,
user);
@ -1190,8 +1289,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} else if ((status == SMOperationStatus.COMPLETED)
|| (status == SMOperationStatus.FAILED)) {
// System.out.println("GWTdbManagerServiceImpl->COMPLETED OR FAILED");
// rootLogger.log(Level.SEVERE, "COMPLETED OR FAILED");
// logger.info("COMPLETED OR FAILED");
SMAbstractResource abstractResource = computation
.abstractResource();
@ -1205,7 +1303,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
//
// }
// throws(smResource.description());
displayOutput(smResource, smResType);
displayOutput(smResource, smResType, outputData);
// System.out.println("GWTdbManagerServiceImpl-> SM resource Name: "
// + smResource.name());
@ -1235,15 +1333,20 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
return percentage;
}
private void displayOutput(SMResource smResource, SMResourceType smResType)
throws Exception {
private void displayOutput(SMResource smResource, SMResourceType smResType,
ComputationOutput outputData) throws Exception {
// System.out.println("displayOutput");
// print check
// rootLogger.log(Level.SEVERE, "displayOutput");
outputMap = new LinkedHashMap<String, String>();
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String,
// String>();
// mapValues = outputData.getMapValues();
// outputMap = new LinkedHashMap<String, String>();
if (smResType.equals(SMResourceType.OBJECT)) {
@ -1255,11 +1358,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// case OBJECT:
SMObject objRes = (SMObject) smResource;
if (objRes.name().contentEquals(PrimitiveTypes.MAP.toString())) {
// System.out.println("Output is a map");
// rootLogger.log(Level.SEVERE, "Output is a map");
// Map<String, String> outputMap = getMap(objRes);
this.outputMap = (LinkedHashMap<String, String>) getMap(objRes);
// this.outputMap = (LinkedHashMap<String, String>)
// getMap(objRes);
// mapValues = (LinkedHashMap<String, String>) getMap(objRes,
// outputData);
logger.info("Output is a map");
getMap(objRes, outputData);
} else if (objRes.name().contentEquals(
PrimitiveTypes.IMAGES.toString())) {
// System.out.println("Output are images");
@ -1275,6 +1384,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
if (smResType.equals(SMResourceType.ERROR)) {
Exception e = new Exception(smResource.description());
// e.printStackTrace();
logger.error(e);
throw e;
// throw new Exception(smResource.description());
@ -1288,13 +1398,22 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// }
}
private Map<String, String> getMap(SMObject objRes) throws Exception {
// private Map<String, String> getMap(SMObject objRes, ComputationOutput
// outputData) throws Exception {
private void getMap(SMObject objRes, ComputationOutput outputData)
throws Exception {
// System.out.println("getMap");
// rootLogger.log(Level.SEVERE, "getMap");
outputKey = new LinkedHashMap<String, String>();
// output data
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
// outputKey = new LinkedHashMap<String, String>();
InputStream is = getStorageClientInputStream(objRes.url());
// object serializer
@ -1317,13 +1436,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
.fromXML(is));
is.close();
LinkedHashMap<String, String> outputmap = new LinkedHashMap<String, String>();
// LinkedHashMap<String, String> outputmap = new LinkedHashMap<String,
// String>();
int i = 0;
for (String key : smMap.keySet()) {
// add key value
outputKey.put(String.valueOf(i), key);
mapKeys.put(String.valueOf(i), key);
SMResource smres = smMap.get(key);
int resourceTypeIndex = smres.resourceType();
@ -1338,30 +1458,26 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
SMObject obje = (SMObject) smres;
String outstring = obje.url();
// System.out.println("key :" + key);
// rootLogger.log(Level.INFO, "key: " + smsubResType);
// System.out.println("Object:"
// + new String(outstring.getBytes(), "UTF-8"));
// rootLogger.log(Level.INFO,
// "Object: " + new String(outstring.getBytes(), "UTF-8"));
// logger.info("key: " + smsubResType);
// logger.info("object: " + outstring);
// outputmap.put(key, outstring);
outputmap.put(String.valueOf(i), outstring);
mapValues.put(String.valueOf(i), outstring);
i++;
}
}
outputData.setMapValues(mapValues);
outputData.setmapKeys(mapKeys);
// System.out.println("Map retrieved with size: " + smMap.size());
// rootLogger
// .log(Level.SEVERE, "Map retrieved with size: " + smMap.size());
return outputmap;
// return outputmap;
}
private InputStream getStorageClientInputStream(String url)