- bug fixed in servlet regarding the refresh of the submitQuery cached data.

- algorithm ID defined in ConstantsPOrtlet class and used in servlet

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100367 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-10-02 12:53:13 +00:00
parent 4a5a0b127d
commit 61e265a734
2 changed files with 28 additions and 15 deletions

View File

@ -24,10 +24,16 @@ public class ConstantsPortlet {
public static final String DATABASE="Database";
public static final String SCHEMA="Schema";
//algorithmID
public static final String ALGID_GETRESOURCE="LISTDBNAMES";
public static final String ALGID_GETDBINFO="LISTDBINFO";
public static final String ALGID_GETDBSCHEMA="LISTDBSCHEMA";
public static final String ALGID_GETTABLES="LISTTABLES";
public static final String ALGID_GETTABLEDETAILS="GETTABLEDETAILS";
public static final String ALGID_SUBMITQUERY="SUBMITQUERY";
public static final String ALGID_SAMPLEONTABLE="SAMPLEONTABLE";
public static final String ALGID_SMARTSAMPLEONTABLE="SMARTSAMPLEONTABLE";
// public static final String ALGID_RANDOMSAMPLEONTABLE="RANDOMSAMPLEONTABLE";
public static final String ALGID_RANDOMSAMPLEONTABLE="RANDOMSAMPLEONTABLE";

View File

@ -289,7 +289,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
List<FileModel> outputParameters = new ArrayList<FileModel>();
// get algorithmId
String algorithmId = "LISTDBNAMES";
String algorithmId = ConstantsPortlet.ALGID_GETRESOURCE;
Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1");
inputParameters.add(maxNumber);
@ -377,7 +377,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
String algorithmId = "LISTDBINFO";
String algorithmId = ConstantsPortlet.ALGID_GETDBINFO;
// print check
logger.info("dbmanager-> ResourceName: " + resourceName);
@ -481,7 +481,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output
List<FileModel> outputParameters = new ArrayList<FileModel>();
String algorithmId = "LISTDBSCHEMA";
String algorithmId = ConstantsPortlet.ALGID_GETDBSCHEMA;
// print check
String rs = dataInput.get("ResourceName");
String db = dataInput.get("DatabaseName");
@ -592,7 +592,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output
List<Result> outputParameters = new ArrayList<Result>();
String algorithmId = "LISTTABLES";
String algorithmId = ConstantsPortlet.ALGID_GETTABLES;
String rs = dataInput.get("ResourceName");
String db = dataInput.get("DatabaseName");
@ -859,7 +859,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// converted query
String convertedQuery = "";
String algorithmId = "SUBMITQUERY";
String algorithmId = ConstantsPortlet.ALGID_SUBMITQUERY;
// print check
String rs = dataDB.get("ResourceName");
@ -1087,7 +1087,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
List<Result> output = new ArrayList<Result>();
SamplingResultWithFileFromServlet result;
String algorithmId = "SAMPLEONTABLE";
String algorithmId = ConstantsPortlet.ALGID_SAMPLEONTABLE;
// print check
String rs = dataInput.get("ResourceName");
@ -1235,7 +1235,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
List<Result> output = new ArrayList<Result>();
SamplingResultWithFileFromServlet result;
String algorithmId = "SMARTSAMPLEONTABLE";
String algorithmId = ConstantsPortlet.ALGID_SMARTSAMPLEONTABLE;
// print check
String rs = dataInput.get("ResourceName");
@ -1380,7 +1380,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// output sample result
List<Result> output = new ArrayList<Result>();
String algorithmId = "RANDOMSAMPLEONTABLE";
String algorithmId = ConstantsPortlet.ALGID_RANDOMSAMPLEONTABLE;
// print check
String rs = dataInput.get("ResourceName");
@ -1498,7 +1498,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data ouptut
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
String algorithmId = "GETTABLEDETAILS";
String algorithmId = ConstantsPortlet.ALGID_GETTABLEDETAILS;
// print check
String rs = dataInput.get("ResourceName");
@ -2237,7 +2237,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
private String getUsername() {
//set the username of the user session to value "database.manager"
// set the username of the user session to value "database.manager"
// HttpSession httpSession = this.getThreadLocalRequest().getSession();
// return SessionUtil.getUsername(httpSession);
return "database.manager";
@ -2426,13 +2426,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
break;
case "schema":
key = inputData.get("ResourceName")
+ inputData.get("DatabaseName")
+ inputData.get("SchemaName");
// refresh submitted query and samplings
keyUsedForQueryRefresh = ConstantsPortlet.ALGID_SUBMITQUERY
+ key;
+ inputData.get("ResourceName")
+ inputData.get("DatabaseName");
refreshSubmittedQueryInCache(keyUsedForQueryRefresh);
keyUsedForSamplingsRefresh = ConstantsPortlet.ALGID_SAMPLEONTABLE
+ key;
@ -2486,7 +2488,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
getTables(inputData, ConstantsPortlet.DATABASE);
}
break;
case "schema":
@ -2530,6 +2532,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// recover keys list that match the key
for (int i = 0; i < listSize; i++) {
if (keysInCache.get(i).startsWith(key)) {
// System.out.println("data removed with key: " +
// keysInCache.get(i));
keysToBeRemoved.add(keysInCache.get(i));
}
}
@ -2556,7 +2560,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
}
// remove keys
DBCache.removeAll(keysToBeRemoved);
// System.out.println("Samplings refreshed with keys: "+keyUsedForSamplingsRefresh+" "+keyUsedForSmartSamplingRefresh);
// System.out.println("Samplings refreshed with keys: "
// + keyUsedForSamplingsRefresh + " "
// + keyUsedForSmartSamplingRefresh);
}
private String storeResultIntoCSVFile(List<Result> result, String n)
@ -2611,7 +2617,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
.getSession());
}
//to delete more space occurences in order to have only one space between two words in a query
// to delete more space occurences in order to have only one space between
// two words in a query
private String parseQuery(String query) {
String queryParsed;