From ba666c807ce39b96f607447a54ecb5cd78116a89 Mon Sep 17 00:00:00 2001 From: Loredana Liccardo Date: Fri, 5 Dec 2014 15:04:06 +0000 Subject: [PATCH] - total number rows added in the header of the result related to the submit Query operation: classes ComputationOutput,SubmitQueryResultWithFileFromServlet,GxtBorderLayoutPanel, GWTdbManagerServiceImpl modified. - class Result modified in order to implement IsSerializable and not Serializable - pom file modified in order to use gwt 2.6.1 with scope compile and not use gwt from the portal bom file. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@101939 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 38 ++++++++++++------- .../client/datamodel/ComputationOutput.java | 9 +++++ .../client/datamodel/Result.java | 3 +- .../SubmitQueryResultWithFileFromServlet.java | 8 +++- .../client/panels/GxtBorderLayoutPanel.java | 8 ++-- .../server/GWTdbManagerServiceImpl.java | 12 +++++- 6 files changed, 58 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 8bcc730..a804444 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,9 @@ UTF-8 UTF-8 - 2.5.1 + 2.6.1 + 2.6.1 + ${project.build.directory}/${project.build.finalName} @@ -39,11 +41,11 @@ - - - - - + + + + + org.gcube.data.analysis statistical-manager-cl @@ -83,7 +85,7 @@ xalan xalan 2.7.1 - + provided @@ -224,13 +226,15 @@ com.google.gwt gwt-servlet - + ${gwtVersion} + com.google.gwt gwt-user - + ${gwtVersion} + @@ -252,11 +256,19 @@ sources test + + + + + + + - com.extjs.gxt - gxt - 2.2.5 + com.sencha.gxt + gxt2.2.5-gwt2.X + ${gxt2Version} + @@ -288,7 +300,7 @@ org.codehaus.mojo gwt-maven-plugin - 2.5.1 + ${gwtVersion} diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/ComputationOutput.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/ComputationOutput.java index 1ab63de..b737998 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/ComputationOutput.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/ComputationOutput.java @@ -7,6 +7,7 @@ public class ComputationOutput { private LinkedHashMap mapValues; private LinkedHashMap mapKeys; private String urlFile; + private int submitQueryTotalRows; public ComputationOutput() { mapKeys = new LinkedHashMap(); @@ -37,4 +38,12 @@ public class ComputationOutput { public String getUrlFile(){ return this.urlFile; } + + public void setSubmitQueryTotalRows(int val){ + this.submitQueryTotalRows = val; + } + + public int getSubmitQueryTotalRows(){ + return this.submitQueryTotalRows; + } } diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/Result.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/Result.java index ee0dbe0..d8f264f 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/Result.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/Result.java @@ -3,8 +3,9 @@ package org.gcube.portlets.user.databasesmanager.client.datamodel; import java.io.Serializable; import com.extjs.gxt.ui.client.data.BaseModelData; +import com.google.gwt.user.client.rpc.IsSerializable; -public class Result extends BaseModelData implements Serializable { +public class Result extends BaseModelData implements IsSerializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/SubmitQueryResultWithFileFromServlet.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/SubmitQueryResultWithFileFromServlet.java index 0b92b53..6d2db02 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/SubmitQueryResultWithFileFromServlet.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/datamodel/SubmitQueryResultWithFileFromServlet.java @@ -12,6 +12,7 @@ public class SubmitQueryResultWithFileFromServlet extends BaseModelData private List attributes; private String convertedQuery; private String urlFile; + private int submitQueryTotalRows; public SubmitQueryResultWithFileFromServlet() { @@ -27,11 +28,12 @@ public class SubmitQueryResultWithFileFromServlet extends BaseModelData // } public SubmitQueryResultWithFileFromServlet(List attributes, - String query, String urlFile) { + String query, String urlFile, int submitQueryTotalRows) { set("attributes", attributes); set("convertedQuery", query); // set("fileName", fileName); set("urlFile", urlFile); + set("submitQueryTotalRows", submitQueryTotalRows); } @@ -50,5 +52,9 @@ public class SubmitQueryResultWithFileFromServlet extends BaseModelData public String getUrlFile(){ return get("urlFile"); } + + public int getSubmitQueryTotalRows(){ + return get("submitQueryTotalRows"); + } } diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java index 615f75a..767a922 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java @@ -999,8 +999,10 @@ public class GxtBorderLayoutPanel extends ContentPanel { // get path // String fileName = obj.getFileName(); String urlFile = obj.getUrlFile(); + + int submitQueryTotalRows = obj.getSubmitQueryTotalRows(); parseSubmitQueryResult(form, dialogID, - listAttributes, query, urlFile, UID); + listAttributes, query, urlFile, UID, submitQueryTotalRows); } @@ -1011,7 +1013,7 @@ public class GxtBorderLayoutPanel extends ContentPanel { // start the parsing of the submit result in order to obtain a table private void parseSubmitQueryResult(Dialog dialog, final int dialogID, final List listAttributes, String query, final String urlFile, - final String UID) { + final String UID, int submitQueryTotalRows) { final Dialog form = dialog; // define the proxy and create the grid to display in the dialog @@ -1175,7 +1177,7 @@ public class GxtBorderLayoutPanel extends ContentPanel { }; // submitResult.setLayout(new FitLayout()); - submitResult.setHeading("Result Query " + dialogID); + submitResult.setHeading("Result Query " + dialogID+ " (Total Rows: "+submitQueryTotalRows+")"); submitResult.setResizable(false); submitResult.setSize(600, 400); submitResult.setScrollMode(Scroll.NONE); diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java index e14ccc3..691d5ac 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java @@ -697,9 +697,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements removeJob(UID); String urlFile=outputData.getUrlFile(); + + int submitQueryTotalRows = outputData.getSubmitQueryTotalRows(); result = new SubmitQueryResultWithFileFromServlet( - listAttributes, convertedQuery, urlFile); + listAttributes, convertedQuery, urlFile,submitQueryTotalRows); // put the two data in cache net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element( @@ -1837,7 +1839,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements throw new Exception("Error in server while generating the file."); } - } else{ + } else if(key.equals("Total Rows")){ + //to recover the total number for the resutl of a submit query operation + SMResource smres = smMap.get(key); + SMObject obje = (SMObject) smres; + String outstring = obje.url(); + outputData.setSubmitQueryTotalRows(Integer.parseInt(outstring)); + }else{ // add key value mapKeys.put(String.valueOf(i), key); SMResource smres = smMap.get(key);