use of com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses in project cubrid-manager by CUBRID.
the class GetClassListTaskTest method testGetClassListTaskTest.
public void testGetClassListTaskTest() {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
GetClassListTask task = new GetClassListTask(serverInfo);
task.setDbName(testDbName);
task.setDbStatus(OnOffType.ON);
task.execute();
assertEquals(true, task.isSuccess());
DBClasses db = task.getDbClassInfo();
assertEquals(testDbName, db.getDbname());
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses in project cubrid-manager by CUBRID.
the class GetClassListTask method getDbClassInfo.
/**
*
* Get the database class info
*
* @return DBClasses
*/
public DBClasses getDbClassInfo() {
TreeNode node = (TreeNode) getResponse();
DBClasses result = new DBClasses();
setFieldValue(node, result);
return result;
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses in project cubrid-manager by CUBRID.
the class UnloadDatabaseAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISchemaNode node = (ISchemaNode) obj[0];
final CubridDatabase database = node.getDatabase();
final UnloadDatabaseDialog dialog = new UnloadDatabaseDialog(getShell());
dialog.setDatabase(database);
final Shell shell = getShell();
TaskExecutor taskExcutor = new TaskExecutor() {
public boolean exec(final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return false;
}
monitor.beginTask(Messages.loadAllClassTaskName, IProgressMonitor.UNKNOWN);
for (ITask task : taskList) {
task.execute();
final String msg = task.getErrorMsg();
if (openErrorBox(shell, msg, monitor)) {
return false;
}
if (monitor.isCanceled()) {
return false;
}
if (task instanceof GetClassListTask) {
GetClassListTask getClassListTask = (GetClassListTask) task;
List<String> allUserClassList = new ArrayList<String>();
DBClasses dbClasses = getClassListTask.getDbClassInfo();
List<ClassItem> userClassList = dbClasses == null ? null : dbClasses.getUserClassList().getClassList();
if (userClassList != null && !userClassList.isEmpty()) {
for (ClassItem userClass : userClassList) {
allUserClassList.add(userClass.getClassname());
}
}
Collections.sort(allUserClassList);
dialog.setUserClassList(allUserClassList);
}
}
return true;
}
};
ServerInfo serverInfo = database.getServer().getServerInfo();
GetClassListTask task = new GetClassListTask(serverInfo, database.getDatabaseInfo().getCharSet());
task.setDbName(database.getLabel());
task.setDbStatus(OnOffType.OFF);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
dialog.open();
}
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses in project cubrid-manager by CUBRID.
the class ChangeTablesPage method pageChanged.
/**
* @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
* @param event PageChangedEvent
*/
public void pageChanged(PageChangedEvent event) {
IWizardPage page = (IWizardPage) event.getSelectedPage();
if (page.getName().equals(PAGENAME)) {
SetDatabaseInfoPage selectDatabasePage = (SetDatabaseInfoPage) getWizard().getPage(SetDatabaseInfoPage.PAGENAME);
String ip = selectDatabasePage.getIp();
String port = selectDatabasePage.getPort();
String userName = selectDatabasePage.getUserName();
String password = selectDatabasePage.getPassword();
String dbName = selectDatabasePage.getMasterDbName();
String dbaPassword = selectDatabasePage.getMasterDbaPassword();
GetAllClassesTaskExecutor taskExcutor = new GetAllClassesTaskExecutor(getShell(), ip, port, userName, password, dbName, dbaPassword);
new ExecTaskWithProgress(taskExcutor).exec(true, true);
if (taskExcutor.isSuccess()) {
DBClasses dbClasses = taskExcutor.getDBClasses();
selectTableComp.fillTableViewer(dbClasses);
initialize();
setErrorMessage(null);
} else {
setErrorMessage(Messages.errPreviousPage);
}
}
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses in project cubrid-manager by CUBRID.
the class SelectTablesPage method pageChanged.
/**
* @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
* @param event PageChangedEvent
*/
public void pageChanged(PageChangedEvent event) {
setPageComplete(false);
IWizardPage page = (IWizardPage) event.getSelectedPage();
if (page.getName().equals(PAGENAME)) {
SlaveDbInfoPage slaveDbInfoPage = (SlaveDbInfoPage) getWizard().getPage(SlaveDbInfoPage.PAGENAME);
String ip = slaveDbInfoPage.getReplInfo().getMasterList().get(0).getMasterIp();
String port = slaveDbInfoPage.getMasterHostPort();
String userName = "admin";
String password = slaveDbInfoPage.getMasterHostPassword();
String mdbName = slaveDbInfoPage.getMasterDbName();
String mdbDbaPassword = slaveDbInfoPage.getMasterDbDbaPassword();
GetAllClassesTaskExecutor taskExcutor = new GetAllClassesTaskExecutor(getShell(), ip, port, userName, password, mdbName, mdbDbaPassword);
new ExecTaskWithProgress(taskExcutor).exec();
if (taskExcutor.isSuccess()) {
DBClasses dbClasses = taskExcutor.getDBClasses();
selectTableComp.fillTableViewer(dbClasses);
setErrorMessage(null);
setPageComplete(true);
} else {
setErrorMessage(Messages.errPreviousPage);
setPageComplete(false);
}
}
}
Aggregations