Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
41
Issues
41
List
Boards
Labels
Milestones
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
d31c19ed
Commit
d31c19ed
authored
May 03, 2019
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Allow setting Institute#uniqueAcceNumbs to false
- true will still check existing data
parent
36cffdf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
src/main/java/org/genesys2/server/service/impl/CropServiceImpl.java
...ava/org/genesys2/server/service/impl/CropServiceImpl.java
+4
-0
src/main/java/org/genesys2/server/service/impl/InstituteServiceImpl.java
...rg/genesys2/server/service/impl/InstituteServiceImpl.java
+10
-3
No files found.
src/main/java/org/genesys2/server/service/impl/CropServiceImpl.java
View file @
d31c19ed
...
...
@@ -39,6 +39,7 @@ import org.genesys.filerepository.model.ImageGallery;
import
org.genesys.filerepository.model.RepositoryImage
;
import
org.genesys.filerepository.service.ImageGalleryService
;
import
org.genesys2.server.component.security.AsAdminInvoker
;
import
org.genesys2.server.exception.NotFoundElement
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.genesys.QAccession
;
import
org.genesys2.server.model.genesys.Taxonomy2
;
...
...
@@ -161,6 +162,9 @@ public class CropServiceImpl implements CropService {
LOG
.
debug
(
"Getting crop details for {}"
,
shortName
);
StopWatch
stopWatch
=
StopWatch
.
createStarted
();
Crop
crop
=
getCrop
(
shortName
);
if
(
crop
==
null
)
{
throw
new
NotFoundElement
(
"No crop: "
+
shortName
);
}
LOG
.
trace
(
"got crop after {}ms"
,
stopWatch
.
getTime
());
Article
article
=
contentService
.
getArticle
(
crop
,
ContentService
.
ENTITY_BLURB_SLUG
,
locale
);
LOG
.
trace
(
"got article after {}ms"
,
stopWatch
.
getTime
());
...
...
src/main/java/org/genesys2/server/service/impl/InstituteServiceImpl.java
View file @
d31c19ed
...
...
@@ -122,7 +122,10 @@ public class InstituteServiceImpl implements InstituteService {
copyValues
(
target
,
institute
);
instituteSettingRepository
.
save
(
target
.
getSettings
().
values
());
target
.
setUniqueAcceNumbs
(
0
==
accessionRepository
.
countNonuniqueAccessionNumbers
(
target
.
getId
()));
if
(
target
.
isUniqueAcceNumbs
())
{
// Assure existing data has unique accenumbs
target
.
setUniqueAcceNumbs
(
0
==
accessionRepository
.
countNonuniqueAccessionNumbers
(
target
.
getId
()));
}
return
instituteRepository
.
save
(
target
);
}
...
...
@@ -191,7 +194,7 @@ public class InstituteServiceImpl implements InstituteService {
@CacheEvict
(
value
=
{
"statistics"
,
HIBERNATE_CACHENAME
},
allEntries
=
true
)
public
List
<
FaoInstitute
>
update
(
final
@Valid
Collection
<
FaoInstitute
>
institutes
)
{
institutes
.
forEach
(
institute
->
{
if
(
institute
.
getId
()
!=
null
)
{
if
(
institute
.
getId
()
!=
null
&&
institute
.
isUniqueAcceNumbs
()
)
{
long
uniqueAcceNumbs
=
accessionRepository
.
countUniqueAccessionNumbers
(
institute
.
getId
());
if
(
uniqueAcceNumbs
>
0
)
{
long
nonUniqueAcceNumbs
=
accessionRepository
.
countNonuniqueAccessionNumbers
(
institute
.
getId
());
...
...
@@ -219,7 +222,11 @@ public class InstituteServiceImpl implements InstituteService {
public
void
setUniqueAcceNumbs
(
FaoInstitute
faoInstitute
,
boolean
uniqueAcceNumbs
)
{
final
FaoInstitute
inst
=
instituteRepository
.
findOne
(
faoInstitute
.
getId
());
LOG
.
info
(
"Setting 'uniqueAcceNumbs' to {} for {}"
,
uniqueAcceNumbs
,
faoInstitute
);
inst
.
setUniqueAcceNumbs
(
0
==
accessionRepository
.
countNonuniqueAccessionNumbers
(
inst
.
getId
()));
inst
.
setUniqueAcceNumbs
(
uniqueAcceNumbs
);
if
(
uniqueAcceNumbs
==
true
)
{
// If set to unique, test that current data is unique!
inst
.
setUniqueAcceNumbs
(
0
==
accessionRepository
.
countNonuniqueAccessionNumbers
(
inst
.
getId
()));
}
instituteRepository
.
save
(
inst
);
}
...
...
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