use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo in project cubrid-manager by CUBRID.
the class TransactionInfoDialog method loadData.
/**
* load the init data from the server
*
* @param shell the shell
* @return <code>true</code> if it is valid;<code>false</code>otherwise
*/
public boolean loadData(Shell shell) {
CommonQueryTask<DbTransactionList> task = new CommonQueryTask<DbTransactionList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbTransactionList());
task.setDbName(database.getName());
DbUserInfo userInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (userInfo != null) {
task.setDbUser(userInfo.getName() == null ? "" : userInfo.getName());
task.setDbpasswd(userInfo.getNoEncryptPassword() == null ? "" : userInfo.getNoEncryptPassword());
}
execTask(-1, new SocketTask[] { task }, true, shell);
if (task.getErrorMsg() != null) {
return false;
}
setDbTransactionList(task.getResultModel());
return true;
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo in project cubrid-manager by CUBRID.
the class EditBackupPlanAction method run.
/**
* Creates a Dialog which is the instance of EditBackupPlanDialog to add a
* query plan
* @param database CubridDatabase
* @param selection DefaultSchemaNode
*/
public int run(CubridDatabase database, DefaultSchemaNode selection) {
boolean isEditAble = false;
if (CubridNodeType.BACKUP_PLAN.equals(selection.getType()) && database != null && database.isLogined()) {
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
isEditAble = true;
}
}
EditBackupPlanDialog editBackupPlanDlg = new EditBackupPlanDialog(getShell(), isEditAble);
editBackupPlanDlg.setOperation(AddEditType.EDIT);
editBackupPlanDlg.initPara(selection);
if (editBackupPlanDlg.open() == IDialogConstants.OK_ID) {
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(selection, CubridNodeChangedEventType.NODE_REFRESH));
ActionManager.getInstance().fireSelectionChanged(getSelection());
return IDialogConstants.OK_ID;
}
return IDialogConstants.CANCEL_ID;
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo in project cubrid-manager by CUBRID.
the class EditQueryPlanAction method run.
/**
*
* Creates a Dialog which is the instance of EditBackupPlanDialog to edit a
* query plan
*
*/
public int run(CubridDatabase database, DefaultSchemaNode schemaNode) {
if (database == null) {
CommonUITool.openErrorBox(Messages.msgSelectDB);
return IDialogConstants.CANCEL_ID;
}
boolean withUser = CompatibleUtil.isSupportQueryPlanWithUser(database.getDatabaseInfo());
boolean isEditAble = false;
if (CubridNodeType.QUERY_PLAN.equals(schemaNode.getType()) && database != null && database.isLogined()) {
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
isEditAble = true;
}
}
EditQueryPlanDialog editQueryPlanDlg = new EditQueryPlanDialog(getShell(), isEditAble);
editQueryPlanDlg.setOperation(AddEditType.EDIT);
editQueryPlanDlg.initPara(schemaNode);
if (editQueryPlanDlg.open() == Dialog.OK) {
// Sets the data of task
List<ICubridNode> list = schemaNode.getParent().getChildren();
List<String> msgList = new ArrayList<String>();
QueryPlanInfo queryPlan = null;
QueryPlanInfoHelp qHelp = new QueryPlanInfoHelp();
for (ICubridNode icn : list) {
if (!icn.isContainer()) {
queryPlan = (QueryPlanInfo) icn.getAdapter(QueryPlanInfo.class);
qHelp.setQueryPlanInfo(queryPlan);
msgList.add(qHelp.buildMsg(withUser));
}
}
ServerInfo serverInfo = database.getServer().getServerInfo();
SetQueryPlanListTask task = new SetQueryPlanListTask(serverInfo);
task.setDbname(database.getName());
task.buildMsg(msgList);
String taskName = Messages.bind(com.cubrid.cubridmanager.ui.cubrid.jobauto.Messages.editQueryPlanTaskName, schemaNode.getName());
TaskExecutor taskExecutor = new CommonTaskExec(taskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(schemaNode, CubridNodeChangedEventType.NODE_REFRESH));
ActionManager.getInstance().fireSelectionChanged(getSelection());
return IDialogConstants.OK_ID;
}
return IDialogConstants.CANCEL_ID;
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method init.
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
this.database = (CubridDatabase) input.getAdapter(CubridDatabase.class);
JobAutoDashboardInput jobAutoDetailInfoPartInput = (JobAutoDashboardInput) input;
backupPlanInfoList = jobAutoDetailInfoPartInput.getBackupPlanInfoList();
queryPlanInfoList = jobAutoDetailInfoPartInput.getQueryPlanInfoList();
StringBuilder partName = new StringBuilder(Messages.jobAutoDetailInfoPartTitle);
partName.append(" [").append(database.getUserName()).append("@").append(database.getName()).append(":").append(database.getDatabaseInfo().getBrokerIP()).append("]");
setPartName(partName.toString());
DbUserInfo dbUserInfo = database.getDatabaseInfo().getAuthLoginedDbUserInfo();
if (dbUserInfo != null && dbUserInfo.isDbaAuthority()) {
canAddOrEdit = true;
}
isSupportPeriodicAutoJob = CompatibleUtil.isSupportPeriodicAutoJob(database.getDatabaseInfo());
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo in project cubrid-manager by CUBRID.
the class CQBUserEditor method loadData.
/**
* Load data
*
* @return <code>true</code> if it is successfully;<code>false</code>
* otherwise
*/
public boolean loadData() {
Connection con = null;
try {
con = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), false);
final GetUserListTask task = new GetUserListTask(database.getDatabaseInfo(), con);
final GetAllClassListTask classInfoTask = new GetAllClassListTask(database.getDatabaseInfo(), con);
final GetAllPartitionClassTask partitionTask = new GetAllPartitionClassTask(database.getDatabaseInfo(), con);
execTask(new ITask[] { task, classInfoTask, partitionTask });
GetUserAuthorizationsTask privilegeTask = new GetUserAuthorizationsTask(database.getDatabaseInfo(), con);
try {
for (DbUserInfo userInfo : userListInfo.getUserList()) {
if (userInfo.getName().equals(userName)) {
userInfo.setUserAuthorizations(privilegeTask.getUserAuthorizations(userInfo.getName()));
}
}
} catch (Exception e) {
LOGGER.error("get user failed", e);
}
initial();
} catch (Exception e) {
LOGGER.error(e.getMessage());
} finally {
QueryUtil.freeQuery(con);
}
return true;
}
Aggregations