- bug fixed for the submit query operation if at the same time a refresh query operation is performed. GWTdbManagerServiceImpl and GxtBorderLayput classes modified
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@101004 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
260ce2c6e6
commit
9cad85a41e
|
@ -1243,6 +1243,39 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
// listener on the dialog "ok" button
|
||||
submitResult.getButtonById(Dialog.OK).addSelectionListener(
|
||||
new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"button ok clicked");
|
||||
|
||||
// call rpc to remove the stored result
|
||||
RPCservice.refreshDataOnServer(UID, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"FAILURE RPC refreshDataOnServer");
|
||||
|
||||
if (caught instanceof SessionExpiredException) {
|
||||
rootLogger.log(Level.INFO, "Session expired");
|
||||
CheckSession.showLogoutDialog();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"SUCCESS RPC refreshDataOnServer");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// add the button to download the result
|
||||
final String urlFile = Window.Location.getProtocol() + "//"
|
||||
+ Window.Location.getHost() + fileName;
|
||||
|
|
|
@ -300,6 +300,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
session.setAttribute("listKeySubmitQueryResult",
|
||||
listKeySubmitQueryResult);
|
||||
|
||||
//map that contains for each UID the submit query result in order
|
||||
//to face the cache refreshing if a pagination is used
|
||||
HashMap<String, List<Result>> listSubmitQueryResult = new HashMap<String, List<Result>>();
|
||||
session.setAttribute("listSubmitQueryResult",
|
||||
listSubmitQueryResult);
|
||||
|
||||
//print data
|
||||
logger.info("dbmanager-> CheckInformation: cache hits number " + cacheHitsNumber);
|
||||
logger.info("dbmanager-> CheckInformation: SM computation number " + smComputationNumber);
|
||||
|
@ -1350,6 +1356,34 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
if (value != null) {
|
||||
result = (List<Result>) value;
|
||||
updateListSubmitQueryResult(UID, result);
|
||||
|
||||
// data = parseCVSString(result, listAttributes);
|
||||
//
|
||||
// int start = config.getOffset();
|
||||
// int limit = data.size();
|
||||
//
|
||||
// if (config.getLimit() > 0) {
|
||||
// limit = Math.min(start + config.getLimit(), limit);
|
||||
// }
|
||||
//
|
||||
// int totalNumber = data.size();
|
||||
// sublist = new ArrayList<Row>(data.subList(start, limit));
|
||||
// loadResult = new BasePagingLoadResult<Row>(sublist,
|
||||
// config.getOffset(), totalNumber);
|
||||
//
|
||||
// // System.out.println("start: " + start);
|
||||
// // System.out.println("limit: " + limit);
|
||||
// // System.out.println("sublist size: " + sublist.size());
|
||||
} else {
|
||||
|
||||
//get the result bound to session
|
||||
result = getSubmitQueryResult(UID);
|
||||
|
||||
// logger.error("dbmanager-> Error in server while loading data. variable value null");
|
||||
// throw new Exception("Error in server while loading data.");
|
||||
|
||||
}
|
||||
|
||||
data = parseCVSString(result, listAttributes);
|
||||
|
||||
|
@ -1368,11 +1402,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// System.out.println("start: " + start);
|
||||
// System.out.println("limit: " + limit);
|
||||
// System.out.println("sublist size: " + sublist.size());
|
||||
} else {
|
||||
|
||||
logger.error("dbmanager-> Error in server while loading data. variable value null");
|
||||
throw new Exception("Error in server while loading data.");
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.error("dbmanager-> Error in server while loading data. key null");
|
||||
|
@ -1385,6 +1414,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
throw new Exception(
|
||||
"Error in server while loading data. Exception: " + e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// get attributes list for display the result in a table
|
||||
|
@ -1646,6 +1676,39 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
return listKeySubmitQueryResult.get(UID);
|
||||
}
|
||||
|
||||
private synchronized List<Result> getSubmitQueryResult(String UID){
|
||||
ASLSession session = SessionUtil.getAslSession(this
|
||||
.getThreadLocalRequest().getSession());
|
||||
|
||||
HashMap<String, List<Result>> listSubmitQueryResult = (HashMap<String, List<Result>>)session.getAttribute("listSubmitQueryResult");
|
||||
return listSubmitQueryResult.get(UID);
|
||||
}
|
||||
|
||||
private synchronized void updateListSubmitQueryResult(String UID, List<Result> value){
|
||||
ASLSession session = SessionUtil.getAslSession(this
|
||||
.getThreadLocalRequest().getSession());
|
||||
|
||||
HashMap<String, List<Result>> listSubmitQueryResult = (HashMap<String, List<Result>>)session.getAttribute("listSubmitQueryResult");
|
||||
listSubmitQueryResult.put(UID, value);
|
||||
session.setAttribute("listSubmitQueryResult",
|
||||
listSubmitQueryResult);
|
||||
}
|
||||
|
||||
private synchronized void removeSubmitQueryResult(String UID){
|
||||
|
||||
ASLSession session = SessionUtil.getAslSession(this
|
||||
.getThreadLocalRequest().getSession());
|
||||
|
||||
HashMap<String, List<Result>> listSubmitQueryResult = (HashMap<String, List<Result>>) session
|
||||
.getAttribute("listSubmitQueryResult");
|
||||
|
||||
if (listSubmitQueryResult.containsKey(UID)) {
|
||||
listSubmitQueryResult.remove(UID);
|
||||
session.setAttribute("listSubmitQueryResult",
|
||||
listSubmitQueryResult);
|
||||
}
|
||||
}
|
||||
|
||||
private String startComputation(String algorithmName,
|
||||
List<Parameter> parameters, ComputationOutput outputData,
|
||||
String scope) throws Exception {
|
||||
|
@ -1959,6 +2022,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if ((submitQueryUID != null) && (!submitQueryUID.equals(""))) {
|
||||
removeKeySubmitQueryResult(submitQueryUID);
|
||||
removeSubmitQueryResult(submitQueryUID);
|
||||
// removeResultParsed(submitQueryUID);
|
||||
// removeResult(submitQueryUID);
|
||||
// removeSubmitQueryUIDCachedData(submitQueryUID);
|
||||
|
|
Loading…
Reference in New Issue