Skip to content
Snippets Groups Projects
Commit 2e7e286c 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 9e85a818
No related branches found
No related tags found
No related merge requests found
...@@ -31,9 +31,6 @@ public class GetFileController extends FileController { ...@@ -31,9 +31,6 @@ public class GetFileController extends FileController {
@Autowired @Autowired
private FileDAO fileDAO; private FileDAO fileDAO;
@Autowired
private JobDAO jobDAO;
@Autowired @Autowired
private AuthorizationService authorizationService; private AuthorizationService authorizationService;
......
...@@ -44,9 +44,9 @@ public class FileDAO { ...@@ -44,9 +44,9 @@ public class FileDAO {
String sql = "SELECT n.node_id, is_public, group_read, group_write, creator_id, async_trans,\n" 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" + "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" + "(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" + "n.type = 'link' AS is_link, n.target,\n"
+ "fs_path \n" + "fs_path \n"
+ "FROM node n\n" + "FROM node n\n"
...@@ -176,9 +176,9 @@ public class FileDAO { ...@@ -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" 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.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" + "(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 = '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" + "n.type = 'link' AS is_link, n.target, l.location_type\n"
+ "FROM node n\n" + "FROM node n\n"
...@@ -209,9 +209,9 @@ public class FileDAO { ...@@ -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" 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.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" + "(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 = '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" + "n.type = 'link' AS is_link, n.target, l.location_type\n"
+ "FROM node n\n" + "FROM node n\n"
...@@ -282,7 +282,6 @@ public class FileDAO { ...@@ -282,7 +282,6 @@ public class FileDAO {
fi.setAsyncTrans(rs.getBoolean("async_trans")); fi.setAsyncTrans(rs.getBoolean("async_trans"));
fi.setAcceptViews(toList(rs.getArray("accept_views"))); fi.setAcceptViews(toList(rs.getArray("accept_views")));
fi.setProvideViews(toList(rs.getArray("provide_views"))); fi.setProvideViews(toList(rs.getArray("provide_views")));
fi.setVirtualParent(rs.getBoolean("virtual_parent"));
fi.setVirtualPath(rs.getString("vos_path")); fi.setVirtualPath(rs.getString("vos_path"));
fi.setVirtualName(rs.getString("name")); fi.setVirtualName(rs.getString("name"));
fi.setContentEncoding(rs.getString("content_encoding")); fi.setContentEncoding(rs.getString("content_encoding"));
...@@ -346,31 +345,4 @@ public class FileDAO { ...@@ -346,31 +345,4 @@ public class FileDAO {
fi.setFsPath(completeFsPath.toString()); 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());
}
} }
...@@ -11,7 +11,6 @@ import java.util.List; ...@@ -11,7 +11,6 @@ import java.util.List;
public class FileInfo { public class FileInfo {
private int nodeId; private int nodeId;
private String osPath;
private String virtualPath; private String virtualPath;
private String virtualName; private String virtualName;
private String fsPath; private String fsPath;
...@@ -19,7 +18,6 @@ public class FileInfo { ...@@ -19,7 +18,6 @@ public class FileInfo {
// dependent manipulations (performed by FileDAO) // dependent manipulations (performed by FileDAO)
private String actualBasePath; private String actualBasePath;
private boolean isPublic; private boolean isPublic;
private boolean virtualParent;
private boolean directory; private boolean directory;
private boolean link; private boolean link;
private String target; private String target;
...@@ -85,14 +83,6 @@ public class FileInfo { ...@@ -85,14 +83,6 @@ public class FileInfo {
this.nodeId = nodeId; this.nodeId = nodeId;
} }
public String getOsPath() {
return osPath;
}
public void setOsPath(String osPath) {
this.osPath = osPath;
}
public String getVirtualPath() { public String getVirtualPath() {
return virtualPath; return virtualPath;
} }
...@@ -133,14 +123,6 @@ public class FileInfo { ...@@ -133,14 +123,6 @@ public class FileInfo {
this.link = link; this.link = link;
} }
public boolean hasVirtualParent() {
return virtualParent;
}
public void setVirtualParent(boolean virtualParent) {
this.virtualParent = virtualParent;
}
public List<String> getGroupRead() { public List<String> getGroupRead() {
return groupRead; return groupRead;
} }
......
...@@ -97,12 +97,12 @@ public class PutFileService { ...@@ -97,12 +97,12 @@ public class PutFileService {
// the first upload (fsPath not null) // the first upload (fsPath not null)
if(destinationFileInfo.getActualBasePath() != null) { if(destinationFileInfo.getActualBasePath() != null) {
if(destinationFileInfo.getFsPath() != 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.getVirtualPath(),
destinationFileInfo.getFsPath()); destinationFileInfo.getFsPath());
throw new InvalidArgumentException("Node " + throw new InvalidArgumentException("Node " +
destinationFileInfo.getVirtualPath() + destinationFileInfo.getVirtualPath() +
" is already populated. Overwriting not allowed."); " is already populated. Overwriting forbidden.");
} }
destinationFileInfo.setFsPath(this.generateFsPath().toString()); destinationFileInfo.setFsPath(this.generateFsPath().toString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment