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

Added some Link Management features

parent 62d0b750
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -46,7 +46,8 @@ public class FileDAO {
                + "content_type, content_encoding, content_length, content_md5, name, n.location_id,\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.path <> n.relative_path AS virtual_parent,\n"
                + "(SELECT user_name FROM users WHERE user_id = creator_id) AS username, n.job_id,\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, get_os_path(n.node_id) AS os_path, ? AS vos_path, false AS is_directory,\n"
                + "type = 'link' AS is_link\n"
                + "FROM node n\n"
                + "FROM node n\n"
                + "JOIN location l ON (n.location_id IS NOT NULL AND n.location_id = l.location_id) OR (n.location_id IS NULL AND l.location_id = ?)\n"
                + "JOIN location l ON (n.location_id IS NOT NULL AND n.location_id = l.location_id) OR (n.location_id IS NULL AND l.location_id = ?)\n"
                + "LEFT JOIN storage s ON s.storage_id = l.storage_dest_id\n"
                + "LEFT JOIN storage s ON s.storage_id = l.storage_dest_id\n"
@@ -175,6 +176,7 @@ public class FileDAO {
                + "(SELECT user_name FROM users WHERE user_id = n.creator_id) AS username,\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_os_path(n.node_id) AS os_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 = 'container' AS is_directory, n.name, n.location_id, n.job_id\n"
                + "n.type = 'link' AS is_link\n"
                + "FROM node n\n"
                + "FROM node n\n"
                + "JOIN node p ON p.path @> n.path\n"
                + "JOIN node p ON p.path @> n.path\n"
                + "LEFT JOIN location l ON l.location_id = n.location_id\n"
                + "LEFT JOIN location l ON l.location_id = n.location_id\n"
@@ -206,7 +208,8 @@ public class FileDAO {
                + "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.path <> n.relative_path AS virtual_parent,\n"
                + "(SELECT user_name FROM users WHERE user_id = n.creator_id) AS username,\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_os_path(n.node_id) AS os_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 = 'container' AS is_directory, n.name, n.location_id, n.job_id,\n"
                + "n.type = 'link' AS is_link\n"
                + "FROM node n\n"
                + "FROM node n\n"
                + "JOIN node p ON p.path @> n.path\n"
                + "JOIN node p ON p.path @> n.path\n"
                + "LEFT JOIN location l ON l.location_id = n.location_id\n"
                + "LEFT JOIN location l ON l.location_id = n.location_id\n"
@@ -286,6 +289,7 @@ public class FileDAO {
        fi.setContentMd5(rs.getString("content_md5"));
        fi.setContentMd5(rs.getString("content_md5"));
        fi.setContentType(rs.getString("content_type"));
        fi.setContentType(rs.getString("content_type"));
        fi.setDirectory(rs.getBoolean("is_directory"));
        fi.setDirectory(rs.getBoolean("is_directory"));
        fi.setLink(rs.getBoolean("is_link"));
        fi.setJobId(rs.getString("job_id"));        
        fi.setJobId(rs.getString("job_id"));        
        int locationId = rs.getInt("location_id");
        int locationId = rs.getInt("location_id");
        if (!rs.wasNull()) {
        if (!rs.wasNull()) {
+9 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@ public class FileInfo {
    private boolean isPublic;
    private boolean isPublic;
    private boolean virtualParent;
    private boolean virtualParent;
    private boolean directory;
    private boolean directory;
    private boolean link;
    private List<String> groupRead;
    private List<String> groupRead;
    private List<String> groupWrite;
    private List<String> groupWrite;
    private String ownerId;
    private String ownerId;
@@ -109,6 +110,14 @@ public class FileInfo {
        this.directory = directory;
        this.directory = directory;
    }
    }
    
    
    public boolean isLink() {
        return link;
    }

    public void setLink(boolean link) {
        this.link = link;
    }

    public boolean hasVirtualParent() {
    public boolean hasVirtualParent() {
        return virtualParent;
        return virtualParent;
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ public class FileCopyService {
        for (FileInfo destinationFileInfo : destinationFileInfos) {
        for (FileInfo destinationFileInfo : destinationFileInfos) {
            LOG.trace("Processing {} destination", destinationFileInfo.getVirtualPath());
            LOG.trace("Processing {} destination", destinationFileInfo.getVirtualPath());
            // Cycle on files only
            // Cycle on files only
            if (!destinationFileInfo.isDirectory()) {
            if (!destinationFileInfo.isDirectory() && !destinationFileInfo.isLink()) {
                // Calculate source file vos path
                // Calculate source file vos path
                String correspondingSourceVosPath
                String correspondingSourceVosPath
                        = this.getCorrespondingSourceVosPath(sourceRootVosPath,
                        = this.getCorrespondingSourceVosPath(sourceRootVosPath,