53 lines
3.0 KiB
Java
53 lines
3.0 KiB
Java
|
package eu.dnetlib.repo.manager.controllers;
|
||
|
|
||
|
import eu.dnetlib.repo.manager.service.SushiliteApiImpl;
|
||
|
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
|
||
|
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
||
|
import io.swagger.annotations.Api;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
import org.springframework.core.ParameterizedTypeReference;
|
||
|
import org.springframework.http.HttpMethod;
|
||
|
import org.springframework.http.MediaType;
|
||
|
import org.springframework.http.ResponseEntity;
|
||
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||
|
import org.springframework.stereotype.Component;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
import org.springframework.web.client.RestClientException;
|
||
|
import org.springframework.web.client.RestTemplate;
|
||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
@RestController
|
||
|
@RequestMapping(value = "/sushilite")
|
||
|
@Api(description = "Sushi-Lite API", tags = {"sushilite"})
|
||
|
public class SushiliteController {
|
||
|
|
||
|
|
||
|
@Autowired
|
||
|
SushiliteApiImpl sushiliteApi;
|
||
|
|
||
|
@RequestMapping(value = "/getReportResults/{page}/{pageSize}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||
|
@ResponseBody
|
||
|
@PreAuthorize("hasRole('ROLE_USER')")
|
||
|
public ReportResponseWrapper getReportResults(@PathVariable("page") String page,
|
||
|
@PathVariable("pageSize") String pageSize,
|
||
|
@RequestParam(value = "Report") String Report,
|
||
|
@RequestParam(value = "Release",defaultValue="4") String Release,
|
||
|
@RequestParam(value = "RequestorID",required=false,defaultValue="anonymous") String RequestorID,
|
||
|
@RequestParam(value = "BeginDate",required=false,defaultValue="") String BeginDate,
|
||
|
@RequestParam(value = "EndDate",required=false,defaultValue="") String EndDate,
|
||
|
@RequestParam(value = "RepositoryIdentifier") String RepositoryIdentifier,
|
||
|
@RequestParam(value = "ItemIdentifier",required=false,defaultValue="") String ItemIdentifier,
|
||
|
@RequestParam(value = "ItemDataType",required=false,defaultValue="") String ItemDataType,
|
||
|
@RequestParam(value = "Granularity") String Granularity,
|
||
|
@RequestParam(value = "Pretty",required=false,defaultValue="") String Pretty) {
|
||
|
|
||
|
return sushiliteApi.getReportResults(page, pageSize, Report, Release, RequestorID, BeginDate, EndDate, RepositoryIdentifier, ItemIdentifier, ItemDataType, Granularity, Pretty);
|
||
|
}
|
||
|
|
||
|
}
|