Skip to content
Snippets Groups Projects
Commit 209bdccf authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added location type to FileInfo and fixed issue with generation of archives containing async nodes

parent e6b31480
No related branches found
No related tags found
No related merge requests found
Pipeline #2327 passed
......@@ -175,8 +175,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 = 'link' AS is_link\n"
+ "n.type = 'container' AS is_directory, n.name, n.location_id, n.job_id,\n"
+ "n.type = 'link' AS is_link, l.location_type\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"
......@@ -209,7 +209,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"
+ "n.type = 'link' AS is_link, l.location_type\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"
......@@ -294,6 +294,7 @@ public class FileDAO {
int locationId = rs.getInt("location_id");
if (!rs.wasNull()) {
fi.setLocationId(locationId);
fi.setLocationType(rs.getString("location_type"));
}
fillOsPath(fi, rs);
......
......@@ -28,6 +28,7 @@ public class FileInfo {
private Long contentLength;
private String contentMd5;
private Integer locationId;
private String locationType;
private String jobId;
public int getNodeId() {
......@@ -182,6 +183,14 @@ public class FileInfo {
this.locationId = locationId;
}
public String getLocationType() {
return locationType;
}
public void setLocationType(String locationType) {
this.locationType = locationType;
}
public String getJobId() {
return jobId;
}
......
......@@ -112,7 +112,7 @@ public class ArchiveService {
continue;
}
if (fileInfo.getLocationId() != null && fileInfo.getLocationId() != uploadLocationId) {
if (fileInfo.getLocationId() != null && "portal".equals(fileInfo.getLocationType())) {
// remote file
if (portalLocationUrls == null) {
portalLocationUrls = locationDAO.getPortalLocationUrls();
......
......@@ -134,7 +134,7 @@ public class FileCopyService {
}
}
if (sourceFileInfo.getLocationId() != null && sourceFileInfo.getLocationId() != uploadLocationId) {
if (sourceFileInfo.getLocationId() != null && "portal".equals(sourceFileInfo.getLocationType())) {
// remote file
if (portalLocationUrls == null) {
portalLocationUrls = locationDAO.getPortalLocationUrls();
......
......@@ -88,10 +88,14 @@ public class FileDAOTest {
assertEquals("/home/vospace/upload/user1/file1", fileInfos.get(0).getOsPath());
assertEquals("/home/vospace/upload/user1/file2", fileInfos.get(1).getOsPath());
assertEquals("user", fileInfos.get(1).getLocationType());
assertTrue(fileInfos.get(2).isDirectory());
assertNull(fileInfos.get(2).getLocationType());
assertEquals("/home/username1/retrieve/subdir1/file3", fileInfos.get(3).getOsPath());
assertEquals("/home/username1/retrieve/subdir1/file4", fileInfos.get(4).getOsPath());
assertEquals("async", fileInfos.get(4).getLocationType());
assertEquals("portal-file", fileInfos.get(5).getVirtualName());
assertEquals("portal", fileInfos.get(5).getLocationType());
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment