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
59b2d25d
Commit
59b2d25d
authored
Jan 22, 2014
by
Matija Obreza
Browse files
Selected accessions displayed on map
parent
4b0b492d
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/persistence/domain/AccessionGeoRepository.java
View file @
59b2d25d
...
...
@@ -16,12 +16,19 @@
package
org.genesys2.server.persistence.domain
;
import
java.util.List
;
import
java.util.Set
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.genesys.AccessionGeo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
public
interface
AccessionGeoRepository
extends
JpaRepository
<
AccessionGeo
,
Long
>
{
AccessionGeo
findByAccession
(
Accession
accession
);
@Query
(
"select ag from AccessionGeo ag join fetch ag.accession a where a.id in ?1"
)
List
<
AccessionGeo
>
findForAccessions
(
Set
<
Long
>
accessionIds
);
}
src/main/java/org/genesys2/server/service/GenesysService.java
View file @
59b2d25d
...
...
@@ -153,4 +153,6 @@ public interface GenesysService {
void
removeAliases
(
Set
<
Long
>
toRemove
);
List
<
AccessionGeo
>
listAccessionsGeo
(
Set
<
Long
>
copy
);
}
src/main/java/org/genesys2/server/service/impl/GenesysServiceImpl.java
View file @
59b2d25d
...
...
@@ -239,6 +239,12 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
return
null
;
return
accessionGeoRepository
.
findByAccession
(
accession
);
}
@Override
public
List
<
AccessionGeo
>
listAccessionsGeo
(
Set
<
Long
>
copy
)
{
if
(
copy
==
null
||
copy
.
isEmpty
())
return
null
;
return
accessionGeoRepository
.
findForAccessions
(
copy
);
}
@Override
public
SvalbardData
getSvalbardData
(
Accession
accession
)
{
...
...
src/main/java/org/genesys2/server/servlet/controller/SelectionController.java
View file @
59b2d25d
...
...
@@ -16,7 +16,11 @@
package
org.genesys2.server.servlet.controller
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.genesys.AccessionGeo
;
import
org.genesys2.server.service.GenesysService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
...
...
@@ -53,6 +57,12 @@ public class SelectionController extends BaseController {
return
"/selection/index"
;
}
@RequestMapping
(
value
=
"/map"
)
public
String
map
(
ModelMap
model
)
{
model
.
addAttribute
(
"selection"
,
selectionBean
);
return
"/selection/map"
;
}
@RequestMapping
(
value
=
"/order"
)
public
String
order
(
ModelMap
model
)
{
return
"redirect:/request"
;
...
...
@@ -93,6 +103,22 @@ public class SelectionController extends BaseController {
return
"redirect:/sel/"
;
}
@RequestMapping
(
value
=
"/json/geo"
,
method
=
RequestMethod
.
GET
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
List
<
AccessionGeoJson
>
selectionGeo
()
{
List
<
AccessionGeoJson
>
geo
=
new
ArrayList
<
AccessionGeoJson
>();
for
(
AccessionGeo
acnGeo
:
genesysService
.
listAccessionsGeo
(
selectionBean
.
copy
()))
{
AccessionGeoJson
g
=
new
AccessionGeoJson
();
g
.
id
=
acnGeo
.
getAccession
().
getId
();
g
.
lat
=
acnGeo
.
getLatitude
();
g
.
lng
=
acnGeo
.
getLongitude
();
g
.
accessionName
=
acnGeo
.
getAccession
().
getAccessionName
();
g
.
instCode
=
acnGeo
.
getAccession
().
getInstituteCode
();
geo
.
add
(
g
);
}
return
geo
;
}
@RequestMapping
(
value
=
"/json"
,
method
=
RequestMethod
.
POST
,
consumes
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
JsonResponse
jsonOp
(
@RequestBody
JsonAction
action
)
{
...
...
@@ -118,4 +144,12 @@ public class SelectionController extends BaseController {
public
int
count
;
public
boolean
included
;
}
public
static
class
AccessionGeoJson
{
public
long
id
;
public
Double
lat
;
public
Double
lng
;
public
String
accessionName
;
public
String
instCode
;
}
}
src/main/java/org/genesys2/server/servlet/controller/UserControllerAdvice.java
View file @
59b2d25d
...
...
@@ -66,6 +66,7 @@ public class UserControllerAdvice extends BaseController {
@ExceptionHandler
(
value
=
{
Throwable
.
class
})
// @ResponseBody
public
ModelAndView
handleAll
(
Throwable
e
)
{
_logger
.
error
(
e
.
getMessage
(),
e
);
ModelAndView
mav
=
new
ModelAndView
(
"/errors/error"
);
mav
.
addObject
(
"exception"
,
e
);
return
mav
;
...
...
src/main/webapp/WEB-INF/jsp/selection/index.jsp
View file @
59b2d25d
...
...
@@ -66,6 +66,7 @@
<a
href=
"
<c:url
value=
"/sel/"
/>
"
><button
class=
"btn"
type=
"button"
>
Refresh
</button></a>
<button
class=
"btn btn-primary"
type=
"submit"
>
Send request for germplasm
</button>
<a
href=
"
<c:url
value=
"/sel/clear"
/>
"
><button
class=
"btn"
type=
"button"
>
Clear list
</button></a>
<a
href=
"
<c:url
value=
"/sel/map"
/>
"
><button
class=
"btn"
type=
"button"
>
Display on map
</button></a>
</div>
</form>
...
...
src/main/webapp/WEB-INF/jsp/selection/map.jsp
0 → 100644
View file @
59b2d25d
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"selection.page.title"
/></title>
</head>
<body>
<h1>
<spring:message
code=
"selection.page.title"
/>
</h1>
<div
class=
"row"
style=
""
>
<div
class=
"col-sm-12"
>
<div
id=
"map"
class=
"gis-map gis-map-square"
><spring:message
code=
"maps.loading-map"
/></div>
</div>
</div>
<content
tag=
"javascript"
>
<script
type=
"text/javascript"
>
jQuery
(
document
).
ready
(
function
()
{
var
map
=
GoogleMaps
.
map
(
"
${pageContext.response.locale.language}
"
,
$
(
"
#map
"
),
{
center
:
new
GoogleMaps
.
LatLng
(
0
,
0
)
},
function
(
el
,
map
)
{
var
infowindow
=
new
google
.
maps
.
InfoWindow
({
content
:
""
,
maxWidth
:
500
});
$
.
ajax
(
'
<c:url
value=
"/sel/json/geo"
/>
'
,
{
type
:
'
get
'
,
dataType
:
'
json
'
,
success
:
function
(
respObject
)
{
respObject
.
forEach
(
function
(
acn
)
{
var
m
=
new
google
.
maps
.
Marker
({
position
:
new
google
.
maps
.
LatLng
(
acn
.
lat
,
acn
.
lng
),
title
:
acn
.
accessionName
,
map
:
map
});
});
map
.
fitBounds
(
GoogleMaps
.
boundingBox
(
respObject
));
},
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
console
.
log
(
textStatus
);
console
.
log
(
errorThrown
);
}
});
});
});
</script>
</content>
</body>
</html>
\ No newline at end of file
src/main/webapp/html/css/custom.css
View file @
59b2d25d
...
...
@@ -1797,6 +1797,10 @@ html[dir="rtl"] ul.statistics .stats-number {
margin-top
:
1em
;
}
.gis-map-square
{
height
:
600px
;
}
.audit-info
{
...
...
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