Search in sources :

Example 66 with DbUserInfo

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;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) DbTransactionList(com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 67 with DbUserInfo

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;
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) EditBackupPlanDialog(com.cubrid.cubridmanager.ui.cubrid.jobauto.dialog.EditBackupPlanDialog)

Example 68 with DbUserInfo

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;
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) EditQueryPlanDialog(com.cubrid.cubridmanager.ui.cubrid.jobauto.dialog.EditQueryPlanDialog) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ArrayList(java.util.ArrayList) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) SetQueryPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.SetQueryPlanListTask) QueryPlanInfoHelp(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 69 with DbUserInfo

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());
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)

Example 70 with DbUserInfo

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;
}
Also used : GetUserListTask(com.cubrid.cubridmanager.core.cubrid.user.task.GetUserListTask) DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) GetAllClassListTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetAllClassListTask) Connection(java.sql.Connection) GetAllPartitionClassTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetAllPartitionClassTask) GetUserAuthorizationsTask(com.cubrid.cubridmanager.core.cubrid.user.task.GetUserAuthorizationsTask) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)80 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)36 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)30 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)22 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)16 ArrayList (java.util.ArrayList)14 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)10 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)10 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)10 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)9 DbUserInfoList (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList)8 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)7 DatabaseEditorConfig (com.cubrid.common.ui.spi.model.DatabaseEditorConfig)6 ICubridNodeLoader (com.cubrid.common.ui.spi.model.ICubridNodeLoader)6 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)6 IsDBAUserTask (com.cubrid.cubridmanager.core.cubrid.user.task.IsDBAUserTask)6 CQBDbConnectionLoader (com.cubrid.cubridmanager.ui.spi.model.loader.CQBDbConnectionLoader)6 HashMap (java.util.HashMap)6 CubridNodeLoader (com.cubrid.common.ui.spi.model.CubridNodeLoader)5 UpdateCMUserTask (com.cubrid.cubridmanager.core.common.task.UpdateCMUserTask)5