Change to embedded tomcat

This commit is contained in:
Dimitris 2021-01-25 10:44:27 +02:00
parent 7b2786354c
commit 7a3761c2c9
8 changed files with 458 additions and 214 deletions

62
pom.xml
View File

@ -6,15 +6,15 @@
<groupId>eu.dnetlib</groupId>
<artifactId>openaire-usage-stats-api-r5</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<!-- <packaging>war</packaging>-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.15.RELEASE</version>
</parent>
<dependencies>
<dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.2.0.RELEASE</version>
@ -29,6 +29,20 @@
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>0.13.1</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
@ -76,12 +90,6 @@
<version>1.2.17</version>
</dependency>
<!-- <dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -125,10 +133,6 @@
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
</exclusion>
<exclusion>
<groupId> org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@ -143,12 +147,23 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>libthrift</artifactId>
<version>0.5.0.0</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<properties>
<properties>
<java.version>1.8</java.version>
<tomcat.version>7.0.52</tomcat.version>
<tomcat.version>8.5.57</tomcat.version>
</properties>
@ -168,18 +183,19 @@
<finalName>usagestats_r5</finalName>
</build>
<repositories>
<!-- <repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
-->
<name>openaire-usage-stats-api-r5</name>
</project>

View File

@ -1,7 +1,6 @@
package eu.dnetlib.usagestats.config;
//import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -60,9 +60,10 @@ class SushiLiteController {
@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(repositoryIdentifier, beginDate, endDate, metricType, granularity);
return sushiLiteService.displayReportPR(repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity);
}
@RequestMapping(value = "/sushilite/r5/reports/pr_p1", method = RequestMethod.GET)
@ -73,4 +74,16 @@ class SushiLiteController {
log.info("COUNTER PR_P1 Report request for repository " + repositoryIdentifier);
return sushiLiteService.displayReportPR_P1(repositoryIdentifier, beginDate, endDate);
}
@RequestMapping(value = "/sushilite/r5/reports/tr", method = RequestMethod.GET)
public String getReportPR(
@RequestParam(value = "RepositoryIdentifier", defaultValue = "") String repositoryIdentifier,
@RequestParam(value = "ItemIdentifier", defaultValue = "") String itemIdentifier,
@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.displayReportTR(repositoryIdentifier, itemIdentifier, beginDate, endDate, metricType, dataType, granularity);
}
}

View File

@ -18,8 +18,8 @@ import eu.dnetlib.usagestats.portal.TotalStatsReposViewsDownloads;
import eu.dnetlib.usagestats.portal.UsageStats;
import eu.dnetlib.usagestats.portal.YearlyStats;
import eu.dnetlib.usagestats.sushilite.domain.ItemIdentifier;
import eu.dnetlib.usagestats.sushilite.domain.ItemPerformance;
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Item_Performance;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Usage;
import org.apache.commons.dbutils.DbUtils;
@ -82,7 +82,7 @@ public class UsageStatsRepository {
/*
private static List<ReportItem> reportItemsFromJson(String string) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(string, objectMapper.getTypeFactory().constructCollectionType(List.class, ReportItem.class));
return objectMapper.readValue(string, objectMapper.getTypeFactory().constructCollectionType(List.class, COUNTER_Platform_Usage.class));
}
*/
public List<MonthlyUsageStats> executeMontlyUsageStats(String query) {
@ -656,7 +656,7 @@ public class UsageStatsRepository {
return "-1";
}
public void executeItem(List<ReportItem> reportItems, String itemIdentifier,
public void executeItem(List<COUNTER_Platform_Usage> reportItems, String itemIdentifier,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
String[] split = itemIdentifier.split(":");
@ -674,7 +674,7 @@ public class UsageStatsRepository {
}
}
private void executeOid(List<ReportItem> reportItems, String oid,
private void executeOid(List<COUNTER_Platform_Usage> reportItems, String oid,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
Connection connection = null;
@ -702,7 +702,7 @@ public class UsageStatsRepository {
}
}
private void executeDoi(List<ReportItem> reportItems, String doi,
private void executeDoi(List<COUNTER_Platform_Usage> reportItems, String doi,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
Connection connection = null;
@ -729,7 +729,7 @@ public class UsageStatsRepository {
}
}
private void executeOpenaire(List<ReportItem> reportItems, String openaire,
private void executeOpenaire(List<COUNTER_Platform_Usage> reportItems, String openaire,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -851,7 +851,7 @@ public class UsageStatsRepository {
rs = st.executeQuery();
String repository = "";
String lastDate = "";
ReportItem reportItem = null;
COUNTER_Platform_Usage reportItem = null;
int ft_total = 0;
int abstr = 0;
@ -859,11 +859,11 @@ public class UsageStatsRepository {
while (rs.next()) {
if (!rs.getString(1).equals(repository)) {
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
repository = rs.getString(1);
reportItem = new ReportItem(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem = new COUNTER_Platform_Usage(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", openaire));
reportItem.addIdentifier(new ItemIdentifier("URLs", rs.getString(4)));
if (rs.getString(9) != null && !rs.getString(9).equals("")) {
@ -887,7 +887,7 @@ public class UsageStatsRepository {
abstr += rs.getInt(11);
}
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
} else if (granularity.equalsIgnoreCase("monthly")) {
@ -903,7 +903,7 @@ public class UsageStatsRepository {
}
repository = rs.getString(1);
lastDate = beginDateStr;
reportItem = new ReportItem(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem = new COUNTER_Platform_Usage(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", openaire));
reportItem.addIdentifier(new ItemIdentifier("URLs", rs.getString(4)));
if (rs.getString(9) != null && !rs.getString(9).equals("")) {
@ -933,7 +933,7 @@ public class UsageStatsRepository {
endC.setTime(postgresFormat.parse(rs.getString(8)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(8))), report_dateFormat.format(endC.getTime()), rs.getString(10), rs.getString(11)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(8))), report_dateFormat.format(endC.getTime()), rs.getString(10), rs.getString(11)));
}
endC.setTime(postgresFormat.parse(rs.getString(8)));
endC.add(Calendar.MONTH, 1);
@ -953,7 +953,7 @@ public class UsageStatsRepository {
}
}
public void executeRepo(List<ReportItem> reportItems,
public void executeRepo(List<COUNTER_Platform_Usage> reportItems,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -1049,7 +1049,7 @@ public class UsageStatsRepository {
rs = st.executeQuery();
String repository = "";
String lastDate = "";
ReportItem reportItem = null;
COUNTER_Platform_Usage reportItem = null;
/*
Calendar startCalendar = Calendar.getInstance();
@ -1063,11 +1063,11 @@ public class UsageStatsRepository {
while (rs.next()) {
if (!rs.getString(1).equals(repository)) {
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
repository = rs.getString(1);
reportItem = new ReportItem(null, rs.getString(2), "Platform", null, "");
reportItem = new COUNTER_Platform_Usage(null, rs.getString(2), "Platform", null, "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("OpenDOAR", rs.getString(4).substring(rs.getString(4).lastIndexOf(":") + 1)));
reportItem.addIdentifier(new ItemIdentifier("URL", rs.getString(3)));
@ -1078,7 +1078,7 @@ public class UsageStatsRepository {
abstr += rs.getInt(7);
}
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
} else if (granularity.equalsIgnoreCase("monthly")) {
@ -1094,7 +1094,7 @@ public class UsageStatsRepository {
}
repository = rs.getString(1);
lastDate = beginDateStr;
reportItem = new ReportItem(null, rs.getString(2), "Platform", null, "");
reportItem = new COUNTER_Platform_Usage(null, rs.getString(2), "Platform", null, "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("OpenDOAR", rs.getString(4).substring(rs.getString(4).lastIndexOf(":") + 1)));
reportItem.addIdentifier(new ItemIdentifier("URL", rs.getString(3)));
@ -1104,7 +1104,7 @@ public class UsageStatsRepository {
endC.setTime(postgresFormat.parse(rs.getString(5)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(5))), report_dateFormat.format(endC.getTime()), rs.getString(6), rs.getString(7)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(5))), report_dateFormat.format(endC.getTime()), rs.getString(6), rs.getString(7)));
}
endC.setTime(postgresFormat.parse(rs.getString(5)));
endC.add(Calendar.MONTH, 1);
@ -1134,7 +1134,7 @@ public class UsageStatsRepository {
}
}
public void executeJournal(List<ReportItem> reportItems,
public void executeJournal(List<COUNTER_Platform_Usage> reportItems,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -1229,7 +1229,7 @@ public class UsageStatsRepository {
rs = st.executeQuery();
String repository = "";
String lastDate = "";
ReportItem reportItem = null;
COUNTER_Platform_Usage reportItem = null;
/*
Calendar startCalendar = Calendar.getInstance();
@ -1243,11 +1243,11 @@ public class UsageStatsRepository {
while (rs.next()) {
if (!rs.getString(1).equals(repository)) {
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
repository = rs.getString(1);
reportItem = new ReportItem(null, rs.getString(2), "Platform", null, "");
reportItem = new COUNTER_Platform_Usage(null, rs.getString(2), "Platform", null, "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("ISSN", rs.getString(4).substring(rs.getString(4).lastIndexOf(":") + 1)));
if (rs.getString(3) != null) {
@ -1260,7 +1260,7 @@ public class UsageStatsRepository {
abstr += rs.getInt(7);
}
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
} else if (granularity.equalsIgnoreCase("monthly")) {
@ -1276,7 +1276,7 @@ public class UsageStatsRepository {
}
repository = rs.getString(1);
lastDate = beginDateStr;
reportItem = new ReportItem(null, rs.getString(2), "Platform", null, "");
reportItem = new COUNTER_Platform_Usage(null, rs.getString(2), "Platform", null, "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("ISSN", rs.getString(4).substring(rs.getString(4).lastIndexOf(":") + 1)));
if (rs.getString(3) != null) {
@ -1288,7 +1288,7 @@ public class UsageStatsRepository {
endC.setTime(postgresFormat.parse(rs.getString(5)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(5))), report_dateFormat.format(endC.getTime()), rs.getString(6), rs.getString(7)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(5))), report_dateFormat.format(endC.getTime()), rs.getString(6), rs.getString(7)));
}
endC.setTime(postgresFormat.parse(rs.getString(5)));
endC.add(Calendar.MONTH, 1);
@ -1318,7 +1318,7 @@ public class UsageStatsRepository {
}
}
public void executeBatchItems(List<ReportItem> reportItems,
public void executeBatchItems(List<COUNTER_Platform_Usage> reportItems,
String repositoryIdentifier, String itemDataType, Date beginDate,
Date endDate, String granularity) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -1399,7 +1399,7 @@ public class UsageStatsRepository {
rs = st.executeQuery();
String result = "";
String lastDate = "";
ReportItem reportItem = null;
COUNTER_Platform_Usage reportItem = null;
int ft_total = 0;
int abstr = 0;
@ -1407,11 +1407,11 @@ public class UsageStatsRepository {
while (rs.next()) {
if (!rs.getString(1).equals(result)) {
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
result = rs.getString(1);
reportItem = new ReportItem(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem = new COUNTER_Platform_Usage(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("URLs", rs.getString(4)));
if (rs.getString(9) != null && !rs.getString(9).equals("")) {
@ -1435,7 +1435,7 @@ public class UsageStatsRepository {
abstr += rs.getInt(11);
}
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), Integer.toString(ft_total), Integer.toString(abstr)));
reportItems.add(reportItem);
}
} else if (granularity.equalsIgnoreCase("monthly")) {
@ -1451,7 +1451,7 @@ public class UsageStatsRepository {
}
result = rs.getString(1);
lastDate = beginDateStr;
reportItem = new ReportItem(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem = new COUNTER_Platform_Usage(rs.getString(3), rs.getString(7), rs.getString(5), rs.getString(2), "");
reportItem.addIdentifier(new ItemIdentifier("OpenAIRE", rs.getString(1)));
reportItem.addIdentifier(new ItemIdentifier("URLs", rs.getString(4)));
if (rs.getString(9) != null && !rs.getString(9).equals("")) {
@ -1474,7 +1474,7 @@ public class UsageStatsRepository {
endC.setTime(postgresFormat.parse(rs.getString(8)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
if (reportItem != null) {
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(8))), report_dateFormat.format(endC.getTime()), rs.getString(10), rs.getString(11)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(8))), report_dateFormat.format(endC.getTime()), rs.getString(10), rs.getString(11)));
}
endC.setTime(postgresFormat.parse(rs.getString(8)));
endC.add(Calendar.MONTH, 1);
@ -1501,9 +1501,9 @@ public class UsageStatsRepository {
}
}
public void executeBatchItemsPR(List<ReportItem> reportItems,
public void executeBatchItemsPR(List<COUNTER_Platform_Usage> reportItems,
String repositoryIdentifier, Date beginDate,
Date endDate, String metricType, String granularity) {
Date endDate, String metricType, String dataType, String granularity) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat postgresFormat = new SimpleDateFormat("yyyy/MM");
String beginDateStr = postgresFormat.format(beginDate);
@ -1516,100 +1516,201 @@ public class UsageStatsRepository {
try {
connection = usageStatsDB.getConnection();
if (granularity.equalsIgnoreCase("totals")) {
st = connection.prepareStatement("SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id GROUP BY rc.type order by rc.type ASC;");
if (dataType.equals("")) {
st = connection.prepareStatement("SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id GROUP BY rc.type order by rc.type ASC;");
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
rs = st.executeQuery();
ReportItem reportItem = null;
rs = st.executeQuery();
COUNTER_Platform_Usage reportItem = null;
switch (metricType) {
case (""):
while (rs.next()) {
reportItem = new ReportItem("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Investigations"):
while (rs.next()) {
reportItem = new ReportItem("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), null, rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Requests"):
while (rs.next()) {
reportItem = new ReportItem("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), null));
reportItems.add(reportItem);
}
break;
switch (metricType) {
case (""):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Investigations"):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), null, rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Requests"):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), null));
reportItems.add(reportItem);
}
break;
}
} else {
st = connection.prepareStatement("SELECT rc.type, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.type=? AND rc.id=us.result_id GROUP BY rc.type order by rc.type ASC;");
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
st.setString(4, dataType);
rs = st.executeQuery();
COUNTER_Platform_Usage reportItem = null;
switch (metricType) {
case (""):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Investigations"):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), null, rs.getString(3)));
reportItems.add(reportItem);
}
break;
case ("Total_Items_Requests"):
while (rs.next()) {
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(beginDate), report_dateFormat.format(endDate), rs.getString(2), null));
reportItems.add(reportItem);
}
break;
}
}
} else if (granularity.equalsIgnoreCase("monthly")) {
st = connection.prepareStatement("SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id GROUP BY rc.type, us.`date` order by rc.type, us.`date` ASC;");
if (dataType.equals("")) {
st = connection.prepareStatement("SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.id=us.result_id GROUP BY rc.type, us.`date` order by rc.type, us.`date` ASC;");
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
rs = st.executeQuery();
String result = "";
String lastDate = "";
ReportItem reportItem = null;
rs = st.executeQuery();
String result = "";
String lastDate = "";
COUNTER_Platform_Usage reportItem = null;
int ft_total = 0;
int abstr = 0;
int ft_total = 0;
int abstr = 0;
Calendar endCal = Calendar.getInstance();
endCal.setTime(postgresFormat.parse(endDateStr));
endCal.add(Calendar.MONTH, 1);
Date endDateForZeros = endCal.getTime();
Calendar endCal = Calendar.getInstance();
endCal.setTime(postgresFormat.parse(endDateStr));
endCal.add(Calendar.MONTH, 1);
Date endDateForZeros = endCal.getTime();
lastDate = beginDateStr;
String datatype = "";
while (rs.next()) {
Calendar endC = Calendar.getInstance();
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
//iterate on data types
if (!datatype.equals(rs.getString(1))) {
lastDate = beginDateStr;
String datatype = "";
while (rs.next()) {
Calendar endC = Calendar.getInstance();
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
//iterate on data types
if (!datatype.equals(rs.getString(1))) {
if (reportItem != null) {
reportItems.add(reportItem);
}
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
datatype = rs.getString(1);
}
if (reportItem != null) {
reportItems.add(reportItem);
}
reportItem = new ReportItem("", "OpenAIRE", rs.getString(1), "Regular", "");
datatype = rs.getString(1);
}
if (reportItem != null) {
switch (metricType) {
case (""):
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), rs.getString(4)));
break;
switch (metricType) {
case (""):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), rs.getString(4)));
break;
case ("Total_Items_Investigations"):
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), null, rs.getString(4)));
break;
case ("Total_Items_Investigations"):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), null, rs.getString(4)));
break;
case ("Total_Items_Requests"):
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), null));
break;
case ("Total_Items_Requests"):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), null));
break;
}
}
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.add(Calendar.MONTH, 1);
lastDate = postgresFormat.format(endC.getTime());
//if (reportItem != null) {
//fillWithZeros(postgresFormat.parse(lastDate), endDateForZeros, reportItem);
}
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.add(Calendar.MONTH, 1);
lastDate = postgresFormat.format(endC.getTime());
//if (reportItem != null) {
//fillWithZeros(postgresFormat.parse(lastDate), endDateForZeros, reportItem);
//add last report item
reportItems.add(reportItem);
} else {
st = connection.prepareStatement("SELECT rc.type, us.`date`, sum(us.downloads) as downloads, sum(us.views) as views FROM " + usagestatsImpalaDB + ".usage_stats us, "
+ statsDB + ".result_classifications rc WHERE us.`date`>=? AND us.`date`<=? AND us.repository_id=? AND rc.type=? AND rc.id=us.result_id GROUP BY rc.type, us.`date` order by rc.type, us.`date` ASC;");
st.setString(1, beginDateStr);
st.setString(2, endDateStr);
st.setString(3, repositoryIdentifier);
st.setString(4, dataType);
rs = st.executeQuery();
String result = "";
String lastDate = "";
COUNTER_Platform_Usage reportItem = null;
int ft_total = 0;
int abstr = 0;
Calendar endCal = Calendar.getInstance();
endCal.setTime(postgresFormat.parse(endDateStr));
endCal.add(Calendar.MONTH, 1);
Date endDateForZeros = endCal.getTime();
lastDate = beginDateStr;
String datatype = "";
while (rs.next()) {
Calendar endC = Calendar.getInstance();
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
//iterate on data types
if (!datatype.equals(rs.getString(1))) {
if (reportItem != null) {
reportItems.add(reportItem);
}
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", rs.getString(1), "Regular", "");
datatype = rs.getString(1);
}
if (reportItem != null) {
switch (metricType) {
case (""):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), rs.getString(4)));
break;
case ("Total_Items_Investigations"):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), null, rs.getString(4)));
break;
case ("Total_Items_Requests"):
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(2))), report_dateFormat.format(endC.getTime()), rs.getString(3), null));
break;
}
}
endC.setTime(postgresFormat.parse(rs.getString(2)));
endC.add(Calendar.MONTH, 1);
lastDate = postgresFormat.format(endC.getTime());
//if (reportItem != null) {
//fillWithZeros(postgresFormat.parse(lastDate), endDateForZeros, reportItem);
}
//add last report item
reportItems.add(reportItem);
}
//add last report item
reportItems.add(reportItem);
}
/*
@ -1627,7 +1728,7 @@ public class UsageStatsRepository {
}
}
public void executeBatchItemsPR_P1(List<ReportItem> reportItems,
public void executeBatchItemsPR_P1(List<COUNTER_Platform_Usage> reportItems,
String repositoryIdentifier, Date beginDate,
Date endDate) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -1652,7 +1753,7 @@ public class UsageStatsRepository {
rs = st.executeQuery();
String result = "";
String lastDate = "";
ReportItem reportItem = null;
COUNTER_Platform_Usage reportItem = null;
int ft_total = 0;
int abstr = 0;
@ -1664,14 +1765,14 @@ public class UsageStatsRepository {
lastDate = beginDateStr;
String datatype = "";
reportItem = new ReportItem("", "OpenAIRE", null, "Regular", "");
reportItem = new COUNTER_Platform_Usage("", "OpenAIRE", null, "Regular", "");
while (rs.next()) {
Calendar endC = Calendar.getInstance();
endC.setTime(postgresFormat.parse(rs.getString(1)));
endC.set(Calendar.DATE, endC.getActualMaximum(Calendar.DATE));
//iterate on data types
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(postgresFormat.parse(rs.getString(1))), report_dateFormat.format(endC.getTime()), rs.getString(2), rs.getString(3)));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(postgresFormat.parse(rs.getString(1))), report_dateFormat.format(endC.getTime()), rs.getString(2), rs.getString(3)));
endC.setTime(postgresFormat.parse(rs.getString(1)));
endC.add(Calendar.MONTH, 1);
lastDate = postgresFormat.format(endC.getTime());
@ -1697,7 +1798,7 @@ public class UsageStatsRepository {
}
}
private void fillWithZeros(Date from, Date to, ReportItem reportItem) {
private void fillWithZeros(Date from, Date to, COUNTER_Platform_Usage reportItem) {
SimpleDateFormat report_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar fromCalendar = Calendar.getInstance();
@ -1711,7 +1812,7 @@ public class UsageStatsRepository {
temp_c.set(Calendar.DAY_OF_MONTH, temp_c.getActualMaximum(Calendar.DAY_OF_MONTH));
Date temp_endDate = temp_c.getTime();
reportItem.addPerformance(new ItemPerformance(report_dateFormat.format(from), report_dateFormat.format(temp_endDate), "0", "0"));
reportItem.addPerformance(new COUNTER_Item_Performance(report_dateFormat.format(from), report_dateFormat.format(temp_endDate), "0", "0"));
fromCalendar.add(Calendar.MONTH, 1);
from = fromCalendar.getTime();
}

View File

@ -1,6 +1,6 @@
package eu.dnetlib.usagestats.services;
import eu.dnetlib.usagestats.sushilite.domain.ReportPR;
import eu.dnetlib.usagestats.sushilite.domain.COUNTER_Platform_Report;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
import java.util.ArrayList;
@ -21,10 +21,13 @@ public interface SushiLiteService {
ArrayList buildReportSupported();
String displayReportsSupported();
ReportPR buildReportPR(String repositoryIdentifier, String beginDate,String endDate, String metricType, String granularity);
String displayReportPR(String repositoryIdentifier, String beginDate,String endDate, String metricType, String granularity);
COUNTER_Platform_Report buildReportPR(String repositoryIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
String displayReportPR(String repositoryIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
ReportPR buildReportPR_P1(String repositoryIdentifier, String beginDate,String endDate);
COUNTER_Platform_Report buildReportPR_P1(String repositoryIdentifier, String beginDate,String endDate);
String displayReportPR_P1(String repositoryIdentifier, String beginDate, String endDate);
COUNTER_Platform_Report buildReportTR(String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
String displayReportTR(String repositoryIdentifier, String itemIdentifier, String beginDate,String endDate, String metricType, String dataType,String granularity);
}

View File

@ -5,10 +5,10 @@ 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.Filter;
import eu.dnetlib.usagestats.sushilite.domain.InstitutionID;
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
import eu.dnetlib.usagestats.sushilite.domain.ReportException;
import eu.dnetlib.usagestats.sushilite.domain.ReportPR;
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.ReportResponse;
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
import eu.dnetlib.usagestats.sushilite.domain.ReportStatus;
@ -43,11 +43,11 @@ public class SushiLiteServiceImpl implements SushiLiteService {
String itemDataType, String hasDoi, String granularity,
String callback) {
List<ReportItem> reportItems = new ArrayList<>();
List<ReportException> reportExceptions = new ArrayList<>();
List<COUNTER_Platform_Usage> reportItems = new ArrayList<>();
List<SUSHI_Error_Model> reportExceptions = new ArrayList<>();
if (!granularity.equalsIgnoreCase("totals") && !granularity.equalsIgnoreCase("monthly")) {
reportExceptions.add(new ReportException("3062", "Warning", "Invalid ReportAttribute Value", "Granularity: \'" + granularity + "\' unknown. Defaulting to Monthly"));
reportExceptions.add(new SUSHI_Error_Model("3062", "Warning", "Invalid ReportAttribute Value", "usagecounts.openaire.eu", "Granularity: \'" + granularity + "\' unknown. Defaulting to Monthly"));
granularity = "Monthly";
}
@ -65,7 +65,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
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;
@ -82,25 +82,25 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
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)));
}
//log.error("dates: " + beginDateParsed.toString() + " - " + endDateParsed.toString());
if (beginDateParsed == null) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
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 ReportException("3020", "Error", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
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 ReportException("3020", "Error", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(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 repoid = "";
if (!repositoryIdentifier.equals("")) {
repoid = usageStatsRepository.executeRepoId(repositoryIdentifier, reportName.toLowerCase());
if (repoid.equals("-1")) {
reportExceptions.add(new ReportException("3060", "Error", "Invalid Filter Value", "RepositoryIdentifier: " + repositoryIdentifier + " is not valid"));
reportExceptions.add(new SUSHI_Error_Model("3060", "Error", "Invalid Filter Value", "usagecounts.openaire.eu", "RepositoryIdentifier: " + repositoryIdentifier + " is not valid"));
}
}
String itemid = "";
@ -117,12 +117,12 @@ public class SushiLiteServiceImpl implements SushiLiteService {
itemid = itemIdentifier;
break;
default:
reportExceptions.add(new ReportException("3060", "Error", "Invalid Filter Value", "ItemIdentifier: " + itemIdentifier + " is not valid"));
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("") && !reportName.equalsIgnoreCase("rr1") && !reportName.equalsIgnoreCase("jr1")) {
reportExceptions.add(new ReportException("3070", "Error", "Required Filter Missing", "ItemIdentifier or RepositoryIdentifier must be supplied"));
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") && !repoid.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
@ -130,15 +130,15 @@ public class SushiLiteServiceImpl implements SushiLiteService {
if (itemDataType.equalsIgnoreCase("") || itemDataType.equalsIgnoreCase("article")) {
usageStatsRepository.executeItem(reportItems, itemIdentifier, repoid, "Article", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 {
reportExceptions.add(new ReportException("3030", "Error", "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("")) {
usageStatsRepository.executeBatchItems(reportItems, repoid, "Article", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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"));
}
}
}
@ -148,15 +148,15 @@ public class SushiLiteServiceImpl implements SushiLiteService {
if (itemDataType.equalsIgnoreCase("") || itemDataType.equalsIgnoreCase("book")) {
usageStatsRepository.executeItem(reportItems, itemIdentifier, repoid, "Book", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 {
reportExceptions.add(new ReportException("3030", "Error", "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("")) {
usageStatsRepository.executeBatchItems(reportItems, repoid, "Book", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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"));
}
}
}
@ -166,15 +166,15 @@ public class SushiLiteServiceImpl implements SushiLiteService {
if (itemDataType.equalsIgnoreCase("") || itemDataType.equalsIgnoreCase("part of book or chapter of book")) {
usageStatsRepository.executeItem(reportItems, itemIdentifier, repoid, "Part of book or chapter of book", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 {
reportExceptions.add(new ReportException("3030", "Error", "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("")) {
usageStatsRepository.executeBatchItems(reportItems, repoid, "Part of book or chapter of book", beginDateParsed, endDateParsed, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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"));
}
}
}
@ -186,7 +186,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
usageStatsRepository.executeBatchItems(reportItems, repoid, itemDataType, beginDateParsed, endDateParsed, granularity);
}
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 (reportName.equalsIgnoreCase("rr1")) {
@ -194,19 +194,19 @@ public class SushiLiteServiceImpl implements SushiLiteService {
usageStatsRepository.executeRepo(reportItems, repoid, itemDataType, beginDateParsed, endDateParsed, granularity);
}
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 (reportName.equalsIgnoreCase("jr1")) {
if (!repoid.equals("-1") && beginDateParsed != null && endDateParsed != null && beginDateParsed.before(endDateParsed)) {
usageStatsRepository.executeJournal(reportItems, repoid, itemDataType, beginDateParsed, endDateParsed, granularity);
}
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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 (reportName.equals("")) {
reportExceptions.add(new ReportException("3050", "Error", "Report argument is missing", "You must supply a Report argument"));
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 ReportException("3000", "Error", "Report " + reportName + " not supported", "Supported reports: AR1, IR1, RR1, BR1, BR2"));
reportExceptions.add(new SUSHI_Error_Model("3000", "Error", "usagecounts.openaire.eu", "Report " + reportName + " not supported", "Supported reports: AR1, IR1, RR1, BR1, BR2"));
}
ReportResponse reportResponse = new ReportResponse(reportName, release, requestorId, beginDate, endDate,
@ -299,9 +299,9 @@ public class SushiLiteServiceImpl implements SushiLiteService {
}
@Override
public ReportPR buildReportPR(String repositoryIdentifier, String beginDate,
String endDate, String metricType, String granularity) {
List<ReportException> reportExceptions = new ArrayList<>();
public COUNTER_Platform_Report buildReportPR(String repositoryIdentifier, 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
@ -322,7 +322,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "usagecounts.openaire.eu", "Unspecified Date Arguments", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
}
Date endDateParsed;
@ -339,18 +339,18 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "usagecounts.openaire.eu", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
}
//log.error("dates: " + beginDateParsed.toString() + " - " + endDateParsed.toString());
if (beginDateParsed == null) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
}
if (endDateParsed == null) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
}
if (beginDateParsed != null && endDateParsed != null && !beginDateParsed.before(endDateParsed)) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
}
List<Filter> reportFilters = new ArrayList();
@ -360,28 +360,29 @@ public class SushiLiteServiceImpl implements SushiLiteService {
String reportName = "Platform Master Report";
//String insitutionName = "Insititution Name " + repositoryIdentifier;
String insitutionName = usageStatsRepository.getInstitutionName(repositoryIdentifier);
List<InstitutionID> institutionIdD = new ArrayList();
institutionIdD.add(new InstitutionID("Openaire", repositoryIdentifier));
List<SUSHI_Org_Identifiers> institutionIdD = new ArrayList();
institutionIdD.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
List<ReportItem> reportItems = new ArrayList();
usageStatsRepository.executeBatchItemsPR(reportItems, repositoryIdentifier, beginDateParsed, endDateParsed, metricType, granularity);
List<COUNTER_Platform_Usage> reportItems = new ArrayList();
usageStatsRepository.executeBatchItemsPR(reportItems, repositoryIdentifier, beginDateParsed, endDateParsed, metricType, dataType, granularity);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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"));
}
if(reportExceptions.size()==0)
reportExceptions=null;
ReportPR reportPr = new ReportPR(dateTime.format(formatter), repositoryIdentifier, reportID, reportName, insitutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
if (reportExceptions.size() == 0) {
reportExceptions = null;
}
COUNTER_Platform_Report reportPr = new COUNTER_Platform_Report(dateTime.format(formatter), repositoryIdentifier, reportID, reportName, insitutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
return reportPr;
}
@Override
public ReportPR buildReportPR_P1(String repositoryIdentifier,
public COUNTER_Platform_Report buildReportPR_P1(String repositoryIdentifier,
String beginDate,
String endDate) {
String granularity="monthly";
List<ReportException> reportExceptions = new ArrayList<>();
String granularity = "monthly";
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
@ -402,7 +403,7 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMinimum(Calendar.DAY_OF_MONTH));
beginDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "usagecounts.openaire.eu", "Unspecified Date Arguments", "Begin Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed)));
}
Date endDateParsed;
@ -419,18 +420,18 @@ public class SushiLiteServiceImpl implements SushiLiteService {
temp.add(Calendar.MONTH, -1);
temp.set(Calendar.DAY_OF_MONTH, temp.getActualMaximum(Calendar.DAY_OF_MONTH));
endDateParsed = temp.getTime();
reportExceptions.add(new ReportException("3021", "Warning", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
reportExceptions.add(new SUSHI_Error_Model("3021", "Warning", "usagecounts.openaire.eu", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
}
//log.error("dates: " + beginDateParsed.toString() + " - " + endDateParsed.toString());
if (beginDateParsed == null) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "Begin Date: " + beginDate + " is not a valid date"));
}
if (endDateParsed == null) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "End Date: " + endDate + " is not a valid date"));
}
if (beginDateParsed != null && endDateParsed != null && !beginDateParsed.before(endDateParsed)) {
reportExceptions.add(new ReportException("3020", "Error", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
}
List<Filter> reportFilters = new ArrayList();
@ -440,29 +441,107 @@ public class SushiLiteServiceImpl implements SushiLiteService {
String reportName = "Platform Master Report";
//String insitutionName = "Insititution Name " + repositoryIdentifier;
String insitutionName = usageStatsRepository.getInstitutionName(repositoryIdentifier);
List<InstitutionID> institutionIdD = new ArrayList();
institutionIdD.add(new InstitutionID("Openaire", repositoryIdentifier));
List<SUSHI_Org_Identifiers> institutionIdD = new ArrayList();
institutionIdD.add(new SUSHI_Org_Identifiers("Openaire", repositoryIdentifier));
List<ReportItem> reportItems = new ArrayList();
List<COUNTER_Platform_Usage> reportItems = new ArrayList();
usageStatsRepository.executeBatchItemsPR_P1(reportItems, repositoryIdentifier, beginDateParsed, endDateParsed);
if (reportItems.isEmpty()) {
reportExceptions.add(new ReportException("3030", "Error", "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"));
}
if(reportExceptions.size()==0)
reportExceptions=null;
if (reportExceptions.size() == 0) {
reportExceptions = null;
}
ReportPR reportPr = new ReportPR(dateTime.format(formatter), repositoryIdentifier, reportID, reportName, insitutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
COUNTER_Platform_Report reportPr = new COUNTER_Platform_Report(dateTime.format(formatter), repositoryIdentifier, reportID, reportName, insitutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
return reportPr;
}
@Override
public COUNTER_Platform_Report buildReportTR(String repositoryIdentifier, String itemIdentifier, 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);
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 {
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", "usagecounts.openaire.eu", "Unspecified Date Arguments", "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 {
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", "usagecounts.openaire.eu", "Unspecified Date Arguments", "End Date set to default: " + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed)));
}
//log.error("dates: " + beginDateParsed.toString() + " - " + endDateParsed.toString());
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"));
}
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"));
}
if (beginDateParsed != null && endDateParsed != null && !beginDateParsed.before(endDateParsed)) {
reportExceptions.add(new SUSHI_Error_Model("3020", "Error", "usagecounts.openaire.eu", "Invalid Date Arguments", "BeginDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(beginDateParsed) + "\' is greater than EndDate \'" + new SimpleDateFormat("yyyy-MM-dd").format(endDateParsed) + "\'"));
}
List<Filter> reportFilters = new ArrayList();
reportFilters.add(new Filter("BeginDate", beginDate));
reportFilters.add(new Filter("EndDate", endDate));
String reportID = "ΤR";
String reportName = "Title Master Report";
String insitutionName = usageStatsRepository.getInstitutionName(repositoryIdentifier);
List<SUSHI_Org_Identifiers> institutionIdD = new ArrayList();
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 (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;
}
COUNTER_Platform_Report reportPr = new COUNTER_Platform_Report(dateTime.format(formatter), repositoryIdentifier, reportID, reportName, insitutionName, institutionIdD, reportExceptions, reportFilters, reportItems);
return reportPr;
}
@Override
public String displayReportPR(String repositoryIdentifier, String beginDate,
String endDate, String metricType, String granularity) {
String endDate, String metricType, String dataType, String granularity) {
ObjectMapper objectMapper = new ObjectMapper();
log.info((beginDate + " " + endDate));
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportPR(repositoryIdentifier, beginDate, endDate, metricType, granularity)) + "</pre>";
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportPR(repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
} catch (JsonProcessingException ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
@ -481,6 +560,19 @@ public class SushiLiteServiceImpl implements SushiLiteService {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public String displayReportTR(String repositoryIdentifier, String itemIdentifier,String beginDate,
String endDate, String metricType, String dataType, String granularity) {
ObjectMapper objectMapper = new ObjectMapper();
log.info((beginDate + " " + endDate));
try {
return "<pre>" + objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(buildReportPR(repositoryIdentifier, beginDate, endDate, metricType, dataType, granularity)) + "</pre>";
} catch (JsonProcessingException ex) {
java.util.logging.Logger.getLogger(SushiLiteServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}

View File

@ -9,16 +9,16 @@ 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=/Users/dpie/Desktop/usageStatsAPI.log
#log4j.appender.R.File=/Volumes/Zeus/dpie/Desktop/usageStatsAPI.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=/Users/dpie/Desktop/usageStatsAPI-spring.log
#log4j.appender.S.File=/Volumes/Zeus/dpie/Desktop/usageStatsAPI-spring.log
log4j.appender.S.MaxFileSize=10MB
log4j.appender.S.MaxBackupIndex=10
log4j.appender.S.layout=org.apache.log4j.PatternLayout

View File

@ -0,0 +1,20 @@
name=usageStatsAPI
logging.config=log4j.properties
usagestats.driverClassName=com.cloudera.impala.jdbc41.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.HSQLDialect
usagestats.url=jdbc:impala://iis-cdh5-test-gw.ocean.icm.edu.pl:21050/;UseNativeQuery=1;AutoReconnect=1
usagestats.username=sqoop
usagestats.password=sqoop
usagestats.redis.hostname=localhost
usagestats.redis.port=6379
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.context-path=/usagestats_r5
server.port=8080
#spring.datasource.testWhileIdle = true
#spring.datasource.timeBetweenEvictionRunsMillis = 60000
#spring.datasource.validationQuery = SELECT 1