public RepositoryConfigViewModel GetRepositoryConfig(Guid id)
        {
            string result = _serviceApi.CallGetApi($"{_urlRepositoryConfigApi}/{id}");
            RepositoryConfigViewModel resultObject = JsonConvert.DeserializeObject <RepositoryConfigViewModel>(result);

            return(resultObject);
        }
        public IActionResult PublishRdf(Guid repositoryId, IFormFile rdfPublish)
        {
            RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(repositoryId);

            try
            {
                _callEtlPublishService.CallDataValidate(rdfPublish, repositoryId);
                _callEtlPublishService.CallDataPublish(rdfPublish, "", false);

                return(View("PublicarRdf", new PublishRepositoryModel
                {
                    RepositoryId = repositoryId,
                    Id = "",
                    Type = "rdf",
                    Result = $"Publicado con éxito el rdf: {rdfPublish.FileName}",
                    RepositoryShapes = result.ShapeConfig
                }));
            }
            catch (ValidationException vEx)
            {
                return(View("ValidationError", vEx.Report));
            }
            catch (Exception ex)
            {
                return(View("PublicarRdf", new PublishRepositoryModel
                {
                    RepositoryId = repositoryId,
                    Id = "",
                    Type = "rdf",
                    Result = $"Ha ocurrido un error al publicar el rdf",
                    RepositoryShapes = result.ShapeConfig
                }));
            }
        }
Ejemplo n.º 3
0
        public void TestConexionCreateRepositoryConfig()
        {
            try
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.Development.json");

                IConfiguration Configuration = builder.Build();

                ConfigUrlService configUrl   = new ConfigUrlService(Configuration);
                CallApiService   callService = new CallApiService();
                CallRepositoryConfigApiService callRepository = new CallRepositoryConfigApiService(callService, null, configUrl);
                RepositoryConfigViewModel      item           = new RepositoryConfigViewModel()
                {
                    Name       = "Prueba",
                    OauthToken = "qyueu11",
                    Url        = "url/prueba"
                };
                var resultado = callRepository.CreateRepositoryConfigView(item);
                Assert.True(true);
            }
            catch (Exception)
            {
                Assert.True(false);
            }
        }
        public RepositoryConfigViewModel CreateRepositoryConfigView(RepositoryConfigViewModel newRepositoryConfigView)
        {
            Guid   guidAdded;
            string result = _serviceApi.CallPostApi(_urlRepositoryConfigApi, newRepositoryConfigView);

            result = JsonConvert.DeserializeObject <string>(result);
            Guid.TryParse(result, out guidAdded);
            result = _serviceApi.CallGetApi($"{_urlRepositoryConfigApi}/{guidAdded}");
            RepositoryConfigViewModel resultObject = JsonConvert.DeserializeObject <RepositoryConfigViewModel>(result);

            return(resultObject);
        }
        public IActionResult PublicarRdf(Guid repository)
        {
            RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(repository);
            PublishRepositoryModel    publishRepositoryModel = new PublishRepositoryModel()
            {
                RepositoryId = repository,
                Id           = "",
                Type         = "rdf",
            };

            return(View(publishRepositoryModel));
        }
        public IActionResult Index(Guid repository)
        {
            RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(repository);
            PublishRepositoryModel    publishRepositoryModel = new PublishRepositoryModel()
            {
                RepositoryId     = repository,
                Id               = "",
                Type             = "rdf",
                RepositoryShapes = result.ShapeConfig
            };

            return(View("ObtenerRdf", publishRepositoryModel));
        }
Ejemplo n.º 7
0
 public IActionResult Create(RepositoryConfigViewModel repositoryConfigView)
 {
     try
     {
         repositoryConfigView.RepositoryConfigID = Guid.NewGuid();
         RepositoryConfigViewModel result = _serviceApi.CreateRepositoryConfigView(repositoryConfigView);
         return(RedirectToAction("Details", new { id = result.RepositoryConfigID }));
     }
     catch (BadRequestException)
     {
         return(BadRequest());
     }
 }
Ejemplo n.º 8
0
        public IActionResult Edit(RepositoryConfigViewModel repositoryConfigView)
        {
            try
            {
                _serviceApi.ModifyRepositoryConfig(repositoryConfigView);

                return(RedirectToAction("Details", new { id = repositoryConfigView.RepositoryConfigID }));
            }
            catch (BadRequestException)
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 9
0
        public IActionResult Edit(Guid id)
        {
            RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(id);

            if (result != null)
            {
                return(View("Create", result));
            }
            else
            {
                return(NotFound());
            }
        }
 public void TestConexionCreateRepositoryConfig()
 {
     try
     {
         ConfigUrlService configUrl   = new ConfigUrlService();
         CallApiService   callService = new CallApiService(configUrl);
         CallRepositoryConfigApiService callRepository = new CallRepositoryConfigApiService(callService);
         RepositoryConfigViewModel      item           = new RepositoryConfigViewModel()
         {
             Name       = "Prueba",
             OauthToken = "qyueu11",
             Url        = "url/prueba"
         };
         var resultado = callRepository.CreateRepositoryConfigView(item);
         Assert.True(true);
     }
     catch (Exception)
     {
         Assert.True(false);
     }
 }
        public IActionResult ValidateRdf(Guid repositoryId, IFormFile rdfToValidate, IFormFile validationRDF, List <Guid> shapesList)
        {
            try
            {
                RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(repositoryId);
                _callEtlPublishService.ValidateRDFPersonalized(repositoryId, rdfToValidate, validationRDF, shapesList, result.ShapeConfig);

                return(View("ValidarRdf", new PublishRepositoryModel
                {
                    RepositoryId = repositoryId,
                    Id = "",
                    Type = "rdf",
                    Result = $"RDF válido",
                    RepositoryShapes = result.ShapeConfig
                }));
            }
            catch (ValidationException vEx)
            {
                return(View("ValidationError", vEx.Report));
            }
        }
        public IActionResult Details(Guid id)
        {
            RepositoryConfigViewModel result = _serviceApi.GetRepositoryConfig(id);

            result.ListRecurringJobs = _respositoryJobService.GetRecurringJobsOfRepo(id);
            result.ListJobs          = _respositoryJobService.GetJobsOfRepo(id);
            result.ListScheduledJobs = _respositoryJobService.GetScheduledJobsOfRepo(id);
            if (result.ListJobs != null && result.ListJobs.Count > 0)
            {
                var job = result.ListJobs.OrderByDescending(item => item.ExecutedAt).FirstOrDefault();
                result.LastJob   = job.Id;
                result.LastState = job.State;
                int    succed     = result.ListJobs.Count(item => item.State.Equals("Succeeded"));
                double percentage = ((double)succed / result.ListJobs.Count) * 100;
                result.PorcentajeTareas = Math.Round(percentage, 2);

                List <ProcessDiscoverStateJob> statesDiscoverJob = _processDiscoverStateJobBDService.GetProcessDiscoverStateJobByIdJobs(result.ListJobs.Select(x => x.Id).ToList());
                foreach (JobViewModel jobVM in result.ListJobs)
                {
                    ProcessDiscoverStateJob state = statesDiscoverJob.FirstOrDefault(x => x.JobId == jobVM.Id);
                    if (state != null)
                    {
                        jobVM.DiscoverState = state.State;
                    }
                    jobVM.IdRepository = id;
                }
            }
            if (result != null)
            {
                return(View(result));
            }
            else
            {
                return(NotFound());
            }
        }
 public void ModifyRepositoryConfig(RepositoryConfigViewModel repositoryConfigView)
 {
     string result = _serviceApi.CallPutApi(_urlRepositoryConfigApi, repositoryConfigView);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Modifica un repositorio OAIPMH
 /// </summary>
 /// <param name="repositoryConfigView">Repositorio a modificar</param>
 public void ModifyRepositoryConfig(RepositoryConfigViewModel repositoryConfigView)
 {
     string result = _serviceApi.CallPutApi(_serviceUrl.GetUrl(), _urlRepositoryConfigApi, repositoryConfigView, _token);
 }
Ejemplo n.º 15
0
 public RepositoryConfigView(RepositoryConfigViewModel repositoryConfigViewModel)
 {
     InitializeComponent();
     _repositoryConfigGrid.DataContext = repositoryConfigViewModel;
     this.repositoryConfigViewModel    = repositoryConfigViewModel;
 }