Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
ee06c75b
Commit
ee06c75b
authored
Dec 27, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccessionRefs: relink only newly added records
- Doesn't rescan entire dataset/subset
parent
c248fbed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
src/main/java/org/genesys/catalog/service/impl/DatasetServiceImpl.java
.../org/genesys/catalog/service/impl/DatasetServiceImpl.java
+21
-1
src/main/java/org/genesys2/server/service/impl/SubsetServiceImpl.java
...a/org/genesys2/server/service/impl/SubsetServiceImpl.java
+19
-1
No files found.
src/main/java/org/genesys/catalog/service/impl/DatasetServiceImpl.java
View file @
ee06c75b
...
...
@@ -628,7 +628,7 @@ public class DatasetServiceImpl implements DatasetService {
TransactionStatus
status
=
transactionManager
.
getTransaction
(
def
);
try
{
// execute your business logic here
rematchDatasetAccessions
(
loadedDataset
);
rematchDatasetAccessions
(
dArs
);
}
catch
(
Throwable
ex
)
{
LOG
.
error
(
"Rolling back rematch. Exception: {}"
,
ex
.
getMessage
(),
ex
);
transactionManager
.
rollback
(
status
);
...
...
@@ -1049,6 +1049,26 @@ public class DatasetServiceImpl implements DatasetService {
LOG
.
warn
(
"Done relinking {} accession refs."
,
accessionRefs
.
size
());
return
lazyLoad
(
dataset
);
}
@Transactional
(
readOnly
=
false
)
@PreAuthorize
(
"hasRole('ADMINISTRATOR')"
)
private
List
<
DatasetAccessionRef
>
rematchDatasetAccessions
(
List
<
DatasetAccessionRef
>
accessionRefs
)
{
LOG
.
warn
(
"Re-linking {} accessions refs with accessions"
,
accessionRefs
.
size
());
final
AtomicInteger
batchCounter
=
new
AtomicInteger
(
0
);
// Use parallel streams for lookups
Lists
.
partition
(
accessionRefs
,
1000
).
parallelStream
().
forEach
(
batch
->
{
LOG
.
info
(
"Batch {} with size {}"
,
batchCounter
.
incrementAndGet
(),
batch
.
size
());
lookupMatchingAccessions
(
batch
);
});
// Save in this transaction
accessionRefRepository
.
update
(
accessionRefs
);
LOG
.
warn
(
"Done relinking {} accession refs."
,
accessionRefs
.
size
());
return
accessionRefs
;
}
@Override
@Transactional
(
readOnly
=
false
,
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
READ_UNCOMMITTED
)
...
...
src/main/java/org/genesys2/server/service/impl/SubsetServiceImpl.java
View file @
ee06c75b
...
...
@@ -380,7 +380,7 @@ public class SubsetServiceImpl implements SubsetService {
TransactionStatus
status
=
transactionManager
.
getTransaction
(
def
);
try
{
// execute your business logic here
rematchSubsetAccessions
(
loadedSubset
);
rematchSubsetAccessions
(
sArs
);
}
catch
(
Throwable
ex
)
{
LOG
.
error
(
"Rolling back rematch. Exception: {}"
,
ex
.
getMessage
(),
ex
);
transactionManager
.
rollback
(
status
);
...
...
@@ -615,6 +615,24 @@ public class SubsetServiceImpl implements SubsetService {
return
lazyLoad
(
subset
);
}
@Transactional
(
readOnly
=
false
)
@PreAuthorize
(
"hasRole('ADMINISTRATOR')"
)
private
List
<
SubsetAccessionRef
>
rematchSubsetAccessions
(
List
<
SubsetAccessionRef
>
accessionRefs
)
{
LOG
.
warn
(
"Linking {} accession refs with accessions"
,
accessionRefs
.
size
());
final
AtomicInteger
batchCounter
=
new
AtomicInteger
(
0
);
// Use parallel streams for lookups
Lists
.
partition
(
accessionRefs
,
1000
).
parallelStream
().
forEach
(
batch
->
{
LOG
.
info
(
"Batch {} with size {}"
,
batchCounter
.
incrementAndGet
(),
batch
.
size
());
lookupMatchingAccessions
(
batch
);
});
// Save in this transaction
accessionRefRepository
.
update
(
accessionRefs
);
LOG
.
warn
(
"Done relinking {} accession refs."
,
accessionRefs
.
size
());
return
accessionRefs
;
}
/**
* Looking for matching Accession and then sets that to AccessionRef
*
...
...
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