Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
45d06255
Commit
45d06255
authored
Oct 05, 2017
by
Andrey Lugovskiy
Browse files
- added services for clear DOIs
parent
d6d38cb5
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/persistence/domain/AccessionRepository.java
View file @
45d06255
...
...
@@ -148,4 +148,8 @@ public interface AccessionRepository extends JpaRepository<Accession, Long>, Acc
public
List
<
Object
[]>
lastUpdatedStatistics
(
FaoInstitute
faoInstitute
);
public
Accession
findByDoi
(
String
doi
);
@Query
(
"update Accession accession set accession.doi = null where accession.doi is not null"
)
@Modifying
void
removeDOIs
();
}
src/main/java/org/genesys2/server/service/GenesysService.java
View file @
45d06255
...
...
@@ -77,6 +77,11 @@ public interface GenesysService {
Accession
getAccession
(
long
accessionId
);
/**
* Clear DOIs for accessions(set null in DOI field)
*/
void
removeDOIs
();
Accession
getAccessionByDOI
(
String
doi
);
List
<
Accession
>
listAccessions
(
FaoInstitute
faoInstitute
,
String
accessionName
);
...
...
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
45d06255
...
...
@@ -335,6 +335,15 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
return
lazyLoadAccession
(
accession
);
}
/**
* {@inheritDoc}
*/
@Transactional
@Override
public
void
removeDOIs
()
{
accessionRepository
.
removeDOIs
();
}
@Override
public
Accession
getAccessionByDOI
(
final
String
doi
)
{
Accession
accession
=
accessionRepository
.
findByDoi
(
doi
);
...
...
src/main/java/org/genesys2/server/servlet/controller/admin/AdminController.java
View file @
45d06255
...
...
@@ -60,6 +60,7 @@ import org.springframework.jdbc.core.RowCallbackHandler;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.xml.sax.SAXException
;
...
...
@@ -478,4 +479,11 @@ public class AdminController {
LOG
.
info
(
"Done assigning crops to accessions with CROPNAME."
);
return
"redirect:/admin/"
;
}
@PostMapping
(
value
=
"/clear-dois"
)
public
String
clearDois
(){
LOG
.
info
(
"Clear DOIs"
);
genesysService
.
removeDOIs
();
return
"redirect:/admin/"
;
}
}
src/main/webapp/WEB-INF/jsp/admin/index.jsp
View file @
45d06255
...
...
@@ -132,5 +132,12 @@
<input
type=
"hidden"
name=
"${_csrf.parameterName}"
value=
"${_csrf.token}"
/>
</form>
<h3>
DOI
</h3>
<form
method=
"post"
action=
"
<c:url
value=
"/admin/clear-dois"
/>
"
>
<input
type=
"submit"
class=
"btn btn-default"
value=
"Clear DOIs"
/>
<!-- CSRF protection -->
<input
type=
"hidden"
name=
"${_csrf.parameterName}"
value=
"${_csrf.token}"
/>
</form>
</body>
</html>
\ No newline at end of file
</html>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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