} // end of CreateUserSession /// <summary> /// Creates a Admin Session /// </summary> private void CreateAdminSession() { // create and initialize admin session object cqAdminSession = CQWrapper.CreateAdminSession(); Logger.WritePerf(LogSource.CQ, "Connecting to CQ Admin Session"); CQWrapper.AdminLogon(cqAdminSession, m_user, m_pwd, m_dbSet, m_configFile); Logger.WritePerf(LogSource.CQ, "Connected to CQ Admin Session"); OAdUser cqUser = CQWrapper.GetUser(cqAdminSession, m_user); try { if (!CQWrapper.IsSuperUser(cqUser)) { string errMsg = UtilityMethods.Format(CQResource.CQ_NO_ADMIN_RIGHT, CurConResource.Analysis, m_configFile); Logger.Write(LogSource.CQ, TraceLevel.Error, errMsg); ConverterMain.MigrationReport.WriteIssue(String.Empty, errMsg, string.Empty /* no item */, null, "Config", ReportIssueType.Critical); throw new ConverterException(errMsg); } } catch (System.Runtime.InteropServices.COMException ex) { string errMsg = UtilityMethods.Format(CQResource.CQ_NO_ADMIN_RIGHT, m_configFile); Logger.WriteException(LogSource.CQ, ex); Logger.Write(LogSource.CQ, TraceLevel.Error, errMsg); ConverterMain.MigrationReport.WriteIssue(String.Empty, errMsg, string.Empty /* no item */, null, "Config", ReportIssueType.Critical); throw new ConverterException(errMsg); } } // end of CreateAdminSession
/// <summary> /// Generate User Mappings based on the Clearquest users /// Each User mapping generates the same user name in to section also /// </summary> private void GenerateDefaultUserMaps(string userMapFileName) { Logger.WritePerf(LogSource.CQ, "Generating Default User Map"); AdminSession cqAdminSess = m_cqConnection.GetAdminSession(); OAdUsers users = CQWrapper.GetUsers(cqAdminSess); // create a instance of usermap.xml file UserMappings userMaps = new UserMappings(userMapFileName); for (int userindx = 0; userindx < users.Count; userindx++) { object userObj = (object)userindx; OAdUser aUser = CQWrapper.GetUser(users, ref userObj); userMaps.Add(aUser.Name, aUser.Name); } userMaps.Flush(); Logger.WritePerf(LogSource.CQ, "Default User Map Generation Done"); } // end of GenerateDefaultUserMaps()