Beta version 14032021

This commit is contained in:
Dimitris 2021-03-14 16:24:14 +02:00
parent f31744a613
commit 3b6f93c03f
17 changed files with 2876 additions and 543 deletions

1
runme.sh Executable file
View File

@ -0,0 +1 @@
java -jar target/usagestats_r5.jar --spring.config.location=file:./usageStatsAPI.properties &

View File

@ -6,10 +6,10 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.retry.annotation.EnableRetry;
@PropertySources({
@PropertySource("classpath:usageStatsAPI.properties"), //@PropertySource("classpath:dnet-override.properties")
}
)
//@PropertySources({
// @PropertySource("classpath:usageStatsAPI.properties"), //@PropertySource("classpath:dnet-override.properties")
//}
//)
@EnableRetry
@SpringBootApplication
public class UsageStatsApi {

View File

@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Created by dpie on 25/01/2021.
* Created by D.Pierrakos.
*/
@Configuration
public class DataSourceConfiguration {
@ -46,6 +46,12 @@ public class DataSourceConfiguration {
//log.info("driverClassName " + driverClassName);
//
// hikariConfig.setMaximumPoolSize(5);
// hikariConfig.setMaximumPoolSize(100);
// hikariConfig.setIdleTimeout(300);
// hikariConfig.setMaximumPoolSize(20);
// hikariConfig.setConnectionTimeout(300000);
// hikariConfig.setConnectionTimeout(120000);
// hikariConfig.setLeakDetectionThreshold(300000);
hikariConfig.setConnectionTestQuery("SELECT 1");
hikariConfig.setPoolName("UsageStats_HikariCP");

View File

@ -35,6 +35,15 @@ public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
registry.addViewController("/sushilite/BR2").setViewName("redirect:/sushilite/BR2/");
registry.addViewController("/sushilite/BR2/").setViewName("forward:/sushilite/BR2/index.html");
registry.addViewController("/sushilite/PR").setViewName("redirect:/sushilite/PR/");
registry.addViewController("/sushilite/PR/").setViewName("forward:/sushilite/PR/index.html");
registry.addViewController("/sushilite/PR_P1").setViewName("redirect:/sushilite/PR_P1/");
registry.addViewController("/sushilite/PR_P1/").setViewName("forward:/sushilite/PR_P1/index.html");
registry.addViewController("/sushilite/IR").setViewName("redirect:/sushilite/IR/");
registry.addViewController("/sushilite/IR/").setViewName("forward:/sushilite/IR/index.html");
super.addViewControllers(registry);
}
}

View File

@ -1,16 +1,29 @@
package eu.dnetlib.usagestats.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.usagestats.services.SushiLiteService;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by dpie on 30/12/2020.
* Created by D.Pierrakos
*/
@RestController
class SushiLiteController {
@ -18,6 +31,8 @@ class SushiLiteController {
private final Logger log = Logger.getLogger(this.getClass());
private final SushiLiteService sushiLiteService;
@Value("${download.folder}")
private String download_folder;
public SushiLiteController(SushiLiteService sushiLiteService) {
this.sushiLiteService = sushiLiteService;
@ -42,7 +57,6 @@ class SushiLiteController {
//
// return sushiLiteService.displayReport(reportP, release, requestorId, beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, hasDoi, granularity, callback, pretty);
// }
@RequestMapping(value = "/sushilite/r5/status", method = RequestMethod.GET)
public String getReportStatus() {
log.info("COUNTER Report status request ");
@ -55,17 +69,10 @@ class SushiLiteController {
return sushiLiteService.displayReportsSupported();
}
@RequestMapping(value = "/sushilite/r5/reports/pr", method = RequestMethod.GET)
public String getReportPR(
@RequestParam(value = "RepositoryIdentifier", defaultValue = "") String repositoryIdentifier,
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
@RequestParam(value = "BeginDate", defaultValue = "") String beginDate,
@RequestParam(value = "EndDate", defaultValue = "") String endDate,
@RequestParam(value = "MetricType", defaultValue = "") String metricType,
@RequestParam(value = "DataType", defaultValue = "") String dataType,
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) {
log.info("COUNTER PR Report request for repository " + repositoryIdentifier);
return sushiLiteService.displayReportPR(requestorId,repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity);
@RequestMapping(value = "/sushilite/r5/members", method = RequestMethod.GET)
public String getMembers() {
log.info("COUNTER Members request ");
return sushiLiteService.displayConsortiumMemberList();
}
@RequestMapping(value = "/sushilite/r5/reports/pr_p1", method = RequestMethod.GET)
@ -77,8 +84,9 @@ class SushiLiteController {
log.info("COUNTER PR_P1 Report request for repository " + repositoryIdentifier);
return sushiLiteService.displayReportPR_P1(requestorId, repositoryIdentifier, beginDate, endDate);
}
@RequestMapping(value = "/sushilite/r5/reports/ir", method = RequestMethod.GET)
public String getReportTR(
public ResponseEntity getReportΙR(
@RequestParam(value = "RepositoryIdentifier", defaultValue = "") String repositoryIdentifier,
@RequestParam(value = "ItemIdentifier", defaultValue = "") String itemIdentifier,
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
@ -87,7 +95,65 @@ class SushiLiteController {
@RequestParam(value = "MetricType", defaultValue = "") List<String> metricType,
@RequestParam(value = "DataType", defaultValue = "") String dataType,
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) {
log.info("COUNTER TR Report request for repository " + repositoryIdentifier +" and for item "+ itemIdentifier);
return sushiLiteService.displayReportIR(requestorId, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
log.info("COUNTER ΙR Report request for repository " + repositoryIdentifier + " and for item " + itemIdentifier);
String report = sushiLiteService.displayReportIR(requestorId, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
if (report.indexOf(".zip") < 0) {
return new ResponseEntity<>(report, HttpStatus.OK);
} else {
String compressedOutput = "<pre> {\"Report\":\"IR\", \"Description\":\"Compressed Report Due to large number of records\", \"URL To Download Report from: \":\"" + report + "\"} </pre>";
return new ResponseEntity<>(compressedOutput, HttpStatus.OK);
}
}
@RequestMapping(value = "/sushilite/r5/reports/dsr", method = RequestMethod.GET)
public String getReportDSR(
@RequestParam(value = "RepositoryIdentifier", defaultValue = "") String repositoryIdentifier,
@RequestParam(value = "ItemIdentifier", defaultValue = "") String itemIdentifier,
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
@RequestParam(value = "BeginDate", defaultValue = "") String beginDate,
@RequestParam(value = "EndDate", defaultValue = "") String endDate,
@RequestParam(value = "MetricType", defaultValue = "") List<String> metricType,
@RequestParam(value = "DataType", defaultValue = "") String dataType,
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) {
log.info("COUNTER ΙR Report request for repository " + repositoryIdentifier + " and for item " + itemIdentifier);
return sushiLiteService.displayReportDSR(requestorId, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
}
@RequestMapping(value = "/download/{file_name}", method = RequestMethod.GET)
public void downloadFile(HttpServletResponse response, @PathVariable("file_name") String filetoDownload) throws IOException {
File file = new File(download_folder + "/" + filetoDownload);
log.info("File downloaded at " + file.getAbsolutePath());
String mimeType = "application/octet-stream";
response.setContentType(mimeType);
/* "Content-Disposition : attachment" will be directly download, may provide save as popup, based on your browser setting*/
response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getName()));
response.setContentLength((int) file.length());
InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
FileCopyUtils.copy(inputStream, response.getOutputStream());
}
@RequestMapping(value = "/sushilite/r5/reports/pr", method = RequestMethod.GET)
public ResponseEntity<String> getReportPR(@RequestParam(value = "RepositoryIdentifier", defaultValue = "") String repositoryIdentifier,
@RequestParam(value = "RequestorID", defaultValue = "anonymous") String requestorId,
@RequestParam(value = "BeginDate", defaultValue = "") String beginDate,
@RequestParam(value = "EndDate", defaultValue = "") String endDate,
@RequestParam(value = "MetricType", defaultValue = "") String metricType,
@RequestParam(value = "DataType", defaultValue = "") String dataType,
@RequestParam(value = "Granularity", defaultValue = "Monthly") String granularity) throws InterruptedException, Exception {
String report = sushiLiteService.displayReportPR(requestorId, repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity);
if (report.indexOf(".zip") < 0) {
return new ResponseEntity<>(report, HttpStatus.OK);
} else {
String compreessedOutput = "<pre> {\"Report\":\"PR\", \"Description\":\"Compressed Report Due to large number of records\", \"URL To Download Report from: \":\"" + report + "\"} </pre>";
return new ResponseEntity<>(compreessedOutput, HttpStatus.OK);
}
}
}

View File

@ -1,10 +1,12 @@
package eu.dnetlib.usagestats.services;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Dataset_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Item_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Title_Report;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Consortium_Member_List;
import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Service_Status;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@ -19,12 +21,15 @@ public interface SushiLiteService {
// String endDate, String repositoryIdentifier, String itemIdentifier,
// String itemDataType, String hasDoi, String granularity, String callback, String pretty);
ReportStatus buildReportStatus();
SUSHI_Service_Status buildReportStatus();
String displayReportStatus();
ArrayList buildReportSupported();
String displayReportsSupported();
ArrayList buildMembersList();
String displayConsortiumMemberList();
COUNTER_Platform_Report buildReportPR(String customerID, String repositoryIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
String displayReportPR(String customerID, String repositoryIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
@ -34,4 +39,6 @@ public interface SushiLiteService {
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, List<String> metricType, String dataType,String granularity);
COUNTER_Dataset_Report buildReportDSR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, List<String> metricType, String dataType,String granularity) throws Exception;
String displayReportDSR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, List<String> metricType, String dataType,String granularity);
}

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.usagestats.repositories.UsageStatsRepository;
import eu.dnetlib.usagestats.sushilite.domain.Alert;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Dataset_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Dataset_Usage;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Item_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Item_Usage;
import eu.dnetlib.usagestats.sushilite.domain.Filter;
@ -11,12 +13,13 @@ import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Org_Identifiers;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Usage;
import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Error_Model;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Report;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Title_Report;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponse;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
import eu.dnetlib.usagestats.sushilite.domain.ReportSupported;
import java.sql.SQLException;
import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Service_Status;
import eu.dnetlib.usagestats.sushilite.domain.SUSHI_Report_List;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
@ -27,7 +30,10 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
@Service
public class SushiLiteServiceImpl implements SushiLiteService {
@ -36,6 +42,17 @@ public class SushiLiteServiceImpl implements SushiLiteService {
private final Logger log = Logger.getLogger(this.getClass());
@Value("${compression.max_number_of_records}")
private int compression_max_number_of_records;
@Value("${download.folder}")
private String download_folder;
@Value("${sushi-lite.server}")
private String sushi_lite_server;
boolean reportForCompression = false;
public SushiLiteServiceImpl(UsageStatsRepository usageStatsRepository) {
this.usageStatsRepository = usageStatsRepository;
}
@ -250,26 +267,40 @@ public class SushiLiteServiceImpl implements SushiLiteService {
}
@Override
public ReportStatus buildReportStatus() {
public SUSHI_Service_Status buildReportStatus() {
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'");
Alert alert1 = new Alert("2020-12-28T13:32:44.632Z", "string");
Alert alert2 = new Alert(dateTime.format(formatter), "string");
Alert alert = new Alert(dateTime.format(formatter), "No alert");
ArrayList alertsList = new ArrayList();
alertsList.add(alert1);
alertsList.add(alert2);
alertsList.add(alert);
try {
if (usageStatsRepository.checkServiceConnection() == true) {
ReportStatus reportStatus = new ReportStatus("desctiption", true, "registry_url", "note", alertsList);
return (reportStatus);
SUSHI_Service_Status reportStatus = new SUSHI_Service_Status("COUNTER R5 Usage Reports by OpenAIRE UsageCounts Service", true, "https://provide.openaire.eu", "UsageCounts Service Info: https://usagecounts.openaire.eu", alertsList);
return (reportStatus);
} else {
return null;
}
} catch (Exception e) {
System.out.println(e);
}
return null;
}
@Override
public String displayReportStatus() {
ObjectMapper objectMapper = new ObjectMapper();
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportStatus()) + "</pre>";
if (buildReportStatus() != null) {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportStatus()) + "</pre>";
} else {
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'");
SUSHI_Error_Model errorModel = new SUSHI_Error_Model("1000", "Fatal", "Service Not Available", "usagecounts.openaire.eu", "Request was for: " + dateTime.format(formatter));
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorModel) + "</pre>";
}
} catch (JsonProcessingException ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
@ -279,11 +310,19 @@ public class SushiLiteServiceImpl implements SushiLiteService {
@Override
public ArrayList buildReportSupported() {
ArrayList reportSupportedList = new ArrayList();
ReportSupported r1 = new ReportSupported("Report_Name", "Report_ID", "Release", "Report_Description", "Path");
ReportSupported r2 = new ReportSupported("Report_Name2", "Report_ID2", "Release2", "Report_Description2", "Path2");
SUSHI_Report_List r1 = new SUSHI_Report_List("Status Report", "", "5", "Current status of the reporting service supported by this API", "/status");
SUSHI_Report_List r2 = new SUSHI_Report_List("Members Report", "", "5", "List of UsageCounts members", "/members");
SUSHI_Report_List r3 = new SUSHI_Report_List("List Of Reports Report", "", "5", "List of reports supported by the API", "/reports/");
SUSHI_Report_List r4 = new SUSHI_Report_List("Platform Master Report PR", "PR", "5", "A customizable report summarizing activity across a providers platforms that allows the user to apply filters and select other configuration options for the report. ", "/PR");
SUSHI_Report_List r5 = new SUSHI_Report_List("Platform Usage Report", "PR_P1", "5", "Standard View of the Package Master Report that presents usage for the overall Platform broken down by Metric_Type.", "/PR_1");
SUSHI_Report_List r6 = new SUSHI_Report_List("Platform Item Report", "IR", "5", "COUNTER 'Item Master Report", "/IR");
reportSupportedList.add(r1);
reportSupportedList.add(r2);
reportSupportedList.add(r3);
reportSupportedList.add(r4);
reportSupportedList.add(r5);
reportSupportedList.add(r6);
return reportSupportedList;
}
@ -301,14 +340,19 @@ public class SushiLiteServiceImpl implements SushiLiteService {
}
@Override
public COUNTER_Platform_Report buildReportPR(String customerID, String repositoryIdentifier, String beginDate,
public COUNTER_Platform_Report buildReportPR(String customerID, String repoID, String beginDate,
String endDate, String metricType, String dataType, String granularity) {
List<SUSHI_Error_Model> reportExceptions = new ArrayList<>();
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'");
//Display Report Created Day
repositoryIdentifier = usageStatsRepository.getInstitutionID(repositoryIdentifier);
String repositoryIdentifier = usageStatsRepository.getInstitutionID(repoID);
if (!repositoryIdentifier.equals("")) {
if (repositoryIdentifier.equals("-1")) {
reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "RepositoryIdentifier: " + repoID + " is not valid"));
}
}
Date beginDateParsed;
if (!beginDate.equals("")) {
@ -318,6 +362,8 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.setTime(beginDateParsed);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
} else if (beginDateParsed == null) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
}
} else {
Calendar temp = Calendar.getInstance();
@ -335,6 +381,8 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.setTime(endDateParsed);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
} else if (endDateParsed == null) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
}
} else {
Calendar temp = Calendar.getInstance();
@ -366,20 +414,31 @@ public class SushiLiteServiceImpl implements SushiLiteService {
institutionIdD.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
List<COUNTER_Platform_Usage> reportItems = new ArrayList();
usageStatsRepository.executeBatchItemsPR(reportItems, repositoryIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
if (reportExceptions.size() == 0) {
reportExceptions = null;
usageStatsRepository.executeBatchItemsPR(reportItems, repositoryIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
}
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"));
}
if (reportExceptions.size() == 0) {
reportExceptions = null;
}
// if (reportExceptions.size() == 0) {
// reportExceptions = null;
// }
COUNTER_Platform_Report reportPr = new COUNTER_Platform_Report(dateTime.format(formatter), customerID, reportID, reportName, institutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
log.info("Total report items " + reportItems.size());
if (reportItems.size() > compression_max_number_of_records) {
log.info("Compression due to " + reportItems.size());
reportForCompression = true;
}
return reportPr;
}
@Override
public COUNTER_Platform_Report buildReportPR_P1(String customerID, String repositoryIdentifier,
public COUNTER_Platform_Report buildReportPR_P1(String customerID, String repoID,
String beginDate,
String endDate) {
String granularity = "monthly";
@ -389,8 +448,12 @@ public class SushiLiteServiceImpl implements SushiLiteService {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
//Display Report Created Day
repositoryIdentifier = usageStatsRepository.getInstitutionID(repositoryIdentifier);
String repositoryIdentifier = usageStatsRepository.getInstitutionID(repoID);
if (!repositoryIdentifier.equals("")) {
if (repositoryIdentifier.equals("-1")) {
reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "RepositoryIdentifier: " + repoID + " is not valid"));
}
}
Date beginDateParsed;
if (!beginDate.equals("")) {
beginDateParsed = tryParse(beginDate);
@ -461,7 +524,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
}
@Override
public COUNTER_Item_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
public COUNTER_Item_Report buildReportIR(String customerID, String repoID, String itemIdentifier, String beginDate,
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
@ -474,7 +537,177 @@ public class SushiLiteServiceImpl implements SushiLiteService {
reportFilters.add(new Filter("BeginDate", beginDate));
reportFilters.add(new Filter("EndDate", endDate));
repositoryIdentifier = usageStatsRepository.getInstitutionID(repositoryIdentifier);
String repositoryIdentifier = "";
if (!repoID.equals("")) {
repositoryIdentifier = usageStatsRepository.getInstitutionID(repoID);
if (repositoryIdentifier.equals("-1")) {
reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "RepositoryIdentifier: " + repoID + " is not valid"));
}
}
orgIdentifiers.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
if (!granularity.equalsIgnoreCase("totals") && !granularity.equalsIgnoreCase("monthly")) {
reportExceptions.add(new SUSHI_Error_Model("3062", "Warning", "Invalid ReportAttribute Value", "usagecounts.openaire.eu", "Granularity: \'" + granularity + "\' unknown. Defaulting to Monthly"));
granularity = "Monthly";
}
Date beginDateParsed;
if (!beginDate.equals("")) {
beginDateParsed = tryParse(beginDate);
if (beginDateParsed != null && (granularity.toLowerCase().equals("monthly") || beginDate.length() == 7)) {
Calendar temp = Calendar.getInstance();
temp.setTime(beginDateParsed);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
} else if (beginDateParsed == null) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "Invalid Date Arguments", "usagecounts.openaire.eu", "Begin Date: " + beginDate + " is not a valid date"));
}
} else {
Calendar temp = Calendar.getInstance();
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "Unspecified Date Arguments", "usagecounts.openaire.eu", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
}
Date endDateParsed;
if (!endDate.equals("")) {
endDateParsed = tryParse(endDate);
if (endDateParsed != null && (granularity.toLowerCase().equals("monthly") || endDate.length() == 7)) {
Calendar temp = Calendar.getInstance();
temp.setTime(endDateParsed);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
} else if (endDateParsed == null) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "Invalid Date Arguments", "usagecounts.openaire.eu", "End Date: " + endDate + " is not a valid date"));
}
} else {
Calendar temp = Calendar.getInstance();
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "Unspecified Date Arguments", "usagecounts.openaire.eu", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
}
// if (beginDateParsed == null) {
// reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "Invalid Date Arguments", "usagecounts.openaire.eu", "Begin Date: " + beginDate + " is not a valid date"));
// }
// if (endDateParsed == null) {
// reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "Invalid Date Arguments", "usagecounts.openaire.eu", "End Date: " + endDate + " is not a valid date"));
// }
if (beginDateParsed != null && endDateParsed != null && !beginDateParsed.before(endDateParsed)) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "Invalid Date Arguments", "usagecounts.openaire.eu", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
}
String institutionName=null;
if(repositoryIdentifier!="-1")
institutionName = usageStatsRepository.getInstitutionName(repositoryIdentifier);
//if (!repositoryIdentifier.equals("")) {
// repoid = usageStatsRepository.getInstitutionID(repositoryIdentifier);
// if (repositoryIdentifier.equals("-1")) {
// reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "RepositoryIdentifier: " + repoID + " is not valid"));
// }
//}
String itemid = "";
if (!itemIdentifier.equals("")) {
String[] split = itemIdentifier.split(":");
switch (split[0].toLowerCase()) {
case "oid":
itemid = itemIdentifier;
break;
case "doi":
itemid = itemIdentifier;
break;
// case "openaire":
// itemid = itemIdentifier;
// break;
default:
reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "ItemIdentifier: " + itemIdentifier + " is not valid"));
itemid = "-1";
}
}
if (itemid.equals("") && repoID.equals("")) {
reportExceptions.add(new SUSHI_Error_Model("3070", "Error", "Required Filter Missing", "usagecounts.openaire.eu", "ItemIdentifier or RepositoryIdentifier must be supplied"));
}
//if (reportName.equalsIgnoreCase("ar1")) {
if (!itemid.equals("-1") && !repositoryIdentifier.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
if (!itemid.equals("") && !repositoryIdentifier.equals("")) {
//if (dataType.equalsIgnoreCase("") || dataType.equalsIgnoreCase("article")) {
if (reportExceptions.size() == 0) {
//reportExceptions = null;
usageStatsRepository.executeItemIR(reportItems, repositoryIdentifier, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
}
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"));
}
// } else {
//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("")) {
if (reportExceptions.size() == 0) {
//reportExceptions = null;
usageStatsRepository.executeBatchItemsIR(reportItems, repositoryIdentifier, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
}
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"));
}
}
}
if (repoID.equals("")) {
if (reportExceptions.isEmpty()) {
//reportExceptions = null;
usageStatsRepository.executeItemIR(reportItems, null, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
}
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"));
}
}
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"));
}
//} else if (reportName.equals("")) {
// reportExceptions.add(new SUSHI_Error_Model("3050", "Error", "usagecounts.openaire.eu", "Report argument is missing", "You must supply a Report argument"));
//} else {
// reportExceptions.add(new SUSHI_Error_Model("3000", "Error", "usagecounts.openaire.eu", "Report " + reportName + " not supported", "Supported reports: AR1, IR1, RR1, BR1, BR2"));
//}
if (reportExceptions.isEmpty()) {
reportExceptions = null;
}
COUNTER_Item_Report reportResponse = new COUNTER_Item_Report(dateTime.format(formatter), customerID, "IR", "Item Report", institutionName, orgIdentifiers,
reportExceptions, reportFilters, reportItems);
log.info("Total report items " + reportItems.size());
if (reportItems.size() > compression_max_number_of_records) {
log.info("Compression due to " + reportItems.size());
reportForCompression = true;
}
return reportResponse;
}
@Override
public COUNTER_Dataset_Report buildReportDSR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
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
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
List<COUNTER_Dataset_Usage> reportItems = new ArrayList<>();
List<SUSHI_Error_Model> reportExceptions = new ArrayList<>();
List<Filter> reportFilters = new ArrayList();
List<SUSHI_Org_Identifiers> orgIdentifiers = new ArrayList<>();
reportFilters.add(new Filter("BeginDate", beginDate));
reportFilters.add(new Filter("EndDate", endDate));
if (!repositoryIdentifier.equals("")) {
repositoryIdentifier = usageStatsRepository.getInstitutionID(repositoryIdentifier);
}
orgIdentifiers.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
@ -559,9 +792,9 @@ public class SushiLiteServiceImpl implements SushiLiteService {
}
//if (reportName.equalsIgnoreCase("ar1")) {
if (!itemid.equals("-1") && !repoid.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
if (!itemid.equals("")) {
if (!itemid.equals("") && !repoid.equals("")) {
//if (dataType.equalsIgnoreCase("") || dataType.equalsIgnoreCase("article")) {
usageStatsRepository.executeItemIR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
usageStatsRepository.executeItemDSR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
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"));
}
@ -569,13 +802,19 @@ 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"));
//}
} else if (!repoid.equals("")) {
usageStatsRepository.executeBatchItemsIR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
usageStatsRepository.executeBatchItemsDSR(reportItems, repoid, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
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"));
}
}
}
if (repoid.equals("")) {
usageStatsRepository.executeItemDSR(reportItems, null, itemIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
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"));
}
}
// }
// //} else if (reportName.equalsIgnoreCase("br1")) {
// if (!itemid.equals("-1") && !repoid.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
@ -635,7 +874,6 @@ public class SushiLiteServiceImpl implements SushiLiteService {
// if (!repoid.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
// usageStatsRepository.executeJournal(reportItems, repoid, dataType, beginDateParsed, endDateParsed, granularity);
// }
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"));
}
@ -648,12 +886,11 @@ public class SushiLiteServiceImpl implements SushiLiteService {
if (reportExceptions.size() == 0) {
reportExceptions = null;
}
COUNTER_Item_Report reportResponse = new COUNTER_Item_Report(dateTime.format(formatter), customerID, "IR", "Item Report", institutionName, orgIdentifiers,
COUNTER_Dataset_Report reportResponse = new COUNTER_Dataset_Report(dateTime.format(formatter), customerID, "DST", "Dataset Report", institutionName, orgIdentifiers,
reportExceptions, reportFilters, reportItems);
return reportResponse;
}
// @Override
// public COUNTER_Title_Report buildReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
// String endDate, String metricType, String dataType, String granularity) {
@ -731,45 +968,312 @@ public class SushiLiteServiceImpl implements SushiLiteService {
// COUNTER_Title_Report reportTR = new COUNTER_Title_Report(dateTime.format(formatter), customerID, reportID, reportName, institutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
// return reportTR;
// }
@Override
public String displayReportPR(String customerID, String repositoryIdentifier, String beginDate,
String endDate, String metricType, String dataType, String granularity) {
ObjectMapper objectMapper = new ObjectMapper();
log.info((beginDate + " " + endDate));
COUNTER_Platform_Report report = buildReportPR(customerID, repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity);
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportPR(customerID, repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
} catch (JsonProcessingException ex) {
if (reportForCompression == false) {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(report) + "</pre>";
} else {
log.info((beginDate + " " + endDate));
try {
java.sql.Timestamp timestamp1 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String start " + timestamp1);
log.info("Start building report..." + timestamp1);
//String outputname = "PR" + "_" + repositoryIdentifier.replace("_", "").replace(":", "") +"_"+ beginDate.replace("-", "") + "_" + endDate.replace("-", "");
String outputname = "PR" + "_" + repositoryIdentifier.substring(repositoryIdentifier.indexOf(":") + 1) + "_" + beginDate.replace("-", "") + "_" + endDate.replace("-", "");
String directory = new File(download_folder).getAbsolutePath();
//writer.writeValue(new File(directory + "/" + outputname + ".json"), tmpReport);
BufferedWriter writer = new BufferedWriter(new FileWriter(directory + "/" + outputname + ".json"));
writer.write(objectMapper.writer().writeValueAsString(report));
writer.close();
FileOutputStream fos = new FileOutputStream(directory + "/" + outputname + ".zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
File fileToZip = new File(directory + "/" + outputname + ".json");
FileInputStream fis = new FileInputStream(fileToZip);
ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
zipOut.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while ((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.close();
fis.close();
fos.close();
fileToZip.delete();
java.sql.Timestamp timestamp2 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String end " + timestamp2);
log.info("Report created..." + timestamp2);
reportForCompression = false;
return new String(sushi_lite_server + "/download/" + outputname + ".zip");
} catch (JsonProcessingException ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (Exception ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public String displayReportPR_P1(String customerID, String repositoryIdentifier,
String beginDate,
String endDate) {
String endDate
) {
ObjectMapper objectMapper = new ObjectMapper();
log.info((beginDate + " " + endDate));
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportPR_P1(customerID, repositoryIdentifier, beginDate, endDate)) + "</pre>";
} catch (JsonProcessingException 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;
}
@Override
public String displayReportIR(String customerID, String repositoryIdentifier, String itemIdentifier, String beginDate,
String endDate, List<String> metricType, String dataType, String granularity) {
public String displayReportIR(String customerID, String repositoryIdentifier,
String itemIdentifier, String beginDate,
String endDate, List<String> metricType,
String dataType, String granularity
) {
ObjectMapper objectMapper = new ObjectMapper();
log.info((beginDate + " " + endDate));
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportIR(customerID, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
COUNTER_Item_Report report = buildReportIR(customerID, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
if (reportForCompression == false) {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(report) + "</pre>";
} else {
log.info((beginDate + " " + endDate));
try {
java.sql.Timestamp timestamp1 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String start " + timestamp1);
log.info("Start building report..." + timestamp1);
String outputname = "IR" + "_" + repositoryIdentifier.substring(repositoryIdentifier.indexOf(":") + 1) + "_" + beginDate.replace("-", "") + "_" + endDate.replace("-", "");
String directory = new File(download_folder).getAbsolutePath();
BufferedWriter writer = new BufferedWriter(new FileWriter(directory + "/" + outputname + ".json"));
writer.write(objectMapper.writer().writeValueAsString(report));
writer.close();
FileOutputStream fos = new FileOutputStream(directory + "/" + outputname + ".zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
File fileToZip = new File(directory + "/" + outputname + ".json");
FileInputStream fis = new FileInputStream(fileToZip);
ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
zipOut.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while ((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.close();
fis.close();
fos.close();
fileToZip.delete();
java.sql.Timestamp timestamp2 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String end " + timestamp2);
log.info("Report created..." + timestamp2);
reportForCompression = false;
return new String(sushi_lite_server + "/download/" + outputname + ".zip");
} catch (Exception ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class
.getName()).log(Level.SEVERE, null, 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;
}
@Override
public String displayReportDSR(String customerID, String repositoryIdentifier,
String itemIdentifier, String beginDate,
String endDate, List<String> metricType,
String dataType, String granularity
) {
ObjectMapper objectMapper = new ObjectMapper();
try {
COUNTER_Dataset_Report report = buildReportDSR(customerID, repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
if (reportForCompression == false) {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(report) + "</pre>";
} else {
log.info((beginDate + " " + endDate));
try {
java.sql.Timestamp timestamp1 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String start " + timestamp1);
log.info("Start building report..." + timestamp1);
String outputname = "DSR" + "_" + repositoryIdentifier.substring(repositoryIdentifier.indexOf(":") + 1) + "_" + beginDate.replace("-", "") + "_" + endDate.replace("-", "");
String directory = new File(download_folder).getAbsolutePath();
BufferedWriter writer = new BufferedWriter(new FileWriter(directory + "/" + outputname + ".json"));
writer.write(objectMapper.writer().writeValueAsString(report));
writer.close();
FileOutputStream fos = new FileOutputStream(directory + "/" + outputname + ".zip");
ZipOutputStream zipOut = new ZipOutputStream(fos);
File fileToZip = new File(directory + "/" + outputname + ".json");
FileInputStream fis = new FileInputStream(fileToZip);
ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
zipOut.putNextEntry(zipEntry);
byte[] bytes = new byte[1024];
int length;
while ((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.close();
fis.close();
fos.close();
fileToZip.delete();
java.sql.Timestamp timestamp2 = new java.sql.Timestamp(System.currentTimeMillis());
//System.out.println("String end " + timestamp2);
log.info("Report created..." + timestamp2);
reportForCompression = false;
return new String(sushi_lite_server + "/download/" + outputname + ".zip");
} catch (Exception ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class
.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (Exception ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class
.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public ArrayList buildMembersList() {
ArrayList consortiumMembers = usageStatsRepository.buildMembersList();
return consortiumMembers;
}
@Override
public String displayConsortiumMemberList() {
ObjectMapper objectMapper = new ObjectMapper();
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildMembersList()) + "</pre>";
} catch (Exception ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class
.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}
class JSONUtil {
public static String escape(String input) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
char ch = input.charAt(i);
int chx = (int) ch;
// let's not put any nulls in our strings
assert (chx != 0);
if (ch == '\n') {
output.append("\\n");
} else if (ch == '\t') {
output.append("\\t");
} else if (ch == '\r') {
output.append("\\r");
} else if (ch == '\\') {
output.append("\\\\");
} else if (ch == '"') {
output.append("\\\"");
} else if (ch == '\b') {
output.append("\\b");
} else if (ch == '\f') {
output.append("\\f");
} else if (chx >= 0x10000) {
assert false : "Java stores as u16, so it should never give us a character that's bigger than 2 bytes. It literally can't.";
} else if (chx > 127) {
output.append(String.format("\\u%04x", chx));
} else {
output.append(ch);
}
}
return output.toString();
}
public static String unescape(String input) {
StringBuilder builder = new StringBuilder();
int i = 0;
while (i < input.length()) {
char delimiter = input.charAt(i);
i++; // consume letter or backslash
if (delimiter == '\\' && i < input.length()) {
// consume first after backslash
char ch = input.charAt(i);
i++;
if (ch == '\\' || ch == '/' || ch == '"' || ch == '\'') {
builder.append(ch);
} else if (ch == 'n') {
builder.append('\n');
} else if (ch == 'r') {
builder.append('\r');
} else if (ch == 't') {
builder.append('\t');
} else if (ch == 'b') {
builder.append('\b');
} else if (ch == 'f') {
builder.append('\f');
} else if (ch == 'u') {
StringBuilder hex = new StringBuilder();
// expect 4 digits
if (i + 4 > input.length()) {
throw new RuntimeException("Not enough unicode digits! ");
}
for (char x : input.substring(i, i + 4).toCharArray()) {
if (!Character.isLetterOrDigit(x)) {
throw new RuntimeException("Bad character in unicode escape.");
}
hex.append(Character.toLowerCase(x));
}
i += 4; // consume those four digits.
int code = Integer.parseInt(hex.toString(), 16);
builder.append((char) code);
} else {
throw new RuntimeException("Illegal escape sequence: \\" + ch);
}
} else { // it's not a backslash, or it's the last character.
builder.append(delimiter);
}
}
return builder.toString();
}
}

View File

@ -8,17 +8,20 @@ log4j.logger.org.springframework = INFO, S
log4j.additivity.org.springframework = false
log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File=/var/log/dnet/usageStatsAPI/usageStatsAPI.log
log4j.appender.R.File=/Users/dpie/Desktop/usageStatsAPI.log
#log4j.appender.R.File=/Volumes/Zeus/dpie/Desktop/usageStatsAPI.log
#log4j.appender.R.File=/var/log/dnet/usageStatsAPI/usageStatsAPI_R5.log
#log4j.appender.R.File=/home/dimitris.pierrakos/Sushilite_R5/usageStatsAPI_R5.log
#log4j.appender.R.File=/Users/dpie/Desktop/usageStatsAPI_R5.log
log4j.appender.R.File=/srv/springboot/9880/usageStatsAPI_R5.log
loglog4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
log4j.appender.S=org.apache.log4j.RollingFileAppender
#log4j.appender.S.File=/var/log/dnet/usageStatsAPI/usageStatsAPI-spring.log
log4j.appender.S.File=/Users/dpie/Desktop/usageStatsAPI-spring.log
#log4j.appender.S.File=/Volumes/Zeus/dpie/Desktop/usageStatsAPI-spring.log
#log4j.appender.S.File=/var/log/dnet/usageStatsAPI/usageStatsAPI_R5-spring.log
#log4j.appender.S.File=/home/dimitris.pierrakos/Sushilite_R5/usageStatsAPI_R5-spring.log
#log4j.appender.S.File=/Users/dpie/Desktop/usageStatsAPI_R5-spring.log
#log4j.appender.S.File=/Volumes/Zeus/dpie/Desktop/usageStatsAPI_R5-spring.log
log4j.appender.S.File=/srv/springboot/9880/usageStatsAPI_R5-spring.log
log4j.appender.S.MaxFileSize=10MB
log4j.appender.S.MaxBackupIndex=10
log4j.appender.S.layout=org.apache.log4j.PatternLayout

View File

@ -69,12 +69,18 @@
<div class="uk-container uk-text-center">
<h3> Supported Reports</h3>
<ul class="uk-list">
<li><a href="./sushilite/AR1/">AR1 Report</a></li>
<li><a href="./sushilite/IR1/">IR1 Report</a></li>
<li><a href="./sushilite/RR1/">RR1 Report</a></li>
<li><a href="./sushilite/JR1/">JR1 Report</a></li>
<li><a href="./sushilite/BR1/">BR1 Report</a></li>
<li><a href="./sushilite/BR2/">BR2 Report</a></li>
<!-- <li><a href="./AR1/">AR1 Report</a></li>
<li><a href="./IR1/">IR1 Report</a></li>
<li><a href="./RR1/">RR1 Report</a></li>
<li><a href="./JR1/">JR1 Report</a></li>
<li><a href="./BR1/">BR1 Report</a></li>
<li><a href="./BR2/">BR2 Report</a></li>-->
<li><a href="./sushilite/r5/status/">Status Report</a></li>
<li><a href="./sushilite/r5/members/">Members Report</a></li>
<li><a href="./sushilite/r5/reports/">COUNTER R5 Reports List</a></li>
<li><a href="./sushilite/PR/">COUNTER PR</a></li>
<li><a href="./sushilite/PR_P1/">COUNTER PR_P1</a></li>
<li><a href="./sushilite/IR/">COUNTER IR</a></li>
</ul>
<br>
</div>

View File

@ -0,0 +1,241 @@
<!DOCTYPE html>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="OpenAIRE SUSHI Lite Client, open access, research, scientific publication, European Commission,
EC, FP7, ERC, Horizon 2020, H2020, search, projects "/>
<link href="../../assets/favicon.ico" />
<title>OpenAIRE SUSHI Lite Client</title>
<script src="../../assets/jquery.js"></script>
<script src="../../assets/uikit.js"></script>
<script src="../../assets/uikit-icon-max.js"></script>
<link rel="stylesheet" type="text/css" href="../../assets/theme.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css.1">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE-->
<!-- MAIN MENU STARTS HERE-->
<!--<div class="tm-header-mobile uk-hidden@m">
<div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" uk-sticky="">
<nav class="uk-navbar-container uk-navbar" uk-navbar="">
<div class="uk-navbar-center">
<a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">
<img src="../../assets/apple-icon-72x72.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
<a class="uk-navbar-item uk-logo uk-padding-remove-left uk-visible@m" href="../../sushilite/" >
OpenAIRE SUSHI Lite Client</a>
<a class="uk-navbar-item uk-logo uk-padding-remove-left uk-hidden@m" href="../../sushilite/">
SUSHI Lite Client</a>
</div>
</nav>
</div>
</div>
<div class="tm-header uk-visible@m tm-header-transparent" uk-header="">
&lt;!&ndash; top=".tm-header" + [class*=&quot;uk-section&quot;] &ndash;&gt;
<div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" media="768" uk-sticky="">
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}" style="background-color:white !important;">
<div class="uk-navbar-center">
<div class="uk-logo uk-navbar-item uk-margin-small-top">
<a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">
<img alt="OpenAIRE" class="uk-responsive-height" src="../../assets/Logo_Horizontal.png">
</a>
</div>
<div class="uk-logo uk-navbar-item uk-margin-medium-top">
<h3 style="color: #767779 !important;"><a class="uk-navbar-item uk-logo" href="../../sushilite/">
SUSHI Lite Client</a>
</h3>
</div>
</div>
</nav>
</div>
</div>
</div>-->
<!-- MENU ENDS HERE-->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div id="tm-main" class=" uk-section tm-middle custom-main-content uk-padding-remove">
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
<div class="uk-container">
<form action="../../sushilite/r5/reports/ir/" method="get" class="uk-form uk-width-1-1 uk-container ">
<h3>Report Request</h3>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Report Name:
</div>
<div class="uk-width-2-3">
<select name='Report'>
<option value='IR'>IR</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Release:
</div>
<div class="uk-width-2-3">
<select name='Release'>
<option value="4">5</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Requestor:
</div>
<div class="uk-width-2-3">
<input type="text" name="RequestorID" value="anonymous">
</div>
</div>
<h3>Report Filters</h3>
<h5>Date range</h5>
<p>Valid date formats are yyyy-mm-dd or yyyy-mm. Default range is the last available month.
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Begin Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="BeginDate" placeholder="2016-03" />
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
End Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="EndDate" placeholder="2016-06" />
</div>
</div>
<h5>Filters</h5>
<p>Provide either a Repository Identifier or an Item Identifier<br />
Identifier format: <b>namespace:value</b><br />
Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br />
Valid namespace for Item Identifier: <b>openaire</b>, <b>doi</b> or <b>oid</b>(for OAI-PMH).
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Repository Identifier:
</div>
<div class="uk-width-2-3">
<input type="text" name="RepositoryIdentifier" placeholder="e.g. openaire:opendoar____::5cbdfd0dfa22a3fca7266376887f549b">
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Item Identifier:
</div>
<div class="uk-width-2-3">
<input type="text" name="ItemIdentifier" placeholder="e.g. openaire:od_________7::fb90de6f20d79783d05749d8f60417d5">
</div>
</div>
<p><b>Metric Type<b></p>
<p><input type="checkbox" name="MetricType" value="Total_Item_Requests" checked="checked">Total_Item_Requests</p>
<p><input type="checkbox" name="MetricType" value="Total_Item_Investigations" checked="checked">Total_Item_Investigations</p>
<p><input type="checkbox" name="MetricType" value="Unique_Item_Requests" checked="checked">Unique_Item_Requests</p>
<p><input type="checkbox" name="MetricType" value="Unique_Item_Investigations" checked="checked">Unique_Item_Investigations</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Item Data Type:
</div>
<div class="uk-width-2-3">
<select name='ItemDataType'>
<option value="">--- Select ItemDataType ---</option>
<option value='Annotation'>Annotation</option>
<option value='Article'>Article</option>
<option value='Bachelor thesis'>Bachelor thesis</option>
<option value='Book'>Book</option>
<option value='clinical trial'>clinical trial</option>
<option value='Collection'>Collection</option>
<option value='Conference object'>Conference object</option>
<option value='Contribution for newspaper or weekly magazine'>Contribution for newspaper or weekly magazine</option>
<option value='Dataset'>Dataset</option>
<option value='Doctoral thesis'>Doctoral thesis</option>
<option value='Event'>Event</option>
<option value='External research report'>External research report</option>
<option value='Film'>Film</option>
<option value='Image'>Image</option>
<option value='InteractiveResource'>InteractiveResource</option>
<option value='Internal report'>Internal report</option>
<option value='Lecture'>Lecture</option>
<option value='Master thesis'>Master thesis</option>
<option value='Newsletter'>Newsletter</option>
<option value='Other'>Other</option>
<option value='Part of book or chapter of book'>Part of book or chapter of book</option>
<option value='Patent'>Patent</option>
<option value='PhysicalObject'>PhysicalObject</option>
<option value='Preprint'>Preprint</option>
<option value='Report'>Report</option>
<option value='Research'>Research</option>
<option value='Review'>Review</option>
<option value='Software'>Software</option>
<option value='Sound'>Sound</option>
<option value='Unknown'>Unknown</option>
</select>
</div>
</div>
<!--
//<p>You may also limit the results to include or exclude items that have a DOI<br />
//Valid values: Yes or No</p>
//hasDOI:
//<select name='hasDOI'>
//<option value="">Not applicable</option>
//<option value="Yes">Yes</option>
//<option value="No">No</option>
//</select>
-->
<h3>Report Attributes</h3>
<p>Valid Granularity values: Monthly or Totals</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Granularity:
</div>
<div class="uk-width-2-3">
<select name='Granularity'>
<option value="Monthly">Monthly</option>
<option value="Totals">Totals</option>
</select>
</div>
</div>
<!--
//<p>The format in which the response is to be returned defaults to JSON unless a callback function name is entered in which case JSONP is returned.</p>
//<input type="text" name="Callback">
-->
<input type="submit" class="uk-button uk-button-primary" value="Get Report"/>
</form>
</div>
</div>
</div>
</div>
<!-- FOOTER STARTS HERE-->
<!--<div class="custom-footer" style="">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="../../assets/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" rel="license" target="_blank"><img alt="Creative" src="../../assets/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/" target="_blank">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop=""></a>
</div>
</div>
</div>
</div>
</div>
</div>-->
</div>
</body>
</html>

View File

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="OpenAIRE SUSHI Lite Client, open access, research, scientific publication, European Commission,
EC, FP7, ERC, Horizon 2020, H2020, search, projects "/>
<link href="../../assets/favicon.ico" />
<title>OpenAIRE SUSHI Lite Client</title>
<script src="../../assets/jquery.js"></script>
<script src="../../assets/uikit.js"></script>
<script src="../../assets/uikit-icon-max.js"></script>
<link rel="stylesheet" type="text/css" href="../../assets/theme.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css.1">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE-->
<!-- MAIN MENU STARTS HERE-->
<!-- <div class="tm-header-mobile uk-hidden@m">-->
<!-- <div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" uk-sticky="">-->
<!-- <nav class="uk-navbar-container uk-navbar" uk-navbar="">-->
<!-- <div class="uk-navbar-center">-->
<!-- <a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">-->
<!-- <img src="../../assets/apple-icon-72x72.png" alt="OpenAIRE" class="uk-responsive-height">-->
<!-- </a>-->
<!-- <a class="uk-navbar-item uk-logo uk-padding-remove-left uk-visible@m" href="../../sushilite/" >-->
<!-- OpenAIRE SUSHI Lite Client</a>-->
<!-- <a class="uk-navbar-item uk-logo uk-padding-remove-left uk-hidden@m" href="../../sushilite/">-->
<!-- SUSHI Lite Client</a>-->
<!-- </div>-->
<!-- </nav>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="tm-header uk-visible@m tm-header-transparent" uk-header="">-->
<!-- &lt;!&ndash; top=".tm-header" + [class*=&quot;uk-section&quot;] &ndash;&gt;-->
<!-- <div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" media="768" uk-sticky="">-->
<!-- <div class="uk-container uk-container-expand">-->
<!-- <nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}" style="background-color:white !important;">-->
<!-- <div class="uk-navbar-center">-->
<!-- <div class="uk-logo uk-navbar-item uk-margin-small-top">-->
<!-- <a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">-->
<!-- <img alt="OpenAIRE" class="uk-responsive-height" src="../../assets/Logo_Horizontal.png">-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="uk-logo uk-navbar-item uk-margin-medium-top">-->
<!-- <h3 style="color: #767779 !important;"><a class="uk-navbar-item uk-logo" href="../../sushilite/">-->
<!-- SUSHI Lite Client</a>-->
<!-- </h3>-->
<!-- </div>-->
<!-- </div>-->
<!-- </nav>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- MENU ENDS HERE-->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div id="tm-main" class=" uk-section tm-middle custom-main-content uk-padding-remove">
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
<div class="uk-container">
<form action="../../sushilite/r5/reports/pr/" method="get" class="uk-form uk-width-1-1 uk-container ">
<h3>Report Request</h3>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Report Name:
</div>
<div class="uk-width-2-3">
<select name='Report'>
<option value='PR'>PR</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Release:
</div>
<div class="uk-width-2-3">
<select name='Release'>
<option value="5">5</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Requestor:
</div>
<div class="uk-width-2-3">
<input type="text" name="RequestorID" value="anonymous">
</div>
</div>
<h3>Report Filters</h3>
<h5>Date range</h5>
<p>Valid date formats are yyyy-mm-dd or yyyy-mm. Default range is the last available month.
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Begin Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="BeginDate" placeholder="2016-03" />
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
End Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="EndDate" placeholder="2016-06" />
</div>
</div>
<!-- <h5>Filters</h5>-->
<p>Provide the Repository Identifier<br />
Identifier format: <b>namespace:value</b><br />
Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br />
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Repository Identifier:
</div>
<div class="uk-width-2-3">
<input type="text" name="RepositoryIdentifier" placeholder="e.g. opendoar:1503">
</div>
</div>
<p><b>Metric Type<b></p>
<p><input type="checkbox" name="MetricType" value="Total_Item_Requests" checked="checked">Total_Item_Requests</p>
<p><input type="checkbox" name="MetricType" value="Total_Item_Investigations" checked="checked">Total_Item_Investigations</p>
<p><input type="checkbox" name="MetricType" value="Unique_Item_Requests" checked="checked">Unique_Item_Requests</p>
<p><input type="checkbox" name="MetricType" value="Unique_Item_Investigations" checked="checked">Unique_Item_Investigations</p>
<!--
//<p>You may also limit the results to include or exclude items that have a DOI<br />
//Valid values: Yes or No</p>
//hasDOI:
//<select name='hasDOI'>
//<option value="">Not applicable</option>
//<option value="Yes">Yes</option>
//<option value="No">No</option>
//</select>
-->
<p>Optional filter to only show results for a single item type, e.g. article, book, etc.</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Item Data Type:
</div>
<div class="uk-width-2-3">
<select name='DataType'>
<option value="All">--- Select Data Type ---</option>
<option value='Annotation'>Annotation</option>
<option value='Article'>Article</option>
<option value='Bachelor thesis'>Bachelor thesis</option>
<option value='Book'>Book</option>
<option value='clinical trial'>clinical trial</option>
<option value='Collection'>Collection</option>
<option value='Conference object'>Conference object</option>
<option value='Contribution for newspaper or weekly magazine'>Contribution for newspaper or weekly magazine</option>
<option value='Dataset'>Dataset</option>
<option value='Doctoral thesis'>Doctoral thesis</option>
<option value='Event'>Event</option>
<option value='External research report'>External research report</option>
<option value='Film'>Film</option>
<option value='Image'>Image</option>
<option value='InteractiveResource'>InteractiveResource</option>
<option value='Internal report'>Internal report</option>
<option value='Lecture'>Lecture</option>
<option value='Master thesis'>Master thesis</option>
<option value='Newsletter'>Newsletter</option>
<option value='Other'>Other</option>
<option value='Part of book or chapter of book'>Part of book or chapter of book</option>
<option value='Patent'>Patent</option>
<option value='PhysicalObject'>PhysicalObject</option>
<option value='Preprint'>Preprint</option>
<option value='Report'>Report</option>
<option value='Research'>Research</option>
<option value='Review'>Review</option>
<option value='Software'>Software</option>
<option value='Sound'>Sound</option>
<option value='Unknown'>Unknown</option>
</select>
</div>
</div>
<h3>Report Attributes</h3>
<p>Valid Granularity values: Monthly or Totals</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Granularity:
</div>
<div class="uk-width-2-3">
<select name='Granularity'>
<option value="Monthly">Monthly</option>
<option value="Totals">Totals</option>
</select>
</div>
</div>
<!--
//<p>The format in which the response is to be returned defaults to JSON unless a callback function name is entered in which case JSONP is returned.</p>
//<input type="text" name="Callback">
-->
<!-- <p>The Pretty attribute is just for humans playing with the API and looking at results in a browser.</p>
<p><input type="checkbox" name="Pretty" value="Pretty" checked="checked">Pretty print json(p) for humans</p>-->
<input type="submit" class="uk-button uk-button-primary" value="Get Report"/>
</form>
</div>
</div>
</div>
</div>
<!-- FOOTER STARTS HERE-->
<!--<div class="custom-footer" style="">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="../../assets/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" rel="license" target="_blank"><img alt="Creative" src="../../assets/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/" target="_blank">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop=""></a>
</div>
</div>
</div>
</div>
</div>
</div>-->
</div>
</body>
</html>

View File

@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en-gb" dir="ltr" vocab="http://schema.org/">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="OpenAIRE SUSHI Lite Client, open access, research, scientific publication, European Commission,
EC, FP7, ERC, Horizon 2020, H2020, search, projects "/>
<link href="../../assets/favicon.ico" />
<title>OpenAIRE SUSHI Lite Client</title>
<script src="../../assets/jquery.js"></script>
<script src="../../assets/uikit.js"></script>
<script src="../../assets/uikit-icon-max.js"></script>
<link rel="stylesheet" type="text/css" href="../../assets/theme.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css">
<link rel="stylesheet" type="text/css" href="../../assets/custom.css.1">
</head>
<body class="" style="">
<div class="uk-offcanvas-content uk-height-viewport">
<!-- MENU STARTS HERE-->
<!-- MAIN MENU STARTS HERE-->
<!-- <div class="tm-header-mobile uk-hidden@m">-->
<!-- <div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" uk-sticky="">-->
<!-- <nav class="uk-navbar-container uk-navbar" uk-navbar="">-->
<!-- <div class="uk-navbar-center">-->
<!-- <a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">-->
<!-- <img src="../../assets/apple-icon-72x72.png" alt="OpenAIRE" class="uk-responsive-height">-->
<!-- </a>-->
<!-- <a class="uk-navbar-item uk-logo uk-padding-remove-left uk-visible@m" href="../../sushilite/" >-->
<!-- OpenAIRE SUSHI Lite Client</a>-->
<!-- <a class="uk-navbar-item uk-logo uk-padding-remove-left uk-hidden@m" href="../../sushilite/">-->
<!-- SUSHI Lite Client</a>-->
<!-- </div>-->
<!-- </nav>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="tm-header uk-visible@m tm-header-transparent" uk-header="">-->
<!-- &lt;!&ndash; top=".tm-header" + [class*=&quot;uk-section&quot;] &ndash;&gt;-->
<!-- <div animation="uk-animation-slide-top" class="uk-navbar-container uk-sticky uk-navbar-transparent uk-light" cls-active="uk-active uk-navbar-sticky" cls-inactive="uk-navbar-transparent uk-light" media="768" uk-sticky="">-->
<!-- <div class="uk-container uk-container-expand">-->
<!-- <nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}" style="background-color:white !important;">-->
<!-- <div class="uk-navbar-center">-->
<!-- <div class="uk-logo uk-navbar-item uk-margin-small-top">-->
<!-- <a class="uk-logo uk-navbar-item uk-link" href="https://www.openaire.eu">-->
<!-- <img alt="OpenAIRE" class="uk-responsive-height" src="../../assets/Logo_Horizontal.png">-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="uk-logo uk-navbar-item uk-margin-medium-top">-->
<!-- <h3 style="color: #767779 !important;"><a class="uk-navbar-item uk-logo" href="../../sushilite/">-->
<!-- SUSHI Lite Client</a>-->
<!-- </h3>-->
<!-- </div>-->
<!-- </div>-->
<!-- </nav>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- MENU ENDS HERE-->
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">
<div class="first_page_banner_headline uk-grid-collapse uk-flex-middle uk-margin-remove-vertical uk-grid" uk-grid="">
</div>
</div>
<div id="tm-main" class=" uk-section tm-middle custom-main-content uk-padding-remove">
<div uk-grid="" class="uk-grid uk-grid-stack">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
<div class="uk-container">
<form action="../../sushilite/r5/reports/pr_p1/" method="get" class="uk-form uk-width-1-1 uk-container ">
<h3>Report Request</h3>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Report Name:
</div>
<div class="uk-width-2-3">
<select name='Report'>
<option value='PR_P1'>PR_P1</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Release:
</div>
<div class="uk-width-2-3">
<select name='Release'>
<option value="5">5</option>
</select>
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Requestor:
</div>
<div class="uk-width-2-3">
<input type="text" name="RequestorID" value="anonymous">
</div>
</div>
<h3>Report Filters</h3>
<h5>Date range</h5>
<p>Valid date formats are yyyy-mm-dd or yyyy-mm. Default range is the last available month.
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Begin Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="BeginDate" placeholder="2016-03" />
</div>
</div>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
End Date:
</div>
<div class="uk-width-2-3">
<input type="text" name="EndDate" placeholder="2016-06" />
</div>
</div>
<h5>Filters</h5>
<p>Provide a Repository Identifier<br />
Identifier format: <b>namespace:value</b><br />
Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br />
</p>
<div class="uk-grid">
<div class=" uk-width-1-3 uk-text-right">
Repository Identifier:
</div>
<div class="uk-width-2-3">
<input type="text" name="RepositoryIdentifier" placeholder="e.g. opendoar:1503">
</div>
</div>
<!--
//<p>You may also limit the results to include or exclude items that have a DOI<br />
//Valid values: Yes or No</p>
//hasDOI:
//<select name='hasDOI'>
//<option value="">Not applicable</option>
//<option value="Yes">Yes</option>
//<option value="No">No</option>
//</select>
-->
<!--
//<p>The format in which the response is to be returned defaults to JSON unless a callback function name is entered in which case JSONP is returned.</p>
//<input type="text" name="Callback">
-->
<input type="submit" class="uk-button uk-button-primary" value="Get Report"/>
</form>
</div>
</div>
</div>
</div>
<!-- FOOTER STARTS HERE-->
<!--<div class="custom-footer" style="">
<div class="uk-section-primary uk-section uk-section-small">
<div class="uk-container">
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid="">
<div class="uk-width-1-1@m uk-first-column">
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-center">
<img alt="OpenAIRE" class="el-image" src="../../assets/Logo_Horizontal_white_small.png">
</div>
<div class="footer-license uk-margin uk-margin-remove-bottom uk-text-center uk-text-lead">
<div><a href="http://creativecommons.org/licenses/by/4.0/" rel="license" target="_blank"><img alt="Creative" src="../../assets/80x15.png" style="height: auto; max-width: 100%; vertical-align: middle;"></a>&nbsp;UNLESS OTHERWISE INDICATED, ALL MATERIALS CREATED BY THE OPENAIRE CONSORTIUM ARE LICENSED UNDER A&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/" rel="license">CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE</a>.</div>
<div>OPENAIRE IS POWERED BY&nbsp;<a href="http://www.d-net.research-infrastructures.eu/" target="_blank">D-NET</a>.</div>
</div>
<div class="uk-margin uk-margin-remove-top uk-margin-remove-bottom uk-text-right">
<a class="uk-totop uk-icon" href="#" uk-scroll="" uk-totop=""></a>
</div>
</div>
</div>
</div>
</div>
</div>-->
</div>
</body>
</html>

View File

@ -69,12 +69,19 @@
<div class="uk-container uk-text-center">
<h3> Supported Reports</h3>
<ul class="uk-list">
<li><a href="./AR1/">AR1 Report</a></li>
<!-- <li><a href="./AR1/">AR1 Report</a></li>
<li><a href="./IR1/">IR1 Report</a></li>
<li><a href="./RR1/">RR1 Report</a></li>
<li><a href="./JR1/">JR1 Report</a></li>
<li><a href="./BR1/">BR1 Report</a></li>
<li><a href="./BR2/">BR2 Report</a></li>
<li><a href="./BR2/">BR2 Report</a></li>-->
<li><a href="./r5/status/">Status Report</a></li>
<li><a href="./r5/members/">Members Report</a></li>
<li><a href="./r5/reports/">COUNTER R5 Reports List</a></li>
<li><a href="./PR/">COUNTER PR</a></li>
<li><a href="./PR_P1/">COUNTER PR_P1</a></li>
<li><a href="./IR/">COUNTER IR</a></li>
</ul>
<br>
</div>

21
usageStatsAPI.properties Normal file
View File

@ -0,0 +1,21 @@
name=usageStatsAPI
logging.config=classpath:log4j.properties
#usagestats.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.datasource.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect
spring.datasource.hikari.max-lifetime=600000
usagestats.url=jdbc:impala://iis-cdh5-test-gw.ocean.icm.edu.pl:21050/;UseNativeQuery=1;AutoReconnect=1
usagestats.redis.hostname=10.19.65.40
usagestats.redis.port=6379
usagestats.redis_scheme=tcp
spring.jackson.serialization.INDENT_OUTPUT=true
prod.statsdb=openaire_prod_stats
prod.usagestatsImpalaDB=openaire_prod_usage_stats
compression.max_number_of_records=100
download.folder=/home/dimitris.pierrakos/Sushilite_R5/DownloadSushiReports
sushi-lite.server=https://beta.services.openaire.eu/usagestats_r5
server.servlet.context-path=/usagestats_r5
#server.port=8080
#spring.datasource.testWhileIdle = true
#spring.datasource.timeBetweenEvictionRunsMillis = 60000
#spring.datasource.validationQuery = SELECT 1

View File

@ -0,0 +1,21 @@
name=usageStatsAPI
logging.config=classpath:log4j.properties
#usagestats.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.datasource.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect
spring.datasource.hikari.max-lifetime=600000
usagestats.url=jdbc:impala://iis-cdh5-test-gw.ocean.icm.edu.pl:21050/;UseNativeQuery=1;AutoReconnect=1
usagestats.redis.hostname=10.19.65.40
usagestats.redis.port=6379
usagestats.redis_scheme=tcp
spring.jackson.serialization.INDENT_OUTPUT=true
prod.statsdb=openaire_prod_stats
prod.usagestatsImpalaDB=openaire_prod_usage_stats
compression.max_number_of_records=100
download.folder=/home/dimitris.pierrakos/Sushilite_R5/DownloadSushiReports
sushi-lite.server=https://beta.services.openaire.eu/usagestats_r5
server.servlet.context-path=/usagestats_r5
#server.port=8080
#spring.datasource.testWhileIdle = true
#spring.datasource.timeBetweenEvictionRunsMillis = 60000
#spring.datasource.validationQuery = SELECT 1

View File

@ -1,8 +1,9 @@
name=usageStatsAPI
logging.config=log4j.properties
logging.config=classpath:log4j.properties
#usagestats.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.datasource.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect
spring.datasource.hikari.max-lifetime=600000
usagestats.url=jdbc:impala://iis-cdh5-test-gw.ocean.icm.edu.pl:21050/;UseNativeQuery=1;AutoReconnect=1
usagestats.redis.hostname=localhost
usagestats.redis.port=6379
@ -10,9 +11,9 @@ spring.jackson.serialization.INDENT_OUTPUT=true
prod.statsdb=openaire_prod_stats
prod.usagestatsImpalaDB=openaire_prod_usage_stats
compression.max_number_of_records=100
download.folder=/Users/dpie/Desktop/DownloadSushiLite
sushi-lite.server=http://localhost:8080/usagestats
server.servlet.context-path.=/usagestats_r5
download.folder=/Users/dpie/Downloads/DownloadSushiLite
sushi-lite.server=http://localhost:8080/usagestats_r5
server.servlet.context-path=/usagestats_r5
server.port=8080
#spring.datasource.testWhileIdle = true
#spring.datasource.timeBetweenEvictionRunsMillis = 60000