/// <summary>
        /// Helper method to update the tag log in database
        /// </summary>
        /// <param name="bulkTagRecord"></param>
        private void UpdateTagStatistics(BulkTagRecord bulkTagRecord)
        {
            var taglog = new TagLogBEO
            {
                DatasetId   = Convert.ToInt32(bulkTagRecord.DatasetId),
                JobId       = WorkAssignment.JobId,
                AlreadyTag  = _documentsAlreadyTagged,
                FailedTag   = _documentsFailed,
                DocumentTag = _documentsTagged
            };

            RVWTagBO.UpdateTagLog(taglog);
        }
        /// <summary>
        /// Sets the selected documents for reprocess tagging.
        /// </summary>
        /// <param name="jobParameters">The job parameters.</param>
        private void SetSelectedDocumentsForReprocessTagging(BulkTagJobBusinessEntity jobParameters)
        {
            var docs = RVWTagBO.GetDocumentsForReprocessTagging(
                jobParameters.DocumentListDetails.SearchContext.MatterId,
                jobParameters.ReprocessJobId, jobParameters.Filters);

            if (!docs.Any())
            {
                return;
            }
            LogMessage(false, string.Format("{0} documents determined for tag reprocessing", docs.Count));
            jobParameters.DocumentListDetails.SelectedDocuments.AddRange(docs);
        }
Beispiel #3
0
        /// <summary>
        /// This method is responsible to construct the Notification subject and Notification Body for the message to be delivered
        /// </summary>
        /// <param name="job"></param>
        /// <param name="jobStatus"></param>
        /// <param name="notificationMessageBeo"></param>
        /// <param name="message"></param>
        private static void ConstructBulkTagNotification(ActiveJob job, Director.JobStatus jobStatus,
                                                         NotificationMessageBEO notificationMessageBeo, JobBusinessEntity jobDetails, string notificationMessage)
        {
            var stream         = new StringReader(job.Beo.BootParameters);
            var xmlStream      = new XmlSerializer(typeof(BulkTagJobBusinessEntity));
            var bootParameters = xmlStream.Deserialize(stream) as BulkTagJobBusinessEntity;

            stream.Close();

            var message = new StringBuilder();

            message.Append(string.IsNullOrEmpty(jobDetails.TypeName) ? string.Empty : " Type: ");
            message.Append(jobDetails.Visibility
                               ? jobDetails.TypeName
                               : jobDetails.TypeName.Replace("Job", "Task"));
            message.Append("<br/>");
            message.Append(jobDetails.Name);
            if (job.Beo != null)
            {
                message.Append(" Instance: ");
                message.Append(job.Beo.JobRunId);
            }
            message.Append("<br/>");
            message.Append("Folder: ");
            message.Append(jobDetails.FolderName);
            message.Append(" ");
            message.Append("<br/>");
            message.Append("Status: ");
            message.Append(notificationMessage);

            if (null != bootParameters)
            {
                var tagLog = RVWTagBO.GetTagLog(Convert.ToInt32(bootParameters.TagDetails.DatasetId), job.JobId);

                if (jobStatus == Director.JobStatus.Completed)
                {
                    notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                    if (tagLog != null)
                    {
                        notificationMessageBeo.NotificationBody = ConstructNotificationBodyForReviewerBulkTag(job, bootParameters, tagLog, jobDetails);
                    }
                }
                else
                {
                    notificationMessageBeo.NotificationBody = notificationMessageBeo.NotificationSubject = message.ToString().Replace("<br/>", "  ");
                }
            }
            notificationMessageBeo.SendDefaultMessage = (jobStatus ==
                                                         Director.JobStatus.Completed);
        }
        /// <summary>
        /// To create dataset tags that are selected for law imprort
        /// </summary>
        private void CreateSelectedLawTags()
        {
            if (_jobParams == null)
            {
                _jobParams = GetJobParams(BootParameters);
            }
            if (_jobParams.MappingTags == null)
            {
                return;
            }
            _selectedTags = _jobParams.MappingTags;

            var allDatasetTags = RVWTagBO.GetTagDefinitions(_jobParams.MatterId.ToString(CultureInfo.InvariantCulture), _jobParams.CollectionId, "All", false, null);

            allDatasetTags = allDatasetTags ?? new List <RVWTagBEO>();

            foreach (var lawTag in _selectedTags.FindAll(x => string.IsNullOrEmpty(x.MappingTagId)))
            {
                var mappedDsTag = allDatasetTags.FirstOrDefault(
                    dsTag => string.IsNullOrEmpty(dsTag.Name) && dsTag.Name.ToLower().Equals(lawTag.MappingTagName));
                if (mappedDsTag != null)
                {
                    //If the tag is already created then continue
                    lawTag.MappingTagId = mappedDsTag.Id.ToString(CultureInfo.InvariantCulture);
                    continue;
                }
                var tag = new RVWTagBEO
                {
                    Name         = lawTag.MappingTagName,
                    IsSystemTag  = lawTag.IsSystemTag,
                    IsPrivateTag = false,
                    Scope        = TagScope.Document,
                    Type         = TagType.Tag,
                    MatterId     = _jobParams.MatterId,
                    CollectionId = _jobParams.CollectionId
                };
                lawTag.MappingTagId = RVWTagBO.CreateTag(tag).ToString(CultureInfo.InvariantCulture);
            }
        }