Ejemplo n.º 1
0
        public ImportPipeline Build(ImportPipelineBuilder importPipelineBuilder, ExternalRepositoryDetailContract externalRepository,
                                    int importHistoryId, RepositoryImportProgressInfo progressInfo, CancellationToken cancellationToken)
        {
            var executionOptions = new ExecutionDataflowBlockOptions {
                CancellationToken = cancellationToken
            };

            var bufferBlock         = new BufferBlock <object>(executionOptions);
            var responseParserBlock =
                importPipelineBuilder.BuildResponseParserBlock(externalRepository.ExternalRepositoryType.Name, executionOptions);
            var filterBlock = importPipelineBuilder.BuildFilterBlock(externalRepository.Id, externalRepository.BibliographicFormat.Name,
                                                                     executionOptions);
            var projectParserBlock =
                importPipelineBuilder.BuildProjectParserBlock(externalRepository.BibliographicFormat.Name, executionOptions);
            var nullTargetBlock = importPipelineBuilder.BuildNullTargetBlock(progressInfo, executionOptions);
            var saveBlock       = importPipelineBuilder.BuildSaveBlock(m_importManager.UserId, importHistoryId, externalRepository.Id,
                                                                       progressInfo, executionOptions);

            var linkOptions = new DataflowLinkOptions {
                PropagateCompletion = true
            };

            bufferBlock.LinkTo(responseParserBlock, linkOptions);
            responseParserBlock.LinkTo(filterBlock, linkOptions);
            filterBlock.LinkTo(projectParserBlock, linkOptions, importedRecord => importedRecord.IsSuitable);
            filterBlock.LinkTo(nullTargetBlock, linkOptions);
            projectParserBlock.LinkTo(saveBlock, linkOptions);

            return(new ImportPipeline {
                BufferBlock = bufferBlock, LastBlock = saveBlock
            });
        }
Ejemplo n.º 2
0
 public IActionResult UpdateExternalRepository(int externalRepositoryId, [FromBody] ExternalRepositoryDetailContract data)
 {
     try
     {
         m_externalRepositoryManager.UpdateExternalRepository(externalRepositoryId, data);
         return(Ok());
     }
     catch (HttpErrorCodeException exception)
     {
         return(StatusCode((int)exception.StatusCode, exception.Message));
     }
 }
        public void UpdateExternalRepository(int externalRepositoryId, ExternalRepositoryDetailContract externalRepository)
        {
            try
            {
                m_client.Put <object>($"bibliography/repository/{externalRepositoryId}", externalRepository);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }
        public int CreateExternalRepository(ExternalRepositoryDetailContract externalRepository)
        {
            try
            {
                var externalRepositoryId = m_client.Post <int>("bibliography/repository", externalRepository);
                return(externalRepositoryId);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }
Ejemplo n.º 5
0
 public UpdateExternalRepositoryWork(ExternalRepositoryRepository externalRepositoryRepository, int externalRepositoryId, ExternalRepositoryDetailContract data) : base(externalRepositoryRepository)
 {
     m_externalRepositoryRepository = externalRepositoryRepository;
     m_externalRepositoryId         = externalRepositoryId;
     m_data = data;
 }
Ejemplo n.º 6
0
 public void UpdateExternalRepository(int externalRepositoryId, ExternalRepositoryDetailContract externalRepositoryDetailContract)
 {
     new UpdateExternalRepositoryWork(m_externalRepositoryRepository, externalRepositoryId, externalRepositoryDetailContract)
     .Execute();
 }
Ejemplo n.º 7
0
        public int CreateExternalRepository(ExternalRepositoryDetailContract externalRepository, int userId)
        {
            var result = new CreateExternalRepositoryWork(m_externalRepositoryRepository, externalRepository, userId).Execute();

            return(result);
        }
Ejemplo n.º 8
0
 public CreateExternalRepositoryWork(ExternalRepositoryRepository externalRepositoryRepository, ExternalRepositoryDetailContract data, int userId) : base(externalRepositoryRepository)
 {
     m_externalRepositoryRepository = externalRepositoryRepository;
     m_data   = data;
     m_userId = userId;
 }
Ejemplo n.º 9
0
        public int CreateExternalRepository([FromBody] ExternalRepositoryDetailContract data)
        {
            var resultId = m_externalRepositoryManager.CreateExternalRepository(data, m_authenticationManager.GetCurrentUserId());

            return(resultId);
        }