Commit d37aac36 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Commented out or deleted code referencing relative_parent_path and os_name

parent 62878e8d
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -31,9 +31,6 @@ public class GetFileController extends FileController {
    @Autowired
    private FileDAO fileDAO;

    @Autowired
    private JobDAO jobDAO;

    @Autowired
    private AuthorizationService authorizationService;

+8 −36
Original line number Diff line number Diff line
@@ -44,9 +44,9 @@ public class FileDAO {

        String sql = "SELECT n.node_id, is_public, group_read, group_write, creator_id, async_trans,\n"
                + "content_type, content_encoding, content_length, content_md5, name, n.location_id,\n"
                + "accept_views, provide_views, l.location_type, n.path <> n.relative_path AS virtual_parent,\n"
                + "accept_views, provide_views, l.location_type,\n"
                + "(SELECT user_name FROM users WHERE user_id = creator_id) AS username, n.job_id,\n"
                + "base_path, get_os_path(n.node_id) AS os_path, ? AS vos_path, false AS is_directory,\n"
                + "base_path, ? AS vos_path, false AS is_directory,\n"
                + "n.type = 'link' AS is_link, n.target,\n"
                + "fs_path \n"
                + "FROM node n\n"
@@ -176,9 +176,9 @@ public class FileDAO {

        String sql = "SELECT n.node_id, n.is_public, n.group_read, n.group_write, n.creator_id, n.async_trans, n.fs_path,\n"
                + "n.content_type, n.content_encoding, n.content_length, n.content_md5,\n"
                + "n.accept_views, n.provide_views, l.location_type, n.path <> n.relative_path AS virtual_parent,\n"
                + "n.accept_views, n.provide_views, l.location_type,\n"
                + "(SELECT user_name FROM users WHERE user_id = n.creator_id) AS username,\n"
                + "base_path, get_os_path(n.node_id) AS os_path, get_vos_path(n.node_id) AS vos_path,\n"
                + "base_path, get_vos_path(n.node_id) AS vos_path,\n"
                + "n.type = 'container' AS is_directory, n.name, n.location_id, n.job_id,\n"
                + "n.type = 'link' AS is_link, n.target, l.location_type\n"
                + "FROM node n\n"
@@ -209,9 +209,9 @@ public class FileDAO {

        String sql = "SELECT n.node_id, n.is_public, n.group_read, n.group_write, n.creator_id, n.async_trans, n.fs_path,\n"
                + "n.content_type, n.content_encoding, n.content_length, n.content_md5,\n"
                + "n.accept_views, n.provide_views, l.location_type, n.path <> n.relative_path AS virtual_parent,\n"
                + "n.accept_views, n.provide_views, l.location_type,\n"
                + "(SELECT user_name FROM users WHERE user_id = n.creator_id) AS username,\n"
                + "base_path, get_os_path(n.node_id) AS os_path, get_vos_path(n.node_id) AS vos_path,\n"
                + "base_path, get_vos_path(n.node_id) AS vos_path,\n"
                + "n.type = 'container' AS is_directory, n.name, n.location_id, n.job_id,\n"
                + "n.type = 'link' AS is_link, n.target, l.location_type\n"
                + "FROM node n\n"
@@ -282,7 +282,6 @@ public class FileDAO {
        fi.setAsyncTrans(rs.getBoolean("async_trans"));
        fi.setAcceptViews(toList(rs.getArray("accept_views")));
        fi.setProvideViews(toList(rs.getArray("provide_views")));        
        fi.setVirtualParent(rs.getBoolean("virtual_parent"));
        fi.setVirtualPath(rs.getString("vos_path"));
        fi.setVirtualName(rs.getString("name"));
        fi.setContentEncoding(rs.getString("content_encoding"));
@@ -346,31 +345,4 @@ public class FileDAO {

        fi.setFsPath(completeFsPath.toString());
    }     

    private void fillOsPath(FileInfo fi, ResultSet rs) throws SQLException {

        String basePath = rs.getString("base_path");
        if (basePath == null) {
            return;
        }

        String osPath = rs.getString("os_path");
        if (osPath.startsWith("/")) {
            osPath = osPath.substring(1);
        }

        Path completeOsPath = Path.of(basePath);

        boolean asyncLocation = "async".equals(rs.getString("location_type"));

        if (asyncLocation) {
            String username = rs.getString("username");
            completeOsPath = completeOsPath.resolve(username).resolve("retrieve");
        } else if (fi.hasVirtualParent()) {
            completeOsPath = completeOsPath.resolve(fi.getOwnerId());
        }

        completeOsPath = completeOsPath.resolve(osPath);
        fi.setOsPath(completeOsPath.toString());
    }
}
+2 −20
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ import java.util.List;
public class FileInfo {

    private int nodeId;    
    private String osPath;
    private String virtualPath;
    private String virtualName;
    private String fsPath;
@@ -19,7 +18,6 @@ public class FileInfo {
    // dependent manipulations (performed by FileDAO)
    private String actualBasePath;    
    private boolean isPublic;    
    private boolean virtualParent;
    private boolean directory;
    private boolean link;
    private String target;
@@ -85,14 +83,6 @@ public class FileInfo {
        this.nodeId = nodeId;
    }

    public String getOsPath() {
        return osPath;
    }

    public void setOsPath(String osPath) {
        this.osPath = osPath;
    }

    public String getVirtualPath() {
        return virtualPath;
    }
@@ -133,14 +123,6 @@ public class FileInfo {
        this.link = link;
    }

    public boolean hasVirtualParent() {
        return virtualParent;
    }

    public void setVirtualParent(boolean virtualParent) {
        this.virtualParent = virtualParent;
    }

    public List<String> getGroupRead() {
        return groupRead;
    }
+2 −2
Original line number Diff line number Diff line
@@ -97,12 +97,12 @@ public class PutFileService {
        // the first upload (fsPath not null)
        if(destinationFileInfo.getActualBasePath() != null) {
            if(destinationFileInfo.getFsPath() != null) {
                LOG.error("Node {} fsPath is not null: {}. Overwriting.", 
                LOG.error("Node {} fsPath is not null: {}. Overwriting forbidden.", 
                        destinationFileInfo.getVirtualPath(), 
                        destinationFileInfo.getFsPath());
                        throw new InvalidArgumentException("Node " + 
                        destinationFileInfo.getVirtualPath() +
                        " is already populated. Overwriting not allowed.");
                        " is already populated. Overwriting forbidden.");
            }
            
            destinationFileInfo.setFsPath(this.generateFsPath().toString());