Revision 56661
Added by Ioannis Diplas almost 5 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/PiWikService.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
|
4 | 4 |
import eu.dnetlib.domain.data.PiwikInfo; |
5 |
import eu.dnetlib.repo.manager.domain.OrderByField; |
|
6 |
import eu.dnetlib.repo.manager.domain.OrderByType; |
|
5 | 7 |
import eu.dnetlib.repo.manager.shared.RepositoryServiceException; |
6 | 8 |
import org.springframework.http.ResponseEntity; |
7 | 9 |
|
... | ... | |
14 | 16 |
|
15 | 17 |
PiwikInfo savePiwikInfo(PiwikInfo piwikInfo); |
16 | 18 |
|
17 |
List<PiwikInfo> getPiwikSitesForRepos(); |
|
19 |
List<PiwikInfo> getPiwikSitesForRepos(OrderByField orderByField, OrderByType orderByType, int from, int quantity, String searchField);
|
|
18 | 20 |
|
19 | 21 |
ResponseEntity<Object> approvePiwikSite(String repositoryId); |
20 | 22 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import com.fasterxml.jackson.databind.ObjectMapper; |
4 | 4 |
import eu.dnetlib.domain.data.PiwikInfo; |
5 |
import eu.dnetlib.domain.data.Repository; |
|
6 |
import eu.dnetlib.repo.manager.domain.OrderByField; |
|
7 |
import eu.dnetlib.repo.manager.domain.OrderByType; |
|
5 | 8 |
import eu.dnetlib.repo.manager.shared.RepositoryServiceException; |
6 | 9 |
import org.apache.commons.codec.digest.DigestUtils; |
7 | 10 |
import org.apache.log4j.Logger; |
... | ... | |
12 | 15 |
import org.springframework.http.HttpStatus; |
13 | 16 |
import org.springframework.http.ResponseEntity; |
14 | 17 |
import org.springframework.jdbc.core.JdbcTemplate; |
18 |
import org.springframework.jdbc.core.PreparedStatementSetter; |
|
15 | 19 |
import org.springframework.jdbc.core.RowMapper; |
20 |
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; |
|
16 | 21 |
import org.springframework.security.access.prepost.PreAuthorize; |
22 |
import org.springframework.security.core.context.SecurityContextHolder; |
|
17 | 23 |
import org.springframework.stereotype.Service; |
18 | 24 |
import org.springframework.web.bind.annotation.PathVariable; |
19 | 25 |
import org.springframework.web.bind.annotation.RequestBody; |
... | ... | |
24 | 30 |
import java.io.UnsupportedEncodingException; |
25 | 31 |
import java.net.URL; |
26 | 32 |
import java.net.URLEncoder; |
33 |
import java.sql.PreparedStatement; |
|
34 |
import java.sql.SQLException; |
|
27 | 35 |
import java.sql.Types; |
36 |
import java.util.Arrays; |
|
28 | 37 |
import java.util.List; |
29 | 38 |
import java.util.Map; |
39 |
import java.util.stream.Collectors; |
|
30 | 40 |
|
31 | 41 |
@Service("piwikService") |
32 | 42 |
public class PiWikServiceImpl implements PiWikService { |
... | ... | |
41 | 51 |
|
42 | 52 |
|
43 | 53 |
@Autowired |
54 |
private RepositoryService repositoryService; |
|
55 |
|
|
56 |
@Autowired |
|
44 | 57 |
@Qualifier("emailUtils") |
45 | 58 |
EmailUtils emailUtils; |
46 | 59 |
|
... | ... | |
51 | 64 |
|
52 | 65 |
private final static String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, validated, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)"; |
53 | 66 |
|
54 |
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site order by repositoryname";
|
|
67 |
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site "; |
|
55 | 68 |
|
56 | 69 |
private final static String APPROVE_PIWIK_SITE = "update piwik_site set validated=true, validationdate=now() where repositoryid = ?;"; |
57 | 70 |
|
... | ... | |
63 | 76 |
|
64 | 77 |
|
65 | 78 |
@Override |
66 |
public PiwikInfo getPiwikSiteForRepo(@PathVariable("repositoryId") String repositoryId) {
|
|
79 |
public PiwikInfo getPiwikSiteForRepo(String repositoryId) { |
|
67 | 80 |
try{ |
68 | 81 |
return new JdbcTemplate(dataSource).queryForObject(GET_PIWIK_SITE, new String[]{repositoryId}, new int[]{Types.VARCHAR}, piwikRowMapper); |
69 | 82 |
}catch (EmptyResultDataAccessException e){ |
... | ... | |
73 | 86 |
|
74 | 87 |
@Override |
75 | 88 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)") |
76 |
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
|
|
89 |
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) { |
|
77 | 90 |
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); |
78 | 91 |
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(), |
79 | 92 |
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()}, |
... | ... | |
82 | 95 |
} |
83 | 96 |
|
84 | 97 |
@Override |
85 |
public List<PiwikInfo> getPiwikSitesForRepos() { |
|
98 |
public List<PiwikInfo> getPiwikSitesForRepos(OrderByField orderByField, OrderByType orderByType, int from, int quantity, String searchField) {
|
|
86 | 99 |
LOGGER.debug("Getting piwik sites for repos! "); |
87 | 100 |
try{ |
88 |
return new JdbcTemplate(dataSource).query(GET_PIWIK_SITES, piwikRowMapper); |
|
101 |
String finalizedQuery = GET_PIWIK_SITES + " where ("+ |
|
102 |
" repositoryid ilike ? " + |
|
103 |
" or siteid ilike ?" + |
|
104 |
" or requestorname ilike ?" + |
|
105 |
" or requestoremail ilike ?" + |
|
106 |
" or comment ilike ?" + |
|
107 |
" or repositoryname ilike ?"+ |
|
108 |
" or country ilike ?" |
|
109 |
+") order by "+orderByField + " " + orderByType + " offset ? limit ?"; |
|
110 |
|
|
111 |
return new JdbcTemplate(dataSource).query(finalizedQuery, preparedStatement -> { |
|
112 |
preparedStatement.setString(1,"%"+searchField+"%"); |
|
113 |
preparedStatement.setString(2,"%"+searchField+"%"); |
|
114 |
preparedStatement.setString(3,"%"+searchField+"%"); |
|
115 |
preparedStatement.setString(4,"%"+searchField+"%"); |
|
116 |
preparedStatement.setString(5,"%"+searchField+"%"); |
|
117 |
preparedStatement.setString(6,"%"+searchField+"%"); |
|
118 |
preparedStatement.setString(7,"%"+searchField+"%"); |
|
119 |
preparedStatement.setInt(8,from); |
|
120 |
preparedStatement.setInt(9,quantity); |
|
121 |
}, piwikRowMapper); |
|
89 | 122 |
}catch (EmptyResultDataAccessException e){ |
90 | 123 |
return null; |
91 | 124 |
} |
... | ... | |
94 | 127 |
|
95 | 128 |
@Override |
96 | 129 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN')") |
97 |
public ResponseEntity<Object> approvePiwikSite(@PathVariable("repositoryId") String repositoryId) {
|
|
130 |
public ResponseEntity<Object> approvePiwikSite(String repositoryId) { |
|
98 | 131 |
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR}); |
99 | 132 |
return new ResponseEntity<>("OK",HttpStatus.OK); |
100 | 133 |
} |
101 | 134 |
|
102 | 135 |
@Override |
103 |
public String getOpenaireId(@PathVariable("repositoryId") String repositoryId) {
|
|
136 |
public String getOpenaireId(String repositoryId) { |
|
104 | 137 |
if (repositoryId != null && repositoryId.contains("::")) |
105 | 138 |
return repositoryId.split("::")[0] + "::" + DigestUtils.md5Hex(repositoryId.split("::")[1]); |
106 | 139 |
return null; |
... | ... | |
108 | 141 |
|
109 | 142 |
@Override |
110 | 143 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN')") |
111 |
public ResponseEntity<Object> markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException {
|
|
144 |
public ResponseEntity<Object> markPiwikSiteAsValidated(String repositoryId) throws RepositoryServiceException { |
|
112 | 145 |
try { |
113 | 146 |
approvePiwikSite(repositoryId); |
114 | 147 |
|
... | ... | |
129 | 162 |
|
130 | 163 |
@Override |
131 | 164 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)") |
132 |
public PiwikInfo enableMetricsForRepository(@RequestParam("officialName") String officialName,
|
|
133 |
@RequestParam("repoWebsite") String repoWebsite,
|
|
134 |
@RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException {
|
|
165 |
public PiwikInfo enableMetricsForRepository(String officialName, |
|
166 |
String repoWebsite, |
|
167 |
PiwikInfo piwikInfo) throws RepositoryServiceException { |
|
135 | 168 |
try { |
136 | 169 |
String URL = analyticsURL + "siteName=" + URLEncoder.encode(officialName, "UTF-8") + "&url=" |
137 | 170 |
+ URLEncoder.encode(repoWebsite, "UTF-8"); |
... | ... | |
143 | 176 |
piwikInfo.setSiteId(siteId); |
144 | 177 |
|
145 | 178 |
savePiwikInfo(piwikInfo); |
179 |
|
|
180 |
Repository repository = repositoryService.getRepositoryById(piwikInfo.getRepositoryId()); |
|
181 |
repository.setPiwikInfo(piwikInfo); |
|
182 |
|
|
183 |
repositoryService.updateRepository(repository, SecurityContextHolder.getContext().getAuthentication()); |
|
184 |
|
|
146 | 185 |
emailUtils.sendAdministratorRequestToEnableMetrics(piwikInfo); |
147 | 186 |
emailUtils.sendUserRequestToEnableMetrics(piwikInfo); |
148 | 187 |
} catch (UnsupportedEncodingException uee) { |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java | ||
---|---|---|
59 | 59 |
httpHeaders.set("Content-Type", "application/json"); |
60 | 60 |
|
61 | 61 |
LOGGER.debug("Init dnet topics!"); |
62 |
InputStream is = null; |
|
63 |
try { |
|
64 |
is = new URL(topicsURL).openStream(); |
|
62 |
try (InputStream is = new URL(topicsURL).openStream() ){ |
|
65 | 63 |
ObjectMapper mapper = new ObjectMapper(); |
66 | 64 |
JsonNode root = mapper.readTree(is); |
67 | 65 |
for (JsonNode term : root.path("terms") ) |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/utils/Converter.java | ||
---|---|---|
281 | 281 |
|
282 | 282 |
//TODO check identitites |
283 | 283 |
//Map<String,String> identity = new HashMap<>(); |
284 |
List identities = new ArrayList(); |
|
285 |
// identities.add(identities); |
|
284 |
Map<String, Object> identities = new HashMap<>(); |
|
285 |
identities.put("issuertype", "piwik"); |
|
286 |
identities.put("pid","piwik:"+repository.getPiwikInfo().getSiteId()); |
|
286 | 287 |
repositoryMap.put("identities",identities); |
287 | 288 |
repositoryMap.put("subjects",""); |
288 | 289 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/StatsController.java | ||
---|---|---|
18 | 18 |
public class StatsController { |
19 | 19 |
|
20 | 20 |
@Autowired |
21 |
StatsServiceImpl statsService; |
|
21 |
private StatsServiceImpl statsService;
|
|
22 | 22 |
|
23 | 23 |
@RequestMapping(value = "/getStatistics" , method = RequestMethod.GET, |
24 | 24 |
produces = MediaType.APPLICATION_JSON_VALUE) |
25 | 25 |
@ResponseBody |
26 |
public Map getStatistics() throws JSONException {
|
|
26 |
public Map getStatistics(){ |
|
27 | 27 |
return statsService.getStatistics(); |
28 | 28 |
} |
29 | 29 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/UserController.java | ||
---|---|---|
15 | 15 |
public class UserController { |
16 | 16 |
|
17 | 17 |
@Autowired |
18 |
UserServiceImpl userService; |
|
18 |
private UserServiceImpl userService;
|
|
19 | 19 |
|
20 | 20 |
@RequestMapping(value = "/login" , method = RequestMethod.GET) |
21 | 21 |
@PreAuthorize("hasRole('ROLE_USER')") |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java | ||
---|---|---|
25 | 25 |
public class RepositoryController { |
26 | 26 |
|
27 | 27 |
@Autowired |
28 |
RepositoryServiceImpl repositoryService; |
|
28 |
private RepositoryServiceImpl repositoryService;
|
|
29 | 29 |
|
30 | 30 |
@RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) |
31 | 31 |
@ResponseBody |
... | ... | |
118 | 118 |
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET, |
119 | 119 |
produces = MediaType.APPLICATION_JSON_VALUE) |
120 | 120 |
@ResponseBody |
121 |
List<String> getDnetCountries(){ |
|
121 |
public List<String> getDnetCountries(){
|
|
122 | 122 |
return repositoryService.getDnetCountries(); |
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET, |
126 | 126 |
produces = MediaType.APPLICATION_JSON_VALUE) |
127 | 127 |
@ResponseBody |
128 |
List<String> getTypologies(){ |
|
128 |
public List<String> getTypologies(){
|
|
129 | 129 |
return repositoryService.getTypologies(); |
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET, |
133 | 133 |
produces = MediaType.APPLICATION_JSON_VALUE) |
134 | 134 |
@ResponseBody |
135 |
List<Timezone> getTimezones(){ |
|
135 |
public List<Timezone> getTimezones(){
|
|
136 | 136 |
return repositoryService.getTimezones(); |
137 | 137 |
} |
138 | 138 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/PiWikController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.repo.manager.controllers; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.domain.data.PiwikInfo; |
4 |
import eu.dnetlib.repo.manager.domain.OrderByField; |
|
5 |
import eu.dnetlib.repo.manager.domain.OrderByType; |
|
4 | 6 |
import eu.dnetlib.repo.manager.service.PiWikServiceImpl; |
5 | 7 |
import eu.dnetlib.repo.manager.shared.RepositoryServiceException; |
6 | 8 |
import io.swagger.annotations.Api; |
... | ... | |
18 | 20 |
public class PiWikController { |
19 | 21 |
|
20 | 22 |
@Autowired |
21 |
PiWikServiceImpl piWikService; |
|
23 |
private PiWikServiceImpl piWikService;
|
|
22 | 24 |
|
23 | 25 |
|
24 | 26 |
@RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
... | ... | |
35 | 37 |
} |
36 | 38 |
|
37 | 39 |
@RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
38 |
List<PiwikInfo> getPiwikSitesForRepos(){ |
|
39 |
return piWikService.getPiwikSitesForRepos(); |
|
40 |
public List<PiwikInfo> getPiwikSitesForRepos( |
|
41 |
@RequestParam(value = "from",required=false,defaultValue = "0") int from, |
|
42 |
@RequestParam(value = "quantity",required=false,defaultValue = "100") int quantity, |
|
43 |
@RequestParam(value = "order",required=false,defaultValue = "ASC") OrderByType orderType, |
|
44 |
@RequestParam(value = "orderField", required = false, defaultValue = "REPOSITORY_NAME") OrderByField orderField, |
|
45 |
@RequestParam(value = "searchField", required = false, defaultValue = "") String searchField |
|
46 |
|
|
47 |
){ |
|
48 |
return piWikService.getPiwikSitesForRepos(orderField,orderType,from,quantity,searchField); |
|
40 | 49 |
} |
41 | 50 |
|
42 | 51 |
@RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET) |
... | ... | |
48 | 57 |
|
49 | 58 |
@RequestMapping(value = "/getOpenaireId/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
50 | 59 |
@ResponseBody |
51 |
String getOpenaireId(String repositoryid){ |
|
60 |
public String getOpenaireId(String repositoryid){
|
|
52 | 61 |
return piWikService.getOpenaireId(repositoryid); |
53 | 62 |
} |
54 | 63 |
|
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/BrokerController.java | ||
---|---|---|
23 | 23 |
public class BrokerController{ |
24 | 24 |
|
25 | 25 |
@Autowired |
26 |
BrokerServiceImpl brokerService; |
|
26 |
private BrokerServiceImpl brokerService;
|
|
27 | 27 |
|
28 | 28 |
|
29 | 29 |
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.GET, |
30 | 30 |
produces = MediaType.APPLICATION_JSON_VALUE) |
31 | 31 |
@ResponseBody |
32 | 32 |
@PreAuthorize("hasRole('ROLE_USER')") |
33 |
DatasourcesBroker getDatasourcesOfUser(@RequestParam("user") |
|
33 |
public DatasourcesBroker getDatasourcesOfUser(@RequestParam("user")
|
|
34 | 34 |
@ApiParam(value = "User email", required = true) String user, |
35 | 35 |
@RequestParam("includeShared") |
36 | 36 |
@ApiParam(value = "Include shared datasources", required = true , defaultValue = "false") String includeShared, |
... | ... | |
43 | 43 |
method = RequestMethod.GET, |
44 | 44 |
produces = MediaType.APPLICATION_JSON_VALUE) |
45 | 45 |
@ResponseBody |
46 |
List<BrowseEntry> getTopicsForDatasource(@PathVariable("datasourceName") String datasourceName) throws BrokerException{ |
|
46 |
public List<BrowseEntry> getTopicsForDatasource(@PathVariable("datasourceName") String datasourceName) throws BrokerException{
|
|
47 | 47 |
return brokerService.getTopicsForDatasource(datasourceName); |
48 | 48 |
} |
49 | 49 |
|
... | ... | |
52 | 52 |
produces = MediaType.APPLICATION_JSON_VALUE) |
53 | 53 |
@ResponseBody |
54 | 54 |
@PreAuthorize("hasRole('ROLE_USER')") |
55 |
EventsPage advancedShowEvents(@PathVariable("page") String page, |
|
55 |
public EventsPage advancedShowEvents(@PathVariable("page") String page,
|
|
56 | 56 |
@PathVariable("size") String size, |
57 | 57 |
@RequestBody AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException{ |
58 | 58 |
return brokerService.advancedShowEvents(page, size, advQueryObject); |
... | ... | |
63 | 63 |
produces = MediaType.APPLICATION_JSON_VALUE) |
64 | 64 |
@ResponseBody |
65 | 65 |
@PreAuthorize("hasRole('ROLE_USER')") |
66 |
EventsPage showEvents(@RequestParam("datasourceName") String datasourceName, |
|
66 |
public EventsPage showEvents(@RequestParam("datasourceName") String datasourceName,
|
|
67 | 67 |
@RequestParam("topic") String topic, |
68 | 68 |
@RequestParam("page") String page, |
69 | 69 |
@RequestParam("size") String size) throws BrokerException, JSONException{ |
... | ... | |
75 | 75 |
produces = MediaType.APPLICATION_JSON_VALUE) |
76 | 76 |
@ResponseBody |
77 | 77 |
@PreAuthorize("hasRole('ROLE_USER')") |
78 |
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException{ |
|
78 |
public Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException{
|
|
79 | 79 |
return brokerService.getSimpleSubscriptionsOfUser(userEmail); |
80 | 80 |
} |
81 | 81 |
|
... | ... | |
84 | 84 |
produces = MediaType.APPLICATION_JSON_VALUE) |
85 | 85 |
@ResponseBody |
86 | 86 |
@PreAuthorize("hasRole('ROLE_USER') ") |
87 |
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException{ |
|
87 |
public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException{
|
|
88 | 88 |
return brokerService.subscribe(obj); |
89 | 89 |
} |
90 | 90 |
|
... | ... | |
93 | 93 |
produces = MediaType.APPLICATION_JSON_VALUE) |
94 | 94 |
@ResponseBody |
95 | 95 |
@PreAuthorize("hasRole('ROLE_USER')") |
96 |
ResponseEntity<Object> unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException{ |
|
96 |
public ResponseEntity<Object> unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException{
|
|
97 | 97 |
return brokerService.unsubscribe(subscriptionId); |
98 | 98 |
} |
99 | 99 |
|
... | ... | |
101 | 101 |
produces = MediaType.APPLICATION_JSON_VALUE) |
102 | 102 |
@ResponseBody |
103 | 103 |
@PreAuthorize("hasRole('ROLE_USER')") |
104 |
Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException{ |
|
104 |
public Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException{
|
|
105 | 105 |
return brokerService.getSubscription(subscriptionId); |
106 | 106 |
} |
107 | 107 |
|
... | ... | |
109 | 109 |
@RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET, |
110 | 110 |
produces = MediaType.APPLICATION_JSON_VALUE) |
111 | 111 |
@ResponseBody |
112 |
Map<String, Term> getDnetTopics() throws BrokerException{ |
|
112 |
public Map<String, Term> getDnetTopics() throws BrokerException{
|
|
113 | 113 |
return brokerService.getDnetTopics(); |
114 | 114 |
} |
115 | 115 |
|
... | ... | |
117 | 117 |
,produces = MediaType.APPLICATION_JSON_VALUE) |
118 | 118 |
@ResponseBody |
119 | 119 |
@PreAuthorize("hasRole('ROLE_USER')") |
120 |
EventsPage getNotificationsBySubscriptionId(@PathVariable("subscriptionId") String subscriptionId, |
|
120 |
public EventsPage getNotificationsBySubscriptionId(@PathVariable("subscriptionId") String subscriptionId,
|
|
121 | 121 |
@PathVariable("page") String page, |
122 | 122 |
@PathVariable("size") String size) throws BrokerException{ |
123 | 123 |
return brokerService.getNotificationsBySubscriptionId(subscriptionId, page, size); |
124 | 124 |
} |
125 | 125 |
|
126 |
/*@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET |
|
127 |
,produces = MediaType.APPLICATION_JSON_VALUE) |
|
128 |
@ResponseBody*/ |
|
129 |
Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException{ |
|
130 |
return brokerService.getSubscriptionsOfUser(userEmail); |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 | 126 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/ValidatorController.java | ||
---|---|---|
26 | 26 |
public class ValidatorController { |
27 | 27 |
|
28 | 28 |
@Autowired |
29 |
ValidatorServiceImpl validatorService; |
|
29 |
private ValidatorServiceImpl validatorService;
|
|
30 | 30 |
|
31 | 31 |
@RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, |
32 | 32 |
consumes = MediaType.APPLICATION_JSON_VALUE, |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/DashboardController.java | ||
---|---|---|
17 | 17 |
public class DashboardController { |
18 | 18 |
|
19 | 19 |
@Autowired |
20 |
DashboardService dashboardService; |
|
20 |
private DashboardService dashboardService;
|
|
21 | 21 |
|
22 | 22 |
@RequestMapping(value = "/getRepositoriesSummary/{userEmail}/{page}/{size}" , method = RequestMethod.GET, |
23 | 23 |
produces = MediaType.APPLICATION_JSON_VALUE) |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/MonitorController.java | ||
---|---|---|
22 | 22 |
.getLogger(MonitorController.class); |
23 | 23 |
|
24 | 24 |
@Autowired |
25 |
MonitorServiceImpl monitorService; |
|
25 |
private MonitorServiceImpl monitorService;
|
|
26 | 26 |
|
27 | 27 |
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.GET, |
28 | 28 |
produces = MediaType.APPLICATION_JSON_VALUE) |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/GenericControllerAdvice.java | ||
---|---|---|
29 | 29 |
@ResponseStatus(HttpStatus.NOT_FOUND) |
30 | 30 |
@ExceptionHandler(ResourceNotFoundException.class) |
31 | 31 |
@ResponseBody |
32 |
ServerError securityException(HttpServletRequest req, Exception ex) { |
|
32 |
public ServerError securityException(HttpServletRequest req, Exception ex) {
|
|
33 | 33 |
return new ServerError(req.getRequestURL().toString(),ex); |
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
@ResponseStatus(HttpStatus.FORBIDDEN) |
37 | 37 |
@ExceptionHandler(AccessDeniedException.class) |
38 | 38 |
@ResponseBody |
39 |
ServerError accessDeniedException(HttpServletRequest req, Exception ex) { |
|
39 |
public ServerError accessDeniedException(HttpServletRequest req, Exception ex) {
|
|
40 | 40 |
return new ServerError(req.getRequestURL().toString(),ex); |
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
@ResponseStatus(HttpStatus.NOT_FOUND) |
44 | 44 |
@ExceptionHandler(UnknownHostException.class) |
45 | 45 |
@ResponseBody |
46 |
ServerError unknownHostException(HttpServletRequest req, Exception ex) { |
|
46 |
public ServerError unknownHostException(HttpServletRequest req, Exception ex) {
|
|
47 | 47 |
return new ServerError(req.getRequestURL().toString(),ex); |
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
51 | 51 |
@ExceptionHandler({JSONException.class,BrokerException.class,ValidatorServiceException.class}) |
52 | 52 |
@ResponseBody |
53 |
ServerError internalException(HttpServletRequest req, Exception ex) { |
|
53 |
public ServerError internalException(HttpServletRequest req, Exception ex) {
|
|
54 | 54 |
return new ServerError(req.getRequestURL().toString(),ex); |
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
@ResponseStatus(HttpStatus.GATEWAY_TIMEOUT) |
58 | 58 |
@ExceptionHandler(EndPointException.class) |
59 | 59 |
@ResponseBody |
60 |
ServerError endPointException(HttpServletRequest req, Exception ex) { |
|
60 |
public ServerError endPointException(HttpServletRequest req, Exception ex) {
|
|
61 | 61 |
return new ServerError(req.getRequestURL().toString(),ex); |
62 | 62 |
} |
63 | 63 |
|
64 |
|
|
65 | 64 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/SushiliteController.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
|
17 | 17 |
@Autowired |
18 |
SushiliteServiceImpl sushiliteService; |
|
18 |
private SushiliteServiceImpl sushiliteService;
|
|
19 | 19 |
|
20 | 20 |
@RequestMapping(value = "/getReportResults/{page}/{pageSize}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) |
21 | 21 |
@ResponseBody |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/domain/OrderByType.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.domain; |
|
2 |
|
|
3 |
public enum OrderByType { |
|
4 |
|
|
5 |
ASC("ASC"), |
|
6 |
DSC("DESC"); |
|
7 |
|
|
8 |
private final String text; |
|
9 |
|
|
10 |
OrderByType(String text) { |
|
11 |
this.text = text; |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
public String toString() { |
|
16 |
return text; |
|
17 |
} |
|
18 |
} |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/domain/OrderByField.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.domain; |
|
2 |
|
|
3 |
public enum OrderByField { |
|
4 |
|
|
5 |
REPOSITORY_NAME("repositoryname"), |
|
6 |
REPOSITORY_ID("repositoryid"), |
|
7 |
SITE_ID("siteid"), |
|
8 |
CREATION_DATE("creationdate"), |
|
9 |
VALIDATION_DATE("validationdate"), |
|
10 |
REQUESTOR_NAME("requestorname"), |
|
11 |
REQUESTOR_EMAIL("requestoremail"), |
|
12 |
VALIDATED("validated"), |
|
13 |
COUNTRY("country"); |
|
14 |
|
|
15 |
|
|
16 |
private final String text; |
|
17 |
|
|
18 |
OrderByField(String text) { |
|
19 |
this.text = text; |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public String toString() { |
|
24 |
return text; |
|
25 |
} |
|
26 |
} |
Also available in: Unified diff
- Fixing some code-smells
- Implemented search of piwik repos
- Added site_id info on repository