Revision 57549
Added by Ioannis Diplas over 4 years ago
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java | ||
---|---|---|
248 | 248 |
requestFilter.setRegisteredby(userEmail); |
249 | 249 |
|
250 | 250 |
try{ |
251 |
long start = System.currentTimeMillis(); |
|
251 | 252 |
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); |
253 |
long end = System.currentTimeMillis(); |
|
252 | 254 |
|
255 |
System.out.println("POST request finished in " + (end-start)+"ms"); |
|
256 |
start=System.currentTimeMillis(); |
|
253 | 257 |
List<Repository> repos = Converter.jsonToRepositoryList(new JSONObject(rs)); |
258 |
end=System.currentTimeMillis(); |
|
259 |
System.out.println("Converting json to repo list finished in " + (end-start)+"ms"); |
|
260 |
start=System.currentTimeMillis(); |
|
254 | 261 |
for (Repository r : repos) |
255 | 262 |
this.updateRepositoryInfo(r); |
256 |
|
|
263 |
end=System.currentTimeMillis(); |
|
264 |
System.out.println("Updating "+repos.size()+" repository infos in " + (end-start)+"ms"); |
|
257 | 265 |
return repos; |
258 | 266 |
}catch (Exception e){ |
259 | 267 |
LOGGER.debug("Exception on getRepositoriesOfUser" , e); |
... | ... | |
300 | 308 |
List<AggregationDetails> aggregationHistory = new ArrayList<>(); |
301 | 309 |
|
302 | 310 |
try { |
311 |
long start = System.currentTimeMillis(); |
|
303 | 312 |
String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); |
313 |
long end = System.currentTimeMillis(); |
|
314 |
|
|
315 |
System.out.println("Aggregations request through rest template took " + (end-start)+"ms"); |
|
304 | 316 |
JSONObject repository = new JSONObject(rs); |
305 | 317 |
|
306 | 318 |
if(repository.getJSONArray("datasourceInfo").length() == 0) |
307 | 319 |
return aggregationHistory; |
320 |
|
|
321 |
start = System.currentTimeMillis(); |
|
308 | 322 |
aggregationHistory.addAll(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); |
323 |
end = System.currentTimeMillis(); |
|
324 |
|
|
325 |
System.out.println("Getting aggregations history from json " + (end-start)+"ms"); |
|
309 | 326 |
return aggregationHistory.size() == 0? aggregationHistory : aggregationHistory.stream() |
310 | 327 |
.sorted(Comparator.comparing(AggregationDetails::getDate).reversed()) |
311 | 328 |
.limit(size) |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/DashboardServiceImpl.java | ||
---|---|---|
49 | 49 |
repositorySummaryInfo.setLogoURL(repository.getLogoUrl()); |
50 | 50 |
|
51 | 51 |
//TODO getRepositoryAggregations returns only the 20 more recent items. Is it positive that we will find an indexed version there? |
52 |
long start = System.currentTimeMillis(); |
|
52 | 53 |
List<AggregationDetails> aggregationDetailsList = repositoryService.getRepositoryAggregations(repository.getId(),0,20); |
53 | 54 |
for(AggregationDetails aggregationDetails: aggregationDetailsList) { |
54 | 55 |
if(aggregationDetails.getIndexedVersion()) { |
... | ... | |
57 | 58 |
break; |
58 | 59 |
} |
59 | 60 |
} |
61 |
long end = System.currentTimeMillis(); |
|
60 | 62 |
|
63 |
System.out.println("Got repo aggregations in "+ (end-start)+"ms"); |
|
64 |
|
|
61 | 65 |
try { |
62 | 66 |
|
63 | 67 |
MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId()); |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/RepositoryController.java | ||
---|---|---|
75 | 75 |
@RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET, |
76 | 76 |
produces = MediaType.APPLICATION_JSON_VALUE) |
77 | 77 |
@ResponseBody |
78 |
@PostAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((returnObject.registeredBy==authentication.userInfo.email or returnObject.registeredBy==null) and hasRole('ROLE_USER'))")
|
|
78 |
@PostAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((returnObject.registeredBy=='null' or returnObject.registeredBy==authentication.userInfo.email) and hasRole('ROLE_USER'))")
|
|
79 | 79 |
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException,ResourceNotFoundException { |
80 |
return repositoryService.getRepositoryById(id); |
|
80 |
Repository repo = repositoryService.getRepositoryById(id); |
|
81 |
return repo; |
|
81 | 82 |
} |
82 | 83 |
|
83 | 84 |
@RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET, |
... | ... | |
106 | 107 |
@RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET, |
107 | 108 |
produces = MediaType.APPLICATION_JSON_VALUE) |
108 | 109 |
@ResponseBody |
109 |
@PostAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#id).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#id).registeredBy==null ) and hasRole('ROLE_USER'))")
|
|
110 |
@PostAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#id).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#id).registeredBy=='null' ) and hasRole('ROLE_USER'))")
|
|
110 | 111 |
public List<RepositoryInterface> getRepositoryInterface(@PathVariable("id") String id) throws JSONException { |
111 | 112 |
return repositoryService.getRepositoryInterface(id); |
112 | 113 |
} |
... | ... | |
114 | 115 |
@RequestMapping(value = "/addRepository", method = RequestMethod.POST, |
115 | 116 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
116 | 117 |
@ResponseBody |
117 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((#repository.registeredBy==authentication.userInfo.email or returnObject.registeredBy==null) and hasRole('ROLE_USER'))")
|
|
118 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((#repository.registeredBy==authentication.userInfo.email or returnObject.registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
118 | 119 |
public Repository addRepository(@RequestParam("datatype") String datatype, |
119 | 120 |
@RequestBody Repository repository) throws Exception { |
120 | 121 |
|
... | ... | |
145 | 146 |
@RequestMapping(value = "/updateRepository", method = RequestMethod.POST, |
146 | 147 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
147 | 148 |
@ResponseBody |
148 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((#repository.registeredBy==authentication.userInfo.email or #repository.registeredBy==null) and hasRole('ROLE_USER'))")
|
|
149 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((#repository.registeredBy==authentication.userInfo.email or #repository.registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
149 | 150 |
public Repository updateRepository(@RequestBody Repository repository,Authentication authentication) throws Exception { |
150 | 151 |
return repositoryService.updateRepository(repository, authentication); |
151 | 152 |
} |
... | ... | |
160 | 161 |
@RequestMapping(value = "/addInterface", method = RequestMethod.POST, |
161 | 162 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
162 | 163 |
@ResponseBody |
163 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy==null) and hasRole('ROLE_USER'))")
|
|
164 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
164 | 165 |
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, |
165 | 166 |
@RequestParam("repoId") String repoId, |
166 | 167 |
@RequestParam("registeredBy") String registeredBy, |
... | ... | |
217 | 218 |
@RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST, |
218 | 219 |
consumes = MediaType.APPLICATION_JSON_VALUE) |
219 | 220 |
@ResponseBody |
220 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy==null) and hasRole('ROLE_USER'))")
|
|
221 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repoId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repoId).registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
221 | 222 |
public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId, |
222 | 223 |
@RequestParam("registeredBy") String registeredBy, |
223 | 224 |
@RequestBody RepositoryInterface repositoryInterface) throws Exception { |
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/controllers/PiWikController.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
@RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) |
50 | 50 |
@ResponseBody |
51 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repositoryId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repositoryId).registeredBy==null) and hasRole('ROLE_USER'))")
|
|
51 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#repositoryId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#repositoryId).registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
52 | 52 |
public PiwikInfo getPiwikSiteForRepo(@PathVariable("repositoryId") String repositoryId) { |
53 | 53 |
return piWikService.getPiwikSiteForRepo(repositoryId); |
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
@RequestMapping(value = "/savePiwikInfo" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) |
57 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy==null) and hasRole('ROLE_USER'))")
|
|
57 |
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or ((@repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy==authentication.userInfo.email or @repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy=='null') and hasRole('ROLE_USER'))")
|
|
58 | 58 |
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) { |
59 | 59 |
return piWikService.savePiwikInfo(piwikInfo); |
60 | 60 |
} |
modules/uoa-repository-manager-service/trunk/pom.xml | ||
---|---|---|
298 | 298 |
<failOnMissingWebXml>false</failOnMissingWebXml> |
299 | 299 |
</configuration> |
300 | 300 |
</plugin> |
301 |
<plugin> |
|
302 |
<groupId>cz.habarta.typescript-generator</groupId> |
|
303 |
<artifactId>typescript-generator-maven-plugin</artifactId> |
|
304 |
<version>2.1.406</version> |
|
305 |
<executions> |
|
306 |
<execution> |
|
307 |
<id>java to typeScript</id> |
|
308 |
<goals> |
|
309 |
<goal>generate</goal> |
|
310 |
</goals> |
|
311 |
<configuration> |
|
312 |
<jsonLibrary>jackson2</jsonLibrary> |
|
313 |
<outputFileType>implementationFile</outputFileType> |
|
314 |
<mapClasses>asClasses</mapClasses> |
|
315 |
<classPatterns> |
|
316 |
<pattern>eu.dnetlib.domain.functionality.validator.*</pattern> |
|
317 |
</classPatterns> |
|
318 |
<outputFile>target/operation.ts</outputFile> |
|
319 |
<outputKind>module</outputKind> |
|
320 |
</configuration> |
|
321 |
</execution> |
|
322 |
</executions> |
|
323 |
</plugin> |
|
301 | 324 |
</plugins> |
302 | 325 |
<finalName>uoa-repository-manager-service</finalName> |
303 | 326 |
<resources> |
Also available in: Unified diff
String comparison for NULL equity