コード例 #1
0
        /// <summary>
        /// Initializes the configuration items.
        /// </summary>
        private void InitializeConfigurationItems()
        {
            // default values if reading from configuration fails. this avoids job from failing.
            m_OutputBatchSize   = 100;
            m_PipelineBatchSize = 100;

            try
            {
                // this can't have a default value.
                m_DecryptionKey = ApplicationConfigurationManager.GetValue("EncryptionKey", "Data Security");
            }
            catch (Exception ex)
            {
                ex.AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_DecryptionKeyUnavailable).Trace().Swallow();
            }

            try
            {
                int.TryParse(ApplicationConfigurationManager.GetValue("EDocsOutputBatchSize", "Imports"), out m_OutputBatchSize);
                uint.TryParse(ApplicationConfigurationManager.GetValue("EDocsPipelineBatchSize", "Imports"), out m_PipelineBatchSize);
            }
            catch (Exception ex)
            {
                ex.AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_ConfigurationUnavailable).Trace().Swallow();
            }
        }
コード例 #2
0
        /// <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();
            }
        }
コード例 #3
0
 protected override void BeginWork()
 {
     base.BeginWork();
     _maxParallelThread      = Convert.ToInt32(ApplicationConfigurationManager.GetValue("NumberOfMaxParallelism", "Export"));
     _exportLoadJobDetailBeo = Utils.SmartXmlDeserializer(BootParameters) as ExportLoadJobDetailBEO;
     _dataset = DataSetBO.GetDatasetDetailsWithMatterInfo(Convert.ToInt64(_exportLoadJobDetailBeo.DatasetId),
                                                          _exportLoadJobDetailBeo.MatterId);
 }
コード例 #4
0
        /// <summary>
        /// Gives the configuration value for a key and sub application
        /// </summary>
        /// <param name="key"></param>
        /// <param name="subapplication"></param>
        /// <returns></returns>
        private static string GetConfigurationValue(string key, string subapplication)
        {
            string result = null;

            result = ApplicationConfigurationManager.GetValue(key, subapplication);
            result = StringUtility.IsNullOrWhiteSpace(result) ? string.Empty : result;

            return(result);
        }
コード例 #5
0
 /// <summary>
 ///     Begins the work.
 /// </summary>
 protected override void BeginWork()
 {
     BootParameters.ShouldNotBe(null);
     base.BeginWork();
     _jobParameter =
         (CategorizeInfo)XmlUtility.DeserializeObject(BootParameters, typeof(CategorizeInfo));
     _batchSize =
         Convert.ToInt32(ApplicationConfigurationManager.GetValue("UpdateFieldsBatchSize", "AnalyticsProject"));
     _projectInfo = AnalyticsProject.Get(_jobParameter.MatterId.ToString(CultureInfo.InvariantCulture),
                                         _jobParameter.DatasetId.ToString(CultureInfo.InvariantCulture), _jobParameter.ProjectId.ToString(CultureInfo.InvariantCulture));
 }
コード例 #6
0
 /// <summary>
 /// To get the batch size for law import
 /// </summary>
 private static int GetMessageBatchSize()
 {
     try
     {
         return(Convert.ToInt32(ApplicationConfigurationManager.GetValue("LawPipelineBatchSize", "Imports")));
     }
     catch (Exception ex)
     {
         ex.Trace().Swallow();
         return(100);
     }
 }
コード例 #7
0
 /// <summary>
 /// To get the batch size for law import
 /// </summary>
 private int GetMessageBatchSize()
 {
     try
     {
         return(Convert.ToInt32(ApplicationConfigurationManager.GetValue("LawPipelineBatchSize", "Imports")));
     }
     catch (Exception)
     {
         Tracer.Error("Law Import: Failed to set message batch size for job run id {0}", PipelineId);
         return(0);
     }
 }
コード例 #8
0
        protected override void BeginWork()
        {
            base.BeginWork();
            var hostId = ServerConnectivity.GetHostIPAddress();

            _redactitPushUrl = CmgServiceConfigBO.GetServiceConfigurationsforConfig
                                   (hostId, External.DataAccess.Constants.SystemConfigurationService, Constants.QueueServerUrl);
            _redactitTimeout = ApplicationConfigurationManager.GetValue(Constants.RedactItTimeout, Constants.NearNativeViewerSection);
            var baseServiceUri = new Uri(CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.WcfHostUrl));
            var lawServiceUri  = new Uri(baseServiceUri, Constants.LawSyncConversionCallBackMethod);

            _redactitCallbackUrl = lawServiceUri.OriginalString;
            _vaultManager        = EVUnityContainer.Resolve <IDocumentVaultManager>(Constants.DocumentVaultManager);
        }
コード例 #9
0
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();
            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo));

            _dataset            = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture));
            _analyticProject    = new AnalyticsProject();
            _totalDocumentCount = _analyticProject.GetProjectDocumentsCount(Convert.ToInt64(_jobParameter.MatterId, CultureInfo.CurrentCulture),
                                                                            _jobParameter.ProjectCollectionId);
            _batchSize =
                Convert.ToInt32(ApplicationConfigurationManager.GetValue("UpdateFieldsBatchSize", "AnalyticsProject"));
            _projectFieldId = AnalyticsProject.GetProjectFieldId(_jobParameter.MatterId, _dataset.CollectionId);
        }
コード例 #10
0
        /// <summary>
        /// Shutdown method will be called at end of the job
        /// </summary>
        /// <param name="jobParameters">Job Business Object</param>
        protected override void Shutdown(CompareSavedSearchResultsJobBEO jobParameters)
        {
            try
            {
                long reportId = 0;
                _encoder = _encodingType.Equals(Constants.UniCode, StringComparison.CurrentCultureIgnoreCase)
                    ? (Encoding) new UnicodeEncoding()
                    : new UTF8Encoding();
                if (_fileType.Equals(Constants.FileTypeCsv, StringComparison.CurrentCultureIgnoreCase))
                {
                    //Writing generated report to Db
                    reportId = SearchResultsBO.SaveExportResults(_searchResultsProperty.SearchResultId,
                                                                 _encoder.GetBytes(_reportString.ToString()), true, _fileType, _userEntityOfJobOwner.UserGUID);
                    _reportString = null;
                }

                #region Notification section

                //Getting Job detail detail
                var jobBeo = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture));
                if (jobBeo.NotificationId > 0)
                {
                    string defaultMessage;
                    defaultMessage = _isJobFailed
                        ? string.Format(Constants.FailureNotificationMessage, _searchResultsProperty.SearchResultsName)
                        : string.Format(Constants.CompareReportMessage, _searchResultsProperty.SearchResultsName,
                                        ApplicationConfigurationManager.GetValue(Constants.ReportHandlerUrl)
                                        , Constants.CompareReport, _searchResultsProperty.SearchResultId, _fileType, reportId,
                                        _searchResultsProperty.DocumentQuery.QueryObject.DatasetId);
                    CustomNotificationMessage = defaultMessage;
                }

                #endregion Notification section
            }
            catch (EVException ex)
            {
                WriteToEventViewer(ex, GetType(), MethodBase.GetCurrentMethod().Name, jobParameters.JobId,
                                   jobParameters.JobRunId);
                HandleJobException(null, ErrorCodes.ProblemInShutDown);
            }
            catch (Exception ex)
            {
                // Handle exception
                LogMessage(ex, GetType(), MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error,
                           jobParameters.JobId, jobParameters.JobRunId);
                HandleJobException(ex, ErrorCodes.ProblemInShutDown);
            }
        }
コード例 #11
0
        /// <summary>
        /// Generates Concvert DCB Link tasks
        /// </summary>
        /// <param name="jobParameters">Job BEO</param>
        /// <param name="previouslyCommittedTaskCount"> </param>
        /// <returns>List of Job Tasks (BEOs)</returns>
        protected override Tasks <ConvertDCBLinkTaskBusinessEntityObject> GenerateTasks(BaseJobBEO jobParameters, out int previouslyCommittedTaskCount)
        {
            Tasks <ConvertDCBLinkTaskBusinessEntityObject> tasks = null;

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Start, EventLogEntryType.Information);
                previouslyCommittedTaskCount = 0;
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobId, MethodInfo.GetCurrentMethod().Name, EventLogEntryType.Information);
                tasks = GetTaskList <BaseJobBEO, ConvertDCBLinkTaskBusinessEntityObject>(jobParameters);
                previouslyCommittedTaskCount = tasks.Count;
                if (tasks.Count <= 0)
                {
                    ConvertDCBLinkTaskBusinessEntityObject convertDcbLinkTask = new ConvertDCBLinkTaskBusinessEntityObject();
                    convertDcbLinkTask = (ConvertDCBLinkTaskBusinessEntityObject)XmlUtility.DeserializeObject(jobParameters.BootParameters, typeof(ConvertDCBLinkTaskBusinessEntityObject));
                    _query             = ApplicationConfigurationManager.GetValue(Constants.SearchQuery);
                    _createdByUserGuid = convertDcbLinkTask.CreateByUserGuid;
                    string pageSize = "1";
                    DocumentQueryEntity docQueryEntity = GetDocumentQueryEntity(convertDcbLinkTask.DatasetId.ToString(CultureInfo.InvariantCulture), _query, pageSize);
                    docQueryEntity.TransactionName = "ConvertDCBLinksToCaseMap - GenerateTasks";
                    ReviewerSearchResults searchResults = JobSearchHandler.GetSearchResults(docQueryEntity);
                    if (searchResults.TotalRecordCount > 0)
                    {
                        convertDcbLinkTask.TaskNumber   = 1;
                        convertDcbLinkTask.TaskPercent  = 100;
                        convertDcbLinkTask.TaskComplete = false;
                    }
                    _documentCount = searchResults.TotalHitCount;
                    tasks.Add(convertDcbLinkTask);
                }
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_GenerateTask_Success, EventLogEntryType.Information);
            }
            catch (EVJobException ex)
            {
                _isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                throw;
            }
            catch (Exception ex)
            {
                _isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                EVJobException jobException = new EVJobException(ErrorCodes.GenerateTasksError, ex, JobLogInfo);
                throw (jobException);
            }
            return(tasks);
        }
コード例 #12
0
        /// <summary>
        /// Before job shuts down, shall update job next run
        /// </summary>
        /// <param name="jobParameters">Job Business Object</param>
        protected override void Shutdown(BaseJobBEO jobParameters)
        {
            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobId, Constants.Event_Job_ShutDown,
                                 EventLogEntryType.Information);

                #region Notification section

                //get job details
                var jobDetails = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString());
                if (jobDetails != null && jobDetails.NotificationId > 0)
                {
                    var defaultMessage = string.Empty;
                    defaultMessage = isJobFailed
                        ? string.Format(Constants.NotificationErrorMessageFormat,
                                        !string.IsNullOrEmpty(requestDescription) ? requestDescription : Constants.TaskName)
                        : documentCount > 0
                            ? string.Format(Constants.NotificationSuccessMessageFormat,
                                            !string.IsNullOrEmpty(requestDescription)
                                    ? requestDescription
                                    : Constants.TaskName, documentCount,
                                            ApplicationConfigurationManager.GetValue(Constants.CaseMapUrl), conversionId, fileType)
                            : string.Format(Constants.NotificationSuccessMessageFormatZeroDocs,
                                            !string.IsNullOrEmpty(requestDescription) ? requestDescription : Constants.TaskName);
                    CustomNotificationMessage = defaultMessage;
                }
                JobLogInfo.AddParameters(Constants.CreatedBy, jobParameters.JobScheduleCreatedBy);
                JobLogInfo.AddParameters(Constants.DocumentIncludedInXml, Convert.ToString(documentCount));

                #endregion
            }
            catch (EVJobException ex)
            {
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInShutDown, string.Empty);
            }
            catch (Exception ex)
            {
                isJobFailed = true;
                // Handle exception in Generate Tasks
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(JobLogInfo, ex, LogCategory.Job, ErrorCodes.ProblemInShutDown, string.Empty);
            }
        }
コード例 #13
0
        private void OpenDCBWithCreds()
        {
            //Adding one more empty pair to handle the case where user passes credentials for the
            //unsecured dcbs
            DcbOpticonJobBEO.DcbCredentialList.Add(Convert.ToString((char)174));

            //If it is a secured dcb
            foreach (var usernamepasswordpair in DcbOpticonJobBEO.DcbCredentialList)
            {
                if (usernamepasswordpair == null)
                {
                    continue;
                }
                var uidpwd   = usernamepasswordpair.Split(new[] { (char)174 });
                var login    = uidpwd[0];
                var password = (uidpwd.Length > 1) ? uidpwd[1] : "";
                if (!string.IsNullOrEmpty(password))
                {
                    password = ApplicationConfigurationManager.Decrypt(password,
                                                                       ApplicationConfigurationManager.GetValue(UNPWEncryption, UNPWDataSecurity));
                }

                try
                {
                    Tracer.Debug("DcbSlicer: Opening secured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath);
                    DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, login, password);
                    DcbCredentials = new DcbCredentials {
                        Login = login, Password = password
                    };
                    return;
                }
                catch (Dcb2EvException ex)
                {
                    if (ex.ErrorCode != (int)DcbFacadeErrorCodes.AccessDenied)
                    {
                        throw;
                    }
                    ex.Trace().Swallow();
                }
            }
            var message = String.Format("Tried all login/password pairs for {0} and none worked",
                                        DcbOpticonJobBEO.DcbSourcePath);

            throw new Dcb2EvException(message, (int)DcbFacadeErrorCodes.AccessDenied);
        }
コード例 #14
0
        protected override void BeginWork()
        {
            base.BeginWork();

            try
            {
                var strFileParserBatchSize = ApplicationConfigurationManager.GetValue("FileParserBatchSize", "Imports",
                                                                                      false);
                if (!String.IsNullOrEmpty(strFileParserBatchSize))
                {
                    fileParserBatchSize = int.Parse(strFileParserBatchSize);
                }

                fileIoHelper = new FileIOHelper();

                // function that's called when a batch of documents are available.
                fileIoHelper.BatchOfDocumentsAvailable += Send;

                profileBEO = DocumentImportHelper.GetProfileBeo(BootParameters);

                #region Check for minimum required information.

                // Check if minimum required information, dataset details and matter details available.
                if (profileBEO.DatasetDetails == null)
                {
                    throw new EVException().AddResMsg(
                              ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable);
                }
                if (profileBEO.DatasetDetails.Matter == null)
                {
                    throw new EVException().AddResMsg(
                              ErrorCodes.EDLoaderFileParserWorker_DatasetOrMatterDetailsUnavailable);
                }

                #endregion Check for minimum required information

                //TODO: Search Engine Replacement - Search Sub System - Create Seed Directory, if required
            }
            catch (Exception ex)
            {
                LogMessage(false, "Failed on initialize values. " + ex.ToUserString());
                ReportToDirector(ex);
                throw;
            }
        }
コード例 #15
0
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();
            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo));
            _analyticProject    = new AnalyticsProject();
            _dataset            = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture));
            _totalDocumentCount = _analyticProject.GetSelectedDocumentsCount(_dataset.CollectionId, _jobParameter, WorkAssignment.JobId);
            //Update job log initial state
            var jobSummaryKeyValuePairs = new EVKeyValuePairs();

            JobMgmtBO.UpdateJobResult(WorkAssignment.JobId, 0, _totalDocumentCount,
                                      jobSummaryKeyValuePairs);
            _documentBachSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectJobBatchSize",
                                                                                         "AnalyticsProject"));
            _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId;
            IncreaseProcessedDocumentsCount(_totalDocumentCount);
        }
コード例 #16
0
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();

            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo));
            _analyticProject = new AnalyticsProject();

            _documentBachSize =
                Convert.ToInt32(
                    ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectInSubSystemJobBatchSize",
                                                             "AnalyticsProject"));
            _dataset =
                DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId,
                                                                       CultureInfo.CurrentCulture));
            _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId;

            _totalDocumentCount =
                _analyticProject.GetProjectDocumentsCountByTaskId(
                    Convert.ToInt64(_jobParameter.MatterId, CultureInfo.CurrentCulture),
                    _jobParameter.ProjectCollectionId, _jobParameter.PrimarySystemJobId);
            //Update job log initial state
            var jobSummaryKeyValuePairs = new EVKeyValuePairs();

            JobMgmtBO.UpdateJobResult(WorkAssignment.JobId, 0, _totalDocumentCount,
                                      jobSummaryKeyValuePairs);

            if (_jobParameter.IsRerunJob || _jobParameter.IsAddAdditionalDocuments) //Rerun job or Add additional documents- need get to get existing IndexId ,if already created
            {
                _indexId = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId,
                                                                 _dataset.CollectionId, _jobParameter.ProjectCollectionId, false);
            }

            if (string.IsNullOrEmpty(_indexId))
            {
                _indexId = "idx-" + Guid.NewGuid().ToString().ToLowerInvariant();
                _analyticProject.InsertIndexId(_jobParameter.MatterId, WorkAssignment.JobId, _dataset.CollectionId,
                                               _jobParameter.ProjectCollectionId, _indexId);
            }
            AnalyticsProject.CreateAnalyticalIndex(_jobParameter.MatterId, WorkAssignment.JobId, _indexId);  //Create Index in Spark SVM..
            IncreaseProcessedDocumentsCount(_totalDocumentCount);
        }
コード例 #17
0
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();
            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo));
            _analyticProject  = new AnalyticsProject();
            _dataset          = DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId, CultureInfo.CurrentCulture));
            _projectFieldId   = AnalyticsProject.GetProjectFieldId(_jobParameter.MatterId, _dataset.CollectionId);
            _documentBachSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectJobBatchSize",
                                                                                         "AnalyticsProject"));
            _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId;

            if (!_jobParameter.IsAddAdditionalDocuments || !string.IsNullOrEmpty(_jobIds))
            {
                return;
            }
            _jobIds = GetIncludeJobIds();
        }
コード例 #18
0
        /// <summary>
        /// Before job shuts down, shall update job next run
        /// </summary>
        /// <param name="jobParameters">Job Business Object</param>
        protected override void Shutdown(SaveSearchResultsJobBEO jobParameters)
        {
            jobParameters.ShouldNotBe(null);
            LogMessage(Constants.ShutdownLogMessage, false, LogCategory.Job, null);
            var additionalDetails = new List <KeyValuePair <string, string> >();

            var aditionalDetail = new KeyValuePair <string, string>(Constants.SearchDescription,
                                                                    _searchResultsProperty.SearchResultsDescription);

            additionalDetails.Add(aditionalDetail);

            aditionalDetail = new KeyValuePair <string, string>(Constants.SearchQuery,
                                                                jobParameters.DocumentQuery.QueryObject.DisplayQuery);
            additionalDetails.Add(aditionalDetail);

            aditionalDetail = new KeyValuePair <string, string>(Constants.NoOfDocuments,
                                                                _dcnList.Count.ToString(CultureInfo.InvariantCulture));
            additionalDetails.Add(aditionalDetail);

            aditionalDetail = new KeyValuePair <string, string>(Constants.DocumentControlNumberList,
                                                                string.Join(",", _dcnList.ToArray()));
            additionalDetails.Add(aditionalDetail);

            #region Notification section

            //Getting Job detail detail
            var jobBeo = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture));
            if (jobBeo.NotificationId > 0)
            {
                string defaultMessage;
                var    nameEndIndex          = jobBeo.Name.LastIndexOf(Constants.JobDateSeparator, StringComparison.Ordinal);
                var    savedSearchResultName = nameEndIndex >= 0 ? jobBeo.Name.Substring(0, nameEndIndex) : jobBeo.Name;
                defaultMessage = string.Format(Constants.SuccessNotificationMessage,
                                               HttpUtility.HtmlEncode(savedSearchResultName),
                                               ApplicationConfigurationManager.GetValue(Constants.SaveSearchResultUrl));
                CustomNotificationMessage = defaultMessage;
            }

            #endregion
        }
コード例 #19
0
 /// <summary>
 /// Initializes Job BEO
 /// </summary>
 /// <param name="jobId">Alert Job Identifier</param>
 /// <param name="jobRunId">Alert Job Run Identifier</param>
 /// <param name="bootParameters">Boot parameters</param>
 /// <param name="createdByGuid">Alert Job created by Guid</param>
 /// <returns>Alert Job Business Entity</returns>
 protected override SearchAlertsJobBEO Initialize(int jobId, int jobRunId, string bootParameters,
                                                  string createdByGuid)
 {
     try
     {
         // Set Job level properties to Alert Job business entity object.
         m_SearchAlertsJobBeo.JobId          = jobId;
         m_SearchAlertsJobBeo.JobRunId       = jobRunId;
         m_SearchAlertsJobBeo.JobTypeName    = Constants.LOG_SOURCE;
         m_SearchAlertsJobBeo.BootParameters = bootParameters;
         m_SearchAlertsJobBeo.JobName        = Constants.LOG_SOURCE;
         m_UserBusinessEntity = UserBO.GetUserUsingGuid(createdByGuid);
         m_SearchAlertsJobBeo.JobScheduleCreatedBy = (m_UserBusinessEntity.DomainName.Equals(Constants.NA))
             ? m_UserBusinessEntity.UserId
             : m_UserBusinessEntity.DomainName + Constants.BackSlash + m_UserBusinessEntity.UserId;
         // job start time need to be reduced by an offset to calculate start time
         // That's because at the beginning, Scheduler increments the start time by an offset for next run.
         var jobStartTimeoffsetFinal = Constants.INTEGER_INITIALIZE_VALUE;
         var jobStartTimeoffset      = ApplicationConfigurationManager.GetValue(Constants.JOB_START_TIME_OFFSET);
         Int32.TryParse(jobStartTimeoffset, out jobStartTimeoffsetFinal);
         m_SearchAlertsJobBeo.JobScheduleNextRunDate =
             m_Helper.GetSearchAlertJobRunStartTime(m_SearchAlertsJobBeo.JobId).AddHours(jobStartTimeoffsetFinal);
     }
     catch (EVException ex)
     {
         HandleEVException(ex, MethodBase.GetCurrentMethod().Name, null);
         var jobException = new EVJobException(ex.GetErrorCode(), ex, JobLogInfo);
         throw (jobException);
     }
     catch (Exception ex)
     {
         // Handle exception in initialize
         LogMessage(ex.Message, MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, null);
         var jobException = new EVJobException(ErrorCodes.ProblemInJobInitialization, ex, JobLogInfo);
         throw (jobException);
     }
     // return Alert Job Business Entity
     return(m_SearchAlertsJobBeo);
 }
コード例 #20
0
 private void SetMessageBatchSize(ImportBEO jobParameter)
 {
     try
     {
         if (jobParameter != null)
         {
             if (jobParameter.IsAppend)
             {
                 m_BatchSize =
                     Convert.ToInt32(ApplicationConfigurationManager.GetValue("LoadFileBatchSize", "Imports"));
             }
             else
             {
                 m_BatchSize =
                     Convert.ToInt32(ApplicationConfigurationManager.GetValue("LoadFileOverlayBatchSize",
                                                                              "Imports"));
             }
         }
     }
     catch (Exception)
     {
         Tracer.Error("Load File Parser: Failed to set message batch size for job run id {0}", PipelineId);
     }
 }
コード例 #21
0
        /// <summary>
        /// Initializes Job BEO
        /// </summary>
        /// <param name="jobId">Job Identifier</param>
        /// <param name="jobRunId">Job Run Identifier</param>
        /// <param name="bootParameters">Boot parameters</param>
        /// <param name="createdBy">Job created by</param>
        /// <returns>Job Business Entity</returns>
        protected override CompareSavedSearchResultsJobBEO Initialize(int jobId, int jobRunId, string bootParameters,
                                                                      string createdBy)
        {
            try
            {
                LogMessage(Constants.InitializationStartMessage, GetType(), Constants.InitializeMethodFullName,
                           EventLogEntryType.Information, jobId, jobRunId);
                //using job framework Logging
                LogMessage(Constants.InitializationStartMessage, false, LogCategory.Job, null);
                try
                {
                    // Set level of logging
                    _fileType     = (ApplicationConfigurationManager.GetValue(Constants.RequiredFileType));
                    _encodingType = (ApplicationConfigurationManager.GetValue(Constants.RequiredEncoding));
                    _xslFilePathForComparisonReport =
                        (CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.XslFilePathForComparisonReport));
                    LogMessage(Constants.InitializationDoneForConfigurableItemMessage, false, LogCategory.Job, null);
                    LogMessage(Constants.InitializationDoneForConfigurableItemMessage, GetType(),
                               Constants.InitializeMethodFullName, EventLogEntryType.Information, jobId, jobRunId);
                }
                catch
                {
                    _isJobFailed = true;
                    LogMessage(Constants.InitializationDoneForConfigurableItemErrorMessage, true, LogCategory.Job, null);
                    LogMessage(Constants.InitializationDoneForConfigurableItemErrorMessage, GetType(),
                               Constants.InitializeMethodFullName, EventLogEntryType.Information, jobId, jobRunId);
                }

                //Constructing Search Results property Beo from passed boot paramter
                _searchResultsProperty =
                    (SearchResultsPropertiesDataContract)
                    XmlUtility.DeserializeObject(bootParameters, typeof(SearchResultsPropertiesDataContract));

                //Initialize the JobBEO object
                _jobBeo.JobName = string.Format("Compare Job - {0} at {1}", _searchResultsProperty.SearchResultsName,
                                                DateTime.UtcNow.ConvertToUserTime());
                _jobBeo.JobDescription = _searchResultsProperty.SearchResultsDescription;
                _jobBeo.FileType       = _fileType;

                _jobBeo.JobTypeName = Constants.JobTypeName;
                _jobBeo.JobId       = jobId;
                _jobBeo.JobRunId    = jobRunId;

                // Obtain User BEO of job owner -> will be used for audit log purpose
                _userEntityOfJobOwner        = UserBO.GetUserUsingGuid(createdBy);
                _jobBeo.JobScheduleCreatedBy = (_userEntityOfJobOwner.DomainName.Equals("N/A"))
                    ? _userEntityOfJobOwner.UserId
                    : _userEntityOfJobOwner.DomainName + "\\" + _userEntityOfJobOwner.UserId;
            }
            catch (EVException ex)
            {
                _isJobFailed = true;
                WriteToEventViewer(ex, GetType(), MethodBase.GetCurrentMethod().Name, jobId, jobRunId);
                HandleJobException(null, ErrorCodes.ProblemInJobInitialization);
            }
            catch (Exception ex)
            {
                _isJobFailed = true;
                // Handle exception in initialize
                LogMessage(ex, GetType(), MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, jobId, jobRunId);
                HandleJobException(ex, ErrorCodes.ProblemInJobInitialization);
            }
            return(_jobBeo);
        }
コード例 #22
0
        /// <summary>
        /// Does atomic 1)Gets document links2) Generate xml 3) Update xml file to database.
        /// </summary>
        /// <param name="task">ConvertDCBLinkTaskBusinessEntityObject</param>
        /// <param name="jobParameters">Job business entity</param>
        /// <returns></returns>
        protected override bool DoAtomicWork(SendDocumentLinksToCaseMapTaskBusinessEntity Task, BaseJobBEO jobParameters)
        {
            var StatusFlag = true; // Function return status.

            try
            {
                EvLog.WriteEntry(
                    Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture),
                    Constants.Event_Job_DoAtomicWork_Start, EventLogEntryType.Information);
                var xml        = string.Empty;
                var taskEntity =
                    (SendDocumentLinksToCaseMapTaskBusinessEntity)
                    XmlUtility.DeserializeObject(jobParameters.BootParameters,
                                                 typeof(SendDocumentLinksToCaseMapTaskBusinessEntity));
                switch (taskEntity.CaseMapSource)
                {
                case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.SearchResults:
                {
                    var documentLinks = new List <DocumentLinkBEO>();
                    if (taskEntity.DocumentLinkTasks.DocumentSelectionMode ==
                        DocumentLinksTaskEntity.SelectionMode.UseSelection &&
                        taskEntity.DocumentLinkTasks.DocumentIdList != null)
                    {
                        documentLinks.AddRange(taskEntity.DocumentLinkTasks.DocumentIdList.Select(documentId =>
                                                                                                  getDocumentLink(taskEntity.DocumentLinkTasks.SearchContext.MatterId,
                                                                                                                  taskEntity.DocumentLinkTasks.SearchContext.CollectionId,
                                                                                                                  documentId, taskEntity.DocumentLinkTasks.BaseLink,
                                                                                                                  DocumentBO.GetDCNNumber(taskEntity.DocumentLinkTasks.SearchContext.MatterId,
                                                                                                                                          taskEntity.DocumentLinkTasks.SearchContext.CollectionId,
                                                                                                                                          documentId, jobParameters.JobScheduleCreatedBy
                                                                                                                                          )
                                                                                                                  )));
                    }
                    else
                    {
                        var documentQueryEntity = new DocumentQueryEntity
                        {
                            QueryObject = new SearchQueryEntity
                            {
                                ReviewsetId            = taskEntity.DocumentLinkTasks.SearchContext.ReviewsetId,
                                DatasetId              = Convert.ToInt32(taskEntity.DocumentLinkTasks.SearchContext.DatasetId),
                                MatterId               = Convert.ToInt32(taskEntity.DocumentLinkTasks.SearchContext.MatterId),
                                IsConceptSearchEnabled =
                                    taskEntity.DocumentLinkTasks.SearchContext.EnableConceptSearch
                            }
                        };
                        documentQueryEntity.QueryObject.QueryList.Add(
                            new Query(taskEntity.DocumentLinkTasks.SearchContext.Query));
                        documentQueryEntity.SortFields.Add(new Sort {
                                SortBy = Constants.Relevance
                            });
                        documentQueryEntity.IgnoreDocumentSnippet = true;
                        documentQueryEntity.TransactionName       = "SendDocumentLinksToCaseMap - DoAtomicWork";
                        var searchResults = JobSearchHandler.GetAllDocuments(documentQueryEntity, false);
                        if (taskEntity.DocumentLinkTasks.DocumentIdList != null &&
                            taskEntity.DocumentLinkTasks.DocumentIdList.Count > 0)
                        {
                            documentLinks =
                                searchResults.ResultDocuments.Where(
                                    x =>
                                    taskEntity.DocumentLinkTasks.DocumentIdList.Find(
                                        y => string.Compare(x.DocumentID, y, true) == 0) == null).
                                Select(
                                    z =>
                                    getDocumentLink(z.MatterID.ToString(), z.CollectionID, z.DocumentID,
                                                    taskEntity.DocumentLinkTasks.BaseLink, z.DocumentControlNumber)
                                    ).ToList();
                        }
                        else
                        {
                            searchResults.ResultDocuments.SafeForEach(d => documentLinks.Add(
                                                                          getDocumentLink(d.MatterID.ToString(), d.CollectionID, d.DocumentID,
                                                                                          taskEntity.DocumentLinkTasks.BaseLink, d.DocumentControlNumber)));
                        }
                    }


                    fileType = ApplicationConfigurationManager.GetValue(Constants.SearchResultsFileType);
                    xml      = DocumentFactBusinessObject.GenerateDocumentLinksXml(documentLinks,
                                                                                   jobParameters.JobScheduleCreatedBy);

                    break;
                }

                case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.DocumentViewer:
                {
                    var documentFactLinks = taskEntity.DocumentFactLinks;
                    fileType = ApplicationConfigurationManager.GetValue(Constants.DocumentViewerFileType);
                    xml      = DocumentFactBusinessObject.GenerateDocumentFactXml(documentFactLinks,
                                                                                  jobParameters.JobScheduleCreatedBy);

                    break;
                }

                case SendDocumentLinksToCaseMapTaskBusinessEntity.Source.NearNative:
                {
                    var documentFactLinks = taskEntity.DocumentFactLinks;
                    fileType = ApplicationConfigurationManager.GetValue(Constants.NearNativeFileType);
                    xml      = DocumentFactBusinessObject.GenerateDocumentFactXml(documentFactLinks,
                                                                                  jobParameters.JobScheduleCreatedBy);

                    break;
                }
                }

                // Perform Atomic Task
                var encoding    = new UTF8Encoding();
                var content     = encoding.GetBytes(xml);
                var nameBuilder = new StringBuilder();
                nameBuilder.Append(Constants.TaskName);
                nameBuilder.Append(Constants.OnDate);
                nameBuilder.Append(startedTime.ConvertToUserTime());
                var requestName = nameBuilder.ToString();

                nameBuilder = new StringBuilder();
                nameBuilder.Append(Constants.TaskName);
                nameBuilder.Append(Constants.RequestByUser);
                nameBuilder.Append(jobParameters.JobScheduleCreatedBy);
                nameBuilder.Append(Constants.OnDate);
                nameBuilder.Append(startedTime.ConvertToUserTime());
                requestDescription = nameBuilder.ToString();


                conversionId = CaseMapDAO.SaveConversionResults(jobParameters.JobRunId, requestName, requestDescription,
                                                                content, fileType, createdByUserGuid);
                StatusFlag = true;
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId,
                                 Constants.Event_Job_DoAtomicWork_Success, EventLogEntryType.Information);
            }
            catch (EVTaskException ex)
            {
                isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(TaskLogInfo, ex, LogCategory.Task, ErrorCodes.ProblemInDoAtomicWork, string.Empty);
            }
            catch (Exception ex)
            {
                isJobFailed = true;
                // Handle exception in Generate Tasks
                EvLog.WriteEntry(Constants.JobTypeName + MethodBase.GetCurrentMethod().Name, ex.Message,
                                 EventLogEntryType.Error);
                LogException(TaskLogInfo, ex, LogCategory.Task, ErrorCodes.ProblemInDoAtomicWork, string.Empty);
            }
            return(StatusFlag);
        }
コード例 #23
0
 /// <summary>
 /// Gets the configuration values.
 /// </summary>
 /// <returns></returns>
 private void GetConfigurationValues()
 {
     _batchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("QueryBatchSize", "Reviewset"));
     Tracer.Info("Configuration values are initialized successfully.");
 }
コード例 #24
0
        /// <summary>
        /// Does atomic 1)Gets DCB document 2) Generate xml 3) Update xml file to database.
        /// </summary>
        /// <param name="task">ConvertDCBLinkTaskBusinessEntityObject</param>
        /// <param name="jobParameters">Job business entity</param>
        /// <returns></returns>
        protected override bool DoAtomicWork(ConvertDCBLinkTaskBusinessEntityObject task, BaseJobBEO jobParameters)
        {
            bool StatusFlag = true;// Function return status.

            try
            {
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Start, EventLogEntryType.Information);
                // Perform Atomic Task
                DCBLinkCollectionBEO  dcbLinks = new DCBLinkCollectionBEO();
                DCBLinkBEO            dcbLink;
                ReviewerSearchResults searchResults = null;
                if (_documentCount > 0)
                {
                    DocumentQueryEntity documentQueryEntity = GetDocumentQueryEntity(task.DatasetId.ToString(CultureInfo.InvariantCulture), _query, _documentCount.ToString(CultureInfo.InvariantCulture));
                    documentQueryEntity.TransactionName = "ConvertDCBLinksToCaseMap - DoAtomicWork";
                    searchResults = JobSearchHandler.GetSearchResults(documentQueryEntity);
                }
                List <DCBLinkBEO> linkList = new List <DCBLinkBEO>();
                string            uuid     = string.Empty;
                int count = 0;
                foreach (DocumentResult document in searchResults.ResultDocuments)
                {
                    dcbLink = new DCBLinkBEO();
                    DocumentIdentifierBEO docIdentifier = new DocumentIdentifierBEO(document.MatterID.ToString(CultureInfo.InvariantCulture), document.CollectionID, document.DocumentID);
                    if (count == 0)
                    {
                        uuid = docIdentifier.UniqueIdentifier.Replace(docIdentifier.DocumentId, string.Empty);
                    }
                    dcbLink.NewDocumentId = docIdentifier.DocumentId;

                    List <FieldResult> fieldValues = document.Fields.Where(f => System.String.Compare(f.Name, EVSystemFields.DcbId, System.StringComparison.OrdinalIgnoreCase) == 0).ToList();
                    dcbLink.OldDocumentId = fieldValues.Any() ? fieldValues.First().Value.Replace("[", "(").Replace("]", ")") : string.Empty;
                    linkList.Add(dcbLink);
                    dcbLink.CollectionId = docIdentifier.CollectionId;
                    dcbLink.DCN          = docIdentifier.DCN;
                    if (docIdentifier.MatterId != null)
                    {
                        dcbLink.MatterId = long.Parse(docIdentifier.MatterId);
                    }

                    count++;
                }
                linkList.SafeForEach(l => dcbLinks.Links.Add(l));
                dcbLinks.UrlApplicationLink = task.LinkBackUrl;

                string        xml         = DocumentFactBusinessObject.GenerateDcbLinksXml(dcbLinks, uuid);
                UTF8Encoding  encoding    = new UTF8Encoding();
                byte[]        content     = encoding.GetBytes(xml);
                StringBuilder nameBuilder = new StringBuilder();
                nameBuilder.Append(Constants.TaskName);
                nameBuilder.Append(Constants.OnDate);
                nameBuilder.Append(startedTime.ConvertToUserTime());
                string requestName = nameBuilder.ToString();

                nameBuilder = new StringBuilder();
                nameBuilder.Append(Constants.TaskName);
                _requestDescription = nameBuilder.ToString();

                string fileType = ApplicationConfigurationManager.GetValue(Constants.FileType);
                _conversionId = CaseMapDAO.SaveConversionResults(jobParameters.JobRunId, requestName, _requestDescription, content, fileType, _createdByUserGuid);
                StatusFlag    = true;
                EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_DoAtomicWork_Success, EventLogEntryType.Information);
                TaskLogInfo.AddParameters(Constants.DataSetName, task.DatasetName);
            }
            catch (EVTaskException ex)
            {
                _isJobFailed = true;
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                throw;
            }
            catch (Exception ex)
            {
                _isJobFailed = true;
                // Handle exception in Generate Tasks
                EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
                EVTaskException jobException = new EVTaskException(ErrorCodes.DoAtomicError, ex);
                TaskLogInfo.StackTrace = ex.Message + Constants.LineBreak + ex.StackTrace;
                TaskLogInfo.AddParameters(Constants.DataSetId, task.DatasetId.ToString(CultureInfo.InvariantCulture));
                TaskLogInfo.AddParameters(Constants.DataSetName, task.DatasetName);
                TaskLogInfo.TaskKey    = Constants.DataSetName + ":" + task.DatasetName;
                jobException.LogMessge = TaskLogInfo;
                throw (jobException);
            }
            return(StatusFlag);
        }
コード例 #25
0
        /// <summary>
        /// Generate Search Alerts Tasks
        /// </summary>
        /// <param name="jobParameters"></param>
        /// <param name="previouslyCommittedTaskCount"></param>
        /// <returns></returns>
        protected override Tasks <SearchAlertsTaskBEO> GenerateTasks(SearchAlertsJobBEO jobParameters,
                                                                     out int previouslyCommittedTaskCount)
        {
            previouslyCommittedTaskCount = 0;
            try
            {
                //It is always try because GetTaskList is not calling.
                // Fix un notified errors - this is self correction of alerts if previous runs failed to update next run date.
                // If not fixed, one failure in chain can stop that specific alert for ever.
                try
                {
                    FixUnnotifiedAlerts();
                }
                catch (Exception ex)
                {
                    LogMessage(Constants.UNNOTIFIED_MESSAGE + ex.Message.Trim(),
                               MethodBase.GetCurrentMethod().Name, EventLogEntryType.FailureAudit, null);
                }
                // Not calling GetTaskList() as no existing tasks are expected.
                // Job can't be paused as it's not seen in job schedule screen.
                // Get tasks from helper function - each Alert is a task
                var searchAlertTasks = m_Helper.GetActiveAlerts
                                           (DateTime.UtcNow.AddSeconds(
                                               Convert.ToInt32(
                                                   ApplicationConfigurationManager.GetValue(Constants.OFFSET_DURATION_IN_SECONDS).Trim())),
                                           m_SearchAlertsJobBeo.JobScheduleNextRunDate);

                var taskCounter = 0;
                foreach (var alertTask in searchAlertTasks)
                {
                    alertTask.TaskNumber = taskCounter++;
                }

                #region Find last alert's timestamp.

                // Find last date in the current job's iteration (in all alerts).
                // Please note alerts in specified time window are the tasks.
                // Check to verify if there are any tasks/alerts.
                if (searchAlertTasks.Count > Constants.INTEGER_INITIALIZE_VALUE)
                {
                    // To sort Tasks list can't be used. So convert to List
                    var tasks = searchAlertTasks.ToList();

                    // Sort
                    var orderedTasks = from p in tasks
                                       orderby p.SearchAlert.NextRunDate descending
                                       select p;

                    // Check if there are any elements
                    if (orderedTasks.Count() > Constants.INTEGER_INITIALIZE_VALUE)
                    {
                        // First item is the last alert in the iteration.Set it to Job BEO.
                        m_SearchAlertsJobBeo.HighestDateInIteration = orderedTasks.First().SearchAlert.NextRunDate;
                    }
                }
                return(searchAlertTasks);
            }
            catch (EVException ex)
            {
                HandleEVException(ex, MethodBase.GetCurrentMethod().Name, null);
                var jobException = new EVJobException(ex.GetErrorCode(), ex, JobLogInfo);
                throw (jobException);
            }
            catch (Exception ex)
            {
                // Handle exception in Generate Tasks
                LogMessage(ex.Message, MethodBase.GetCurrentMethod().Name, EventLogEntryType.Error, null);
                var jobException = new EVJobException(ErrorCodes.ProblemInJobInitialization, ex, JobLogInfo);
                throw (jobException);
            }

            #endregion Find last alert's timestamp.
        }
コード例 #26
0
 protected override void BeginWork()
 {
     base.BeginWork();
     m_BatchSize = Convert.ToInt32(ApplicationConfigurationManager.GetValue("TagBatchSize", "Reviewset"));
 }
コード例 #27
0
        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);
            }
        }
コード例 #28
0
 /// <summary>
 /// Before job shuts down, shall update job next run
 /// </summary>
 /// <param name="jobParameters">Job Business Object</param>
 protected override void Shutdown(BaseJobBEO jobParameters)
 {
     try
     {
         EvLog.WriteEntry(Constants.JobTypeName + " - " + jobParameters.JobId.ToString(CultureInfo.InvariantCulture), Constants.Event_Job_ShutDown, EventLogEntryType.Information);
         #region Notification section
         //get job details
         JobBusinessEntity jobDetails = JobMgmtBO.GetJobDetails(jobParameters.JobId.ToString(CultureInfo.InvariantCulture));
         if (jobDetails != null && jobDetails.NotificationId > 0)
         {
             string defaultMessage = string.Empty;
             defaultMessage            = _isJobFailed ? string.Format(Constants.NotificationErrorMessageFormat, !string.IsNullOrEmpty(_requestDescription) ? _requestDescription : Constants.TaskName) : string.Format(Constants.NotificationSuccessMessageFormat, _requestDescription, _documentCount, ApplicationConfigurationManager.GetValue(Constants.CaseMapUrl), _conversionId.ToString());
             CustomNotificationMessage = defaultMessage;
         }
         #endregion
         JobLogInfo.AddParameters(Constants.CreatedBy, jobParameters.JobScheduleCreatedBy);
         JobLogInfo.AddParameters(Constants.DocumentIncludedInXml, Convert.ToString(_documentCount));
         JobLogInfo.AddParameters(Constants.TaskStartTime, Convert.ToString(startedTime));
         JobLogInfo.AddParameters(Constants.TaskEndTime, Convert.ToString(DateTime.UtcNow));
     }
     catch (EVJobException ex)
     {
         EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
         throw;
     }
     catch (Exception ex)
     {
         _isJobFailed = true;
         // Handle exception in Generate Tasks
         EvLog.WriteEntry(Constants.JobTypeName + MethodInfo.GetCurrentMethod().Name, ex.Message, EventLogEntryType.Error);
         EVJobException jobException = new EVJobException(ErrorCodes.DoAtomicError, ex);
         JobLogInfo.AddParameters(Constants.JobRunId, jobParameters.JobRunId.ToString(CultureInfo.InvariantCulture));
         jobException.LogMessge = JobLogInfo;
         throw (jobException);
     }
 }
コード例 #29
0
 protected override void BeginWork()
 {
     base.BeginWork();
     _bootParameter     = BootParameters;
     _maxParallelThread = Convert.ToInt32(ApplicationConfigurationManager.GetValue("NumberOfMaxParallelism", "Export"));
 }
コード例 #30
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);
        }