Пример #1
0
        public CQRecordStoredQueryQuery(
            Session userSession,
            CQRecordFilter recordFilter,
            string hwmStr,
            IServiceProvider serviceProvider)
            : base(userSession, recordFilter, serviceProvider)
        {
            if (!(recordFilter is CQRecordStoredQueryFilter))
            {
                throw new ArgumentException("recordFilter is not CQRecordStoredQueryFilter");
            }

            ClearQuestMigrationContext cqContext = serviceProvider.GetService(typeof(ClearQuestMigrationContext)) as ClearQuestMigrationContext;

            m_queryTimeDelimiter = (cqContext == null) ? ClearQuestConstants.CQQueryDefaultTimeDelimiter : cqContext.CQQueryTimeDelimiter;

            m_queryDef = CQWrapper.GetQueryDef(
                CQWrapper.GetWorkSpace(m_userSession), ((CQRecordStoredQueryFilter)m_recordFilter).StoredQueryName);

            string originalQueryString = NormalizeSqlQuery(m_queryDef.SQL);

            if (string.IsNullOrEmpty(hwmStr))
            {
                m_queryStr = originalQueryString;
            }
            else
            {
                m_queryStr = UtilityMethods.Format(QueryBase, originalQueryString, m_queryTimeDelimiter, hwmStr, m_queryTimeDelimiter);
            }

            Query();
        }
Пример #2
0
        private void InitializeCQClient()
        {
            Microsoft.TeamFoundation.Migration.BusinessModel.MigrationSource migrationSourceConfig = m_configurationService.MigrationSource;
            string dbSet  = migrationSourceConfig.ServerUrl;
            string userDb = migrationSourceConfig.SourceIdentifier;

            ICredentialManagementService credManagementService =
                m_serviceContainer.GetService(typeof(ICredentialManagementService)) as ICredentialManagementService;

            ICQLoginCredentialManager loginCredManager =
                CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig);

            // connect to user session
            UserSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                   loginCredManager.Password,
                                                                   userDb,
                                                                   dbSet);
            m_userSession = CQConnectionFactory.GetUserSession(UserSessionConnConfig);

            #region we won't need admin session until we start syncing cq schema
            //// connect to admin session
            //if (!string.IsNullOrEmpty(loginCredManager.AdminUserName))
            //{
            //    AdminSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.AdminUserName,
            //                                                                loginCredManager.AdminPassword ?? string.Empty,
            //                                                                userDb,
            //                                                                dbSet);
            //    m_adminSession = CQConnectionFactory.GetAdminSession(AdminSessionConnConfig);
            //}
            #endregion
            MigrationContext = new ClearQuestMigrationContext(m_userSession, migrationSourceConfig);
        }
Пример #3
0
        public CQRecordSqlQuery(
            Session userSession,
            List <CQRecordFilter> recordFilters,
            string hwmStr,
            IServiceProvider serviceProvider)
            : base(userSession, recordFilters[0], serviceProvider)
        {
            if (recordFilters == null || recordFilters.Count == 0)
            {
                throw new ArgumentException("recordFilters");
            }

            ClearQuestMigrationContext cqContext = serviceProvider.GetService(typeof(ClearQuestMigrationContext)) as ClearQuestMigrationContext;

            m_queryTimeDelimiter = (cqContext == null) ? ClearQuestConstants.CQQueryDefaultTimeDelimiter : cqContext.CQQueryTimeDelimiter;

            BuildQueryString(recordFilters, hwmStr);
            Query();
        }
Пример #4
0
        private void InitializeCQClient()
        {
            MigrationSource migrationSourceConfig = m_configurationService.MigrationSource;
            string          dbSet  = migrationSourceConfig.ServerUrl;
            string          userDb = migrationSourceConfig.SourceIdentifier;

            ICredentialManagementService credManagementService =
                m_serviceContainer.GetService(typeof(ICredentialManagementService)) as ICredentialManagementService;

            ICQLoginCredentialManager loginCredManager =
                CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig);

            // connect to user session
            UserSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                   loginCredManager.Password,
                                                                   userDb,
                                                                   dbSet);
            m_userSession = CQConnectionFactory.GetUserSession(UserSessionConnConfig);

            #region admin session is not needed until we sync context
            //// connect to admin session
            //if (!string.IsNullOrEmpty(loginCredManager.AdminUserName))
            //{
            //    AdminSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.AdminUserName,
            //                                                                loginCredManager.AdminPassword ?? string.Empty,
            //                                                                userDb,
            //                                                                dbSet);
            //    m_adminSession = CQConnectionFactory.GetAdminSession(AdminSessionConnConfig);
            //}
            #endregion

            // parse the filter strings in the configuration file
            m_filters = new CQRecordFilters(m_configurationService.Filters, m_userSession);

            m_migrationContext = new ClearQuestMigrationContext(m_userSession, migrationSourceConfig);
        }