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
12
Issues
12
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
2aac80a8
Commit
2aac80a8
authored
Feb 27, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REST genus not required for faoInstitute.uniqueAcceNumbs
parent
2d343e50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
src/main/java/org/genesys2/server/service/impl/BatchRESTServiceImpl.java
...rg/genesys2/server/service/impl/BatchRESTServiceImpl.java
+14
-2
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
.../org/genesys2/server/service/impl/GenesysServiceImpl.java
+2
-0
src/main/java/org/genesys2/server/servlet/controller/rest/AccessionController.java
...2/server/servlet/controller/rest/AccessionController.java
+6
-0
No files found.
src/main/java/org/genesys2/server/service/impl/BatchRESTServiceImpl.java
View file @
2aac80a8
...
@@ -586,9 +586,15 @@ public class BatchRESTServiceImpl implements BatchRESTService {
...
@@ -586,9 +586,15 @@ public class BatchRESTServiceImpl implements BatchRESTService {
List
<
AccessionAlias
>
toSave
=
new
ArrayList
<
AccessionAlias
>();
List
<
AccessionAlias
>
toSave
=
new
ArrayList
<
AccessionAlias
>();
List
<
AccessionAlias
>
toRemove
=
new
ArrayList
<
AccessionAlias
>();
List
<
AccessionAlias
>
toRemove
=
new
ArrayList
<
AccessionAlias
>();
boolean
useUniqueAcceNumbs
=
institute
.
hasUniqueAcceNumbs
();
for
(
AccessionNamesJson
dataJson
:
batch
)
{
for
(
AccessionNamesJson
dataJson
:
batch
)
{
Accession
accession
=
genesysService
.
getAccession
(
institute
.
getCode
(),
dataJson
.
acceNumb
,
dataJson
.
genus
);
Accession
accession
=
null
;
if
(
useUniqueAcceNumbs
)
accession
=
genesysService
.
getAccession
(
institute
.
getCode
(),
dataJson
.
acceNumb
);
else
accession
=
genesysService
.
getAccession
(
institute
.
getCode
(),
dataJson
.
acceNumb
,
dataJson
.
genus
);
if
(
accession
==
null
)
{
if
(
accession
==
null
)
{
LOG
.
warn
(
"No such accession "
+
dataJson
);
LOG
.
warn
(
"No such accession "
+
dataJson
);
continue
;
continue
;
...
@@ -664,6 +670,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
...
@@ -664,6 +670,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
public
int
deleteAccessions
(
FaoInstitute
institute
,
List
<
AccessionJson
>
batch
)
{
public
int
deleteAccessions
(
FaoInstitute
institute
,
List
<
AccessionJson
>
batch
)
{
LOG
.
info
(
"Batch deleting "
+
batch
.
size
()
+
" entries for "
+
institute
);
LOG
.
info
(
"Batch deleting "
+
batch
.
size
()
+
" entries for "
+
institute
);
List
<
Accession
>
toDelete
=
new
ArrayList
<
Accession
>(
batch
.
size
());
List
<
Accession
>
toDelete
=
new
ArrayList
<
Accession
>(
batch
.
size
());
boolean
useUniqueAcceNumbs
=
institute
.
hasUniqueAcceNumbs
();
for
(
AccessionJson
dataJson
:
batch
)
{
for
(
AccessionJson
dataJson
:
batch
)
{
if
(
LOG
.
isDebugEnabled
())
if
(
LOG
.
isDebugEnabled
())
...
@@ -673,7 +680,12 @@ public class BatchRESTServiceImpl implements BatchRESTService {
...
@@ -673,7 +680,12 @@ public class BatchRESTServiceImpl implements BatchRESTService {
throw
new
RuntimeException
(
"Accession does not belong to instCode="
+
institute
.
getCode
()
+
" acn="
+
dataJson
);
throw
new
RuntimeException
(
"Accession does not belong to instCode="
+
institute
.
getCode
()
+
" acn="
+
dataJson
);
}
}
Accession
accession
=
genesysService
.
getAccession
(
dataJson
.
instCode
,
dataJson
.
acceNumb
,
dataJson
.
genus
);
Accession
accession
;
if
(
useUniqueAcceNumbs
)
accession
=
genesysService
.
getAccession
(
institute
.
getCode
(),
dataJson
.
acceNumb
);
else
accession
=
genesysService
.
getAccession
(
institute
.
getCode
(),
dataJson
.
acceNumb
,
dataJson
.
genus
);
if
(
accession
!=
null
)
{
if
(
accession
!=
null
)
{
toDelete
.
add
(
accession
);
toDelete
.
add
(
accession
);
}
}
...
...
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
2aac80a8
...
@@ -234,6 +234,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
...
@@ -234,6 +234,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Override
@Override
public
Accession
getAccession
(
String
instCode
,
String
acceNumb
,
String
genus
)
{
public
Accession
getAccession
(
String
instCode
,
String
acceNumb
,
String
genus
)
{
if
(
genus
==
null
)
throw
new
NullPointerException
(
"Genus is required to load accession by instCode, acceNumb and genus"
);
return
accessionRepository
.
findOne
(
instCode
,
acceNumb
,
genus
);
return
accessionRepository
.
findOne
(
instCode
,
acceNumb
,
genus
);
}
}
...
...
src/main/java/org/genesys2/server/servlet/controller/rest/AccessionController.java
View file @
2aac80a8
...
@@ -210,6 +210,12 @@ public class AccessionController extends RestController {
...
@@ -210,6 +210,12 @@ public class AccessionController extends RestController {
if
(
institute
==
null
)
{
if
(
institute
==
null
)
{
throw
new
ResourceNotFoundException
();
throw
new
ResourceNotFoundException
();
}
}
for
(
AccessionNamesJson
aid3
:
batch
)
{
if
(!
instCode
.
equals
(
aid3
.
instCode
))
{
throw
new
RuntimeException
(
"Accession does not belong to instCode="
+
instCode
+
" acn="
+
aid3
);
}
}
batchRESTService
.
upsertAccessionNames
(
institute
,
batch
);
batchRESTService
.
upsertAccessionNames
(
institute
,
batch
);
return
JSON_OK
;
return
JSON_OK
;
...
...
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