Exemplo n.º 1
0
        public override async Task ExecuteAsync(ICommandDeleteUDSData command)
        {
            _logger.WriteInfo(new LogMessage(string.Concat(command.CommandName, " is arrived")), LogCategories);
            UDSEntityModel udsEntityModel = await CancelDataAsync(command.ContentType.ContentTypeValue, command.Identity.User, command.CreationTime);

            IEventDeleteUDSData evt = new EventDeleteUDSData(Guid.NewGuid(), command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity,
                                                             command.ContentType.ContentTypeValue, null);

            evt.CorrelatedMessages.Add(command);
            if (!await PushEventAsync(evt))
            {
                throw new Exception("EventDeleteUDSData not sent");
            }

            UDSBuildModel udsBuildModel = MapUDSModel(command.ContentType.ContentTypeValue, udsEntityModel);

            IEventCompleteUDSDelete eventCompleteUDSDelete = new EventCompleteUDSDelete(Guid.NewGuid(), command.CorrelationId, command.TenantName, command.TenantId,
                                                                                        command.TenantAOOId, command.Identity, udsBuildModel, null);

            if (!await PushEventAsync(eventCompleteUDSDelete))
            {
                _logger.WriteError(new LogMessage($"EventCompleteUDSDelete {udsBuildModel.UniqueId} has not been sended"), LogCategories);
                throw new Exception("IEventCompleteUDSDelete not sended");
            }
            _logger.WriteInfo(new LogMessage($"EventCompleteUDSDelete {udsBuildModel.UniqueId} has been sended"), LogCategories);
        }
Exemplo n.º 2
0
        private async Task <UDSEntityModel> InsertDataAsync(UDSBuildModel model, string userName, DateTimeOffset creationTime)
        {
            UDSEntityModel udsModel;

            try
            {
                UDSDataFacade udsDataFacade = new UDSDataFacade(_logger, _biblosClient, model.XMLContent, CurrentUDSSchemaRepository.SchemaXML, DBSchema);
                udsModel = udsDataFacade.AddUDS(ConnectionString, model.UDSRepository.Id, model.UDSRepository.Name, model.Roles.Where(f => f.UniqueId.HasValue && f.IdRole.HasValue).Select(f => new AuthorizationInstance()
                {
                    AuthorizationInstanceType = AuthorizationInstanceType.Role,
                    AuthorizationType         = (AuthorizationType)f.AuthorizationType,
                    IdAuthorization           = f.IdRole.Value,
                    UniqueId = f.UniqueId.Value.ToString(),
                }), userName, creationTime, null, model.Year, model.Number);

                ///TODO: Tali attività devono essere integrate in transazione con l'inserimento della UDS. In questo momento sono fuori in quanto non risulta possibile gestire la
                ///transazione della UDS e delle attività nelle web api
                await InsertRelationsAsync(udsModel, model.UDSRepository.Id, model.UDSRepository.DSWEnvironment, userName, creationTime);
                await InsertLogAsync(udsModel, model.UDSRepository.Id, model.UDSRepository.DSWEnvironment);
            }
            catch (Exception ex)
            {
                _logger.WriteError(ex, LogCategories);
                throw ex;
            }
            return(udsModel);
        }
Exemplo n.º 3
0
        public Guid SendCommandUpdateData(Guid idRepository, Guid idUDS, Guid correlationId, UDSModel model)
        {
            CommandFacade <ICommandUpdateUDSData> commandFacade = new CommandFacade <ICommandUpdateUDSData>();
            IdentityContext identity     = new IdentityContext(DocSuiteContext.Current.User.FullUserName);
            UDSBuildModel   commandModel = CreateUDSCommandModel(idRepository, idUDS, model);

            ICommandUpdateUDSData commandUpdate = new CommandUpdateUDSData(correlationId, CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel);

            commandFacade.Push(commandUpdate);
            return(commandUpdate.Id);
        }
Exemplo n.º 4
0
        private UDSBuildModel CreateUDSCommandModel(Guid idRepository, Guid idUDS, UDSModel model)
        {
            UDSRepositoryModelMapper repositoryModelMapper = new UDSRepositoryModelMapper();
            UDSBuildModel            commandModel          = new UDSBuildModel(model.SerializeToXml());
            UDSRepository            repository            = GetById(idRepository);

            commandModel.UDSRepository    = repositoryModelMapper.MappingDTO(repository);
            commandModel.UniqueId         = idUDS;
            commandModel.RegistrationUser = DocSuiteContext.Current.User.FullUserName;

            return(commandModel);
        }
Exemplo n.º 5
0
        private void ConfirmRepository(UDSModel model, DateTimeOffset activeDate, Guid idRepository)
        {
            if (idRepository.Equals(Guid.Empty))
            {
                throw new ArgumentNullException("idRepository");
            }

            UDSSchemaRepositoryModelMapper repositoryschemaModelMapper = new UDSSchemaRepositoryModelMapper();
            UDSRepositoryModelMapper       repositoryModelMapper       = new UDSRepositoryModelMapper(repositoryschemaModelMapper);
            UDSBuildModel   commandModel = new UDSBuildModel(model.SerializeToXml());
            IdentityContext identity     = new IdentityContext(DocSuiteContext.Current.User.FullUserName);
            string          tenantName   = DocSuiteContext.Current.ProtocolEnv.CorporateAcronym;
            Guid            tenantId     = DocSuiteContext.Current.CurrentTenant.TenantId;

            WebAPIDto <UDSRepository> resultDto = null;

            WebAPIImpersonatorFacade.ImpersonateFinder(Currentfinder, (impersonationType, finder) =>
            {
                finder.UniqueId         = idRepository;
                finder.EnablePaging     = false;
                finder.ExpandProperties = true;
                finder.ActionType       = UDSRepositoryFinderActionType.FindElement;
                resultDto = finder.DoSearch().FirstOrDefault();
                finder.ResetDecoration();
            });

            UDSRepository repository = resultDto.Entity;

            commandModel.UDSRepository    = repositoryModelMapper.Map(repository, new UDSRepositoryModel());
            commandModel.ActiveDate       = activeDate;
            commandModel.UniqueId         = repository.UniqueId;
            commandModel.RegistrationUser = repository.RegistrationUser;

            if (repository.Version > 0)
            {
                ICommandUpdateUDS commandUpdate = new CommandUpdateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel);
                CommandFacade <ICommandUpdateUDS> commandUpdateFacade = new CommandFacade <ICommandUpdateUDS>();
                commandUpdateFacade.Push(commandUpdate);
            }
            else
            {
                ICommandCreateUDS commandInsert = new CommandCreateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel);
                CommandFacade <ICommandCreateUDS> commandCreateFacade = new CommandFacade <ICommandCreateUDS>();
                commandCreateFacade.Push(commandInsert);
            }
        }
Exemplo n.º 6
0
        private async Task <UDSEntityModel> CancelDataAsync(UDSBuildModel model, string userName, DateTimeOffset creationTime)
        {
            UDSEntityModel udsEntityModel;

            try
            {
                UDSDataFacade udsDataFacade = new UDSDataFacade(_logger, _biblosClient, model.XMLContent, CurrentUDSSchemaRepository.SchemaXML, DBSchema);
                udsEntityModel = udsDataFacade.CancelUDS(ConnectionString, model.UniqueId, userName, creationTime, model.CancelMotivation);
                await InsertLogAsync(udsEntityModel, model.UDSRepository.Id, model.UDSRepository.DSWEnvironment);
            }
            catch (Exception ex)
            {
                _logger.WriteError(ex, LogCategories);
                throw ex;
            }
            return(udsEntityModel);
        }
Exemplo n.º 7
0
        private async Task SaveUDSRepositoryAsync(UDSBuildModel model, string idContainer)
        {
            try
            {
                if (model.UDSRepository != null)
                {
                    if (!model.UDSRepository.ActiveDate.HasValue)
                    {
                        _logger.WriteError(new LogMessage("Active date is empty"), LogCategories);
                        throw new ArgumentNullException("Active date is empty");
                    }

                    UDSRepository       udsRepository        = new UDSRepository(model.UDSRepository.Id);
                    UDSSchemaRepository lastSchemaRepository = CurrentUDSSchemaRepository;

                    _logger.WriteInfo(new LogMessage(string.Concat("Last valid Repository : ", lastSchemaRepository.UniqueId)), LogCategories);

                    udsRepository.ActiveDate          = model.UDSRepository.ActiveDate.Value;
                    udsRepository.ExpiredDate         = null;
                    udsRepository.LastChangedDate     = DateTimeOffset.UtcNow;
                    udsRepository.Version             = 1;
                    udsRepository.ModuleXML           = model.XMLContent;
                    udsRepository.Name                = model.UDSRepository.Name;
                    udsRepository.SchemaRepository    = lastSchemaRepository;
                    udsRepository.SequenceCurrentYear = (short)model.UDSRepository.ActiveDate.Value.Year;
                    udsRepository.Alias               = model.UDSRepository.Alias;
                    udsRepository.DSWEnvironment      = model.UDSRepository.DSWEnvironment;
                    udsRepository.Status              = DocSuiteWeb.Entity.UDS.UDSRepositoryStatus.Confirmed;
                    udsRepository.Container           = new DocSuiteWeb.Entity.Commons.Container()
                    {
                        EntityShortId = Convert.ToInt16(idContainer)
                    };

                    udsRepository = await UpdateUDSRepositoryAsync(udsRepository);

                    _logger.WriteInfo(new LogMessage(string.Concat("Repository is updated: ", udsRepository.UniqueId)), LogCategories);
                }
            }
            catch (Exception ex)
            {
                _logger.WriteError(ex, LogCategories);
                throw ex;
            }
        }
Exemplo n.º 8
0
        private async Task <UDSEntityModel> UpdateData(UDSBuildModel model, string userName, DateTimeOffset creationTime)
        {
            UDSEntityModel udsModel;

            try
            {
                UDSDataFacade df = new UDSDataFacade(_logger, _biblosClient, model.XMLContent, CurrentUDSSchemaRepository.SchemaXML, DBSchema);
                udsModel = df.UpdateUDS(ConnectionString, model.UniqueId, model.Roles.Where(f => f.UniqueId.HasValue && f.IdRole.HasValue).Select(f => new AuthorizationInstance()
                {
                    AuthorizationInstanceType = AuthorizationInstanceType.Role,
                    AuthorizationType         = (AuthorizationType)f.AuthorizationType,
                    IdAuthorization           = f.IdRole.Value,
                    UniqueId = f.UniqueId.Value.ToString(),
                }), userName, creationTime);
                await UpdateRelationsAsync(udsModel, model.UDSRepository.Id, model.UDSRepository.DSWEnvironment, userName, creationTime);
                await InsertLogAsync(udsModel, model.UDSRepository.Id, model.UDSRepository.DSWEnvironment);
            }
            catch (Exception ex)
            {
                _logger.WriteError(ex, LogCategories);
                throw ex;
            }
            return(udsModel);
        }
Exemplo n.º 9
0
        internal override async Task <DocumentUnit> MappingUpdateAsync(IContentBase entity, DocumentUnit documentUnit, IIdentityContext identity)
        {
            try
            {
                UDSBuildModel udsBuildModel = (UDSBuildModel)entity;

                #region [ Base ]

                documentUnit.LastChangedDate = udsBuildModel.LastChangedDate;
                documentUnit.LastChangedUser = udsBuildModel.LastChangedUser;
                documentUnit.Subject         = udsBuildModel.Subject;
                documentUnit.Title           = documentUnit.Title;
                documentUnit.Status          = DocumentUnitStatus.Active;

                #endregion

                #region [ Navigation Properties ]

                Category category = await _webApiClient.GetCategoryAsync(udsBuildModel.Category.IdCategory.Value);

                if (category.UniqueId != Guid.Empty && documentUnit.Category.UniqueId != udsBuildModel.Category.UniqueId)
                {
                    documentUnit.Category = category;
                }

                Container container = await _webApiClient.GetContainerAsync(udsBuildModel.Container.IdContainer.Value);

                if (container.UniqueId != Guid.Empty && documentUnit.Container.UniqueId != udsBuildModel.Container.UniqueId)
                {
                    documentUnit.Container = container;
                }

                documentUnit.Fascicle = await _webApiClient.GetFascicleAsync(udsBuildModel.UniqueId);

                if (udsBuildModel.Roles == null || !udsBuildModel.Roles.Any())
                {
                    documentUnit.DocumentUnitRoles.Clear();
                }

                if (udsBuildModel.Roles != null)
                {
                    IList <Role> roles = new List <Role>();
                    foreach (RoleModel item in udsBuildModel.Roles)
                    {
                        roles.Add(await _webApiClient.GetRoleAsync(item));
                    }

                    foreach (Role item in roles.Where(t => !documentUnit.DocumentUnitRoles.Any(x => x.UniqueIdRole == t.UniqueId)))
                    {
                        documentUnit.DocumentUnitRoles.Add(new DocumentUnitRole()
                        {
                            UniqueIdRole          = item.UniqueId,
                            RoleLabel             = udsBuildModel.Roles.SingleOrDefault(r => r.UniqueId.HasValue ? r.UniqueId.Value.Equals(item.UniqueId) : r.IdRole.Equals(item.EntityShortId))?.RoleLabel,
                            RegistrationDate      = DateTimeOffset.UtcNow,
                            RegistrationUser      = identity.User,
                            AuthorizationRoleType = GetRoleType(string.Empty)
                        });
                    }

                    foreach (DocumentUnitRole item in documentUnit.DocumentUnitRoles.Where(t => !roles.Any(x => x.UniqueId == t.UniqueIdRole)).ToList())
                    {
                        documentUnit.DocumentUnitRoles.Remove(item);
                    }
                }

                if (udsBuildModel.Users == null || !udsBuildModel.Users.Any())
                {
                    documentUnit.DocumentUnitUsers.Clear();
                }

                if (udsBuildModel.Users != null)
                {
                    IList <DocumentUnitUser> users = new List <DocumentUnitUser>();
                    foreach (UserModel item in udsBuildModel.Users)
                    {
                        if (item.Account != null && !documentUnit.DocumentUnitUsers.Where(x => x.Account != item.Account).Any())
                        {
                            users.Add(new DocumentUnitUser()
                            {
                                Account           = item.Account,
                                RegistrationDate  = DateTimeOffset.UtcNow,
                                RegistrationUser  = identity.User,
                                AuthorizationType = AuthorizationRoleType.Accounted
                            });
                        }
                    }
                    foreach (DocumentUnitUser item in users.Where(t => !documentUnit.DocumentUnitUsers.Any(x => x.Account == t.Account)))
                    {
                        documentUnit.DocumentUnitUsers.Add(new DocumentUnitUser()
                        {
                            Account           = item.Account,
                            RegistrationDate  = DateTimeOffset.UtcNow,
                            RegistrationUser  = identity.User,
                            AuthorizationType = AuthorizationRoleType.Accounted
                        });
                    }

                    foreach (DocumentUnitUser item in documentUnit.DocumentUnitUsers.Where(t => !users.Any(x => x.Account == t.Account)).ToList())
                    {
                        documentUnit.DocumentUnitUsers.Remove(item);
                    }
                }

                if (udsBuildModel.Documents.Count == 0)
                {
                    documentUnit.DocumentUnitChains.Clear();
                }

                if (udsBuildModel.Documents.Count > 0)
                {
                    //Elimino le chain che non esistono più
                    foreach (DocumentUnitChain item in documentUnit.DocumentUnitChains.Where(t => !udsBuildModel.Documents.Any(x => x.IdChain == t.IdArchiveChain)).ToList())
                    {
                        documentUnit.DocumentUnitChains.Remove(item);
                    }

                    foreach (UDSDocumentModel document in udsBuildModel.Documents)
                    {
                        switch (document.DocumentType)
                        {
                        case UDSDocumentType.Document:
                        {
                            DocumentUnitChain mainDocument = documentUnit.DocumentUnitChains.Where(t => t.ChainType == ChainType.MainChain).FirstOrDefault();
                            if (mainDocument != null)
                            {
                                if (document.IdChain != Guid.Empty)
                                {
                                    if (mainDocument.IdArchiveChain != document.IdChain || (mainDocument.ChainType == ChainType.MainChain && !mainDocument.DocumentName.Equals(document.DocumentName)))
                                    {
                                        documentUnit.DocumentUnitChains.Remove(mainDocument);
                                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.MainChain, identity);
                                    }
                                }
                                else
                                {
                                    documentUnit.DocumentUnitChains.Remove(mainDocument);
                                }
                            }
                            else
                            {
                                AddUDSDocumentUnitChain(documentUnit, document, ChainType.MainChain, identity);
                            }
                            break;
                        }

                        case UDSDocumentType.DocumentAttachment:
                        {
                            DocumentUnitChain attachment = documentUnit.DocumentUnitChains.Where(t => t.ChainType == ChainType.AttachmentsChain).FirstOrDefault();
                            if (attachment != null)
                            {
                                if (document.IdChain != Guid.Empty)
                                {
                                    if (attachment.IdArchiveChain != document.IdChain)
                                    {
                                        documentUnit.DocumentUnitChains.Remove(attachment);
                                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.AttachmentsChain, identity);
                                    }
                                }
                                else
                                {
                                    documentUnit.DocumentUnitChains.Remove(attachment);
                                }
                            }
                            else
                            {
                                AddUDSDocumentUnitChain(documentUnit, document, ChainType.AttachmentsChain, identity);
                            }
                            break;
                        }

                        case UDSDocumentType.DocumentAnnexed:
                        {
                            DocumentUnitChain annexed = documentUnit.DocumentUnitChains.Where(t => t.ChainType == ChainType.AnnexedChain).FirstOrDefault();
                            if (annexed != null)
                            {
                                if (document.IdChain != Guid.Empty)
                                {
                                    if (annexed.IdArchiveChain != document.IdChain)
                                    {
                                        documentUnit.DocumentUnitChains.Remove(annexed);
                                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.AnnexedChain, identity);
                                    }
                                }
                                else
                                {
                                    documentUnit.DocumentUnitChains.Remove(annexed);
                                }
                            }
                            else
                            {
                                AddUDSDocumentUnitChain(documentUnit, document, ChainType.AnnexedChain, identity);
                            }
                            break;
                        }

                        case UDSDocumentType.DocumentDematerialisation:
                        {
                            DocumentUnitChain dematerialisation = documentUnit.DocumentUnitChains.Where(t => t.ChainType == ChainType.DematerialisationChain).FirstOrDefault();
                            if (dematerialisation != null)
                            {
                                if (document.IdChain != Guid.Empty)
                                {
                                    if (dematerialisation.IdArchiveChain != document.IdChain)
                                    {
                                        documentUnit.DocumentUnitChains.Remove(dematerialisation);
                                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.DematerialisationChain, identity);
                                    }
                                }
                                else
                                {
                                    documentUnit.DocumentUnitChains.Remove(dematerialisation);
                                }
                            }
                            else
                            {
                                AddUDSDocumentUnitChain(documentUnit, document, ChainType.DematerialisationChain, identity);
                            }
                            break;
                        }
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                _logger.WriteError(new LogMessage("UDS, MappingUpdateAsync Error: "), ex, LogCategories);
                throw ex;
            }

            return(documentUnit);
        }
Exemplo n.º 10
0
        internal override async Task <DocumentUnit> MappingInsertAsync(IContentBase entity, IIdentityContext identity)
        {
            DocumentUnit documentUnit = new DocumentUnit();

            try
            {
                UDSBuildModel udsBuildModel = (UDSBuildModel)entity;
                #region [ Base ]

                documentUnit.EntityId         = 0;
                documentUnit.UniqueId         = udsBuildModel.UniqueId;
                documentUnit.Environment      = udsBuildModel.UDSRepository.DSWEnvironment;
                documentUnit.Year             = udsBuildModel.Year.Value;
                documentUnit.Number           = udsBuildModel.Number.Value;
                documentUnit.RegistrationDate = udsBuildModel.RegistrationDate.Value;
                documentUnit.RegistrationUser = udsBuildModel.RegistrationUser;
                documentUnit.LastChangedDate  = null;
                documentUnit.LastChangedUser  = null;
                documentUnit.Subject          = udsBuildModel.Subject;
                documentUnit.Title            = string.Concat(udsBuildModel.Year.Value, "/", udsBuildModel.Number.Value.ToString("0000000"));
                documentUnit.DocumentUnitName = udsBuildModel.Title;
                documentUnit.Status           = DocumentUnitStatus.Active;
                #endregion

                #region [ Navigation Properties ]

                //TODO: Category, Container e Authorizations dovrebbero arrivare già completi di UniqueId. Va modificata l'UDS nella DSW.
                documentUnit.UDSRepository = MapUDSRepositoryModel(new UDSRepository(), udsBuildModel.UDSRepository);
                Category category = await _webApiClient.GetCategoryAsync(udsBuildModel.Category.IdCategory.Value);

                if (category.UniqueId != Guid.Empty)
                {
                    documentUnit.Category = category;
                }

                Container container = await _webApiClient.GetContainerAsync(udsBuildModel.Container.IdContainer.Value);

                if (container.UniqueId != Guid.Empty)
                {
                    documentUnit.Container = container;
                }

                documentUnit.Fascicle = await _webApiClient.GetFascicleAsync(udsBuildModel.UniqueId);

                foreach (RoleModel item in udsBuildModel.Roles)
                {
                    Role role = await _webApiClient.GetRoleAsync(item);

                    documentUnit.DocumentUnitRoles.Add(new DocumentUnitRole()
                    {
                        UniqueIdRole          = role.UniqueId,
                        RoleLabel             = item.RoleLabel,
                        RegistrationDate      = DateTimeOffset.UtcNow,
                        RegistrationUser      = identity.User,
                        AuthorizationRoleType = GetRoleType(string.Empty)
                    });
                }
                foreach (UserModel item in udsBuildModel.Users)
                {
                    documentUnit.DocumentUnitUsers.Add(new DocumentUnitUser()
                    {
                        Account           = item.Account,
                        RegistrationDate  = DateTimeOffset.UtcNow,
                        RegistrationUser  = identity.User,
                        AuthorizationType = AuthorizationRoleType.Accounted
                    });
                }

                foreach (UDSDocumentModel document in udsBuildModel.Documents)
                {
                    switch (document.DocumentType)
                    {
                    case UDSDocumentType.Document:
                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.MainChain, identity);
                        break;

                    case UDSDocumentType.DocumentAttachment:
                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.AttachmentsChain, identity);
                        break;

                    case UDSDocumentType.DocumentAnnexed:
                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.AnnexedChain, identity);
                        break;

                    case UDSDocumentType.DocumentDematerialisation:
                        AddUDSDocumentUnitChain(documentUnit, document, ChainType.DematerialisationChain, identity);
                        break;
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                _logger.WriteError(new LogMessage("UDS, MappingInsertAsync Error: "), ex, LogCategories);
                throw ex;
            }

            return(documentUnit);
        }
Exemplo n.º 11
0
        protected override void AfterSave(Fascicle entity)
        {
            try
            {
                _logger.WriteDebug(new LogMessage($"VecompSoftware.DocSuite.Private.WebAPI.Controllers.Entity.Fascicles.AfterSave with entity UniqueId {entity.UniqueId}"), LogCategories);

                if (CurrentDeleteActionType.HasValue && CurrentDeleteActionType == DeleteActionType.CancelFascicle)
                {
                    IQueryable <FascicleDocumentUnit> documentUnits = _unitOfWork.Repository <FascicleDocumentUnit>().GetByFascicle(entity.UniqueId);

                    ServiceBusMessage message;
                    foreach (FascicleDocumentUnit item in documentUnits)
                    {
                        if (item.DocumentUnit.Environment == (int)DSWEnvironmentType.Protocol)
                        {
                            Protocol protocol = _unitOfWork.Repository <Protocol>().GetByUniqueId(item.DocumentUnit.UniqueId).Single();
                            message = GenerateMessage(item.DocumentUnit.Category, (int)DSWEnvironmentType.Protocol,
                                                      (categoryFascicle) => new CommandUpdateProtocol(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, item.DocumentUnit.TenantAOO.UniqueId, null, null, null,
                                                                                                      new IdentityContext(_currentIdentity.FullUserName), protocol, categoryFascicle, null));
                            Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        }
                        if (item.DocumentUnit.Environment == (int)DSWEnvironmentType.Resolution)
                        {
                            Resolution      resolution      = _unitOfWork.Repository <Resolution>().GetByUniqueId(item.DocumentUnit.UniqueId).Single();
                            ResolutionModel resolutionModel = _mapper.Map(resolution, new ResolutionModel());
                            _mapper.FileResolution  = _unitOfWork.Repository <FileResolution>().GetByResolution(item.DocumentUnit.EntityId).SingleOrDefault();
                            _mapper.ResolutionRoles = _unitOfWork.Repository <ResolutionRole>().GetByResolution(item.DocumentUnit.EntityId);
                            message = GenerateMessage(item.DocumentUnit.Category, (int)DSWEnvironmentType.Resolution,
                                                      (categoryFascicle) => new CommandUpdateResolution(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, item.DocumentUnit.TenantAOO.UniqueId,
                                                                                                        new IdentityContext(_currentIdentity.FullUserName), resolutionModel, categoryFascicle, null));
                            Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        }
                        if (item.DocumentUnit.Environment == (int)DSWEnvironmentType.DocumentSeries)
                        {
                            DocumentSeriesItem documentSeriesItem = _unitOfWork.Repository <DocumentSeriesItem>().GetFullByUniqueId(item.DocumentUnit.UniqueId).SingleOrDefault();
                            message = GenerateMessage(item.DocumentUnit.Category, (int)DSWEnvironmentType.DocumentSeries,
                                                      (categoryFascicle) => new CommandUpdateDocumentSeriesItem(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, item.DocumentUnit.TenantAOO.UniqueId, null,
                                                                                                                new IdentityContext(_currentIdentity.FullUserName), documentSeriesItem, categoryFascicle, null));
                            Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        }
                        if (item.DocumentUnit.Environment >= 100)
                        {
                            UDSBuildModel commandModel = _mapperUnitOfwork.Repository <IDomainMapper <DocumentUnit, UDSBuildModel> >().Map(item.DocumentUnit, new UDSBuildModel());
                            commandModel.UniqueId         = item.DocumentUnit.UniqueId;
                            commandModel.RegistrationDate = item.DocumentUnit.RegistrationDate;
                            commandModel.RegistrationUser = item.DocumentUnit.RegistrationUser;
                            message = GenerateMessage(item.DocumentUnit.Category, item.DocumentUnit.Environment,
                                                      (categoryFascicle) => new CommandCQRSUpdateUDSData(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, item.DocumentUnit.TenantAOO.UniqueId,
                                                                                                         new IdentityContext(_currentIdentity.FullUserName), commandModel, categoryFascicle, null, null, null, null));
                            Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        }
                    }
                }
                if (CurrentInsertActionType.HasValue || CurrentUpdateActionType.HasValue)
                {
                    if (CurrentInsertActionType.HasValue)
                    {
                        Task.Run(async() =>
                        {
                            FascicleFolder fascicleNode = new FascicleFolder
                            {
                                UniqueId = Guid.NewGuid(),
                                Fascicle = entity,
                                Name     = "Fascicolo",
                                Category = entity.Category,
                                Status   = FascicleFolderStatus.Active,
                                Typology = FascicleFolderTypology.Fascicle
                            };
                            _unitOfWork.Repository <FascicleFolder>().Insert(fascicleNode);
                            await _unitOfWork.SaveChangesAsync();
                            _logger.WriteDebug(new LogMessage($"Created principal folder from Fascicle.UniqueId {entity.UniqueId}"), LogCategories);
                            Fascicle fascicleTemplateModel = null;
                            if (entity.FascicleTemplate != null && !string.IsNullOrEmpty(entity.FascicleTemplate.JsonModel))
                            {
                                fascicleTemplateModel = JsonConvert.DeserializeObject <Fascicle>(entity.FascicleTemplate.JsonModel, Defaults.DefaultJsonSerializer);
                                if (fascicleTemplateModel != null && fascicleTemplateModel.FascicleFolders.Any())
                                {
                                    _logger.WriteDebug(new LogMessage($"Evaluating fascicle template {entity.FascicleTemplate.UniqueId} with {fascicleTemplateModel.FascicleFolders.Count} folders from Fascicle.UniqueId {entity.UniqueId}"), LogCategories);
                                    IEnumerable <FascicleFolder> results = fascicleTemplateModel.FascicleFolders.Where(f => f.Typology == FascicleFolderTypology.SubFascicle);
                                    await RecursiveInsertFascicleFoldersAsync(entity, fascicleNode, results, results.Where(f => !f.ParentInsertId.HasValue));
                                }
                            }
                        }).Wait();
                    }
                    IIdentityContext identity = new IdentityContext(_currentIdentity.FullUserName);
                    Fascicle         fascicle = _unitOfWork.Repository <Fascicle>().GetByUniqueId(entity.UniqueId);
                    ICQRS            command  = new CommandCreateFascicle(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty, identity, fascicle);
                    if (CurrentUpdateActionType.HasValue)
                    {
                        command = new CommandUpdateFascicle(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty, identity, fascicle);
                    }

                    foreach (IWorkflowAction workflowAction in WorkflowActions)
                    {
                        workflowAction.IdWorkflowActivity = IdWorkflowActivity;
                        command.WorkflowActions.Add(workflowAction);
                    }
                    ServiceBusMessage message = _cqrsMapper.Map(command, new ServiceBusMessage());
                    if (message == null || string.IsNullOrEmpty(message.ChannelName))
                    {
                        throw new DSWException($"Queue name to command [{command}] is not mapped", null, DSWExceptionCode.SC_Mapper);
                    }
                    Task.Run(async() =>
                    {
                        await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                    }).Wait();
                }
            }
            catch (DSWException ex)
            {
                _logger.WriteError(ex, LogCategories);
            }
            base.AfterSave(entity);
        }
        protected override void AfterSave(FascicleDocumentUnit entity)
        {
            try
            {
                _logger.WriteDebug(new LogMessage(string.Concat("VecompSoftware.DocSuite.Private.WebAPI.Controllers.Entity.Fascicles.FascicleDocumentUnit.AfterSave with entity UniqueId ", entity.UniqueId)), LogCategories);
                ServiceBusMessage message = null;

                if (entity.ReferenceType == ReferenceType.Fascicle)
                {
                    switch (entity.DocumentUnit.Environment)
                    {
                    case 1:
                    {
                        Collaboration collaboration             = null;
                        Guid?         collaborationUniqueId     = null;
                        int?          collaborationId           = null;
                        string        collaborationTemplateName = string.Empty;
                        Protocol      protocol = _unitOfWork.Repository <Protocol>().GetByUniqueIdWithRole(entity.DocumentUnit.UniqueId).SingleOrDefault();
                        if (protocol != null)
                        {
                            collaboration = _unitOfWork.Repository <Collaboration>().GetByProtocol(protocol.Year, protocol.Number).SingleOrDefault();
                            if (collaboration != null)
                            {
                                collaborationId           = collaboration.EntityId;
                                collaborationUniqueId     = collaboration.UniqueId;
                                collaborationTemplateName = collaboration.TemplateName;
                            }
                        }
                        message = GenerateMessage(entity.DocumentUnit.Category, (int)DSWEnvironmentType.Protocol,
                                                  (categoryFascicle) => new CommandUpdateProtocol(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, protocol.TenantAOO.UniqueId,
                                                                                                  collaborationUniqueId, collaborationId, collaborationTemplateName, new IdentityContext(_currentIdentity.FullUserName), protocol, categoryFascicle, null));
                        Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        break;
                    }

                    case 2:
                    {
                        Resolution resolution = _unitOfWork.Repository <Resolution>().GetFullByUniqueId(entity.DocumentUnit.UniqueId).SingleOrDefault();
                        if (resolution.AdoptionDate.HasValue)
                        {
                            ResolutionModel resolutionModel = _mapper.Map(resolution, new ResolutionModel());
                            _mapper.FileResolution  = _unitOfWork.Repository <FileResolution>().GetByResolution(resolution.EntityId).SingleOrDefault();
                            _mapper.ResolutionRoles = _unitOfWork.Repository <ResolutionRole>().GetByResolution(resolution.EntityId);
                            message = GenerateMessage(entity.DocumentUnit.Category, (int)DSWEnvironmentType.Resolution,
                                                      (categoryFascicle) => new CommandUpdateResolution(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty,
                                                                                                        new IdentityContext(_currentIdentity.FullUserName), resolutionModel, categoryFascicle, null));
                            Task.Run(async() =>
                                {
                                    await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                                }).Wait();
                        }
                        break;
                    }

                    case 4:
                    {
                        DocumentSeriesItem documentSeriesItem = _unitOfWork.Repository <DocumentSeriesItem>().GetFullByUniqueId(entity.DocumentUnit.UniqueId).SingleOrDefault();
                        message = GenerateMessage(entity.DocumentUnit.Category, (int)DSWEnvironmentType.DocumentSeries,
                                                  (categoryFascicle) => new CommandUpdateDocumentSeriesItem(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty, null,
                                                                                                            new IdentityContext(_currentIdentity.FullUserName), documentSeriesItem, categoryFascicle, null));
                        Task.Run(async() =>
                            {
                                await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                            }).Wait();
                        break;
                    }

                    default:
                    {
                        if (entity.DocumentUnit.Environment >= 100)
                        {
                            UDSBuildModel commandModel = _mapperUnitOfwork.Repository <IDomainMapper <DocumentUnit, UDSBuildModel> >().Map(entity.DocumentUnit, new UDSBuildModel());
                            commandModel.UniqueId         = entity.DocumentUnit.UniqueId;
                            commandModel.UDSId            = entity.DocumentUnit.UniqueId;
                            commandModel.RegistrationDate = entity.DocumentUnit.RegistrationDate;
                            commandModel.RegistrationUser = entity.DocumentUnit.RegistrationUser;
                            message = GenerateMessage(entity.DocumentUnit.Category, entity.DocumentUnit.Environment,
                                                      (categoryFascicle) => new CommandCQRSUpdateUDSData(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, entity.DocumentUnit.TenantAOO?.UniqueId ?? Guid.Empty,
                                                                                                         new IdentityContext(_currentIdentity.FullUserName), commandModel, categoryFascicle, entity.DocumentUnit, null, null, null));
                            Task.Run(async() =>
                                {
                                    await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                                }).Wait();
                        }
                        break;
                    }
                    }
                }

                if (CurrentInsertActionType.HasValue)
                {
                    message = GenerateMessage(entity.DocumentUnit.Category, (int)DSWEnvironmentType.Fascicle,
                                              (categoryFascicle) =>
                    {
                        return(new CommandCreateFascicleDocumentUnit(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty,
                                                                     new IdentityContext(_currentIdentity.FullUserName), entity));
                    });
                    Task.Run(async() =>
                    {
                        await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                    }).Wait();
                }

                if (CurrentDeleteActionType.HasValue)
                {
                    message = GenerateMessage(entity.DocumentUnit.Category, (int)DSWEnvironmentType.Fascicle,
                                              (categoryFascicle) =>
                    {
                        return(new CommandDeleteFascicleDocumentUnit(_parameterEnvService.CurrentTenantName, _parameterEnvService.CurrentTenantId, Guid.Empty,
                                                                     new IdentityContext(_currentIdentity.FullUserName), entity));
                    });
                    Task.Run(async() =>
                    {
                        await _queueService.SubscribeQueue(message.ChannelName).SendToQueueAsync(message);
                    }).Wait();
                }
            }
            catch (DSWException ex)
            {
                _logger.WriteError(ex, LogCategories);
            }
            base.AfterSave(entity);
        }
Exemplo n.º 13
0
        public override async Task ExecuteAsync(ICommandInsertUDSData command)
        {
            _logger.WriteInfo(new LogMessage(string.Concat(command.CommandName, " is arrived")), LogCategories);

            Guid?  collaborationUniqueId;
            string collaborationTemplateName;
            int?   collaborationId;

            try
            {
                _logger.WriteInfo(new LogMessage(string.Concat(command.ContentType.Id, " model evaluating ... ")), LogCategories);
                UDSEntityModel udsEntityModel = await InsertDataAsync(command.ContentType.ContentTypeValue, command.Identity.User, command.CreationTime);

                command.ContentType.ContentTypeValue.UniqueId = udsEntityModel.IdUDS;
                ResetModelXML(command.ContentType.ContentTypeValue);

                collaborationId           = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.IdCollaboration;
                collaborationUniqueId     = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.CollaborationUniqueId;
                collaborationTemplateName = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.CollaborationTemplateName;

                IEventInsertUDSData evt = new EventInsertUDSData(command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity,
                                                                 command.ContentType.ContentTypeValue);
                evt.CorrelatedMessages.Add(command);
                if (!await PushEventAsync(evt))
                {
                    throw new Exception("EventInsertUDSData not sent");
                }

                UDSBuildModel    udsBuildModel    = MapUDSModel(command.ContentType.ContentTypeValue, udsEntityModel);
                CategoryFascicle categoryFascicle = await GetPeriodicCategoryFascicleByEnvironment(udsEntityModel.IdCategory.Value, command.ContentType.ContentTypeValue.UDSRepository.DSWEnvironment);

                if (categoryFascicle == null)
                {
                    categoryFascicle = await GetDefaultCategoryFascicle(udsEntityModel.IdCategory.Value);
                }
                ICommandCQRSCreateUDSData commandCQRS = new CommandCQRSCreateUDSData(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, udsBuildModel, categoryFascicle, null,
                                                                                     collaborationUniqueId, collaborationId, collaborationTemplateName);
                if (command.CorrelationId.HasValue)
                {
                    commandCQRS = new CommandCQRSCreateUDSData(command.CorrelationId.Value, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, udsBuildModel, categoryFascicle, null,
                                                               collaborationUniqueId, collaborationId, collaborationTemplateName);
                }
                if (udsBuildModel.WorkflowActions != null)
                {
                    foreach (IWorkflowAction workflowAction in udsBuildModel.WorkflowActions)
                    {
                        commandCQRS.WorkflowActions.Add(workflowAction);
                    }
                }
                if (!await PushCommandAsync(commandCQRS))
                {
                    throw new Exception("CommandCQRSCreateUDSData not sent");
                }
                #region [ EventCompleteUDSBuild ]
                IEventCompleteUDSBuild eventCompleteUDSBuild = new EventCompleteUDSBuild(Guid.NewGuid(), command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId,
                                                                                         command.Identity, udsBuildModel, null);
                if (!await PushEventAsync(eventCompleteUDSBuild))
                {
                    _logger.WriteError(new LogMessage($"EventCompleteUDSBuild {udsBuildModel.UniqueId} has not been sended"), LogCategories);
                    throw new Exception("IEventCompleteUDSBuild not sended");
                }
                _logger.WriteInfo(new LogMessage($"EventCompleteUDSBuild {udsBuildModel.UniqueId} has been sended"), LogCategories);
                #endregion
            }
            catch (Exception ex)
            {
                ResetModelXML(command.ContentType.ContentTypeValue);
                IEventError evt = new EventError(command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity,
                                                 new ContentTypeString($"Errore in fase di inserimento nell'archivio [{ex.Message}]"), null);
                evt.CorrelatedMessages.Add(command);
                if (!await PushEventAsync(evt))
                {
                    throw new Exception("EventError not sent");
                }
                throw ex;
            }

            _logger.WriteInfo(new LogMessage("message completed."), LogCategories);
        }
Exemplo n.º 14
0
        public override async Task ExecuteAsync(ICommandUpdateUDSData command)
        {
            _logger.WriteInfo(new LogMessage($"{command.CommandName} is arrived"), LogCategories);

            Guid?  collaborationUniqueId;
            string collaborationTemplateName;
            int?   collaborationId;

            try
            {
                UDSEntityModel udsEntityModel = await UpdateData(command.ContentType.ContentTypeValue, command.Identity.User, command.CreationTime);

                ResetModelXML(command.ContentType.ContentTypeValue);

                collaborationId           = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.IdCollaboration;
                collaborationUniqueId     = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.CollaborationUniqueId;
                collaborationTemplateName = udsEntityModel.Relations.Collaborations.FirstOrDefault()?.CollaborationTemplateName;

                IEventUpdateUDSData evt = new EventUpdateUDSData(Guid.NewGuid(), command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity,
                                                                 command.ContentType.ContentTypeValue, null);
                evt.CorrelatedMessages.Add(command);
                if (!await PushEventAsync(evt))
                {
                    throw new Exception("EventUpdateUDSData not sent");
                }

                CategoryFascicle categoryFascicle = await GetPeriodicCategoryFascicleByEnvironment(udsEntityModel.IdCategory.Value, command.ContentType.ContentTypeValue.UDSRepository.DSWEnvironment);

                if (categoryFascicle == null)
                {
                    categoryFascicle = await GetDefaultCategoryFascicle(udsEntityModel.IdCategory.Value);
                }

                UDSBuildModel udsBuildModel = MapUDSModel(command.ContentType.ContentTypeValue, udsEntityModel);

                ICommandCQRSUpdateUDSData commandCQRS = new CommandCQRSUpdateUDSData(command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, udsBuildModel, categoryFascicle, null,
                                                                                     collaborationUniqueId, collaborationId, collaborationTemplateName);

                if (command.CorrelationId.HasValue)
                {
                    commandCQRS = new CommandCQRSUpdateUDSData(command.CorrelationId.Value, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity, udsBuildModel, categoryFascicle, null,
                                                               collaborationUniqueId, collaborationId, collaborationTemplateName);
                }

                if (udsBuildModel.WorkflowActions != null)
                {
                    foreach (IWorkflowAction workflowAction in udsBuildModel.WorkflowActions)
                    {
                        commandCQRS.WorkflowActions.Add(workflowAction);
                    }
                }
                if (!await PushCommandAsync(commandCQRS))
                {
                    throw new Exception("CommandCQRSUpdateUDSData not sent");
                }
            }
            catch (Exception ex)
            {
                ResetModelXML(command.ContentType.ContentTypeValue);
                IEventError evt = new EventError(command.CorrelationId, command.TenantName, command.TenantId, command.TenantAOOId, command.Identity,
                                                 new ContentTypeString($"Errore in fase di aggiornamento nell'archivio [{ex.Message}]"), null);
                evt.CorrelatedMessages.Add(command);
                if (!await PushEventAsync(evt))
                {
                    throw new Exception("EventError not sent");
                }
                throw ex;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Aggiorno la UDSRepository attiva in questo momento.
        /// Aggiongo la repository presente nel comando
        /// Associo l'ultimo schema
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private async Task UpdateUDSRepositoryAsync(UDSBuildModel model, bool requiredRevisionUDSRepository = true)
        {
            try
            {
                if (model.UDSRepository != null)
                {
                    if (!model.UDSRepository.ActiveDate.HasValue)
                    {
                        _logger.WriteError(new LogMessage("Active date is empty"), LogCategories);
                        throw new ArgumentNullException("Active date is empty");
                    }

                    UDSRepository currentRepository = await GetCurrentUDSRepositoryAsync(model.UDSRepository.Name);

                    UDSRepository newRepository = await GetUDSRepositoryAsync(model.UDSRepository.Id);

                    _logger.WriteInfo(new LogMessage($"Last valid Repository is {CurrentUDSSchemaRepository.UniqueId}"), LogCategories);

                    if (requiredRevisionUDSRepository)
                    {
                        currentRepository.ExpiredDate       = model.UDSRepository.ActiveDate;
                        newRepository.ActiveDate            = model.UDSRepository.ActiveDate.Value;
                        newRepository.ExpiredDate           = null;
                        newRepository.LastChangedDate       = DateTimeOffset.UtcNow;
                        newRepository.ModuleXML             = model.XMLContent;
                        newRepository.Name                  = model.UDSRepository.Name;
                        newRepository.SchemaRepository      = CurrentUDSSchemaRepository;
                        newRepository.Version               = ++currentRepository.Version;
                        newRepository.Status                = DocSuiteWeb.Entity.UDS.UDSRepositoryStatus.Confirmed;
                        newRepository.SequenceCurrentYear   = currentRepository.SequenceCurrentYear;
                        newRepository.SequenceCurrentNumber = currentRepository.SequenceCurrentNumber;
                        currentRepository = await UpdateUDSRepositoryAsync(currentRepository);

                        _logger.WriteInfo(new LogMessage($"Repository {currentRepository.UniqueId}/{currentRepository.Name}/{newRepository.Version} has expired"), LogCategories);
                        newRepository = await UpdateUDSRepositoryAsync(newRepository);

                        _logger.WriteInfo(new LogMessage($"Repository {newRepository.UniqueId}/{newRepository.Name}/{newRepository.Version} has been successfully confirmed."), LogCategories);
                    }
                    else
                    {
                        currentRepository.ModuleXML = model.XMLContent;
                        currentRepository           = await UpdateUDSRepositoryAsync(currentRepository);

                        _logger.WriteInfo(new LogMessage($"Repository {newRepository.UniqueId}/{newRepository.Name}/{newRepository.Version} has been successfully updated."), LogCategories);
                        newRepository = await DeleteUDSRepositoryAsync(newRepository);

                        if (newRepository != null)
                        {
                            _logger.WriteInfo(new LogMessage($"Draft repository {newRepository.UniqueId}/{newRepository.Name}/{newRepository.Version} has been deleted"), LogCategories);
                        }
                        else
                        {
                            _logger.WriteWarning(new LogMessage($"Error occoured during deleting draft repository {newRepository.UniqueId}/{newRepository.Name}/{newRepository.Version}"), LogCategories);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.WriteError(ex, LogCategories);
                throw ex;
            }
        }