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
18
Issues
18
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
45d06255
Commit
45d06255
authored
Oct 05, 2017
by
Andrey Lugovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added services for clear DOIs
parent
d6d38cb5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
1 deletion
+34
-1
src/main/java/org/genesys2/server/persistence/domain/AccessionRepository.java
...nesys2/server/persistence/domain/AccessionRepository.java
+4
-0
src/main/java/org/genesys2/server/service/GenesysService.java
...main/java/org/genesys2/server/service/GenesysService.java
+5
-0
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
.../org/genesys2/server/service/impl/GenesysServiceImpl.java
+9
-0
src/main/java/org/genesys2/server/servlet/controller/admin/AdminController.java
...sys2/server/servlet/controller/admin/AdminController.java
+8
-0
src/main/webapp/WEB-INF/jsp/admin/index.jsp
src/main/webapp/WEB-INF/jsp/admin/index.jsp
+8
-1
No files found.
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>
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