Commit b9be8fc5 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

project files are removed before marking project as removed

parent 1dc9b49b
Pipeline #2577 passed with stage
in 41 seconds
......@@ -559,7 +559,6 @@ public class ProjectRestImpl extends BaseRestImpl {
protected String computePathForProject(String projectId, String path) {
long id = projectDao.getNextId();
logger.debug(id);
return path + "/../map_images/" + md5(projectId + "-" + id) + "/";
}
......
......@@ -120,7 +120,7 @@ import lcsb.mapviewer.services.view.ProjectViewFactory;
public class ProjectService implements IProjectService {
/**
* Size of the artifitial buffer that will be released when
* Size of the artificial buffer that will be released when
* {@link OutOfMemoryError} is thrown to gain some free memory and report
* problem.
*/
......@@ -132,7 +132,7 @@ public class ProjectService implements IProjectService {
private static final double CREATION_OF_DATA = 0.50;
/**
* How much time (out of 1.00) is used for upploading of the data from file.
* How much time (out of 1.00) is used for uploading of the data from file.
*/
private static final double UPLOAD_OF_DATA = 0.50;
......@@ -192,19 +192,19 @@ public class ProjectService implements IProjectService {
private IUserService userService;
/**
* Services that accessa data about chemicals.
* Services that access data about chemicals.
*/
@Autowired
private IChemicalService chemicalService;
/**
* Services that accessa data about drugs.
* Services that access data about drugs.
*/
@Autowired
private IDrugService drugService;
/**
* Services that accessa data about mirna.
* Services that access data about mirna.
*/
@Autowired
private IMiRNAService mirnaService;
......@@ -414,8 +414,7 @@ public class ProjectService implements IProjectService {
public void run() {
if (async) {
// because we are running this in separate thread we need to open a
// new
// session for db connection
// new session for db connection
dbUtils.createSessionForCurrentThread();
}
......@@ -445,6 +444,17 @@ public class ProjectService implements IProjectService {
}
email = project.getNotifyEmail();
}
if (homeDir != null) {
File homeDirFile = new File(homeDir);
if (homeDirFile.exists()) {
logger.debug("Removing project directory: " + homeDirFile.getAbsolutePath());
try {
FileUtils.deleteDirectory(homeDirFile);
} catch (IOException e) {
logger.error("Problem with removing diriectory", e);
}
}
}
projectDao.delete(project);
if (async) {
projectDao.commit();
......@@ -471,17 +481,6 @@ public class ProjectService implements IProjectService {
dbUtils.closeSessionForCurrentThread();
}
}
if (homeDir != null) {
File homeDirFile = new File(homeDir);
if (homeDirFile.exists()) {
logger.debug("Removing project directory: " + homeDirFile.getAbsolutePath());
try {
FileUtils.deleteDirectory(homeDirFile);
} catch (IOException e) {
logger.error("Problem with removing diriectory", e);
}
}
}
}
});
......
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