Ejemplo n.º 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);
        }
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            LawSyncBEO jobParameter = null;

            base.SetPipelineTypeSpecificParameters(activeJob);
            switch (JobTypeId)
            {
            case 40:
                jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(LawSyncBEO));
                break;

            case 41:
            {
                var reprocessJobParameter = (ConversionReprocessJobBeo)XmlUtility.DeserializeObject(activeJob.BootParameters.ToString(), typeof(ConversionReprocessJobBeo));

                var baseConfig = ReconversionDAO.GetJobConfigInfo(Convert.ToInt32(reprocessJobParameter.OrginialJobId));
                jobParameter = (LawSyncBEO)XmlUtility.DeserializeObject(baseConfig.BootParameters, typeof(LawSyncBEO));
            }
            break;
            }
            if (jobParameter == null)
            {
                return;
            }
            MatterId  = jobParameter.MatterId;
            SyncImage = jobParameter.IsProduceImage;
            LawCaseId = jobParameter.LawCaseId;
        }
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();

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

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

            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(baseConfig.BootParameters, typeof(AnalyticsProjectInfo));

            _dataset = DataSetBO.GetDataSetDetailForDataSetId(_jobParameter.DatasetId);
        }
        /// <summary>
        /// End of the work. process
        /// Update the job's boot parameter with total number of document processed and number of failed documents
        /// </summary>
        protected override void EndWork()
        {
            var bootParam = GetBootObject <ConversionReprocessJobBeo>(BootParameters);

            //the corresponding job id
            int jobId = WorkAssignment.JobId;

            //get various count
            DatasetBEO ds       = DataSetBO.GetDataSetDetailForDataSetId(bootParam.DatasetId);
            long       matterId = ds.Matter.FolderID;

            var vault = VaultRepository.CreateRepository(matterId);

            int totalDocCount;
            int failedDocCount;
            int succeedDocCount;

            vault.GetReconversionDocStatusCount(jobId, out totalDocCount, out succeedDocCount,
                                                out failedDocCount);

            bootParam.TotalDocCount  = totalDocCount;
            bootParam.FailedDocCount = failedDocCount;
            //bootParam.SucceedDocCount = succeedDocCount;


            //re serialize the boot param
            string newBootParam;

            var serializer = new XmlSerializer(typeof(ConversionReprocessJobBeo));

            using (var writer = new StringWriter())
            {
                serializer.Serialize(writer, bootParam);

                newBootParam = writer.ToString();
            }

            //update the boot parameters for the job
            ReconversionDAO.UpdateReconversionBootParamter(jobId, newBootParam);

            //clean up reconversion input file that contain the list of document to convert
            SafeDeleteFile(bootParam.FilePath);
        }
Ejemplo n.º 5
0
        /// <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);
        }