Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
ca1a6ad4
Commit
ca1a6ad4
authored
Mar 29, 2018
by
Piotr Gawron
Browse files
when removing big file remove all of them
parent
7d0413dd
Pipeline
#4388
passed with stage
in 2 minutes and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
annotation/src/main/java/lcsb/mapviewer/annotation/cache/BigFileCache.java
View file @
ca1a6ad4
...
...
@@ -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
);
}
}
/**
...
...
frontend-js/package-lock.json
View file @
ca1a6ad4
...
...
@@ -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"
,
...
...
persist/src/main/java/lcsb/mapviewer/persist/dao/cache/BigFileEntryDao.java
View file @
ca1a6ad4
...
...
@@ -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
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment