/// <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(); } }
/// <summary> /// Worker begin work event /// </summary> protected override void BeginWork() { try { base.BeginWork(); _jobParams = GetJobParams(BootParameters); _jobParams.ShouldNotBe(null); _jobParams.FolderId.ShouldBeGreaterThan(0); _datasetDetails = DataSetBO.GetDataSetDetailForDataSetId(_jobParams.FolderId); var matterDetails = MatterDAO.GetMatterDetails(_jobParams.MatterId.ToString(CultureInfo.InvariantCulture)); matterDetails.ShouldNotBe(null); _datasetDetails.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); searchServerDetails.ShouldNotBe(null); _datasetDetails.Matter.SearchServer = searchServerDetails; if (!LawBO.TestServerConnection(_jobParams.LawCaseId)) { ReportToDirector("Failed to connect Law server. Please see application log for details."); } if (EVHttpContext.CurrentContext == null) { // Moq the session MockSession(_jobParams.CreatedBy); } //Create fields for selected law fields CreateSelectedLawFields(); //Create tags for selected law tags CreateSelectedLawTags(); //Law import batch size for documents _batchSize = GetMessageBatchSize(); } catch (Exception ex) { //Send log infor to Log worker LogMessage(false, ex.ToUserString()); ReportToDirector(ex.ToUserString()); throw; } }
/// <summary> /// Get dataset detail. /// </summary> internal static DatasetBEO GetDatasetDetails(long datasetId, string matterId) { var dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(datasetId)); var matterDetails = MatterDAO.GetMatterDetails(matterId); if (matterDetails == null) { return(dataset); } dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); if (searchServerDetails != null) { dataset.Matter.SearchServer = searchServerDetails; } return(dataset); }
/// <summary> /// Get Dataset details /// </summary> private DatasetBEO GetDatasetDetails(long datasetId, long matterId) { var dataset = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(datasetId)); dataset.ShouldNotBe(null); var matterDetails = MatterDAO.GetMatterDetails(matterId.ToString(CultureInfo.InvariantCulture)); if (matterDetails == null) { return(dataset); } dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); if (searchServerDetails != null) { dataset.Matter.SearchServer = searchServerDetails; } return(dataset); }
protected override void BeginWork() { try { base.BeginWork(); m_Parameters = GetImportBEO(BootParameters); m_Parameters.ShouldNotBe(null); m_LoadFileUri = new Uri(m_Parameters.Locations.First()); m_ColumnDelimiter = (char)m_Parameters.LoadFile.ColumnDelimiter; m_QuoteCharacter = (char)m_Parameters.LoadFile.QuoteCharacter; m_NewlineCharacter = (char)m_Parameters.LoadFile.NewlineDelimiter; m_RecordTokenizer = new RecordTokenizer(m_ColumnDelimiter, m_QuoteCharacter); m_EncodingType = Encoding.GetEncoding(m_Parameters.LoadFile.EncodingType); m_IsFirstLineHeader = m_Parameters.LoadFile.IsFirstLineHeader; var loadFilePath = HttpUtility.UrlDecode(m_LoadFileUri.OriginalString); ReportToDirector("LoadFileParser works on load file {0}", loadFilePath); m_StreamReader = new StreamReader(loadFilePath, m_EncodingType); #region Dataset Detaills m_Parameters.DatasetId.ShouldBeGreaterThan(0); m_Dataset = DataSetBO.GetDataSetDetailForDataSetId(m_Parameters.DatasetId); var matterDetails = MatterDAO.GetMatterDetails(m_Parameters.MatterId.ToString()); matterDetails.ShouldNotBe(null); m_Dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); searchServerDetails.ShouldNotBe(null); m_Dataset.Matter.SearchServer = searchServerDetails; m_DatasetPath = m_Dataset.CompressedFileExtractionLocation; #endregion if (m_Parameters != null && m_Parameters.IsImportImages && m_Parameters.LoadFile.ImageFile != null && m_Parameters.LoadFile.ImageFile.ImageExtractionOption == LoadFileImageExtractionOption.HelperFile) { var imageHelperFileName = m_Parameters.LoadFile.ImageFile.HelperFileName; ReportToDirector("LoadFileParser uses image helper file {0}", imageHelperFileName); _imageHelperFileParser = new HelperFileParser(this, imageHelperFileName); } if (m_Parameters != null && m_Parameters.LoadFile.ContentFile != null && m_Parameters.LoadFile.ContentFile.TextExtractionOption == LoadFileTextExtractionOption.HelperFile) { var contentHelperFileName = m_Parameters.LoadFile.ContentFile.HelperFileName; ReportToDirector("LoadFileParser uses content (text) helper file {0}", contentHelperFileName); TextHelperFile = new HelperFile(this, contentHelperFileName); } if (null != m_Parameters && null != m_Parameters.LoadFile && null != m_Parameters.LoadFile.ContentFile && null != m_Parameters.LoadFile.ContentFile.LoadFileContentField) { m_ContentFieldNumber = Convert.ToInt32(m_Parameters.LoadFile.ContentFile.LoadFileContentField); } _uniqueThreadString = Guid.NewGuid().ToString().Replace("-", "").ToUpper(); SetMessageBatchSize(m_Parameters); } catch (Exception ex) { //Send log to Log Pipe LogMessage(false, Constants.ParserFailureMessageOnInitialize); ex.Trace(); ReportToDirector("Exception in LoadFileParser.BeginWork", ex.ToDebugString()); throw; } }