Exemple #1
0
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                _exportDocumentCollection = (ExportDocumentCollection)message.Body;

                #region Assertion
                //Pre Condition
                PipelineId.ShouldNotBeEmpty();
                BootParameters.ShouldNotBe(null);
                BootParameters.ShouldBeTypeOf <string>();
                _exportDocumentCollection.ShouldNotBe(null);
                _exportDocumentCollection.Documents.ShouldNotBe(null);
                _exportDocumentCollection.Documents.LongCount().ShouldBeGreaterThan(0);
                #endregion

                if (_exportDocumentCollection == null || _exportDocumentCollection.Documents == null)
                {
                    Tracer.Error("ExportOption Volume Worker: Document detail is not set in pipe message for job run id: {0}", PipelineId);
                    return;
                }

                if (_volume == null)
                {
                    InitializeForProcessing(BootParameters);
                }

                CalculateVolume(_exportDocumentCollection.Documents);
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assert conditions

            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            try
            {
                if (!Int32.TryParse(ApplicationConfigurationManager.GetValue(MBulkTaggingWindowSize), out _mWindowSize))
                {
                    _mWindowSize = MDefaultWindowSize;
                }
                DoBeginWork(BootParameters);
            }
            catch (Exception ex)
            {
                LogMessage(true, string.Format("Error in TagStartupWorker - Exception: {0}", ex.ToUserString()));
                ReportToDirector(ex);
                ex.Trace().Swallow();
            }
        }
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assert conditions

            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            try
            {
                DoBeginWork(BootParameters);
            }
            catch (ApplicationException apEx)
            {
                LogMessage(false, apEx.Message);
                throw;
            }
            catch (Exception ex)
            {
                LogMessage(false,
                           string.Format("Split Reviewset {0} creation failed. Exception: {1}", _reviewSetRecord.ReviewSetName,
                                         ex.Message));
                throw;
            }
        }
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                _exportDocumentCollection = (ExportDocumentCollection)message.Body;
                #region Assertion
                //Pre Condition
                PipelineId.ShouldNotBeEmpty();
                BootParameters.ShouldNotBe(null);
                BootParameters.ShouldBeTypeOf <string>();
                _exportDocumentCollection.ShouldNotBe(null);
                _exportDocumentCollection.Documents.ShouldNotBe(null);
                _exportDocumentCollection.Documents.LongCount().ShouldBeGreaterThan(0);
                #endregion
                if (_exportDocumentCollection == null)
                {
                    Tracer.Error("ExportOption File Copy Worker: Pipe message body contains empty data for job run id:{0}", PipelineId);
                    return;
                }
                _exportDocumentCollection.Dataset = _dataset;
                InitializeForProcessing(BootParameters);

                List <JobWorkerLog <ExportFileCopyLogInfo> > fileCopyLogList;
                PerformCopy(out fileCopyLogList);

                //Audit Log
                InsertAuditLog(_exportDocumentCollection, _exportLoadJobDetailBeo.JobName);

                #region Send Message

                Send();
                if (fileCopyLogList != null && fileCopyLogList.Count > 0)
                {
                    SendLog(fileCopyLogList);
                }
                #endregion
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }
Exemple #5
0
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assertion

            //Pre Condition
            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            // Get values from boot parameters....
            _mBootParameters = GetPrintDetailsBusinessEntity(BootParameters);
            _mCollectionId   = _mBootParameters.DataSet.CollectionId;
            _mCreatedBy      = _mBootParameters.RequestedBy.UserId;
            // Mock session
            MockSession();
        }
Exemple #6
0
 protected override void ProcessMessage(PipeMessageEnvelope message)
 {
     try
     {
         var exportDocumentCollection = (ExportDocumentCollection)message.Body;
         #region Assertion
         //Pre Condition
         PipelineId.ShouldNotBeEmpty();
         exportDocumentCollection.ShouldNotBe(null);
         exportDocumentCollection.Documents.ShouldNotBe(null);
         exportDocumentCollection.Documents.LongCount().ShouldBeGreaterThan(0);
         #endregion
         exportDocumentCollection.Dataset = _dataset;
         GetAllData(exportDocumentCollection);
     }
     catch (Exception ex)
     {
         ex.Trace().Swallow();
         ReportToDirector(ex);
     }
 }
        protected override void ProcessMessage(PipeMessageEnvelope envelope)
        {
            if (envelope.Label == "PleaseFinalize")
            {
                FinalizeFiles();
                return;
            }

            exportDocumentCollection = (ExportDocumentCollection)envelope.Body;
            #region Assertion
            //Pre Condition
            PipelineId.ShouldNotBeEmpty();
            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            exportDocumentCollection.ShouldNotBe(null);
            exportDocumentCollection.Documents.ShouldNotBe(null);
            exportDocumentCollection.Documents.LongCount().ShouldBeGreaterThan(0);
            #endregion
            exportDocumentCollection.Dataset = _dataset;
            try
            {
                if (parametersExportLoadFile == null)
                {
                    InitializeForProcessing(BootParameters);
                }

                GetDocumentFields(exportDocumentCollection.Documents);

                #region Get Content-Field value from Text file
                GetDocumentsContentField();
                #endregion

                if (exportDocumentCollection.ExportOption.IsImage || exportDocumentCollection.ExportOption.IsProduction)
                {
                    //Set Images File Path..
                    var loadFileHelper = new ExportLoadFileHelper(BootParameters);
                    Parallel.ForEach(exportDocumentCollection.Documents,
                                     new ParallelOptions {
                        MaxDegreeOfParallelism = _maxParallelThread
                    },
                                     (docDetail) =>
                                     loadFileHelper.SetImageSourceFiles(docDetail, exportDocumentCollection.ExportOption));
                }

                var fileWriterLogList = WriteLoadFiles();
                #region Send Log
                if (fileWriterLogList != null && fileWriterLogList.Any())
                {
                    //Send to Log pipe
                    SendLog(fileWriterLogList);
                }
                #endregion

                documentContentFieldsValueCollection.Clear();
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }
        private int _documentsRetrievalbatchSize; //value set by configuration
        #endregion

        #endregion

        #region OverDrive

        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assertion

            //Pre Condition
            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            _batchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("ExportBatchSize", "Export"));
            _documentsRetrievalbatchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("ExportGetDocumentsBatchSize", "Export"));


            #region Load File

            Initialize(BootParameters);

            #endregion

            #region DCB - Restored When DCB Export is migrated to Overdrive

            /* else if (PipelineType == PipelineType.ExportDcb)
             * {
             *  _parametersExportDCB = GetExportBEO<ExportDCBJobDetailBEO>((string)BootParameters);
             *  if (_parametersExportDCB != null)
             *  {
             *      //dataset
             *      if (!string.IsNullOrEmpty(_parametersExportDCB.DatasetId) && !string.IsNullOrEmpty(_parametersExportDCB.MatterId))
             *      {
             *          _dataset = GetDatasetDetails(Convert.ToInt64(_parametersExportDCB.DatasetId), _parametersExportDCB.MatterId);
             *      }
             *
             #region ExportOption Option
             *      _exportOption = new ExportOption();
             *      //Native
             *      if (_parametersExportDCB.ExportDCBFileInfo.ExportDCBFileOption.IncludeNativeFiles)
             *          _exportOption.IsNative = true;
             *
             *      //Production/Image
             *      if (_parametersExportDCB.ExportDCBFileInfo.PriImgSelection == SetSelection.ProductionSet)
             *      {
             *          _exportOption.IsProduction = true;
             *          _exportOption.ProductionSetCollectionId = _parametersExportDCB.ExportDCBFileInfo.ProdImgCollectionId;
             *      }
             *      else if (_parametersExportDCB.ExportDCBFileInfo.PriImgSelection == SetSelection.ImageSet)
             *      {
             *          _exportOption.IsImage = true;
             *          _exportOption.ImageSetCollectionId = _parametersExportDCB.ExportDCBFileInfo.ProdImgCollectionId;
             *      }
             *
             *      //Fields
             *      if (_parametersExportDCB.ExportDCBFields.ExportDCBFields != null && _parametersExportDCB.ExportDCBFields.ExportDCBFields.Count > 0)
             *          _exportOption.IsField = true;
             *
             *      //Tag
             *      if (_parametersExportDCB.ExportDCBTagInfo != null && _parametersExportDCB.ExportDCBTagInfo.IncludeTag)
             *          _exportOption.IsTag = true;
             *
             *      //Comments
             *      if (_parametersExportDCB.ExportDCBTagInfo != null && (_parametersExportDCB.ExportDCBTagInfo.IncludeTextDocumentComment || _parametersExportDCB.ExportDCBTagInfo.IncludeTextLevelComment))
             *          _exportOption.IsComments = true;
             *
             *      if (!string.IsNullOrEmpty(_parametersExportDCB.ExportDCBFileInfo.FilePath))
             *          _exportOption.ExportDestinationFolderPath = _parametersExportDCB.ExportDCBFileInfo.FilePath;
             #endregion
             *
             #region Set User
             *      if (!string.IsNullOrEmpty(_parametersExportDCB.CreatedBy))
             *          _createdBy = _parametersExportDCB.CreatedBy;
             *      else
             *      {
             *          Tracer.Error("ExportOption Startup Worker: Job created by user id not specified in boot parameters for job run id:{0}", PipelineId);
             *          //TODO: throw appropriate exception after analysis.
             *      }
             *      MockSession();
             #endregion
             *
             #region Construct Search Query
             *      _searchQuery = GetSearchQueryForExportDCB(out _reviewsetId, out _isIncludeConceptSearch);
             #endregion
             *  }
             * }*/

            #endregion

            try
            {
                _totalDocumentCount = SetTotalDocumentsCount();
            }
            catch (Exception ex)
            {
                Tracer.Error(
                    "ExportOption Startup Worker: On beginWork failed to set total documents count for job run id:{0}, exception:{1}",
                    PipelineId, ex);
                LogMessage(false, Constants.FailureInSearch);
                throw;
            }
            if (_totalDocumentCount <= 0)
            {
                Tracer.Error("ExportOption Startup Worker: Search return empty records for job run id:{0}", PipelineId);
                LogMessage(false, Constants.ExportSearchNoRecords);
                CleanFileResources();
                throw new EVException().AddUsrMsg(Constants.ExportSearchNoRecords);
            }
        }