exceptions management on algorithm input parameters

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100094 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-09-22 09:10:07 +00:00
parent 6528b95a3b
commit 41bab2bbb1
5 changed files with 203 additions and 70 deletions

View File

@ -32,13 +32,13 @@ public interface GWTdbManagerService extends RemoteService {
boolean smartCorrectionQuery, String language, String UID) boolean smartCorrectionQuery, String language, String UID)
throws Exception; throws Exception;
SamplingResultWithFileFromServlet sample(LinkedHashMap<String, String> dataInput) SamplingResultWithFileFromServlet sample(LinkedHashMap<String, String> dataInput, String elementType)
throws Exception; throws Exception;
SamplingResultWithFileFromServlet smartSample(LinkedHashMap<String, String> dataInput) SamplingResultWithFileFromServlet smartSample(LinkedHashMap<String, String> dataInput, String elementType)
throws Exception; throws Exception;
SamplingResultWithFileFromServlet randomSample(LinkedHashMap<String, String> dataInput) SamplingResultWithFileFromServlet randomSample(LinkedHashMap<String, String> dataInput, String elementType)
throws Exception; throws Exception;
List<Row> parseCVSString(List<Result> result, List<String> attrNames) List<Row> parseCVSString(List<Result> result, List<String> attrNames)
@ -48,7 +48,7 @@ public interface GWTdbManagerService extends RemoteService {
LinkedHashMap<String, String> dataInput) throws Exception; LinkedHashMap<String, String> dataInput) throws Exception;
PagingLoadResult<Result> LoadTables(PagingLoadConfig config, PagingLoadResult<Result> LoadTables(PagingLoadConfig config,
LinkedHashMap<String, String> dataInput, boolean SearchTable, LinkedHashMap<String, String> dataInput, String elementType, boolean SearchTable,
String keyword) throws Exception; String keyword) throws Exception;
PagingLoadResult<Row> loadSubmitResult(PagingLoadConfig config, PagingLoadResult<Row> loadSubmitResult(PagingLoadConfig config,

View File

@ -31,20 +31,20 @@ public interface GWTdbManagerServiceAsync {
void parseCVSString(List<Result> result, List<String> attrNames, void parseCVSString(List<Result> result, List<String> attrNames,
AsyncCallback<List<Row>> callback); AsyncCallback<List<Row>> callback);
void sample(LinkedHashMap<String, String> dataInput, void sample(LinkedHashMap<String, String> dataInput, String elementType,
AsyncCallback<SamplingResultWithFileFromServlet> callback); AsyncCallback<SamplingResultWithFileFromServlet> callback);
void getTableDetails(LinkedHashMap<String, String> dataInput, void getTableDetails(LinkedHashMap<String, String> dataInput,
AsyncCallback<LinkedHashMap<String, FileModel>> callback); AsyncCallback<LinkedHashMap<String, FileModel>> callback);
void smartSample(LinkedHashMap<String, String> dataInput, void smartSample(LinkedHashMap<String, String> dataInput, String elementType,
AsyncCallback<SamplingResultWithFileFromServlet> callback); AsyncCallback<SamplingResultWithFileFromServlet> callback);
void randomSample(LinkedHashMap<String, String> dataInput, void randomSample(LinkedHashMap<String, String> dataInput, String elementType,
AsyncCallback<SamplingResultWithFileFromServlet> callback); AsyncCallback<SamplingResultWithFileFromServlet> callback);
void LoadTables(PagingLoadConfig config, void LoadTables(PagingLoadConfig config,
LinkedHashMap<String, String> dataInput, boolean SearchTable, LinkedHashMap<String, String> dataInput, String elementType, boolean SearchTable,
String keyword, AsyncCallback<PagingLoadResult<Result>> callback); String keyword, AsyncCallback<PagingLoadResult<Result>> callback);
void removeComputation(String uidSubmitQuery, void removeComputation(String uidSubmitQuery,

View File

@ -102,7 +102,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
private Dialog tablesLoaded = null; private Dialog tablesLoaded = null;
// to keep track of selected table in the tables list // to keep track of selected table in the tables list
private String selectedTable = ""; private String selectedTable = "";
private String currentselectedTable=""; private String currentselectedTable = "";
private FileModel table = new FileModel(""); private FileModel table = new FileModel("");
// variables to perform the table search // variables to perform the table search
private String keyword = ""; private String keyword = "";
@ -238,7 +238,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// clean variable // clean variable
selectedTable = ""; selectedTable = "";
currentselectedTable=""; currentselectedTable = "";
if (DepthSelectedItem != 3) { if (DepthSelectedItem != 3) {
centerUpper.removeAll(); centerUpper.removeAll();
@ -334,10 +334,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// method to load the tables list // method to load the tables list
private void loadTables() { private void loadTables() {
// clean variable // clean variable
// selectedTable = null; // selectedTable = null;
// disable table details and sampling buttons // disable table details and sampling buttons
// toolbar.disableButtonsOperationsOnTable(); // toolbar.disableButtonsOperationsOnTable();
// clear the panel // clear the panel
// centerBottom.removeAll(); // centerBottom.removeAll();
// centerBottom.layout(true); // centerBottom.layout(true);
@ -353,6 +353,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
String database = ""; String database = "";
String schema = ""; String schema = "";
final String elementType;
if (element.isDatabase()) { // the selected item is a database if (element.isDatabase()) { // the selected item is a database
rootLogger.log(Level.INFO, "selected element is a database "); rootLogger.log(Level.INFO, "selected element is a database ");
database = element.getName(); database = element.getName();
@ -361,6 +363,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
dataInput.put("ResourceName", resource); dataInput.put("ResourceName", resource);
dataInput.put("DatabaseName", database); dataInput.put("DatabaseName", database);
dataInput.put("SchemaName", ""); dataInput.put("SchemaName", "");
elementType = ConstantsPortlet.DATABASE;
} else { // the selected item is a schema } else { // the selected item is a schema
rootLogger.log(Level.INFO, "selected element is a schema "); rootLogger.log(Level.INFO, "selected element is a schema ");
FileModel db = treePanel.getTreeStore().getParent(element); FileModel db = treePanel.getTreeStore().getParent(element);
@ -371,6 +374,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
dataInput.put("ResourceName", resource); dataInput.put("ResourceName", resource);
dataInput.put("DatabaseName", database); dataInput.put("DatabaseName", database);
dataInput.put("SchemaName", schema); dataInput.put("SchemaName", schema);
elementType = ConstantsPortlet.SCHEMA;
} }
// print check // print check
@ -390,7 +394,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
+ startSearchTable); + startSearchTable);
// remote rpc // remote rpc
RPCservice.LoadTables((PagingLoadConfig) loadConfig, dataInput, RPCservice.LoadTables((PagingLoadConfig) loadConfig, dataInput,
startSearchTable, keyword, elementType, startSearchTable, keyword,
new AsyncCallback<PagingLoadResult<Result>>() { new AsyncCallback<PagingLoadResult<Result>>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -569,7 +573,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}); });
// listener to manage the table selection in the grid // listener to manage the table selection in the grid
grid.addListener(Events.RowClick, new Listener<GridEvent<Result>>() { grid.addListener(Events.RowClick, new Listener<GridEvent<Result>>() {
@Override @Override
@ -582,7 +585,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
grid.getSelectionModel().getSelectedItems().get(0), grid.getSelectionModel().getSelectedItems().get(0),
true); true);
// tablesLoaded.addListener(Events.Hide, new // tablesLoaded.addListener(Events.Hide, new
// Listener<WindowEvent>() { // Listener<WindowEvent>() {
// @Override // @Override
@ -594,7 +596,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}); });
grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() { grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Result>>() {
@Override @Override
public void handleEvent(final GridEvent<Result> be) { public void handleEvent(final GridEvent<Result> be) {
@ -684,7 +685,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
Button canc = (Button) tablesLoaded.getButtonBar().getWidget(1); Button canc = (Button) tablesLoaded.getButtonBar().getWidget(1);
rootLogger.log(Level.INFO, "button: " + canc.getText()); rootLogger.log(Level.INFO, "button: " + canc.getText());
// listener for buttons // listener for buttons
ok.addSelectionListener(new SelectionListener<ButtonEvent>() { ok.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
@ -692,8 +692,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
keyword = null; keyword = null;
startSearchTable = false; startSearchTable = false;
// if (selectedTable != null) { // if (selectedTable != null) {
if (!currentselectedTable.equals(selectedTable)){ if (!currentselectedTable.equals(selectedTable)) {
currentselectedTable = selectedTable; currentselectedTable = selectedTable;
// refresh the content in the two panels // refresh the content in the two panels
centerBottom.removeAll(); centerBottom.removeAll();
@ -728,22 +728,21 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
}); });
// listener to manage the table selection in the grid
grid.getSelectionModel().addSelectionChangedListener(
// listener to manage the table selection in the grid new SelectionChangedListener<Result>() {
grid.getSelectionModel().addSelectionChangedListener( @Override
new SelectionChangedListener<Result>() { public void selectionChanged(
@Override SelectionChangedEvent<Result> se) {
public void selectionChanged( selectedTable = grid.getSelectionModel()
SelectionChangedEvent<Result> se) { .getSelectedItems().get(0).getValue();
selectedTable = grid.getSelectionModel() rootLogger.log(Level.INFO,
.getSelectedItems().get(0).getValue(); "SelectionChangedListener->table selected: "
rootLogger.log(Level.INFO, "SelectionChangedListener->table selected: "
+ selectedTable); + selectedTable);
ok.enable(); ok.enable();
} }
}); });
tablesLoaded.add(grid); tablesLoaded.add(grid);
tablesLoaded.show(); tablesLoaded.show();
} }
@ -877,11 +876,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
} }
@Override @Override
public void onSuccess(SubmitQueryResultWithFileFromServlet obj) { public void onSuccess(
SubmitQueryResultWithFileFromServlet obj) {
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery"); rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
if (obj != null){ if (obj != null) {
//get list attributes // get list attributes
List<String> listAttributes = obj.getListOutput(); List<String> listAttributes = obj.getListOutput();
if (form.getBody().isMasked()) if (form.getBody().isMasked())
@ -919,7 +919,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// return; // return;
// } // }
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery"); rootLogger.log(Level.SEVERE,
"SUCCESS RPC submitQuery");
rootLogger.log(Level.SEVERE, "output size: " rootLogger.log(Level.SEVERE, "output size: "
+ listAttributes.size()); + listAttributes.size());
@ -952,8 +953,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// get path // get path
String fileName = obj.getFileName(); String fileName = obj.getFileName();
parseSubmitQueryResult(form, dialogID, listAttributes, fileName, parseSubmitQueryResult(form, dialogID,
UID); listAttributes, fileName, UID);
} }
@ -1169,18 +1170,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
}); });
// add the button to download the result // add the button to download the result
final String urlFile = Window.Location final String urlFile = Window.Location.getProtocol() + "//"
.getProtocol()
+ "//"
+ Window.Location.getHost() + fileName; + Window.Location.getHost() + fileName;
Button download = new Button("Download", Button download = new Button("Download",
new SelectionListener<ButtonEvent>() { new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected( public void componentSelected(ButtonEvent ce) {
ButtonEvent ce) { Window.open(urlFile, "Result File", "_blank");
Window.open(urlFile, "Result File",
"_blank");
} }
}); });
submitResult.addButton(download); submitResult.addButton(download);
@ -1205,6 +1202,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
FileModel database; FileModel database;
FileModel resource; FileModel resource;
String elementType;
if (selectedItem.isDatabase()) { if (selectedItem.isDatabase()) {
// the table has not a schema because the selected item is a // the table has not a schema because the selected item is a
// database // database
@ -1220,6 +1219,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + ""); rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.DATABASE;
} else { } else {
// the table has a schema because the selected item is a schema // the table has a schema because the selected item is a schema
schema = selectedItem; schema = selectedItem;
@ -1235,13 +1236,15 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName()); rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.SCHEMA;
} }
// to mask the entire content panel // to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading"); obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.sample(dataInput, RPCservice.sample(dataInput, elementType,
new AsyncCallback<SamplingResultWithFileFromServlet>() { new AsyncCallback<SamplingResultWithFileFromServlet>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -1341,6 +1344,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
FileModel database; FileModel database;
FileModel resource; FileModel resource;
String elementType;
if (selectedItem.isDatabase()) { if (selectedItem.isDatabase()) {
// the table has not a schema // the table has not a schema
database = selectedItem; database = selectedItem;
@ -1355,6 +1360,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + ""); rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType=ConstantsPortlet.DATABASE;
} else { } else {
// the table has a schema // the table has a schema
schema = selectedItem; schema = selectedItem;
@ -1370,12 +1376,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName()); rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType=ConstantsPortlet.SCHEMA;
} }
// to mask the entire content panel // to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading"); obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.smartSample(dataInput, RPCservice.smartSample(dataInput, elementType,
new AsyncCallback<SamplingResultWithFileFromServlet>() { new AsyncCallback<SamplingResultWithFileFromServlet>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -1438,6 +1445,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
FileModel database; FileModel database;
FileModel resource; FileModel resource;
String elementType;
if (selectedItem.isDatabase()) { if (selectedItem.isDatabase()) {
// the table has not a schema // the table has not a schema
database = selectedItem; database = selectedItem;
@ -1452,6 +1461,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + ""); rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.DATABASE;
} else { } else {
// the table has a schema // the table has a schema
schema = selectedItem; schema = selectedItem;
@ -1467,13 +1477,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName()); rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName()); rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable); rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.SCHEMA;
} }
// to mask the entire content panel // to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading"); obj.mask("Sampling the table", "x-mask-loading");
// call remote service // call remote service
RPCservice.randomSample(dataInput, RPCservice.randomSample(dataInput, elementType,
new AsyncCallback<SamplingResultWithFileFromServlet>() { new AsyncCallback<SamplingResultWithFileFromServlet>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {

View File

@ -20,6 +20,9 @@ public class ConstantsPortlet {
public static final String MYSQL = "MYSQL"; public static final String MYSQL = "MYSQL";
public static final String NONE = "NONE"; public static final String NONE = "NONE";
//element types
public static final String DATABASE="Database";
public static final String SCHEMA="Schema";

View File

@ -300,6 +300,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// print check // print check
logger.info("dbmanager-> ResourceName: " + resourceName); logger.info("dbmanager-> ResourceName: " + resourceName);
if ((resourceName == null) || (resourceName.equals(""))) {
throw new Exception("Unable to load data");
}
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
inputParameters.add(resource); inputParameters.add(resource);
inputParameters.get(0).setValue(resourceName); inputParameters.get(0).setValue(resourceName);
@ -398,6 +402,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> ResourceName: " + rs); logger.info("dbmanager-> ResourceName: " + rs);
logger.info("dbmanager-> DatabaseName: " + db); logger.info("dbmanager-> DatabaseName: " + db);
if ((rs == null) || (rs.equals(""))) {
throw new Exception("Unable to load data");
}
if ((db == null) || (db.equals(""))) {
throw new Exception("Unable to load data");
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -484,8 +495,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} }
// to get tables // to get tables
private List<Result> getTables(LinkedHashMap<String, String> dataInput) private List<Result> getTables(LinkedHashMap<String, String> dataInput,
throws Exception { String elementType) throws Exception {
// data input // data input
List<Parameter> inputParameters = new ArrayList<Parameter>(); List<Parameter> inputParameters = new ArrayList<Parameter>();
// data output // data output
@ -502,6 +513,26 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> DatabaseName: " + db); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> SchemaName: " + scm); logger.info("dbmanager-> SchemaName: " + scm);
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.SCHEMA))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((scm==null)||(scm.equals(""))){
throw new Exception("Unable to load data");
}
}
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.DATABASE))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -611,8 +642,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// to load tables // to load tables
@Override @Override
public PagingLoadResult<Result> LoadTables(PagingLoadConfig config, public PagingLoadResult<Result> LoadTables(PagingLoadConfig config,
LinkedHashMap<String, String> dataInput, boolean SearchTable, LinkedHashMap<String, String> dataInput, String elementType,
String keyword) throws Exception { boolean SearchTable, String keyword) throws Exception {
// tables' list stored for a user session // tables' list stored for a user session
// ASLSession session = // ASLSession session =
@ -654,7 +685,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// if (result == null) // if (result == null)
// result = getTables(dataInput); // result = getTables(dataInput);
if (result.size() == 0) if (result.size() == 0)
result = getTables(dataInput); result = getTables(dataInput, elementType);
// Create a sublist and add data to list according // Create a sublist and add data to list according
// to the limit and offset value of the config // to the limit and offset value of the config
@ -744,6 +775,16 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> SmartCorrections check: " logger.info("dbmanager-> SmartCorrections check: "
+ smartCorrectionQuery); + smartCorrectionQuery);
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((query==null)||(query.equals(""))){
throw new Exception("Unable to load data");
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -919,7 +960,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
@Override @Override
public SamplingResultWithFileFromServlet sample( public SamplingResultWithFileFromServlet sample(
LinkedHashMap<String, String> dataInput) throws Exception { LinkedHashMap<String, String> dataInput, String elementType) throws Exception {
// data input // data input
List<Parameter> inputParameters = new ArrayList<Parameter>(); List<Parameter> inputParameters = new ArrayList<Parameter>();
// output sample result // output sample result
@ -939,6 +980,32 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> SchemaName: " + scm); logger.info("dbmanager-> SchemaName: " + scm);
logger.info("dbmanager-> TableName: " + tab); logger.info("dbmanager-> TableName: " + tab);
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.SCHEMA))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((scm==null)||(scm.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.DATABASE))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -993,7 +1060,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
@Override @Override
public SamplingResultWithFileFromServlet smartSample( public SamplingResultWithFileFromServlet smartSample(
LinkedHashMap<String, String> dataInput) throws Exception { LinkedHashMap<String, String> dataInput, String elementType) throws Exception {
// data input // data input
List<Parameter> inputParameters = new ArrayList<Parameter>(); List<Parameter> inputParameters = new ArrayList<Parameter>();
// output sample result // output sample result
@ -1013,6 +1080,32 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> SchemaName: " + scm); logger.info("dbmanager-> SchemaName: " + scm);
logger.info("dbmanager-> TableName: " + tab); logger.info("dbmanager-> TableName: " + tab);
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.SCHEMA))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((scm==null)||(scm.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.DATABASE))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1067,7 +1160,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
@Override @Override
public SamplingResultWithFileFromServlet randomSample( public SamplingResultWithFileFromServlet randomSample(
LinkedHashMap<String, String> dataInput) throws Exception { LinkedHashMap<String, String> dataInput, String elementType) throws Exception {
// data input // data input
List<Parameter> inputParameters = new ArrayList<Parameter>(); List<Parameter> inputParameters = new ArrayList<Parameter>();
@ -1088,6 +1181,32 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> SchemaName: " + scm); logger.info("dbmanager-> SchemaName: " + scm);
logger.info("dbmanager-> TableName: " + tab); logger.info("dbmanager-> TableName: " + tab);
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.SCHEMA))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((scm==null)||(scm.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
if ((elementType!=null)&&(elementType.equals(ConstantsPortlet.DATABASE))) {
if ((rs==null)||(rs.equals(""))){
throw new Exception("Unable to load data");
}
if ((db==null)||(db.equals(""))){
throw new Exception("Unable to load data");
}
if ((tab==null)||(tab.equals(""))){
throw new Exception("Unable to load data");
}
}
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1928,7 +2047,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
ConstantsPortlet.MYSQL)) { // refresh ConstantsPortlet.MYSQL)) { // refresh
// table // table
// list // list
getTables(inputData); getTables(inputData, ConstantsPortlet.DATABASE);
} }
// resourceName = inputData.get("ResourceName"); // resourceName = inputData.get("ResourceName");
@ -1937,7 +2056,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
break; break;
case "schema": case "schema":
getTables(inputData); getTables(inputData, ConstantsPortlet.SCHEMA);
break; break;
} }
} }