public List <ReconversionDocumentBEO> GetDocumentsFromReprocessSelection( string inputFilePath, ReProcessJobSelectionMode selectionMode, long matterId, long datasetId, long jobId, string filters = null) { var reprocessDicumentList = new List <ReconversionDocumentBEO>(); switch (selectionMode) { case ReProcessJobSelectionMode.Selected: { var docidList = ConversionReprocessStartupHelper.GetDocumentIdListFromFile(inputFilePath, Constants.DocId); reprocessDicumentList.AddRange(ConversionReprocessStartupHelper.GetImportDocumentListForIDList(docidList, Constants.DocId, null, matterId)); break; } case ReProcessJobSelectionMode.CrossReference: { var docidList = ConversionReprocessStartupHelper.GetDocumentIdListFromFile(inputFilePath, Constants.DCN); reprocessDicumentList.AddRange(ConversionReprocessStartupHelper.GetImportDocumentListForIDList(docidList, Constants.DCN, _dataset.CollectionId, matterId)); break; } case ReProcessJobSelectionMode.Csv: var dictIds = ConversionReprocessStartupHelper.GetDocumentIdListFromFile(inputFilePath, Constants.DCN, Constants.DocumentSetName); var lstDocumentSet = DataSetBO.GetAllDocumentSet(datasetId.ToString(CultureInfo.InvariantCulture)); foreach (var key in dictIds.Keys) { var firstOrDefault = lstDocumentSet.FirstOrDefault(d => d.DocumentSetName.Equals(key)); if (firstOrDefault == null) { continue; } var collectionId = firstOrDefault.DocumentSetId; reprocessDicumentList.AddRange(ConversionReprocessStartupHelper.GetImportDocumentListForIDList(dictIds[key], Constants.DCN, collectionId, matterId)); } break; case ReProcessJobSelectionMode.All: reprocessDicumentList.AddRange(ConversionReprocessStartupHelper.GetReconversionDocumentBeosForJobId(matterId, jobId, filters)); break; } return(reprocessDicumentList); }
/// <summary> /// Sends the specified document batch to next worker in the pipeline. /// </summary> /// <param name="docCollection">The document batch.</param> private void SendMessage(ConversionDocCollection docCollection) { if (docCollection.BaseJobTypeId == 2 || docCollection.BaseJobTypeId == 8 || docCollection.BaseJobTypeId == 14 || docCollection.BaseJobTypeId == 35) //import { var docBatch = new List <ReconversionDocumentBEO>(); foreach (var doc in docCollection.Documents) { docBatch.Add(doc); if (docBatch.Count == BatchSize) { SendImportReconversionBatch(docBatch, docCollection); docBatch = new List <ReconversionDocumentBEO>(); } } if (docBatch.Count != BatchSize) //the last batch is not a full batch and so not sent yet. need to send here { SendImportReconversionBatch(docBatch, docCollection); } } else if (docCollection.BaseJobTypeId == 9) //production reconversion, jump to production preprocessing { var docList = ConversionReprocessStartupHelper.ConvertToProductionDocumentList(docCollection); if (docList != null && docList.Count > 0) { var pBatch = new List <ProductionDocumentDetail>(); int count = 0; foreach (var doc in docList) { count++; pBatch.Add(doc); if (count % BatchSize == 0 || count == docList.Count) { BulkUpdateProductionReprocessingState(docCollection, pBatch); SendProductionReconversionBatch(pBatch); pBatch = new List <ProductionDocumentDetail>(); } } } } }
/// <summary> /// Get document collection for reconversion /// </summary> /// <returns></returns> /// public ConversionDocCollection GetReconversionDocCollection( ) { var docs = new ConversionDocCollection(); //collectionid to be used in reconversion string collectionId = ""; //populate job info docs.JobConfig = BootObject; BaseJobBEO baseConfig = ReconversionDAO.GetJobConfigInfo(Convert.ToInt32(BootObject.OrginialJobId)); docs.BaseJobTypeId = baseConfig.JobTypeId; //different type of base job has different object to hold job config info if (baseConfig.JobTypeId == 9) // Base job is production job { docs.BaseJobConfig = GetBootObject <ProductionDetailsBEO>(baseConfig.BootParameters); //for production reconversion, the collection id is the production Set collectionId, which is the collectionId in job parameter collectionId = ((ProductionDetailsBEO)docs.BaseJobConfig).OriginalCollectionId; //this is the native set collectionId //dataset associate with the document set docs.DataSet = DataSetBO.GetDataSetDetailForCollectionId(collectionId); //matterid associate with the document set long matterId = docs.DataSet.Matter.FolderID; //get the list of production document list to be reprocessed var helper = new ConversionReprocessStartupHelper(); IEnumerable <ReconversionProductionDocumentBEO> pDocs = helper.GetProductionDocumentList( BootObject.FilePath, BootObject.JobSelectionMode, matterId, docs.BaseJobConfig as ProductionDetailsBEO, docs.DataSet.RedactableDocumentSetId, Convert.ToInt32(BootObject.OrginialJobId), BootObject.Filters); //cast back to parent list of parent class if (pDocs != null && pDocs.Any()) { docs.Documents = pDocs.Cast <ReconversionDocumentBEO>().ToList(); } } else { if (baseConfig.JobTypeId == 14) //load file import { docs.BaseJobConfig = GetBootObject <ImportBEO>(baseConfig.BootParameters); //for import reconversion, the collection id is the native document set collectionId collectionId = ((ImportBEO)docs.BaseJobConfig).CollectionId; } else if (baseConfig.JobTypeId == 2 || baseConfig.JobTypeId == 8) //DCB import and Edoc Import { docs.BaseJobConfig = GetBootObject <ProfileBEO>(baseConfig.BootParameters); //for import reconversion, the collection id is the native document set collectionId collectionId = ((ProfileBEO)docs.BaseJobConfig).DatasetDetails.CollectionId; } else if (baseConfig.JobTypeId == 35) //Law import { docs.BaseJobConfig = GetBootObject <LawImportBEO>(baseConfig.BootParameters); //for import reconversion, the collection id is the native document set collectionId collectionId = ((LawImportBEO)docs.BaseJobConfig).CollectionId; } //dataset associate with the document set docs.DataSet = DataSetBO.GetDataSetDetailForCollectionId(collectionId); //assign heartbeat file path, if directory not exists, create it. docs.HeartbeatFilePath = docs.DataSet.CompressedFileExtractionLocation + ApplicationConfigurationManager.GetValue("ReconversionHeartbeatFileFolder", "Imports") + PipelineId; if (!Directory.Exists(docs.HeartbeatFilePath)) { Directory.CreateDirectory(docs.HeartbeatFilePath); } //matterid associate with the document set long matterId = docs.DataSet.Matter.FolderID; docs.Documents = ConversionReprocessStartupHelper.GetImportDocumentList( BootObject.FilePath, BootObject.JobSelectionMode, matterId, docs.DataSet.FolderID, BootObject.OrginialJobId, BootObject.Filters); } return(docs); }