/// <summary> /// Parametrized Constructor for instantiating schema object /// No other CTors are provided as these values are required to start with /// </summary> /// <param name="xmlFile">Name of the target schema xml file</param> /// <param name="cqSess">Handle to valid CQ session</param> /// <param name="entityDef">Handle to valid CQ Entity Definition</param> public WITDXMLGenerator(string schemaXmlFile, string fieldMapXmlFile, Session cqSess, OAdEntityDef entityDef, VSTSConnection vstsConn) { Logger.EnteredMethod(LogSource.CQ, schemaXmlFile, fieldMapXmlFile, cqSess, entityDef); // create instance of WITDFieldMap to store field mappings witdFieldMap = new WITFieldMappings(); // create instance of WITDSchema to store WITD schema witdSchema = new WITDSchema(); witdSchema.SetApplication(Application.Workitemtypeeditor); // set the VSTS connection handle for finding the unique fields in VSTS system WITDSchema.VstsConn = vstsConn; // store file name to be used later to generate xml schemaXMLFileName = schemaXmlFile; fieldMapXMLFileName = fieldMapXmlFile; cqEntityDef = entityDef; cqSession = cqSess; cqEntity = CQWrapper.BuildEntity(cqSession, CQWrapper.GetEntityDefName(cqEntityDef)); Logger.ExitingMethod(LogSource.CQ); }
/// <summary> /// Initialize the object with the ConverterParameter values /// Also validates the Schema Mapping field Mapping on the CQ side /// </summary> /// <param name="convParams"></param> public void Initialize(ConverterParameters convParams) { // store it for future use this.m_convParams = convParams; m_cqParams.schemaMaps = convParams.SchemaMaps; m_cqParams.exitOnError = convParams.ExitOnError; // create the connection to VSTS and ensure that the user // is part of Service Accounts group m_vstsConn = new VSTSConnection(m_convParams.TargetConfig); m_cqParams.vstsConn = m_vstsConn; CQConstants.VstsConn = m_vstsConn; // create a ClearQuest connection handle m_cqConnection = new CQConnection(convParams.SourceConfig, convParams.ConfigFile); // check for valid CQ installation.. m_cqParams.uniqueInstId = GetUniqueInstallationId(); // set the output directory even before making a connection to CQ.. // IFF some output directory is specified in CQConfig.xml (bug#12110) // and only if it is Analyze phase.. no file is dumped in Migration phase in o/p dir if (m_convParams.OutputDirectory != null && m_convParams.OutputDirectory.Length >= 0) { CQConverterUtil.SetOutputDirectory(m_convParams.OutputDirectory, m_convParams.ConfigFile); } // create a user session and a admin session and execute the query m_cqConnection.Initialize(); // process the schema xml file // validate the entities on CQ database // for each entity validate the field map on CQ databases m_cqParams.cqSession = m_cqConnection.GetUserSession(); ConverterMain.MigrationReport.Converter = ReportConverter.CQConverter; } // end of Initialize