IR Report no Identifier selection
This commit is contained in:
parent
5a2d8fe1eb
commit
9ba8cc6bbd
|
@ -1,6 +1,7 @@
|
||||||
package eu.dnetlib.usagestats.controllers;
|
package eu.dnetlib.usagestats.controllers;
|
||||||
|
|
||||||
import eu.dnetlib.usagestats.services.SushiLiteService;
|
import eu.dnetlib.usagestats.services.SushiLiteService;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -83,7 +84,7 @@ class SushiLiteController {
|
||||||
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
|
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
|
||||||
@RequestParam(value = "BeginDate", defaultValue = "") String beginDate,
|
@RequestParam(value = "BeginDate", defaultValue = "") String beginDate,
|
||||||
@RequestParam(value = "EndDate", defaultValue = "") String endDate,
|
@RequestParam(value = "EndDate", defaultValue = "") String endDate,
|
||||||
@RequestParam(value = "MetricType", defaultValue = "") String metricType,
|
@RequestParam(value = "MetricType", defaultValue = "") List<String> metricType,
|
||||||
@RequestParam(value = "DataType", defaultValue = "") String dataType,
|
@RequestParam(value = "DataType", defaultValue = "") String dataType,
|
||||||
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) {
|
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) {
|
||||||
log.info("COUNTER TR Report request for repository " + repositoryIdentifier +" and for item "+ itemIdentifier);
|
log.info("COUNTER TR Report request for repository " + repositoryIdentifier +" and for item "+ itemIdentifier);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,9 @@ import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Report;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Title_Report;
|
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Title_Report;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface SushiLiteService {
|
public interface SushiLiteService {
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ public interface SushiLiteService {
|
||||||
COUNTER_Platform_Report buildReportPR_P1(String customerID, String repositoryIdentifier, String beginDate,String endDate);
|
COUNTER_Platform_Report buildReportPR_P1(String customerID, String repositoryIdentifier, String beginDate,String endDate);
|
||||||
String displayReportPR_P1(String customerID, String repositoryIdentifier, String beginDate, String endDate);
|
String displayReportPR_P1(String customerID, String repositoryIdentifier, String beginDate, String endDate);
|
||||||
|
|
||||||
COUNTER_Item_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
|
COUNTER_Item_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, List<String> metricType, String dataType,String granularity) throws Exception;
|
||||||
String displayReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
|
String displayReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, List<String> metricType, String dataType,String granularity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import eu.dnetlib.usagestats.sushilite.domain.ReportResponse;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportSupported;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportSupported;
|
||||||
|
import java.sql.SQLException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -462,7 +463,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COUNTER_Item_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
public COUNTER_Item_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
||||||
String endDate, String metricType, String dataType, String granularity) {
|
String endDate, List<String> metricType, String dataType, String granularity) throws Exception {
|
||||||
|
|
||||||
ZonedDateTime dateTime = ZonedDateTime.now(); // Gets the current date and time, with your default time-zone
|
ZonedDateTime dateTime = ZonedDateTime.now(); // Gets the current date and time, with your default time-zone
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
@ -570,7 +571,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
||||||
// reportExceptions.add(new SUSHI_Error_Model("3030", "Error", "usagecounts.openaire.eu", "No Usage Available for Requested Dates", "Service did not find any data"));
|
// reportExceptions.add(new SUSHI_Error_Model("3030", "Error", "usagecounts.openaire.eu", "No Usage Available for Requested Dates", "Service did not find any data"));
|
||||||
// }
|
// }
|
||||||
// } else if (!repoid.equals("")) {
|
// } else if (!repoid.equals("")) {
|
||||||
usageStatsRepository.executeBatchItemsIR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, "Article", granularity);
|
usageStatsRepository.executeBatchItemsIR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
|
||||||
|
|
||||||
if (reportItems.isEmpty()) {
|
if (reportItems.isEmpty()) {
|
||||||
reportExceptions.add(new SUSHI_Error_Model("3030", "Error", "usagecounts.openaire.eu", "No Usage Available for Requested Dates", "Service did not find any data"));
|
reportExceptions.add(new SUSHI_Error_Model("3030", "Error", "usagecounts.openaire.eu", "No Usage Available for Requested Dates", "Service did not find any data"));
|
||||||
|
@ -653,6 +654,8 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
||||||
|
|
||||||
return reportResponse;
|
return reportResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public COUNTER_Title_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
// public COUNTER_Title_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
||||||
// String endDate, String metricType, String dataType, String granularity) {
|
// String endDate, String metricType, String dataType, String granularity) {
|
||||||
|
@ -761,12 +764,12 @@ public class SushiLiteServiceImpl implements SushiLiteService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String displayReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
public String displayReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
|
||||||
String endDate, String metricType, String dataType, String granularity) {
|
String endDate, List<String> metricType, String dataType, String granularity) {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
log.info((beginDate + " " + endDate));
|
log.info((beginDate + " " + endDate));
|
||||||
try {
|
try {
|
||||||
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportIR(customerID, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
|
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportIR(customerID, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
|
||||||
} catch (JsonProcessingException ex) {
|
} catch (Exception ex) {
|
||||||
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
|
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue