Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -31,9 +31,6 @@ public class GetFileController extends FileController {
@Autowired
private FileDAO fileDAO;
@Autowired
private JobDAO jobDAO;
@Autowired
private AuthorizationService authorizationService;
......
......@@ -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"
......@@ -281,8 +281,7 @@ public class FileDAO {
fi.setOwnerId(rs.getString("creator_id"));
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.setProvideViews(toList(rs.getArray("provide_views")));
fi.setVirtualPath(rs.getString("vos_path"));
fi.setVirtualName(rs.getString("name"));
fi.setContentEncoding(rs.getString("content_encoding"));
......@@ -345,32 +344,5 @@ public class FileDAO {
Path completeFsPath = Path.of(fsPath);
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());
}
}
}
......@@ -10,16 +10,14 @@ import java.util.List;
public class FileInfo {
private int nodeId;
private String osPath;
private int nodeId;
private String virtualPath;
private String virtualName;
private String fsPath;
// actualBasePath differs from base path in db due to some location type
// dependent manipulations (performed by FileDAO)
private String actualBasePath;
private boolean isPublic;
private boolean virtualParent;
private boolean isPublic;
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;
}
......
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment