Revision 49868
Added by Panagiotis Kanakakis over 6 years ago
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.repo.manager.service.controllers; |
2 | 2 |
|
3 |
|
|
4 | 3 |
import com.fasterxml.jackson.databind.ObjectMapper; |
5 |
import com.google.gson.Gson; |
|
6 | 4 |
import eu.dnetlib.domain.data.Repository; |
7 | 5 |
import eu.dnetlib.repo.manager.shared.BrokerException; |
8 | 6 |
import eu.dnetlib.repo.manager.shared.Tuple; |
9 |
import eu.dnetlib.repo.manager.shared.broker.AdvQueryObject; |
|
10 |
import eu.dnetlib.repo.manager.shared.broker.BrowseEntry; |
|
11 |
import eu.dnetlib.repo.manager.shared.broker.DatasourcesBroker; |
|
12 |
import eu.dnetlib.repo.manager.shared.broker.EventsPage; |
|
13 |
import org.apache.xpath.operations.Bool; |
|
7 |
import eu.dnetlib.repo.manager.shared.broker.*; |
|
14 | 8 |
import org.json.JSONException; |
15 | 9 |
import org.json.JSONObject; |
16 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
28 | 22 |
import org.springframework.web.client.RestTemplate; |
29 | 23 |
import org.springframework.web.util.UriComponentsBuilder; |
30 | 24 |
|
25 |
import java.io.IOException; |
|
31 | 26 |
import java.util.*; |
32 | 27 |
|
33 | 28 |
@Component |
... | ... | |
38 | 33 |
private RepositoryApiImpl repoAPI; |
39 | 34 |
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}${services.broker.openaire}") |
40 | 35 |
private String openairePath; |
36 |
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}") |
|
37 |
private String apiPath; |
|
41 | 38 |
|
39 |
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger |
|
40 |
.getLogger(BrokerApiImpl.class); |
|
41 |
|
|
42 | 42 |
@Override |
43 | 43 |
public DatasourcesBroker getDatasourcesOfUser(String params) throws JSONException { |
44 | 44 |
JSONObject json_params = new JSONObject(params); |
... | ... | |
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
@Override |
94 |
public EventsPage advancedShowEvents(String params) throws BrokerException, JSONException { |
|
94 |
public EventsPage advancedShowEvents(String params) throws BrokerException, JSONException ,IOException {
|
|
95 | 95 |
JSONObject json_params = new JSONObject(params); |
96 | 96 |
|
97 | 97 |
String page = json_params.getString("page"); |
98 | 98 |
String pagesize = json_params.getString("pagesize"); |
99 |
String json_advQueryObject = json_params.getString("advQueryObject"); |
|
99 | 100 |
|
100 |
JSONObject json_advQueryObject = json_params.getJSONObject("advQueryObject"); |
|
101 |
ObjectMapper obj = new ObjectMapper(); |
|
102 |
AdvQueryObject advQueryObject = new Gson().fromJson(json_advQueryObject.toString(),AdvQueryObject.class); |
|
101 |
ObjectMapper mapper = new ObjectMapper(); |
|
102 |
AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class); |
|
103 | 103 |
|
104 |
|
|
105 | 104 |
final String service = "/events/{page}/{pageSize}"; |
106 | 105 |
|
107 | 106 |
Map<String, Long> uriParams = new HashMap<>(); |
... | ... | |
218 | 217 |
return resp.getBody(); |
219 | 218 |
} |
220 | 219 |
|
220 |
@Override |
|
221 |
public Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException { |
|
221 | 222 |
|
223 |
final String service = "/subscriptions"; |
|
224 |
|
|
225 |
//build the uri params |
|
226 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service) |
|
227 |
.queryParam("email", userEmail); |
|
228 |
|
|
229 |
//create new template engine |
|
230 |
RestTemplate template = new RestTemplate(); |
|
231 |
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
232 |
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp; |
|
233 |
try { |
|
234 |
//communicate with endpoint |
|
235 |
resp = template.exchange( |
|
236 |
builder.build().encode().toUri(), |
|
237 |
HttpMethod.GET, |
|
238 |
null, |
|
239 |
new ParameterizedTypeReference<Map<String, List<SimpleSubscriptionDesc>>>() { |
|
240 |
}); |
|
241 |
} catch (RestClientException e) { |
|
242 |
throw new BrokerException(e); |
|
243 |
} |
|
244 |
|
|
245 |
return resp.getBody(); |
|
246 |
} |
|
247 |
|
|
248 |
@Override |
|
249 |
public Subscription subscribe(OpenaireSubscription obj) throws BrokerException { |
|
250 |
final String service = "/subscribe"; |
|
251 |
|
|
252 |
//build the uri params |
|
253 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service); |
|
254 |
|
|
255 |
//Header info |
|
256 |
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
|
257 |
headers.add("Content-Type", "application/json"); |
|
258 |
HttpEntity<OpenaireSubscription> entity = new HttpEntity<>(obj, headers); |
|
259 |
|
|
260 |
//create new template engine |
|
261 |
RestTemplate template = new RestTemplate(); |
|
262 |
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
263 |
ResponseEntity<Subscription> resp; |
|
264 |
try { |
|
265 |
//communicate with endpoint |
|
266 |
resp = template.exchange( |
|
267 |
builder.build().encode().toUri(), |
|
268 |
HttpMethod.POST, |
|
269 |
entity, |
|
270 |
new ParameterizedTypeReference<Subscription>() { |
|
271 |
}); |
|
272 |
} catch (RestClientException e) { |
|
273 |
throw new BrokerException(e); |
|
274 |
} |
|
275 |
|
|
276 |
return resp.getBody(); |
|
277 |
} |
|
278 |
|
|
279 |
@Override |
|
280 |
public void unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException { |
|
281 |
final String service = "/subscriptions/" + subscriptionId; |
|
282 |
|
|
283 |
//build the uri params |
|
284 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiPath + service); |
|
285 |
|
|
286 |
//create new template engine |
|
287 |
RestTemplate template = new RestTemplate(); |
|
288 |
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
289 |
try { |
|
290 |
//communicate with endpoint |
|
291 |
template.exchange( |
|
292 |
builder.build().encode().toUri(), |
|
293 |
HttpMethod.DELETE, |
|
294 |
null, |
|
295 |
new ParameterizedTypeReference<Void>() { |
|
296 |
}); |
|
297 |
} catch (RestClientException e) { |
|
298 |
throw new BrokerException(e); |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
@Override |
|
303 |
public Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException { |
|
304 |
final String service = "/subscriptions/" + subscriptionId; |
|
305 |
|
|
306 |
//build the uri params |
|
307 |
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiPath + service); |
|
308 |
|
|
309 |
//create new template engine |
|
310 |
RestTemplate template = new RestTemplate(); |
|
311 |
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
312 |
ResponseEntity<Subscription> resp; |
|
313 |
try { |
|
314 |
//communicate with endpoint |
|
315 |
resp = template.exchange( |
|
316 |
builder.build().encode().toUri(), |
|
317 |
HttpMethod.GET, |
|
318 |
null, |
|
319 |
new ParameterizedTypeReference<Subscription>() { |
|
320 |
}); |
|
321 |
} catch (RestClientException e) { |
|
322 |
throw new BrokerException(e); |
|
323 |
} |
|
324 |
return resp.getBody(); |
|
325 |
} |
|
326 |
|
|
327 |
|
|
328 |
|
|
222 | 329 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWiApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.controllers; |
|
2 |
|
|
3 |
|
|
4 |
import eu.dnetlib.repo.manager.shared.PiwikInfo; |
|
5 |
import org.springframework.http.MediaType; |
|
6 |
import org.springframework.web.bind.annotation.*; |
|
7 |
|
|
8 |
import java.util.List; |
|
9 |
|
|
10 |
@RestController |
|
11 |
@RequestMapping(value = "/piwi") |
|
12 |
public interface PiWiApi { |
|
13 |
|
|
14 |
|
|
15 |
@RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
16 |
@ResponseBody |
|
17 |
PiwikInfo getPiwikSiteForRepo(String repositoryId); |
|
18 |
|
|
19 |
@RequestMapping(value = "/savePiwikInfo" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
|
20 |
PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo); |
|
21 |
|
|
22 |
@RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
23 |
List<PiwikInfo> getPiwikSitesForRepos(); |
|
24 |
|
|
25 |
@RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
26 |
@ResponseBody |
|
27 |
void approvePiwikSite(String repositoryId); |
|
28 |
|
|
29 |
@RequestMapping(value = "/getOpenaireId/{repositoryid}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
30 |
@ResponseBody |
|
31 |
String getOpenaireId(String repositoryid); |
|
32 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWiApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.controllers; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.shared.PiwikInfo; |
|
4 |
import eu.dnetlib.utils.md5.MD5; |
|
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.beans.factory.annotation.Qualifier; |
|
7 |
import org.springframework.jdbc.core.JdbcTemplate; |
|
8 |
import org.springframework.jdbc.core.RowMapper; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
import org.springframework.web.bind.annotation.PathVariable; |
|
11 |
|
|
12 |
import javax.sql.DataSource; |
|
13 |
import java.security.NoSuchAlgorithmException; |
|
14 |
import java.sql.ResultSet; |
|
15 |
import java.sql.SQLException; |
|
16 |
import java.sql.Types; |
|
17 |
import java.util.List; |
|
18 |
|
|
19 |
@Component |
|
20 |
public class PiWiApiImpl implements PiWiApi{ |
|
21 |
|
|
22 |
@Autowired |
|
23 |
@Qualifier("repomanager.dataSource") |
|
24 |
private DataSource dataSource; |
|
25 |
|
|
26 |
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger |
|
27 |
.getLogger(BrokerApiImpl.class); |
|
28 |
|
|
29 |
private final static String GET_PIWIK_SITE = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, approved, approvaldate, comment, repositoryname, country from piwik_site where repositoryid = ?;"; |
|
30 |
|
|
31 |
private final static String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, approved, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)"; |
|
32 |
|
|
33 |
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, approved, approvaldate, comment, repositoryname, country from piwik_site order by repositoryname"; |
|
34 |
|
|
35 |
private final static String APPROVE_PIWIK_SITE = "update piwik_site set approved=true, approvaldate=now() where repositoryid = ?;"; |
|
36 |
|
|
37 |
private RowMapper<PiwikInfo> piwikRowMapper = new RowMapper<PiwikInfo>() { |
|
38 |
@Override |
|
39 |
public PiwikInfo mapRow(ResultSet rs, int i) throws SQLException { |
|
40 |
return new PiwikInfo(rs.getString("repositoryid"), getOpenaireId(rs.getString("repositoryid")), rs.getString("repositoryname"), rs.getString("country"), |
|
41 |
rs.getString("siteid"), rs.getString("authenticationtoken"), rs.getTimestamp("creationdate"), rs.getString("requestorname"), rs.getString("requestoremail"), |
|
42 |
rs.getBoolean("approved"), rs.getTimestamp("approvaldate"), rs.getString("comment")); |
|
43 |
} |
|
44 |
}; |
|
45 |
|
|
46 |
|
|
47 |
@Override |
|
48 |
public PiwikInfo getPiwikSiteForRepo(@PathVariable("repositoryId") String repositoryId) { |
|
49 |
try { |
|
50 |
LOGGER.debug("URL -> " + dataSource.getConnection()); |
|
51 |
} catch (SQLException e) { |
|
52 |
LOGGER.debug("error on connection",e); |
|
53 |
} |
|
54 |
return new JdbcTemplate(dataSource).queryForObject(GET_PIWIK_SITE, new String[]{repositoryId}, new int[]{Types.VARCHAR}, piwikRowMapper); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) { |
|
59 |
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); |
|
60 |
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(), |
|
61 |
piwikInfo.getRequestorEmail(), piwikInfo.isApproved(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()}, |
|
62 |
new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}); |
|
63 |
return piwikInfo; |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public List<PiwikInfo> getPiwikSitesForRepos() { |
|
68 |
return new JdbcTemplate(dataSource).query(GET_PIWIK_SITES, piwikRowMapper); |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public void approvePiwikSite(@PathVariable("repositoryId") String repositoryId) { |
|
73 |
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR}); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public String getOpenaireId(@PathVariable("repositoryId") String repositoryid) { |
|
78 |
try { |
|
79 |
if (repositoryid != null && repositoryid.contains("::")) |
|
80 |
return repositoryid.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryid.split("::")[1]); |
|
81 |
else |
|
82 |
return null; |
|
83 |
} catch (NoSuchAlgorithmException e) { |
|
84 |
e.printStackTrace(); |
|
85 |
} |
|
86 |
return null; |
|
87 |
} |
|
88 |
|
|
89 |
|
|
90 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.repo.manager.service.controllers; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.repo.manager.shared.BrokerException; |
4 |
import eu.dnetlib.repo.manager.shared.broker.BrowseEntry; |
|
5 |
import eu.dnetlib.repo.manager.shared.broker.DatasourcesBroker; |
|
6 |
import eu.dnetlib.repo.manager.shared.broker.EventsPage; |
|
4 |
import eu.dnetlib.repo.manager.shared.broker.*; |
|
7 | 5 |
import org.json.JSONException; |
8 | 6 |
import org.springframework.http.MediaType; |
9 |
import org.springframework.web.bind.annotation.RequestBody; |
|
10 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
11 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
12 |
import org.springframework.web.bind.annotation.RestController; |
|
7 |
import org.springframework.web.bind.annotation.*; |
|
13 | 8 |
|
9 |
import java.io.IOException; |
|
14 | 10 |
import java.util.List; |
11 |
import java.util.Map; |
|
15 | 12 |
|
16 | 13 |
@RestController |
17 | 14 |
@RequestMapping(value = "/broker") |
... | ... | |
24 | 21 |
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException; |
25 | 22 |
|
26 | 23 |
@RequestMapping(value = "/advancedShowEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
27 |
EventsPage advancedShowEvents(@RequestBody String params) throws BrokerException, JSONException; |
|
24 |
EventsPage advancedShowEvents(@RequestBody String params) throws BrokerException, JSONException ,IOException;
|
|
28 | 25 |
|
29 | 26 |
@RequestMapping(value = "/showEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
30 |
EventsPage showEvents(String params) throws BrokerException, JSONException; |
|
27 |
EventsPage showEvents(@RequestBody String params) throws BrokerException, JSONException; |
|
28 |
|
|
29 |
@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
30 |
@ResponseBody |
|
31 |
Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(String userEmail) throws BrokerException; |
|
32 |
|
|
33 |
@RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
34 |
@ResponseBody |
|
35 |
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException; |
|
36 |
|
|
37 |
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
38 |
@ResponseBody |
|
39 |
void unsubscribe(String subscriptionId) throws BrokerException; |
|
40 |
|
|
41 |
@RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
|
42 |
@ResponseBody |
|
43 |
Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException; |
|
31 | 44 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/shared/PiwikInfo.java | ||
---|---|---|
10 | 10 |
public class PiwikInfo implements IsSerializable { |
11 | 11 |
|
12 | 12 |
private String repositoryId; |
13 |
private String openaireId; |
|
14 |
private String repositoryName; |
|
15 |
private String country; |
|
13 | 16 |
private String siteId; |
17 |
private String authenticationToken; |
|
14 | 18 |
private Date creationDate; |
19 |
private String requestorName; |
|
20 |
private String requestorEmail; |
|
21 |
private boolean approved; |
|
22 |
private Date approvalDate; |
|
23 |
private String comment; |
|
15 | 24 |
|
16 | 25 |
public PiwikInfo() { |
17 | 26 |
|
18 | 27 |
} |
19 | 28 |
|
20 |
public PiwikInfo(String repositoryId, String siteId, Date creationDate) { |
|
29 |
public PiwikInfo(String repositoryId, String openaireId, String repositoryName, String country, String siteId, |
|
30 |
String authenticationToken, Date creationDate, String requestorName, String requestorEmail, |
|
31 |
boolean approved, Date approvalDate, String comment) { |
|
21 | 32 |
this.repositoryId = repositoryId; |
33 |
this.openaireId = openaireId; |
|
34 |
this.repositoryName = repositoryName; |
|
35 |
this.country = country; |
|
22 | 36 |
this.siteId = siteId; |
37 |
this.authenticationToken = authenticationToken; |
|
23 | 38 |
this.creationDate = creationDate; |
39 |
this.requestorName = requestorName; |
|
40 |
this.requestorEmail = requestorEmail; |
|
41 |
this.approved = approved; |
|
42 |
this.approvalDate = approvalDate; |
|
43 |
this.comment = comment; |
|
24 | 44 |
} |
25 | 45 |
|
26 | 46 |
public String getRepositoryId() { |
... | ... | |
31 | 51 |
this.repositoryId = repositoryId; |
32 | 52 |
} |
33 | 53 |
|
54 |
public String getOpenaireId() { |
|
55 |
return openaireId; |
|
56 |
} |
|
57 |
|
|
58 |
public void setOpenaireId(String openaireId) { |
|
59 |
this.openaireId = openaireId; |
|
60 |
} |
|
61 |
|
|
62 |
public String getRepositoryName() { |
|
63 |
return repositoryName; |
|
64 |
} |
|
65 |
|
|
66 |
public void setRepositoryName(String repositoryName) { |
|
67 |
this.repositoryName = repositoryName; |
|
68 |
} |
|
69 |
|
|
70 |
public String getCountry() { |
|
71 |
return country; |
|
72 |
} |
|
73 |
|
|
74 |
public void setCountry(String country) { |
|
75 |
this.country = country; |
|
76 |
} |
|
77 |
|
|
34 | 78 |
public String getSiteId() { |
35 | 79 |
return siteId; |
36 | 80 |
} |
... | ... | |
39 | 83 |
this.siteId = siteId; |
40 | 84 |
} |
41 | 85 |
|
86 |
public String getAuthenticationToken() { |
|
87 |
return authenticationToken; |
|
88 |
} |
|
89 |
|
|
90 |
public void setAuthenticationToken(String authenticationToken) { |
|
91 |
this.authenticationToken = authenticationToken; |
|
92 |
} |
|
93 |
|
|
42 | 94 |
public Date getCreationDate() { |
43 | 95 |
return creationDate; |
44 | 96 |
} |
... | ... | |
46 | 98 |
public void setCreationDate(Date creationDate) { |
47 | 99 |
this.creationDate = creationDate; |
48 | 100 |
} |
101 |
|
|
102 |
public String getRequestorName() { |
|
103 |
return requestorName; |
|
104 |
} |
|
105 |
|
|
106 |
public void setRequestorName(String requestorName) { |
|
107 |
this.requestorName = requestorName; |
|
108 |
} |
|
109 |
|
|
110 |
public String getRequestorEmail() { |
|
111 |
return requestorEmail; |
|
112 |
} |
|
113 |
|
|
114 |
public void setRequestorEmail(String requestorEmail) { |
|
115 |
this.requestorEmail = requestorEmail; |
|
116 |
} |
|
117 |
|
|
118 |
public boolean isApproved() { |
|
119 |
return approved; |
|
120 |
} |
|
121 |
|
|
122 |
public void setApproved(boolean approved) { |
|
123 |
this.approved = approved; |
|
124 |
} |
|
125 |
|
|
126 |
public Date getApprovalDate() { |
|
127 |
return approvalDate; |
|
128 |
} |
|
129 |
|
|
130 |
public void setApprovalDate(Date approvalDate) { |
|
131 |
this.approvalDate = approvalDate; |
|
132 |
} |
|
133 |
|
|
134 |
public String getComment() { |
|
135 |
return comment; |
|
136 |
} |
|
137 |
|
|
138 |
public void setComment(String comment) { |
|
139 |
this.comment = comment; |
|
140 |
} |
|
49 | 141 |
} |
modules/uoa-repository-manager-service/src/main/resources/application-context.xml | ||
---|---|---|
6 | 6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
7 | 7 |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> |
8 | 8 |
|
9 |
|
|
10 |
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
|
11 |
<property name="driverClassName" value="${repomanager.db.driverClassName}" /> |
|
12 |
<property name="url" value="${repomanager.db.url}" /> |
|
13 |
<property name="username" value="${repomanager.db.username}" /> |
|
14 |
<property name="password" value="${repomanager.db.password}" /> |
|
15 |
<property name="maxIdle" value="10" /> |
|
16 |
<property name="maxActive" value="100" /> |
|
17 |
<property name="maxWait" value="10000" /> |
|
18 |
<property name="validationQuery" value="SELECT 1;" /> |
|
19 |
<property name="testOnBorrow" value="true" /> |
|
20 |
<property name="testOnReturn" value="true" /> |
|
21 |
<property name="testWhileIdle" value="true" /> |
|
22 |
<property name="timeBetweenEvictionRunsMillis" value="1200000" /> |
|
23 |
<property name="minEvictableIdleTimeMillis" value="1800000" /> |
|
24 |
<property name="numTestsPerEvictionRun" value="5" /> |
|
25 |
<property name="poolPreparedStatements" value="true" /> |
|
26 |
<property name="defaultAutoCommit" value="true" /> |
|
27 |
</bean> |
|
28 |
|
|
9 | 29 |
<context:property-placeholder location="classpath*:/eu/**/application.properties" /> |
10 | 30 |
|
11 | 31 |
</beans> |
modules/uoa-repository-manager-service/pom.xml | ||
---|---|---|
182 | 182 |
<artifactId>spring-context</artifactId> |
183 | 183 |
<version>${spring.version}</version> |
184 | 184 |
</dependency> |
185 |
|
|
185 | 186 |
<dependency> |
187 |
<groupId>org.springframework</groupId> |
|
188 |
<artifactId>spring-jdbc</artifactId> |
|
189 |
<version>${spring.version}</version> |
|
190 |
</dependency> |
|
191 |
|
|
192 |
<dependency> |
|
186 | 193 |
<groupId>com.sun.jersey</groupId> |
187 | 194 |
<artifactId>jersey-client</artifactId> |
188 | 195 |
<version>1.19.3</version> |
Also available in: Unified diff
1. Broker api ready.
2. Piwi api ready.
3. Create repomanager.datasource bean.