From 6622ea344468a4cc2b04f99f506d6128316e6721 Mon Sep 17 00:00:00 2001
From: Nicola Fulvio Calabria <nicola.calabria@inaf.it>
Date: Thu, 15 Sep 2022 18:14:18 +0200
Subject: [PATCH] Removed storage.base_url field

---
 .../it/inaf/oats/vospace/persistence/LocationDAO.java    | 5 ++---
 .../it/inaf/oats/vospace/persistence/model/Storage.java  | 9 ---------
 src/test/resources/test-data.sql                         | 8 ++++----
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/main/java/it/inaf/oats/vospace/persistence/LocationDAO.java b/src/main/java/it/inaf/oats/vospace/persistence/LocationDAO.java
index 71d86f3..09fca17 100644
--- a/src/main/java/it/inaf/oats/vospace/persistence/LocationDAO.java
+++ b/src/main/java/it/inaf/oats/vospace/persistence/LocationDAO.java
@@ -35,7 +35,7 @@ public class LocationDAO {
     public Optional<Location> getNodeLocation(String vosPath) {
 
         String sql = "SELECT l.location_id, location_type, storage_src_id, storage_dest_id,\n"
-                + "storage_id, storage_type, base_path, base_url, hostname\n"
+                + "storage_id, storage_type, base_path, hostname\n"
                 + "FROM location l\n"
                 + "JOIN storage s ON l.storage_src_id = s.storage_id OR l.storage_dest_id = s.storage_id\n"
                 + "JOIN node n ON n.location_id = l.location_id\n"
@@ -84,8 +84,7 @@ public class LocationDAO {
             }
 
             storage.setType(StorageType.parse(rs.getString("storage_type")));
-            storage.setBasePath(rs.getString("base_path"));
-            storage.setBaseUrl(rs.getString("base_url"));
+            storage.setBasePath(rs.getString("base_path"));           
             storage.setHostname(rs.getString("hostname"));
 
             Storage storageSrc = storagesMap.get(rs.getInt("storage_src_id"));
diff --git a/src/main/java/it/inaf/oats/vospace/persistence/model/Storage.java b/src/main/java/it/inaf/oats/vospace/persistence/model/Storage.java
index 4d4e8c7..4be7532 100644
--- a/src/main/java/it/inaf/oats/vospace/persistence/model/Storage.java
+++ b/src/main/java/it/inaf/oats/vospace/persistence/model/Storage.java
@@ -10,7 +10,6 @@ public class Storage {
     private int id;
     private StorageType type;
     private String basePath;
-    private String baseUrl;
     private String hostname;
 
     public int getId() {
@@ -37,14 +36,6 @@ public class Storage {
         this.basePath = basePath;
     }
 
-    public String getBaseUrl() {
-        return baseUrl;
-    }
-
-    public void setBaseUrl(String baseUrl) {
-        this.baseUrl = baseUrl;
-    }
-
     public String getHostname() {
         return hostname;
     }
diff --git a/src/test/resources/test-data.sql b/src/test/resources/test-data.sql
index 16b8418..a2daaf1 100644
--- a/src/test/resources/test-data.sql
+++ b/src/test/resources/test-data.sql
@@ -1,9 +1,9 @@
 INSERT INTO linked_service(service_base_url) VALUES ('http://archives.ia2.inaf.it/files/aao');
 
-INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('cold', '/ia2_tape/users', NULL, 'tape-server');
-INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('hot', '/mnt/hot_storage/users', NULL, 'server');
-INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('local', '/home', NULL, 'localhost');
-INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('local', '/home/vospace/upload', NULL, 'localhost');
+INSERT INTO storage (storage_type, base_path, hostname) VALUES ('cold', '/ia2_tape/users', 'tape-server');
+INSERT INTO storage (storage_type, base_path, hostname) VALUES ('hot', '/mnt/hot_storage/users', 'server');
+INSERT INTO storage (storage_type, base_path, hostname) VALUES ('local', '/home', 'localhost');
+INSERT INTO storage (storage_type, base_path, hostname) VALUES ('local', '/home/vospace/upload', 'localhost');
 
 INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('async', 1, 3);
 INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('async', 2, 3);
-- 
GitLab