コード例 #1
0
        protected override void BeginWork()
        {
            base.BeginWork();

            _reprocessJobParameter = (ConversionReprocessJobBeo)XmlUtility.DeserializeObject(BootParameters, typeof(ConversionReprocessJobBeo));

            var baseConfig = ReconversionDAO.GetJobConfigInfo(Convert.ToInt32(_reprocessJobParameter.OrginialJobId));

            _lawSyncJobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(baseConfig.BootParameters, typeof(LawSyncBEO));

            _dataset = DataSetBO.GetDataSetDetailForDataSetId(_lawSyncJobParameter.DatasetId);
            var field = _dataset.DatasetFieldList.FirstOrDefault(f => f.FieldType.DataTypeId == Constants.DCNFieldTypeId);

            if (field != null)
            {
                _dcnFieldName = field.Name;
            }

            var lawField = _dataset.DatasetFieldList.FirstOrDefault(f => f.Name == EVSystemFields.LawDocumentId);

            if (lawField != null)
            {
                _lawFieldId = lawField.ID;
            }

            if (_lawSyncJobParameter.IsProduceImage)
            {
                _jobEVImagesDirectory = LawVolumeHelper.GetJobImageFolder(WorkAssignment.JobId,
                                                                          _lawSyncJobParameter.LawCaseId);
                _volumeCount++;
                _volumeFolderName = LawVolumeHelper.CreateVolumeFolder(_jobEVImagesDirectory, _volumeCount);
            }

            _vaultManager = EVUnityContainer.Resolve <IDocumentVaultManager>(Constants.DocumentVaultManager);
        }
コード例 #2
0
        protected override void BeginWork()
        {
            base.BeginWork();
            _jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(BootParameters, typeof(LawSyncBEO));

            #region "Assertion"
            _jobParameter.DatasetId.ShouldBeGreaterThan(0);
            _jobParameter.MatterId.ShouldBeGreaterThan(0);
            #endregion
            try
            {
                //Get DCN field name
                _dataset = GetDatasetDetails(_jobParameter.DatasetId, _jobParameter.MatterId);
                var field =
                    _dataset.DatasetFieldList.FirstOrDefault(f => f.FieldType.DataTypeId == Constants.DCNFieldTypeId);
                if (field != null)
                {
                    _dcnFieldName = field.Name;
                }

                var lawField = _dataset.DatasetFieldList.FirstOrDefault(f => f.Name == EVSystemFields.LawDocumentId);
                if (lawField != null)
                {
                    _lawFieldId = lawField.ID;
                }

                //Create Volume for Images
                if (_jobParameter.IsProduceImage)
                {
                    _jobEVImagesDirectory = LawVolumeHelper.GetJobImageFolder(WorkAssignment.JobId,
                                                                              _jobParameter.LawCaseId);
                    _volumeCount++;
                    _volumeFolderName = LawVolumeHelper.CreateVolumeFolder(_jobEVImagesDirectory, _volumeCount);
                }
                _vaultManager = EVUnityContainer.Resolve <IDocumentVaultManager>(Constants.DocumentVaultManager);
            }
            catch (Exception ex)
            {
                ex.Trace();
                ReportToDirector(ex);
                ConstructLog(Constants.LawSyncStartupFailureMessage);
                throw;
            }
        }
コード例 #3
0
        private void ConstructLawSyncDocument(IEnumerable <ReconversionDocumentBEO> reprocessDocumentList)
        {
            #region Produce Image
            List <FilteredDocumentBusinessEntity> imagingDocuments = null;
            if (_lawSyncJobParameter.IsProduceImage)
            {
                var documentsSelection = new List <DocumentsSelectionBEO>
                {
                    _lawSyncJobParameter.DocumentsSelection,
                    _lawSyncJobParameter.ImageDocumentsSelection
                };
                imagingDocuments = LawSyncSearchHelper.GetDocuments(documentsSelection, _dcnFieldName, _lawSyncJobParameter.CreatedBy);
            }
            #endregion

            var runningDocCount          = 0;
            var lawDocumentsList         = new List <LawSyncDocumentDetail>();
            var documentProcessStateList = new List <DocumentConversionLogBeo>();
            _logInfoList = new List <JobWorkerLog <LawSyncLogInfo> >();
            foreach (var reprocessDocument in reprocessDocumentList)
            {
                _documentCorrelationId++;
                runningDocCount++;
                if (runningDocCount > Constants.BatchSize)
                {
                    runningDocCount = 0;
                    UpdateDcoumentProcessState(documentProcessStateList);
                    Send(lawDocumentsList);
                    lawDocumentsList         = new List <LawSyncDocumentDetail>();    //Clear document List
                    documentProcessStateList = new List <DocumentConversionLogBeo>(); //Clear document process state List
                }
                var lawDocument = new LawSyncDocumentDetail
                {
                    DocumentReferenceId   = reprocessDocument.DocumentId,
                    DocumentControlNumber = reprocessDocument.DCNNumber,
                    CorrelationId         = _documentCorrelationId
                };

                if (_lawSyncJobParameter.IsProduceImage && imagingDocuments != null && imagingDocuments.Any())
                {
                    lawDocument.IsImaging = imagingDocuments.Exists(y => y.DCN.Equals(lawDocument.DocumentControlNumber));
                }
                else
                {
                    //Document not part of imaging subset excluded for imaging.
                    lawDocument.IsImaging = false;
                }


                var field =
                    DocumentBO.GetDocumentFieldById(
                        _lawSyncJobParameter.MatterId.ToString(CultureInfo.InvariantCulture), _dataset.CollectionId,
                        lawDocument.DocumentReferenceId, _lawFieldId);
                if (field != null && !string.IsNullOrEmpty(field.FieldValue))
                {
                    lawDocument.LawDocumentId = Convert.ToInt32(field.FieldValue);
                }

                if (lawDocument.IsImaging)
                {
                    _volumeDocumentCount++;
                    var documentPagesCount = GetPageCountForImages(_lawSyncJobParameter.MatterId,
                                                                   _dataset.RedactableDocumentSetId, lawDocument.DocumentReferenceId);
                    if (_volumeDocumentCount > VolumeMaximumDocumentCount)
                    {
                        _volumeDocumentCount = 0;
                        _volumeCount++;
                        _volumeFolderName         = LawVolumeHelper.CreateVolumeFolder(_jobEVImagesDirectory, _volumeCount);
                        _volumeDocumentPagesCount = 0;
                    }
                    lawDocument.ImagesFolderPath    = _volumeFolderName;
                    lawDocument.ImageStartingNumber = _volumeDocumentPagesCount;
                    _volumeDocumentPagesCount       = _volumeDocumentPagesCount + documentPagesCount;
                }
                if (lawDocument.LawDocumentId > 0)
                {
                    lawDocumentsList.Add(lawDocument);
                }
                else
                {
                    ConstructLog(lawDocument.LawDocumentId, lawDocument.CorrelationId, lawDocument.DocumentControlNumber, Constants.LawSyncDocumentNotAvailable);
                }
                documentProcessStateList.Add(GetDocumentProcessStateInformation(lawDocument));
            }

            if (documentProcessStateList.Any())
            {
                UpdateDcoumentProcessState(documentProcessStateList);
            }

            if (lawDocumentsList.Any())
            {
                Send(lawDocumentsList);
            }
            if (_logInfoList.Any())
            {
                SendLogPipe(_logInfoList);
            }
        }
コード例 #4
0
        /// <summary>
        /// Construct LawSync document
        /// </summary>
        private void ConstructLawSyncDocument(IEnumerable <FilteredDocumentBusinessEntity> resultDocuments)
        {
            var runningDocCount          = 0;
            var lawDocumentsList         = new List <LawSyncDocumentDetail>();
            var documentProcessStateList = new List <DocumentConversionLogBeo>();

            _logInfoList = new List <JobWorkerLog <LawSyncLogInfo> >();
            foreach (var doc in resultDocuments)
            {
                _documentCorrelationId++;
                runningDocCount++;
                if (runningDocCount > Constants.BatchSize)
                {
                    runningDocCount = 0;
                    InsertDcoumentProcessState(documentProcessStateList);
                    Send(lawDocumentsList);
                    lawDocumentsList         = new List <LawSyncDocumentDetail>();    //Clear document List
                    documentProcessStateList = new List <DocumentConversionLogBeo>(); //Clear document process state List
                }

                var lawDocument = new LawSyncDocumentDetail
                {
                    DocumentReferenceId   = doc.Id,
                    DocumentControlNumber = doc.DCN,
                    IsImaging             = !doc.IsExclude,
                    CorrelationId         = _documentCorrelationId
                };
                var field = doc.OutPutFields.FirstOrDefault(f => f.Name == EVSystemFields.LawDocumentId);
                if (field != null && !string.IsNullOrEmpty(field.Value))
                {
                    lawDocument.LawDocumentId = Convert.ToInt32(field.Value);
                }

                //To fix upgrade issue from earlier version to 3.0 version. Law document id(LawDocumentId) not coming part of search result.
                if (lawDocument.LawDocumentId <= 0)
                {
                    var lawField = DocumentBO.GetDocumentFieldById(
                        _jobParameter.MatterId.ToString(CultureInfo.InvariantCulture), _dataset.CollectionId,
                        lawDocument.DocumentReferenceId, _lawFieldId);
                    if (lawField != null && !string.IsNullOrEmpty(lawField.FieldValue))
                    {
                        lawDocument.LawDocumentId = Convert.ToInt32(lawField.FieldValue);
                    }
                }

                if (lawDocument.IsImaging)
                {
                    _volumeDocumentCount++;
                    var documentPagesCount = GetPageCountForImages(_jobParameter.MatterId,
                                                                   _dataset.RedactableDocumentSetId, lawDocument.DocumentReferenceId);
                    if (_volumeDocumentCount > VolumeMaximumDocumentCount)
                    {
                        _volumeDocumentCount = 0;
                        _volumeCount++;
                        _volumeFolderName         = LawVolumeHelper.CreateVolumeFolder(_jobEVImagesDirectory, _volumeCount);
                        _volumeDocumentPagesCount = 0;
                    }
                    lawDocument.ImagesFolderPath    = _volumeFolderName;
                    lawDocument.ImageStartingNumber = _volumeDocumentPagesCount;
                    _volumeDocumentPagesCount       = _volumeDocumentPagesCount + documentPagesCount;
                }

                if (lawDocument.LawDocumentId > 0)
                {
                    lawDocumentsList.Add(lawDocument);
                }
                else
                {
                    ConstructLog(lawDocument.LawDocumentId, lawDocument.CorrelationId, lawDocument.DocumentControlNumber, Constants.LawSyncDocumentNotAvailable);
                }
                documentProcessStateList.Add(GetDocumentProcessStateInformation(lawDocument));
            }

            if (documentProcessStateList.Any())
            {
                InsertDcoumentProcessState(documentProcessStateList);
            }

            if (lawDocumentsList.Any())
            {
                Send(lawDocumentsList);
            }

            if (_logInfoList.Any())
            {
                SendLogPipe(_logInfoList);
            }
        }