- 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:
parent
4a5a0b127d
commit
61e265a734
|
@ -24,10 +24,16 @@ public class ConstantsPortlet {
|
||||||
public static final String DATABASE="Database";
|
public static final String DATABASE="Database";
|
||||||
public static final String SCHEMA="Schema";
|
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_SUBMITQUERY="SUBMITQUERY";
|
||||||
public static final String ALGID_SAMPLEONTABLE="SAMPLEONTABLE";
|
public static final String ALGID_SAMPLEONTABLE="SAMPLEONTABLE";
|
||||||
public static final String ALGID_SMARTSAMPLEONTABLE="SMARTSAMPLEONTABLE";
|
public static final String ALGID_SMARTSAMPLEONTABLE="SMARTSAMPLEONTABLE";
|
||||||
// public static final String ALGID_RANDOMSAMPLEONTABLE="RANDOMSAMPLEONTABLE";
|
public static final String ALGID_RANDOMSAMPLEONTABLE="RANDOMSAMPLEONTABLE";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
List<FileModel> outputParameters = new ArrayList<FileModel>();
|
List<FileModel> outputParameters = new ArrayList<FileModel>();
|
||||||
|
|
||||||
// get algorithmId
|
// get algorithmId
|
||||||
String algorithmId = "LISTDBNAMES";
|
String algorithmId = ConstantsPortlet.ALGID_GETRESOURCE;
|
||||||
|
|
||||||
Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1");
|
Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1");
|
||||||
inputParameters.add(maxNumber);
|
inputParameters.add(maxNumber);
|
||||||
|
@ -377,7 +377,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data output
|
// data output
|
||||||
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
|
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
|
||||||
|
|
||||||
String algorithmId = "LISTDBINFO";
|
String algorithmId = ConstantsPortlet.ALGID_GETDBINFO;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
logger.info("dbmanager-> ResourceName: " + resourceName);
|
logger.info("dbmanager-> ResourceName: " + resourceName);
|
||||||
|
@ -481,7 +481,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data output
|
// data output
|
||||||
List<FileModel> outputParameters = new ArrayList<FileModel>();
|
List<FileModel> outputParameters = new ArrayList<FileModel>();
|
||||||
|
|
||||||
String algorithmId = "LISTDBSCHEMA";
|
String algorithmId = ConstantsPortlet.ALGID_GETDBSCHEMA;
|
||||||
// print check
|
// print check
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
String db = dataInput.get("DatabaseName");
|
String db = dataInput.get("DatabaseName");
|
||||||
|
@ -592,7 +592,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data output
|
// data output
|
||||||
List<Result> outputParameters = new ArrayList<Result>();
|
List<Result> outputParameters = new ArrayList<Result>();
|
||||||
|
|
||||||
String algorithmId = "LISTTABLES";
|
String algorithmId = ConstantsPortlet.ALGID_GETTABLES;
|
||||||
|
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
String db = dataInput.get("DatabaseName");
|
String db = dataInput.get("DatabaseName");
|
||||||
|
@ -859,7 +859,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
// converted query
|
// converted query
|
||||||
String convertedQuery = "";
|
String convertedQuery = "";
|
||||||
String algorithmId = "SUBMITQUERY";
|
String algorithmId = ConstantsPortlet.ALGID_SUBMITQUERY;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
String rs = dataDB.get("ResourceName");
|
String rs = dataDB.get("ResourceName");
|
||||||
|
@ -1087,7 +1087,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
List<Result> output = new ArrayList<Result>();
|
List<Result> output = new ArrayList<Result>();
|
||||||
SamplingResultWithFileFromServlet result;
|
SamplingResultWithFileFromServlet result;
|
||||||
|
|
||||||
String algorithmId = "SAMPLEONTABLE";
|
String algorithmId = ConstantsPortlet.ALGID_SAMPLEONTABLE;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
|
@ -1235,7 +1235,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
List<Result> output = new ArrayList<Result>();
|
List<Result> output = new ArrayList<Result>();
|
||||||
SamplingResultWithFileFromServlet result;
|
SamplingResultWithFileFromServlet result;
|
||||||
|
|
||||||
String algorithmId = "SMARTSAMPLEONTABLE";
|
String algorithmId = ConstantsPortlet.ALGID_SMARTSAMPLEONTABLE;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
|
@ -1380,7 +1380,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// output sample result
|
// output sample result
|
||||||
List<Result> output = new ArrayList<Result>();
|
List<Result> output = new ArrayList<Result>();
|
||||||
|
|
||||||
String algorithmId = "RANDOMSAMPLEONTABLE";
|
String algorithmId = ConstantsPortlet.ALGID_RANDOMSAMPLEONTABLE;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
|
@ -1498,7 +1498,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data ouptut
|
// data ouptut
|
||||||
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
|
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
|
||||||
|
|
||||||
String algorithmId = "GETTABLEDETAILS";
|
String algorithmId = ConstantsPortlet.ALGID_GETTABLEDETAILS;
|
||||||
|
|
||||||
// print check
|
// print check
|
||||||
String rs = dataInput.get("ResourceName");
|
String rs = dataInput.get("ResourceName");
|
||||||
|
@ -2237,7 +2237,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUsername() {
|
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();
|
// HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
// return SessionUtil.getUsername(httpSession);
|
// return SessionUtil.getUsername(httpSession);
|
||||||
return "database.manager";
|
return "database.manager";
|
||||||
|
@ -2426,13 +2426,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "schema":
|
case "schema":
|
||||||
|
|
||||||
key = inputData.get("ResourceName")
|
key = inputData.get("ResourceName")
|
||||||
+ inputData.get("DatabaseName")
|
+ inputData.get("DatabaseName")
|
||||||
+ inputData.get("SchemaName");
|
+ inputData.get("SchemaName");
|
||||||
|
|
||||||
// refresh submitted query and samplings
|
// refresh submitted query and samplings
|
||||||
keyUsedForQueryRefresh = ConstantsPortlet.ALGID_SUBMITQUERY
|
keyUsedForQueryRefresh = ConstantsPortlet.ALGID_SUBMITQUERY
|
||||||
+ key;
|
+ inputData.get("ResourceName")
|
||||||
|
+ inputData.get("DatabaseName");
|
||||||
refreshSubmittedQueryInCache(keyUsedForQueryRefresh);
|
refreshSubmittedQueryInCache(keyUsedForQueryRefresh);
|
||||||
keyUsedForSamplingsRefresh = ConstantsPortlet.ALGID_SAMPLEONTABLE
|
keyUsedForSamplingsRefresh = ConstantsPortlet.ALGID_SAMPLEONTABLE
|
||||||
+ key;
|
+ key;
|
||||||
|
@ -2486,7 +2488,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
getTables(inputData, ConstantsPortlet.DATABASE);
|
getTables(inputData, ConstantsPortlet.DATABASE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "schema":
|
case "schema":
|
||||||
|
@ -2530,6 +2532,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// recover keys list that match the key
|
// recover keys list that match the key
|
||||||
for (int i = 0; i < listSize; i++) {
|
for (int i = 0; i < listSize; i++) {
|
||||||
if (keysInCache.get(i).startsWith(key)) {
|
if (keysInCache.get(i).startsWith(key)) {
|
||||||
|
// System.out.println("data removed with key: " +
|
||||||
|
// keysInCache.get(i));
|
||||||
keysToBeRemoved.add(keysInCache.get(i));
|
keysToBeRemoved.add(keysInCache.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2556,7 +2560,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
// remove keys
|
// remove keys
|
||||||
DBCache.removeAll(keysToBeRemoved);
|
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)
|
private String storeResultIntoCSVFile(List<Result> result, String n)
|
||||||
|
@ -2611,7 +2617,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
.getSession());
|
.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) {
|
private String parseQuery(String query) {
|
||||||
String queryParsed;
|
String queryParsed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue