Пример #1
0
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            try
            {
                m_Parameters = DocumentImportHelper.GetProfileBeo((string)BootParameters);

                m_CounterForCorrelationId = 0;

                InitializeConfigurationItems();

                //?? need to percentage completion
                m_PercenatgeCompletion = 100;

                m_Documents = new List <RVWDocumentBEO>();

                #region Get Dataset Details
                if (m_Parameters != null && m_Parameters.DatasetDetails.FolderID > 0)
                {
                    m_FileProcessor = FileProcessorFactory.CreateFileProcessor(
                        FileProcessorFactory.ExtractionChoices.CompoundFileExtraction);
                    m_Dataset = DataSetBO.GetDataSetDetailForDataSetId(m_Parameters.DatasetDetails.FolderID);

                    if (m_Dataset.Matter != null && m_Dataset.Matter.FolderID > 0)
                    {
                        var matterDetails = MatterDAO.GetMatterDetails(m_Dataset.Matter.FolderID.ToString());
                        if (matterDetails != null)
                        {
                            m_Dataset.Matter = matterDetails;
                            var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id);
                            if (searchServerDetails != null)
                            {
                                m_Dataset.Matter.SearchServer = searchServerDetails;
                            }
                        }
                    }
                    else
                    {
                        throw new EVException().AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_FailedToObtainMatterDetails); //?? need to set message in resource file
                    }
                }
                else
                {
                    throw new EVException().AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_ObtainDatasetDetailsFailure); //?? need to set message in resource file
                }
                #endregion
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
            }
        }
        protected override void BeginWork()
        {
            base.BeginWork();

            try
            {
                var strFileParserBatchSize = ApplicationConfigurationManager.GetValue("FileParserBatchSize", "Imports",
                                                                                      false);
                if (!String.IsNullOrEmpty(strFileParserBatchSize))
                {
                    fileParserBatchSize = int.Parse(strFileParserBatchSize);
                }

                fileIoHelper = new FileIOHelper();

                // function that's called when a batch of documents are available.
                fileIoHelper.BatchOfDocumentsAvailable += Send;

                profileBEO = DocumentImportHelper.GetProfileBeo(BootParameters);

                #region Check for minimum required information.

                // Check if minimum required information, dataset details and matter details available.
                if (profileBEO.DatasetDetails == null)
                {
                    throw new EVException().AddResMsg(
                              ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable);
                }
                if (profileBEO.DatasetDetails.Matter == null)
                {
                    throw new EVException().AddResMsg(
                              ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable);
                }

                #endregion Check for minimum required information

                //TODO: Search Engine Replacement - Search Sub System - Create Seed Directory, if required
            }
            catch (Exception ex)
            {
                LogMessage(false, "Failed on initialize values. " + ex.ToUserString());
                ReportToDirector(ex);
                throw;
            }
        }