Exemplo n.º 1
0
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                if (string.IsNullOrEmpty(_indexId))
                {
                    _indexId = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId,
                                                                     _dataset.CollectionId, _jobParameter.ProjectCollectionId);
                }

                if (_indexService == null)
                {
                    //Get Indexservice
                    _indexService = AnalyticsProject.GetAnalyticalEngineIndexService(_jobParameter.MatterId,
                                                                                     WorkAssignment.JobId, _indexId);
                }


                var projectDocumentCollection = (ProjectDocumentCollection)message.Body;
                projectDocumentCollection.ShouldNotBe(null);
                projectDocumentCollection.Documents.ShouldNotBe(null);
                var documents = projectDocumentCollection.Documents.Select(projectDocument => new Business.Analytics.DocumentIdentifier
                {
                    ReferenceId = projectDocument.DocumentReferenceId,
                    DocId       = projectDocument.DocId,
                    Url         = projectDocument.TextFilePath
                }).ToList();

                _analyticProject = new AnalyticsProject();
                _analyticProject.AddDocumentsInAnalyticalEngine(_jobParameter.MatterId, _dataset.CollectionId, _jobParameter, documents, _indexService,
                                                                _indexId, WorkAssignment.JobId);

                Send(projectDocumentCollection);
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }