Search in sources :

Example 1 with GetAllUserAuthorizationsTask

use of com.cubrid.cubridmanager.core.cubrid.user.task.GetAllUserAuthorizationsTask in project cubrid-manager by CUBRID.

the class DBAuthComparator method loadData.

/**
	 * Load the data
	 */
private void loadData() {
    final GetUserListTask getUserTask = new GetUserListTask(database.getDatabaseInfo());
    final GetAllUserAuthorizationsTask getUserAuthTask = new GetAllUserAuthorizationsTask(database.getDatabaseInfo());
    TaskJobExecutor taskExec = new CommonTaskJobExec(new ITaskExecutorInterceptor() {

        public void completeAll() {
            final List<UserDetailInfo> userDetailList = new ArrayList<UserDetailInfo>();
            DbUserInfoList userListInfo = getUserTask.getResultModel();
            Map<String, UserDetailInfo> allUserAuthMap = getUserAuthTask.getAllAuthMap();
            if (userListInfo != null) {
                for (DbUserInfo userInfo : userListInfo.getUserList()) {
                    UserDetailInfo userDetailInfo = allUserAuthMap.get(userInfo.getName());
                    if (userDetailInfo == null) {
                        userDetailInfo = new UserDetailInfo();
                        userDetailInfo.setUserName(userInfo.getName());
                    }
                    userDetailList.add(userDetailInfo);
                }
            }
            setTableData(userDetailList);
        }

        public IStatus postTaskFinished(ITask task) {
            return Status.OK_STATUS;
        }
    });
    taskExec.addTask(getUserTask);
    taskExec.addTask(getUserAuthTask);
    JobFamily jobFamily = new JobFamily();
    String serverName = database.getServer().getName();
    String dbName = database.getName();
    jobFamily.setServerName(serverName);
    jobFamily.setDbName(dbName);
    String jobName = Messages.jobLoadUserData + " - " + "@" + dbName + "@" + serverName;
    taskExec.schedule(jobName, jobFamily, false, Job.SHORT);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) ITaskExecutorInterceptor(com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor) ITask(com.cubrid.common.core.task.ITask) IStatus(org.eclipse.core.runtime.IStatus) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily) GetAllUserAuthorizationsTask(com.cubrid.cubridmanager.core.cubrid.user.task.GetAllUserAuthorizationsTask) GetUserListTask(com.cubrid.cubridmanager.core.cubrid.user.task.GetUserListTask) DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) List(java.util.List) ArrayList(java.util.ArrayList) DbUserInfoList(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList) DbUserInfoList(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList) Map(java.util.Map) UserDetailInfo(com.cubrid.cubridmanager.core.cubrid.user.model.UserDetailInfo)

Aggregations

ITask (com.cubrid.common.core.task.ITask)1 CommonTaskJobExec (com.cubrid.common.ui.spi.progress.CommonTaskJobExec)1 ITaskExecutorInterceptor (com.cubrid.common.ui.spi.progress.ITaskExecutorInterceptor)1 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)1 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)1 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)1 DbUserInfoList (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList)1 UserDetailInfo (com.cubrid.cubridmanager.core.cubrid.user.model.UserDetailInfo)1 GetAllUserAuthorizationsTask (com.cubrid.cubridmanager.core.cubrid.user.task.GetAllUserAuthorizationsTask)1 GetUserListTask (com.cubrid.cubridmanager.core.cubrid.user.task.GetUserListTask)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 IStatus (org.eclipse.core.runtime.IStatus)1