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

Added some Link Management features

parent 62d0b750
......@@ -46,7 +46,8 @@ public class FileDAO {
+ "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"
+ "(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"
+ "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"
......@@ -175,6 +176,7 @@ public class FileDAO {
+ "(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"
+ "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"
+ "JOIN node p ON p.path @> n.path\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"
+ "(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"
+ "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"
+ "JOIN node p ON p.path @> n.path\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.setContentType(rs.getString("content_type"));
fi.setDirectory(rs.getBoolean("is_directory"));
fi.setLink(rs.getBoolean("is_link"));
fi.setJobId(rs.getString("job_id"));
int locationId = rs.getInt("location_id");
if (!rs.wasNull()) {
......
......@@ -16,6 +16,7 @@ public class FileInfo {
private boolean isPublic;
private boolean virtualParent;
private boolean directory;
private boolean link;
private List<String> groupRead;
private List<String> groupWrite;
private String ownerId;
......@@ -108,6 +109,14 @@ public class FileInfo {
public void setDirectory(boolean directory) {
this.directory = directory;
}
public boolean isLink() {
return link;
}
public void setLink(boolean link) {
this.link = link;
}
public boolean hasVirtualParent() {
return virtualParent;
......
......@@ -107,7 +107,7 @@ public class FileCopyService {
for (FileInfo destinationFileInfo : destinationFileInfos) {
LOG.trace("Processing {} destination", destinationFileInfo.getVirtualPath());
// Cycle on files only
if (!destinationFileInfo.isDirectory()) {
if (!destinationFileInfo.isDirectory() && !destinationFileInfo.isLink()) {
// Calculate source file vos path
String correspondingSourceVosPath
= this.getCorrespondingSourceVosPath(sourceRootVosPath,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment