Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
2085c719
Commit
2085c719
authored
Jan 04, 2022
by
Piotr Gawron
Browse files
fetching list of reactions is faster
parent
793a72d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
persist/src/main/java/lcsb/mapviewer/persist/dao/map/ReactionDao.java
View file @
2085c719
...
...
@@ -4,8 +4,10 @@ import java.awt.geom.Point2D;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -141,14 +143,17 @@ public class ReactionDao extends BaseDao<Reaction> {
participantClause
=
" and element.id in :participant_ids "
;
}
String
queryString
=
"select reaction, node, line from "
+
this
.
getClazz
().
getSimpleName
()
+
" reaction "
+
"inner join reaction.nodes node "
+
"inner join node.element element "
+
"inner join node.line line "
+
"where reaction.model in :maps "
+
idClause
+
participantClause
+
removableAndStatemant
();
Query
<?>
query
=
getSession
()
.
createQuery
(
"select reaction from "
+
this
.
getClazz
().
getSimpleName
()
+
" reaction "
+
"inner join reaction.nodes node inner join node.element element "
+
"where reaction.model in :maps "
+
idClause
+
participantClause
+
removableAndStatemant
()
+
" group by reaction"
)
.
createQuery
(
queryString
)
.
setParameter
(
"maps"
,
maps
);
if
(
ids
.
size
()
>
0
)
{
query
.
setParameter
(
"ids"
,
ids
);
...
...
@@ -157,7 +162,14 @@ public class ReactionDao extends BaseDao<Reaction> {
query
.
setParameter
(
"participant_ids"
,
participantIds
);
}
return
genericListToReactionList
(
query
.
list
());
Set
<
Reaction
>
result
=
new
LinkedHashSet
<>();
for
(
Object
object
:
query
.
list
())
{
Object
[]
row
=
(
Object
[])
object
;
result
.
add
((
Reaction
)
row
[
0
]);
}
return
new
ArrayList
<>(
result
);
}
@SuppressWarnings
(
"unchecked"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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