bugs fixed for sample operations to manage database mysql.
logger gwt added in gwt.xml file git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98520 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
850d3ecda9
commit
a1a86b007c
|
@ -17,11 +17,11 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
// private boolean isTable = false;
|
// private boolean isTable = false;
|
||||||
private boolean isDatabase = false;
|
private boolean isDatabase = false;
|
||||||
|
|
||||||
|
|
||||||
private List<Result> DBInfo = null;
|
private List<Result> DBInfo = null;
|
||||||
private boolean isDBInfoDisplayed = false;
|
private boolean isDBInfoDisplayed = false;
|
||||||
private List<Result> TableDetails = null;
|
private List<Result> TableDetails = null;
|
||||||
private boolean isTableDetailsDisplayed = false;
|
private boolean isTableDetailsDisplayed = false;
|
||||||
|
private String DatabaseType;
|
||||||
|
|
||||||
public FileModel() {
|
public FileModel() {
|
||||||
setId();
|
setId();
|
||||||
|
@ -135,6 +135,16 @@ public class FileModel extends BaseModelData implements Serializable {
|
||||||
return isTableDetailsDisplayed;
|
return isTableDetailsDisplayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDatabaseType(String value) {
|
||||||
|
|
||||||
|
DatabaseType = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatabaseType() {
|
||||||
|
|
||||||
|
return this.DatabaseType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj != null && obj instanceof FileModel) {
|
if (obj != null && obj instanceof FileModel) {
|
||||||
|
|
|
@ -567,7 +567,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// the selected item is a table
|
// the selected item is a table
|
||||||
FileModel selectedItem = data.get(0);
|
FileModel selectedItem = data.get(0);
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "the selected table is: " + selectedItem);
|
rootLogger.log(Level.INFO, "the selected table is: " + selectedItem.getName());
|
||||||
|
|
||||||
// recover data inputs
|
// recover data inputs
|
||||||
|
|
||||||
|
@ -578,7 +578,40 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel database;
|
FileModel database;
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
if (treePanel.getTreeStore().getParent(selectedItem).isSchema()) {
|
if (treePanel.getTreeStore().getParent(selectedItem).isDatabase()) {
|
||||||
|
|
||||||
|
// the table has not a schema
|
||||||
|
|
||||||
|
database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
dataInput.put("TableName", selectedItem.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
// schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
// database = treePanel.getTreeStore().getParent(schema);
|
||||||
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", schema.getName());
|
||||||
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//the table has a schema
|
||||||
|
|
||||||
schema = treePanel.getTreeStore().getParent(selectedItem);
|
schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
database = treePanel.getTreeStore().getParent(schema);
|
database = treePanel.getTreeStore().getParent(schema);
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
@ -593,20 +626,19 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
} else {
|
|
||||||
// the table has not a schema
|
// the table has not a schema
|
||||||
database = treePanel.getTreeStore().getParent(selectedItem);
|
// database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
//
|
||||||
dataInput.put("ResourceName", resource.getName());
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
dataInput.put("DatabaseName", database.getName());
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
dataInput.put("SchemaName", "");
|
// dataInput.put("SchemaName", "");
|
||||||
dataInput.put("TableName", selectedItem.getName());
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
|
//
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
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, "SchemaName: " + selectedItem.getName());
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
@ -680,7 +712,40 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel database;
|
FileModel database;
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
if (treePanel.getTreeStore().getParent(selectedItem).isSchema()) {
|
if (treePanel.getTreeStore().getParent(selectedItem).isDatabase()) { //the table has not a schema
|
||||||
|
|
||||||
|
database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
dataInput.put("TableName", selectedItem.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
|
||||||
|
// schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
// database = treePanel.getTreeStore().getParent(schema);
|
||||||
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", schema.getName());
|
||||||
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// the table has a schema
|
||||||
|
|
||||||
|
|
||||||
schema = treePanel.getTreeStore().getParent(selectedItem);
|
schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
database = treePanel.getTreeStore().getParent(schema);
|
database = treePanel.getTreeStore().getParent(schema);
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
@ -695,20 +760,18 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
} else {
|
// database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
// the table has not a schema
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
database = treePanel.getTreeStore().getParent(selectedItem);
|
//
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
dataInput.put("ResourceName", resource.getName());
|
// dataInput.put("SchemaName", "");
|
||||||
dataInput.put("DatabaseName", database.getName());
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
dataInput.put("SchemaName", "");
|
//
|
||||||
dataInput.put("TableName", selectedItem.getName());
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
// rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
@ -781,7 +844,39 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel database;
|
FileModel database;
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
if (treePanel.getTreeStore().getParent(selectedItem).isSchema()) {
|
if (treePanel.getTreeStore().getParent(selectedItem).isDatabase()) { //the has not a schema
|
||||||
|
|
||||||
|
database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
dataInput.put("TableName", selectedItem.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
// schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
|
// database = treePanel.getTreeStore().getParent(schema);
|
||||||
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", schema.getName());
|
||||||
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//the table has a schema
|
||||||
|
|
||||||
schema = treePanel.getTreeStore().getParent(selectedItem);
|
schema = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
database = treePanel.getTreeStore().getParent(schema);
|
database = treePanel.getTreeStore().getParent(schema);
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
@ -796,20 +891,20 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
|
|
||||||
} else {
|
|
||||||
// the table has not a schema
|
|
||||||
database = treePanel.getTreeStore().getParent(selectedItem);
|
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
|
||||||
|
|
||||||
dataInput.put("ResourceName", resource.getName());
|
// // the table has not a schema
|
||||||
dataInput.put("DatabaseName", database.getName());
|
// database = treePanel.getTreeStore().getParent(selectedItem);
|
||||||
dataInput.put("SchemaName", "");
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
dataInput.put("TableName", selectedItem.getName());
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
// dataInput.put("SchemaName", "");
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
// dataInput.put("TableName", selectedItem.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + selectedItem.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// call remote service
|
// call remote service
|
||||||
|
@ -1161,6 +1256,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
this.mask("Loading", "x-mask-loading");
|
this.mask("Loading", "x-mask-loading");
|
||||||
|
|
||||||
|
// to unmask the entire content panel
|
||||||
|
final GxtBorderLayoutPanel obj = this;
|
||||||
|
|
||||||
// System.out.println("Start RPC - submitQuery");
|
// System.out.println("Start RPC - submitQuery");
|
||||||
|
|
||||||
rootLogger.log(Level.SEVERE, "Start RPC - getTableDetails");
|
rootLogger.log(Level.SEVERE, "Start RPC - getTableDetails");
|
||||||
|
@ -1185,7 +1283,40 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel database;
|
FileModel database;
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
if (treePanel.getTreeStore().getParent(selectedTable).isSchema()) {
|
if (treePanel.getTreeStore().getParent(selectedTable).isDatabase()) { //the table has not a schema
|
||||||
|
|
||||||
|
database = treePanel.getTreeStore().getParent(selectedTable);
|
||||||
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource.getName());
|
||||||
|
dataInput.put("DatabaseName", database.getName());
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
dataInput.put("TableName", selectedTable.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
rootLogger
|
||||||
|
.log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
||||||
|
|
||||||
|
// schema = treePanel.getTreeStore().getParent(selectedTable);
|
||||||
|
// database = treePanel.getTreeStore().getParent(schema);
|
||||||
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", schema.getName());
|
||||||
|
// dataInput.put("TableName", selectedTable.getName());
|
||||||
|
//
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
|
// rootLogger
|
||||||
|
// .log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// the table has a schema
|
||||||
|
|
||||||
schema = treePanel.getTreeStore().getParent(selectedTable);
|
schema = treePanel.getTreeStore().getParent(selectedTable);
|
||||||
database = treePanel.getTreeStore().getParent(schema);
|
database = treePanel.getTreeStore().getParent(schema);
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
resource = treePanel.getTreeStore().getParent(database);
|
||||||
|
@ -1201,21 +1332,20 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger
|
rootLogger
|
||||||
.log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
.log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
||||||
|
|
||||||
} else {
|
|
||||||
// the table has not a schema
|
|
||||||
database = treePanel.getTreeStore().getParent(selectedTable);
|
|
||||||
resource = treePanel.getTreeStore().getParent(database);
|
|
||||||
|
|
||||||
dataInput.put("ResourceName", resource.getName());
|
// database = treePanel.getTreeStore().getParent(selectedTable);
|
||||||
dataInput.put("DatabaseName", database.getName());
|
// resource = treePanel.getTreeStore().getParent(database);
|
||||||
dataInput.put("SchemaName", "");
|
//
|
||||||
dataInput.put("TableName", selectedTable.getName());
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
// dataInput.put("SchemaName", "");
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
// dataInput.put("TableName", selectedTable.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
//
|
||||||
rootLogger
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
.log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
|
// rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
|
// rootLogger
|
||||||
|
// .log(Level.INFO, "SchemaName: " + selectedTable.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedTable.isTableDetailsDisplayed()) {
|
if (selectedTable.isTableDetailsDisplayed()) {
|
||||||
|
@ -1238,6 +1368,10 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ",
|
||||||
"<br/>Message:" + caught.getMessage(), null);
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
|
if (obj.isMasked()) {
|
||||||
|
obj.unmask();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,22 +11,14 @@ import org.gcube.portlets.user.databasesmanager.client.GWTdbManagerServiceAsync;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.FileModel;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.events.SelectedItemEvent;
|
import org.gcube.portlets.user.databasesmanager.client.events.SelectedItemEvent;
|
||||||
|
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
||||||
//import org.gcube.portlets.user.dbmanager.client.GWTdbManagerServiceAsync;
|
|
||||||
//import org.gcube.portlets.user.dbmanager.client.datamodel.FileModel;
|
|
||||||
//import org.gcube.portlets.user.dbmanager.client.datamodel.Result;
|
|
||||||
//import org.gcube.portlets.user.dbmanager.client.events.SelectedItemEvent;
|
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
||||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||||
import com.extjs.gxt.ui.client.event.EventType;
|
import com.extjs.gxt.ui.client.event.EventType;
|
||||||
import com.extjs.gxt.ui.client.event.Listener;
|
|
||||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
|
||||||
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
||||||
import com.extjs.gxt.ui.client.event.TreePanelEvent;
|
import com.extjs.gxt.ui.client.event.TreePanelEvent;
|
||||||
import com.extjs.gxt.ui.client.store.TreeStore;
|
import com.extjs.gxt.ui.client.store.TreeStore;
|
||||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
|
||||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FlowData;
|
import com.extjs.gxt.ui.client.widget.layout.FlowData;
|
||||||
|
@ -34,14 +26,17 @@ import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Event;
|
import com.google.gwt.user.client.Event;
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
//class that implements the tree object
|
||||||
|
|
||||||
public class GxtTreePanel extends LayoutContainer {
|
public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
|
//to manage the tree
|
||||||
private TreeStore<FileModel> store;
|
private TreeStore<FileModel> store;
|
||||||
private TreePanel<FileModel> treePanel;
|
private TreePanel<FileModel> treePanel;
|
||||||
|
|
||||||
|
//to manage events
|
||||||
private HandlerManager eventBus = null;
|
private HandlerManager eventBus = null;
|
||||||
|
|
||||||
private String value = "";
|
private String value = "";
|
||||||
|
@ -49,6 +44,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
private boolean SelectedItemIsSchema = false;
|
private boolean SelectedItemIsSchema = false;
|
||||||
private GWTdbManagerServiceAsync RPCservice = null;
|
private GWTdbManagerServiceAsync RPCservice = null;
|
||||||
|
|
||||||
|
//to keep track of innformation associated to a database
|
||||||
private LinkedHashMap<String, FileModel> dataDBInfo = null;
|
private LinkedHashMap<String, FileModel> dataDBInfo = null;
|
||||||
|
|
||||||
private String ResourceNameSelected;
|
private String ResourceNameSelected;
|
||||||
|
@ -220,8 +216,15 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
if (selectedItem.getDatabaseType().equals(
|
||||||
|
ConstantsPortlet.POSTGRES)) {
|
||||||
// selectedItem.setIsSchema(false);
|
// selectedItem.setIsSchema(false);
|
||||||
loadSchema(data.get(0));
|
loadSchema(data.get(0));
|
||||||
|
} else {
|
||||||
|
// System.out.println("database mysql: " + data.get(0).getName() + data.get(0).getDatabaseType());
|
||||||
|
|
||||||
|
loadTables(data.get(0));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -407,6 +410,8 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (i = 0; i < numIterations; i++) {
|
for (i = 0; i < numIterations; i++) {
|
||||||
|
|
||||||
|
String DatabaseType = null;
|
||||||
|
|
||||||
// System.out.println("index i: " + i);
|
// System.out.println("index i: " + i);
|
||||||
|
|
||||||
String DBName = null;
|
String DBName = null;
|
||||||
|
@ -445,8 +450,24 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
Result row = new Result("Driver Name",
|
Result row = new Result("Driver Name",
|
||||||
result.get(array[j].toString())
|
result.get(array[j].toString())
|
||||||
.getName());
|
.getName());
|
||||||
|
|
||||||
|
String driver = result.get(
|
||||||
|
array[j].toString()).getName();
|
||||||
DBInfo.add(row);
|
DBInfo.add(row);
|
||||||
|
|
||||||
|
if (driver.toUpperCase().contains(
|
||||||
|
ConstantsPortlet.POSTGRES)) {
|
||||||
|
|
||||||
|
DatabaseType = ConstantsPortlet.POSTGRES;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (driver.toUpperCase().contains(
|
||||||
|
ConstantsPortlet.MYSQL)) {
|
||||||
|
|
||||||
|
DatabaseType = ConstantsPortlet.MYSQL;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array[j].toString().contains(
|
if (array[j].toString().contains(
|
||||||
|
@ -478,6 +499,11 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
child.setDBInfo(DBInfo);
|
child.setDBInfo(DBInfo);
|
||||||
|
|
||||||
|
//check print
|
||||||
|
// rootLogger.log(Level.INFO, "DatabaseType: " + DatabaseType);
|
||||||
|
|
||||||
|
child.setDatabaseType(DatabaseType);
|
||||||
|
|
||||||
children.add(child);
|
children.add(child);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -555,8 +581,6 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<FileModel> result) {
|
public void onSuccess(List<FileModel> result) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("SUCCESS");
|
// System.out.println("SUCCESS");
|
||||||
|
|
||||||
// rootLogger.log(Level.SEVERE,
|
// rootLogger.log(Level.SEVERE,
|
||||||
|
@ -568,7 +592,9 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
// element.setIsSchema(false);
|
// element.setIsSchema(false);
|
||||||
// element.setIsLoaded(false);
|
// element.setIsLoaded(false);
|
||||||
loadTables(element);
|
// loadTables(element);
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "the database has not schema");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -663,18 +689,67 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
FileModel database = store.getParent(element);
|
String resource="";
|
||||||
FileModel resource = store.getParent(database);
|
String database="";
|
||||||
|
String schema="";
|
||||||
|
|
||||||
|
|
||||||
|
if (element.isDatabase()){ //the selected item is a database
|
||||||
|
|
||||||
|
database= element.getName();
|
||||||
|
resource=store.getParent(element).getName();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource);
|
||||||
|
dataInput.put("DatabaseName", database);
|
||||||
|
dataInput.put("SchemaName", "");
|
||||||
|
|
||||||
|
}else { //the selected item is a schema
|
||||||
|
|
||||||
|
FileModel db = store.getParent(element);
|
||||||
|
database = db.getName();
|
||||||
|
|
||||||
|
resource = store.getParent(db).getName();
|
||||||
|
schema = element.getName();
|
||||||
|
|
||||||
|
dataInput.put("ResourceName", resource);
|
||||||
|
dataInput.put("DatabaseName", database);
|
||||||
|
dataInput.put("SchemaName", schema);
|
||||||
|
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
// dataInput.put("SchemaName", element.getName());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// FileModel database = store.getParent(element);
|
||||||
|
// FileModel resource = store.getParent(database);
|
||||||
|
//
|
||||||
|
// dataInput.put("ResourceName", resource.getName());
|
||||||
|
// dataInput.put("DatabaseName", database.getName());
|
||||||
|
|
||||||
|
// if (element.getDatabaseType().equals(ConstantsPortlet.POSTGRES)){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// dataInput.put("SchemaName", "");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
dataInput.put("ResourceName", resource.getName());
|
|
||||||
dataInput.put("DatabaseName", database.getName());
|
|
||||||
dataInput.put("SchemaName", element.getName());
|
|
||||||
|
|
||||||
// System.out.println("schema name: " + element.getName());
|
// System.out.println("schema name: " + element.getName());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
// rootLogger.log(Level.INFO, "ResourceName: " + resource.getName());
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
// rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + element.getName());
|
// rootLogger.log(Level.INFO, "SchemaName: " + element.getName());
|
||||||
|
|
||||||
|
rootLogger.log(Level.INFO, "ResourceName: " + resource);
|
||||||
|
rootLogger.log(Level.INFO, "DatabaseName: " + database);
|
||||||
|
rootLogger.log(Level.INFO, "SchemaName: " + schema);
|
||||||
|
|
||||||
|
|
||||||
// System.out.println(parent1.getName());
|
// System.out.println(parent1.getName());
|
||||||
// System.out.println(parent.getName());
|
// System.out.println(parent.getName());
|
||||||
|
@ -690,7 +765,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
// System.out.println("FAILURE");
|
// System.out.println("FAILURE");
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC getTables");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC getTables");
|
||||||
|
|
||||||
// no tables are available
|
// no tables are available (the schema has not table)
|
||||||
if (caught.getMessage().equals(
|
if (caught.getMessage().equals(
|
||||||
"java.lang.Exception: Result not available")) {
|
"java.lang.Exception: Result not available")) {
|
||||||
|
|
||||||
|
@ -701,6 +776,8 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
if (treePanel.isMasked())
|
if (treePanel.isMasked())
|
||||||
treePanel.unmask();
|
treePanel.unmask();
|
||||||
|
|
||||||
|
element.setIsLoaded(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(),
|
// MessageBox.alert("Error ","<br/>Message:"+caught.getMessage(),
|
||||||
|
@ -729,6 +806,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
treePanel.setExpanded(element, false);
|
treePanel.setExpanded(element, false);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
for (int i = 0; i < result.size(); i++) {
|
||||||
|
@ -741,12 +819,11 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
// element.setIsLoaded(true);
|
// element.setIsLoaded(true);
|
||||||
|
|
||||||
|
//ppritn check
|
||||||
|
|
||||||
// System.out.println(result.get(i).getName());
|
// System.out.println(result.get(i).getName());
|
||||||
|
|
||||||
rootLogger.log(Level.INFO, "table: "
|
// rootLogger.log(Level.INFO, "table: "
|
||||||
+ result.get(i).getName());
|
// + result.get(i).getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,6 +964,7 @@ public class GxtTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
infoOnSelectedItem.put("ResourceName", ResourceNameSelected);
|
infoOnSelectedItem.put("ResourceName", ResourceNameSelected);
|
||||||
infoOnSelectedItem.put("DatabaseName", DatabaseNameSelected);
|
infoOnSelectedItem.put("DatabaseName", DatabaseNameSelected);
|
||||||
|
// infoOnSelectedItem.put("SchemaName", "");
|
||||||
infoOnSelectedItem.put("TableName", TableNameSelected);
|
infoOnSelectedItem.put("TableName", TableNameSelected);
|
||||||
|
|
||||||
} else if (treeDepthSelectedItem == 5) { // the selected item is a table
|
} else if (treeDepthSelectedItem == 5) { // the selected item is a table
|
||||||
|
|
|
@ -190,6 +190,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
inputParameters.get(i).setValue(resourceName);
|
inputParameters.get(i).setValue(resourceName);
|
||||||
|
|
||||||
|
|
||||||
|
// rootLogger.log(Level.INFO, "ResourceName: " + resourceName);
|
||||||
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
|
rootLogger.log(Level.INFO, inputParameters.get(i).getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -353,6 +355,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||||
inputParameters.get(2).setValue(dataInput.get("SchemaName"));
|
inputParameters.get(2).setValue(dataInput.get("SchemaName"));
|
||||||
|
|
||||||
|
rootLogger.log(Level.SEVERE, "ResourceName: " + dataInput.get("ResourceName"));
|
||||||
|
rootLogger.log(Level.SEVERE, "DatabaseName: " + dataInput.get("DatabaseName"));
|
||||||
|
rootLogger.log(Level.SEVERE, "SchemaName: " + dataInput.get("SchemaName"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// System.out.println("size outputMap pre computation: "
|
// System.out.println("size outputMap pre computation: "
|
||||||
// + outputMap.size());
|
// + outputMap.size());
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||||
|
|
||||||
|
<inherits name="com.google.gwt.logging.Logging"/>
|
||||||
|
|
||||||
<!-- We need the JUnit module in the main module, -->
|
<!-- We need the JUnit module in the main module, -->
|
||||||
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||||
<inherits name='com.google.gwt.junit.JUnit' />
|
<inherits name='com.google.gwt.junit.JUnit' />
|
||||||
|
@ -25,4 +27,8 @@
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
<source path='shared' />
|
<source path='shared' />
|
||||||
|
|
||||||
|
<!-- <set-property name="gwt.logging.logLevel" value="SEVERE"/> -->
|
||||||
|
<!-- <set-property name="gwt.logging.logLevel" value="INFO"/> -->
|
||||||
|
<set-property name="gwt.logging.enabled" value="TRUE"/>
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
Loading…
Reference in New Issue