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
33283ea3
Commit
33283ea3
authored
Sep 06, 2013
by
Matija Obreza
Browse files
Accession details
parent
5a77ee81
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/crophub/rest/common/persistence/domain/AccessionRepository.java
View file @
33283ea3
...
...
@@ -61,4 +61,6 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
// List<Accession> findByOrigin(String origin);
Page
<
Accession
>
findByOrigin
(
String
isoCode3
,
Pageable
pageable
);
List
<
Accession
>
findByInstituteAndAccessionName
(
FaoInstitute
faoInstitute
,
String
accessionName
);
}
src/main/java/org/crophub/rest/common/service/GenesysService.java
View file @
33283ea3
package
org.crophub.rest.common.service
;
import
java.util.List
;
import
org.crophub.rest.common.model.genesys.Accession
;
import
org.crophub.rest.common.model.impl.Country
;
import
org.crophub.rest.common.model.impl.FaoInstitute
;
...
...
@@ -18,4 +20,8 @@ public interface GenesysService {
Page
<
Accession
>
listAccessionsByInstitute
(
FaoInstitute
faoInstitute
,
Pageable
pageable
);
Accession
getAccession
(
long
accessionId
);
List
<
Accession
>
listAccessions
(
FaoInstitute
faoInstitute
,
String
accessionName
);
}
src/main/java/org/crophub/rest/common/service/impl/GenesysServiceImpl.java
View file @
33283ea3
package
org.crophub.rest.common.service.impl
;
import
java.util.List
;
import
org.crophub.rest.common.model.genesys.Accession
;
import
org.crophub.rest.common.model.impl.Country
;
import
org.crophub.rest.common.model.impl.FaoInstitute
;
...
...
@@ -50,4 +52,14 @@ public class GenesysServiceImpl implements GenesysService {
public
Page
<
Accession
>
listAccessionsByInstitute
(
FaoInstitute
faoInstitute
,
Pageable
pageable
)
{
return
accessionRepository
.
findByInstitute
(
faoInstitute
,
pageable
);
}
@Override
public
Accession
getAccession
(
long
accessionId
)
{
return
accessionRepository
.
findOne
(
accessionId
);
}
@Override
public
List
<
Accession
>
listAccessions
(
FaoInstitute
faoInstitute
,
String
accessionName
)
{
return
accessionRepository
.
findByInstituteAndAccessionName
(
faoInstitute
,
accessionName
);
}
}
src/main/java/org/crophub/rest/servlet/controller/AccessionController.java
0 → 100644
View file @
33283ea3
package
org.crophub.rest.servlet.controller
;
import
java.util.List
;
import
org.crophub.rest.common.model.genesys.Accession
;
import
org.crophub.rest.common.model.impl.FaoInstitute
;
import
org.crophub.rest.common.service.GenesysService
;
import
org.crophub.rest.common.service.InstituteService
;
import
org.crophub.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@Controller
@RequestMapping
(
"/acn"
)
public
class
AccessionController
extends
BaseController
{
@Autowired
private
InstituteService
instituteService
;
@Autowired
private
GenesysService
genesysService
;
@RequestMapping
(
"/id/{accessionId}"
)
public
String
view
(
ModelMap
model
,
@PathVariable
(
value
=
"accessionId"
)
long
accessionId
)
{
_logger
.
debug
(
"Viewing ACN "
+
accessionId
);
Accession
accession
=
genesysService
.
getAccession
(
accessionId
);
if
(
accession
==
null
)
{
throw
new
ResourceNotFoundException
();
}
model
.
addAttribute
(
"accession"
,
accession
);
return
"/accession/details"
;
}
@RequestMapping
(
"/{holdingInstitute}/{accessionName}"
)
public
String
viewInstituteAccession
(
ModelMap
model
,
@PathVariable
(
value
=
"holdingInstitute"
)
String
holdingInstitute
,
@PathVariable
(
value
=
"accessionName"
)
String
accessionName
)
{
_logger
.
debug
(
"Viewing ACN "
+
accessionName
);
FaoInstitute
faoInstitute
=
instituteService
.
getInstitute
(
holdingInstitute
);
if
(
faoInstitute
==
null
)
{
throw
new
ResourceNotFoundException
();
}
List
<
Accession
>
accessions
=
genesysService
.
listAccessions
(
faoInstitute
,
accessionName
);
if
(
accessions
.
size
()==
0
)
{
throw
new
ResourceNotFoundException
();
}
if
(
accessions
.
size
()==
1
)
{
return
"redirect:/acn/id/"
+
accessions
.
get
(
0
).
getId
();
}
model
.
addAttribute
(
"faoInstitute"
,
faoInstitute
);
model
.
addAttribute
(
"accessions"
,
accessions
);
return
"/accession/resolve"
;
}
}
src/main/resources/content/language.properties
View file @
33283ea3
...
...
@@ -108,6 +108,12 @@ accession.holdingInstitute=Holding institute
accession.holdingCountry
=
Location
accession.taxonomy
=
Taxonomy
accession.page.profile.title
=
Accession profile: {0}
accession.page.resolve.title
=
Multiple accessions found
accession.resolve
=
Multiple accessions with the name ''{0}'' found in Genesys. Select one from the list.
taxonomy.genus
=
Genus
taxonomy.species
=
Species
taxonomy.taxonName
=
Taxonomy
src/main/webapp/WEB-INF/jsp/accession/details.jsp
0 → 100644
View file @
33283ea3
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"accession.page.profile.title"
arguments=
"
${
accession
.
accessionName
}
"
argumentSeparator=
"|"
/></title>
</head>
<body>
<h1>
<c:out
value=
"
${
accession
.
accessionName
}
"
/>
<small><c:out
value=
"
${
accession
.
instituteCode
}
"
/></small>
</h1>
<table>
<tbody>
<tr>
<td><spring:message
code=
"accession.holdingInstitute"
/></td>
<td><c:out
value=
"
${
accession
.
institute
.
fullName
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"accession.holdingCountry"
/></td>
<td><c:out
value=
"
${
accession
.
institute
.
country
.
name
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"accession.accessionName"
/></td>
<td><c:out
value=
"
${
accession
.
accessionName
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"accession.origin"
/></td>
<td><c:out
value=
"
${
accession
.
origin
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"taxonomy.genus"
/></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
genus
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"taxonomy.species"
/></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
species
}
"
/></td>
</tr>
<tr>
<td><spring:message
code=
"taxonomy.taxonName"
/></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
taxonName
}
"
/></td>
</tr>
<tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/accession/resolve.jsp
0 → 100644
View file @
33283ea3
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"accession.page.resolve.title"
/></title>
</head>
<body>
<h1><spring:message
code=
"accession.resolve"
arguments=
"
${
accessionName
}
"
/></h1>
<table>
<thead>
<tr>
<td><spring:message
code=
"accession.accessionName"
/></td>
<td><spring:message
code=
"accession.origin"
/></td>
<td><spring:message
code=
"accession.taxonomy"
/></td>
<td><spring:message
code=
"accession.holdingInstitute"
/></td>
<td><spring:message
code=
"accession.holdingCountry"
/></td>
</tr>
</thead>
<tbody>
<c:forEach
items=
"
${
accessions
}
"
var=
"accession"
varStatus=
"status"
>
<tr>
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b><c:out
value=
"
${
accession
.
accessionName
}
"
/></b></a></td>
<td><c:out
value=
"
${
country
.
name
}
"
/></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
taxonName
}
"
/></td>
<td><a
href=
"
<c:url
value=
"/wiews/${accession.institute.code.toLowerCase()}"
/>
"
><c:out
value=
"
${
accession
.
institute
.
code
}
"
/></a></td>
<td><a
href=
"
<c:url
value=
"/geo/${accession.institute.country.code3.toLowerCase()}"
/>
"
><c:out
value=
"
${
accession
.
institute
.
country
.
name
}
"
/></a></td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/wiews/data.jsp
View file @
33283ea3
...
...
@@ -39,7 +39,7 @@
<td><a
href=
"
<c:url
value=
"/acn/id/${accession.id}"
/>
"
><b><c:out
value=
"
${
accession
.
accessionName
}
"
/></b></a></td>
<td><a
href=
"
<c:url
value=
"/geo/${accession.origin.toLowerCase()}"
/>
"
><c:out
value=
"
${
accession
.
origin
}
"
/></a></td>
<td><c:out
value=
"
${
accession
.
taxonomy
.
taxonName
}
"
/></td>
<td><a
href=
"
<c:url
value=
"/wiews/${
accession.i
nstitute.code.toLowerCase()}"
/>
"
><c:out
value=
"
${
accession
.
i
nstitute
.
code
}
"
/></a></td>
<td><a
href=
"
<c:url
value=
"/wiews/${
faoI
nstitute.code.toLowerCase()}"
/>
"
><c:out
value=
"
${
faoI
nstitute
.
code
}
"
/></a></td>
<td><a
href=
"
<c:url
value=
"/geo/${accession.institute.country.code3.toLowerCase()}"
/>
"
><c:out
value=
"
${
accession
.
institute
.
country
.
name
}
"
/></a></td>
</tr>
</c:forEach>
...
...
src/main/webapp/WEB-INF/jsp/wiews/index.jsp
View file @
33283ea3
...
...
@@ -15,7 +15,9 @@
<ul>
<c:forEach
items=
"
${
faoInstitutes
.
content
}
"
var=
"faoInstitute"
varStatus=
"status"
>
<li><a
href=
"
<c:url
value=
"/wiews/${faoInstitute.code.toLowerCase()}"
/>
"
><b><c:out
value=
"
${
faoInstitute
.
code
}
"
/></b>
<c:out
value=
"
${
faoInstitute
.
fullName
}
"
/></a></li>
<li><a
href=
"
<c:url
value=
"/wiews/${faoInstitute.code.toLowerCase()}"
/>
"
><b><c:out
value=
"
${
faoInstitute
.
code
}
"
/></b>
<c:out
value=
"
${
faoInstitute
.
fullName
}
"
/></a>
<spring:message
code=
"faoInstitute.accessionCount"
arguments=
"
${
faoInstitute
.
accessionCount
}
"
/>
</li>
</c:forEach>
</ul>
...
...
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