public virtual ActionBlock <ImportedRecord> BuildNullTargetBlock(RepositoryImportProgressInfo progressInfo,
                                                                  ExecutionDataflowBlockOptions executionOptions)
 {
     return(new ActionBlock <ImportedRecord>(
                importedRecord => { progressInfo.IncrementProcessedProjectsCount(); }, executionOptions
                ));
 }
Beispiel #2
0
        public void SaveImportedProject(ImportedRecord importedRecord, int userId, int externalRepositoryId, int bookTypeId,
                                        IList <int> roleIds, int importHistoryId, RepositoryImportProgressInfo progressInfo)
        {
            try
            {
                if (importedRecord.IsFailed)
                {
                    progressInfo.IncrementFailedProjectsCount();
                }
                else
                {
                    new SaveImportedDataWork(m_projectRepository, m_metadataRepository, m_catalogValueRepository,
                                             m_personRepository, m_permissionRepository, importedRecord, userId, externalRepositoryId, bookTypeId,
                                             roleIds).Execute();
                }
            }
            catch (DataException e)
            {
                importedRecord.IsFailed       = true;
                importedRecord.FaultedMessage = e.Message;
                progressInfo.IncrementFailedProjectsCount();

                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError(e, e.Message);
                }
            }


            try
            {
                progressInfo.IncrementProcessedProjectsCount();
                m_importedRecordMetadataManager.CreateImportedRecordMetadata(importedRecord, importHistoryId);
            }
            catch (DataException e)
            {
                if (!importedRecord.IsFailed)
                {
                    importedRecord.IsFailed       = true;
                    importedRecord.FaultedMessage = e.Message;
                    progressInfo.IncrementFailedProjectsCount();
                }

                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError(e, e.Message);
                }
            }
        }