Skip to content
GitLab
Menu
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
d243a51b
Commit
d243a51b
authored
Sep 10, 2013
by
Matija Obreza
Browse files
Admin actions
parent
8c1da1ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/crophub/rest/servlet/controller/AdminController.java
0 → 100644
View file @
d243a51b
package
org.crophub.rest.servlet.controller
;
import
java.io.IOException
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.crophub.rest.common.service.GeoService
;
import
org.crophub.rest.common.service.InstituteService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@Controller
@RequestMapping
(
"/admin"
)
public
class
AdminController
{
public
static
final
Log
LOG
=
LogFactory
.
getLog
(
AdminController
.
class
);
@Autowired
InstituteService
instituteService
;
@Autowired
GeoService
geoService
;
@RequestMapping
(
"/"
)
public
String
root
()
{
return
"/admin/index"
;
}
@RequestMapping
(
"/refreshWiews"
)
public
String
refreshWiews
()
{
try
{
instituteService
.
updateFaoInstitutes
();
}
catch
(
IOException
e
)
{
LOG
.
error
(
e
);
}
return
"redirect:/admin/"
;
}
@RequestMapping
(
"/refreshCountries"
)
public
String
refreshCountries
()
{
try
{
geoService
.
updateCountryData
();
}
catch
(
final
IOException
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
}
return
"redirect:/admin/"
;
}
}
src/main/webapp/WEB-INF/jsp/admin/index.jsp
0 → 100644
View file @
d243a51b
<!DOCTYPE html>
<%@include
file=
"/WEB-INF/jsp/init.jsp"
%>
<%@ taglib
prefix=
"sec"
uri=
"http://www.springframework.org/security/tags"
%>
<html>
<head>
<title><spring:message
code=
"sample.message.index.title"
/></title>
</head>
<body>
<sec:authorize
access=
"hasRole('ADMINISTRATOR')"
>
<form
method=
"post"
action=
"
<c:url
value=
"/admin/refreshWiews"
/>
"
>
<input
type=
"submit"
value=
"Refresh WIEWS data"
/>
</form>
<form
method=
"post"
action=
"
<c:url
value=
"/admin/refreshCountries"
/>
"
>
<input
type=
"submit"
value=
"Refresh country data"
/>
</form>
</sec:authorize>
</body>
</html>
\ No newline at end of file
Write
Preview
Supports
Markdown
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