diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/BigFileCache.java b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/BigFileCache.java index 11c9daa14e79f986a40b9aa9ec44f94f08043090..eacd0a8c15f8e16b99eab1b15eb33ccf65877b94 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/cache/BigFileCache.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/cache/BigFileCache.java @@ -11,6 +11,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Calendar; +import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -621,20 +622,19 @@ public class BigFileCache { * thrown when there is a problem with deleting file */ public void removeFile(String url) throws IOException { - BigFileEntry entry = bigFileEntryDao.getByUrl(url); - if (entry == null) { - throw new InvalidArgumentException("Cannot remove file. File wasn't downloaded: " + url); - } - String path = Configuration.getWebAppDir() + entry.getLocalPath(); - File f = new File(path); - if (!f.exists()) { - logger.warn("Missing file: " + path + ". Downloaded from: " + url); - } - String dirPath = FilenameUtils.getFullPath(path); + List<BigFileEntry> entries = bigFileEntryDao.getAllByUrl(url); + for (BigFileEntry entry : entries) { + String path = Configuration.getWebAppDir() + entry.getLocalPath(); + File f = new File(path); + if (!f.exists()) { + logger.warn("Missing file: " + path + ". Downloaded from: " + url); + } + String dirPath = FilenameUtils.getFullPath(path); - FileUtils.deleteDirectory(new File(dirPath)); + FileUtils.deleteDirectory(new File(dirPath)); - bigFileEntryDao.delete(entry); + bigFileEntryDao.delete(entry); + } } /** diff --git a/frontend-js/package-lock.json b/frontend-js/package-lock.json index 29898ad842e00b3eb7c8dd24e29d521cd5cf3cef..378ebd38856bbe27a33730663ce7dda52de9c70f 100644 --- a/frontend-js/package-lock.json +++ b/frontend-js/package-lock.json @@ -45,30 +45,38 @@ "litemol": "github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b" }, "dependencies": { + "ProtVista": { + "version": "git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e", + "dev": true, + "requires": { + "d3": "3.5.17", + "file-saver": "1.3.3", + "jquery": "2.2.4", + "jszip": "3.1.4", + "underscore": "1.8.3" + }, + "dependencies": { + "jquery": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", + "integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI=", + "dev": true + } + } + }, "jquery": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==", "dev": true - } - } - }, - "ProtVista": { - "version": "git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e", - "dev": true, - "requires": { - "d3": "3.5.17", - "file-saver": "1.3.3", - "jquery": "2.2.4", - "jszip": "3.1.4", - "underscore": "1.8.3" - }, - "dependencies": { - "jquery": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", - "integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI=", - "dev": true + }, + "litemol": { + "version": "github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b", + "dev": true, + "requires": { + "@types/react": "15.6.14", + "@types/react-dom": "15.5.7" + } } } }, @@ -2050,14 +2058,6 @@ "immediate": "3.0.6" } }, - "litemol": { - "version": "github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b", - "dev": true, - "requires": { - "@types/react": "15.6.14", - "@types/react-dom": "15.5.7" - } - }, "lodash": { "version": "4.17.4", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", diff --git a/persist/src/main/java/lcsb/mapviewer/persist/dao/cache/BigFileEntryDao.java b/persist/src/main/java/lcsb/mapviewer/persist/dao/cache/BigFileEntryDao.java index 9622308ec702862c76e5390051b728b0f1fb8812..d2ed61900fb1c8c80124827b28362cde7bb528aa 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/dao/cache/BigFileEntryDao.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/dao/cache/BigFileEntryDao.java @@ -14,38 +14,42 @@ import lcsb.mapviewer.persist.dao.BaseDao; * */ public class BigFileEntryDao extends BaseDao<BigFileEntry> { - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private Logger logger = Logger.getLogger(BigFileEntryDao.class); - - /** - * Default constructor. - */ - public BigFileEntryDao() { - super(BigFileEntry.class, "removed"); - } - - /** - * Return {@link BigFileEntry} identified by remote url. - * - * @param url - * url of the file - * @return {@link BigFileEntry} identified by remote url - */ - public BigFileEntry getByUrl(String url) { - List<?> list = getElementsByParameter("url", url); - if (list.size() == 0) { - return null; - } - return (BigFileEntry) list.get(0); - } - - @Override - public void delete(BigFileEntry entry) { - entry.setRemoved(true); - update(entry); - } + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private Logger logger = Logger.getLogger(BigFileEntryDao.class); + + /** + * Default constructor. + */ + public BigFileEntryDao() { + super(BigFileEntry.class, "removed"); + } + + /** + * Return {@link BigFileEntry} identified by remote url. + * + * @param url + * url of the file + * @return {@link BigFileEntry} identified by remote url + */ + public BigFileEntry getByUrl(String url) { + List<?> list = getElementsByParameter("url", url); + if (list.size() == 0) { + return null; + } + return (BigFileEntry) list.get(0); + } + + public List<BigFileEntry> getAllByUrl(String url) { + return getElementsByParameter("url", url); + } + + @Override + public void delete(BigFileEntry entry) { + entry.setRemoved(true); + update(entry); + } }