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
46
Issues
46
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
bd39b807
Commit
bd39b807
authored
May 13, 2017
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API Fix: accession#taxGenus is still required, accession#crop misbehaving for null
parent
0834c4e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
16 deletions
+13
-16
src/main/java/org/genesys2/server/model/genesys/AccessionData.java
...java/org/genesys2/server/model/genesys/AccessionData.java
+1
-0
src/main/java/org/genesys2/server/service/impl/BatchRESTServiceImpl.java
...rg/genesys2/server/service/impl/BatchRESTServiceImpl.java
+2
-8
src/main/java/org/genesys2/server/service/impl/CropServiceImpl.java
...ava/org/genesys2/server/service/impl/CropServiceImpl.java
+10
-8
No files found.
src/main/java/org/genesys2/server/model/genesys/AccessionData.java
View file @
bd39b807
...
...
@@ -285,6 +285,7 @@ public abstract class AccessionData implements IdUUID, Serializable {
public
void
setTaxonomy
(
Taxonomy2
taxonomy2
)
{
this
.
taxonomy
=
taxonomy2
;
this
.
taxGenus
=
taxonomy2
.
getTaxGenus
();
}
public
abstract
List
<
Integer
>
getStoRage
();
...
...
src/main/java/org/genesys2/server/service/impl/BatchRESTServiceImpl.java
View file @
bd39b807
...
...
@@ -594,18 +594,12 @@ public class BatchRESTServiceImpl implements BatchRESTService {
}
final
String
cropName
=
StringUtils
.
trimToNull
(
value
.
textValue
());
if
(!
StringUtils
.
equals
(
cropName
,
accession
.
getCropName
())
||
accession
.
getCrop
()
==
null
)
{
// existing cropName doesn't match or current crop assigned is null
accession
.
setCropName
(
cropName
);
accession
.
setCrop
(
cropService
.
getCrop
(
cropName
));
return
true
;
}
accession
.
setCropName
(
cropName
);
if
(
StringUtils
.
isNotBlank
(
cropName
))
{
// has cropName, check if needs updating
Crop
newCrop
=
cropService
.
getCrop
(
cropName
);
if
(
accession
.
getCrop
()
==
null
||
(
newCrop
!=
null
&&
accession
.
getCrop
().
getId
()
!=
newCrop
.
getId
()))
{
if
(
accession
.
getCrop
()
==
null
||
newCrop
==
null
||
(
newCrop
!=
null
&&
accession
.
getCrop
().
getId
()
!=
newCrop
.
getId
()))
{
accession
.
setCrop
(
newCrop
);
return
true
;
}
...
...
src/main/java/org/genesys2/server/service/impl/CropServiceImpl.java
View file @
bd39b807
...
...
@@ -81,6 +81,10 @@ public class CropServiceImpl implements CropService {
@Override
@Cacheable
(
value
=
CACHE_CROPS
,
key
=
"#shortName"
,
unless
=
"#result == null || #shortName == null"
)
public
Crop
getCrop
(
String
shortName
)
{
if
(
StringUtils
.
isBlank
(
shortName
))
{
return
null
;
}
Crop
crop
=
cropRepository
.
findByShortName
(
shortName
);
// Find crop by alias when null
...
...
@@ -111,16 +115,15 @@ public class CropServiceImpl implements CropService {
public
void
updateBlurp
(
Crop
crop
,
String
textBody
,
String
summary
,
Locale
locale
)
{
contentService
.
updateArticle
(
crop
,
"blurp"
,
null
,
textBody
,
summary
,
locale
);
}
@Override
@PreAuthorize
(
"hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER') or hasPermission(#crop, 'ADMINISTRATION')"
)
@Transactional
(
readOnly
=
false
)
@CacheEvict
(
value
=
CACHE_CROPS
,
allEntries
=
true
)
public
Crop
updateAliases
(
Crop
crop
,
List
<
String
>
otherNames
)
{
crop
.
setOtherNames
(
otherNames
.
stream
().
distinct
().
map
(
otherName
->
StringUtils
.
trim
(
otherName
)).
filter
(
otherName
->
StringUtils
.
isNotBlank
(
otherName
))
.
sorted
().
collect
(
Collectors
.
toList
()));
crop
.
setOtherNames
(
otherNames
.
stream
().
distinct
().
map
(
otherName
->
StringUtils
.
trim
(
otherName
)).
filter
(
otherName
->
StringUtils
.
isNotBlank
(
otherName
)).
sorted
().
collect
(
Collectors
.
toList
()));
return
cropRepository
.
save
(
crop
);
}
...
...
@@ -135,7 +138,7 @@ public class CropServiceImpl implements CropService {
});
return
crops
;
}
@Override
public
Page
<
Crop
>
listCrops
(
Pageable
pageable
)
{
return
cropRepository
.
findAll
(
pageable
);
...
...
@@ -221,8 +224,7 @@ public class CropServiceImpl implements CropService {
@Override
public
boolean
evaluate
(
Taxonomy2
taxonomy
)
{
if
(
cr
.
getSpecies
()
==
null
&&
cr
.
getSubtaxa
()
==
null
)
{
return
StringUtils
.
equalsIgnoreCase
(
taxonomy
.
getSubtaxa
(),
cr
.
getSubtaxa
())
&&
StringUtils
.
equalsIgnoreCase
(
taxonomy
.
getSpecies
(),
cr
.
getSpecies
());
return
StringUtils
.
equalsIgnoreCase
(
taxonomy
.
getSubtaxa
(),
cr
.
getSubtaxa
())
&&
StringUtils
.
equalsIgnoreCase
(
taxonomy
.
getSpecies
(),
cr
.
getSpecies
());
}
else
if
(
cr
.
getSubtaxa
()
==
null
)
{
return
StringUtils
.
equalsIgnoreCase
(
taxonomy
.
getSpecies
(),
cr
.
getSpecies
());
}
else
{
...
...
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