1st commit 24012023

This commit is contained in:
dimitrispie 2023-01-24 15:01:43 +02:00
commit d602848b2e
41 changed files with 1468 additions and 0 deletions

1
trunk/.svn/entries Executable file
View File

@ -0,0 +1 @@
12

1
trunk/.svn/format Executable file
View File

@ -0,0 +1 @@
12

View File

@ -0,0 +1,72 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by tsampikos on 25/10/2016.
*/
public class ReportResponse {
private String created;
private List<ReportException> reportExceptions = new ArrayList<>();
private Requestor requestor;
private ReportDefinition reportDefinition;
private ReportWrapper reportWrapper;
public ReportResponse() {
}
public ReportResponse(String reportName, String release, String requestorId, String beginDate,
String endDate, String repositoryIdentifier, String itemIdentifier,
String itemDataType, String hasDoi, String granularity, String callback, List<ReportItem> reportItems, List<ReportException> reportExceptions) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
Date date = new Date();
created = dateFormat.format(date);
if (!reportExceptions.isEmpty()) {
this.reportExceptions = reportExceptions;
}
requestor = new Requestor(requestorId);
reportDefinition = new ReportDefinition(reportName, release, beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, Integer.toString(reportItems.size()));
Report report = new Report(created, reportName, release, requestorId, reportItems);
reportWrapper = new ReportWrapper(report);
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("Exception")
public List<ReportException> getReportExceptions() {
return reportExceptions;
}
@JsonProperty("Requestor")
public Requestor getRequestor() {
return requestor;
}
@JsonProperty("ReportDefinition")
public ReportDefinition getReportDefinition() {
return reportDefinition;
}
@JsonProperty("Report")
public ReportWrapper getReportWrapper() {
return reportWrapper;
}
}

View File

@ -0,0 +1,53 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Filters {
private UsageDateRange usageDateRange = null;
private List<Filter> filter = new ArrayList<>();
private List<Filter> reportAttribute = new ArrayList<>();
public Filters() {
}
public Filters(String beginDate, String endDate, String repositoryIdentifier,
String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
usageDateRange = new UsageDateRange(beginDate, endDate);
if (repositoryIdentifier != null && !repositoryIdentifier.equals("")) {
filter.add(new Filter("RepositoryIdentifier", repositoryIdentifier));
}
if (itemIdentifier != null && !itemIdentifier.equals("")) {
filter.add(new Filter("ItemIdentifier", itemIdentifier));
}
if (itemDataType != null && !itemDataType.equals("")) {
filter.add(new Filter("ItemDataType", itemDataType));
}
reportAttribute.add(new Filter("Granularity", granularity));
if (reportItemCount != null && !reportItemCount.equals("")) {
reportAttribute.add(new Filter("ReportItemCount", reportItemCount));
}
}
@JsonProperty("UsageDateRange")
public UsageDateRange getUsageDateRange() {
return usageDateRange;
}
@JsonProperty("Filter")
public List<Filter> getFilter() {
return filter;
}
@JsonProperty("ReportAttribute")
public List<Filter> getReportAttribute() {
return reportAttribute;
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 25/10/2016.
*/
public class Requestor {
private String id;
public Requestor() {
}
public Requestor(String id) {
this.id = id;
}
@JsonProperty("ID")
public String getID() {
return id;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Filter {
private String name = null;
private String value = null;
public Filter() {
}
public Filter(String name, String value) {
this.name = name;
this.value = value;
}
@JsonProperty("Name")
public String getName() {
return name;
}
@JsonProperty("Value")
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,26 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class ReportWrapper {
private Report report;
public ReportWrapper() {
}
public ReportWrapper(Report report) {
this.report = report;
}
@JsonProperty("Report")
public Report getReport() {
return report;
}
public void setReport(Report report) {
this.report = report;
}
}

View File

@ -0,0 +1,75 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ReportItem {
private List<ItemIdentifier> itemIdentifiers = new ArrayList<>();
private String itemPublisher;
private String itemPlatform;
private String itemDataType;
private String itemName;
private List<ItemPerformance> itemPerformances = new ArrayList<>();
public ReportItem() {
}
public ReportItem(String itemPublisher, String itemPlatform, String itemDataType, String itemName) {
this.itemPublisher = itemPublisher;
this.itemPlatform = itemPlatform;
this.itemDataType = itemDataType;
this.itemName = itemName;
}
@JsonProperty("ItemIdentifier")
public List<ItemIdentifier> getItemIdentifiers() {
return itemIdentifiers;
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("ItemPublisher")
public String getItemPublisher() {
return itemPublisher;
}
@JsonProperty("ItemPlatform")
public String getItemPlatform() {
return itemPlatform;
}
@JsonProperty("ItemDataType")
public String getItemDataType() {
return itemDataType;
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("ItemName")
public String getItemName() {
return itemName;
}
@JsonProperty("ItemPerformance")
public List<ItemPerformance> getItemPerformances() {
return itemPerformances;
}
public void addIdentifier(ItemIdentifier itemIdentifier) {
itemIdentifiers.add(itemIdentifier);
}
public void addPerformance(ItemPerformance itemPerformance) {
itemPerformances.add(itemPerformance);
}
public void setItemPlatform(String itemPlatform) {
this.itemPlatform = itemPlatform;
}
}

View File

@ -0,0 +1,24 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Vendor {
private Contact contact = new Contact();
public Vendor() {
}
@JsonProperty("Name")
public String getName() {
return "OpenAIRE";
}
@JsonProperty("Contact")
public Contact getContact() {
return contact;
}
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
<version>1.0.0-SNAPSHOT</version>
<!--
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
-->
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.6</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class UsageDateRange {
private String begin;
private String end;
public UsageDateRange() {
}
public UsageDateRange(String begin, String end) {
this.begin = begin;
this.end = end;
}
@JsonProperty("Begin")
public String getBegin() {
return begin;
}
@JsonProperty("End")
public String getEnd() {
return end;
}
}

View File

@ -0,0 +1,38 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ItemPerformance {
private Period period;
private List<Instance> instances = new ArrayList<>();
public ItemPerformance() {
}
public ItemPerformance(String start, String end, String ft_count, String abstr) {
period = new Period(start, end);
instances.add(new Instance("ft_total", ft_count));
instances.add(new Instance("abstract", abstr));
}
@JsonProperty("Period")
public Period getPeriod() {
return period;
}
@JsonProperty("Category")
public String getCategory() {
return "Requests";
}
@JsonProperty("Instance")
public List<Instance> getInstance() {
return instances;
}
}

View File

@ -0,0 +1,50 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class Report {
private String created;
private String version;
private String name;
private Vendor vendor = new Vendor();
private Customer customer;
public Report() {
}
public Report(String created, String name, String version, String requestor, List<ReportItem> reportItems) {
this.created = created;
this.version = version;
this.name = name + ":" + version;
this.customer = new Customer(requestor, reportItems);
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonProperty("@Version")
public String getVersion() {
return version;
}
@JsonProperty("@Name")
public String getName() {
return name;
}
@JsonProperty("Vendor")
public Vendor getVendor() {
return vendor;
}
@JsonProperty("Customer")
public Customer getCustomer() {
return customer;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Period {
private String begin;
private String end;
public Period() {
}
public Period(String begin, String end) {
this.begin = begin;
this.end = end;
}
@JsonProperty("Begin")
public String getBegin() {
return begin;
}
@JsonProperty("End")
public String getEnd() {
return end;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Instance {
private String metricType;
private String count;
public Instance() {
}
public Instance(String type, String count) {
this.metricType = type;
this.count = count;
}
@JsonProperty("MetricType")
public String getMetricType() {
return metricType;
}
@JsonProperty("Count")
public String getCount() {
return count;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ItemIdentifier {
private String type;
private String value;
public ItemIdentifier() {
}
public ItemIdentifier(String type, String value) {
this.type = type;
this.value = value;
}
@JsonProperty("Type")
public String getType() {
return type;
}
@JsonProperty("Value")
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,39 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 25/10/2016.
*/
public class ReportDefinition {
private String name;
private String release;
private Filters filters;
public ReportDefinition() {
}
public ReportDefinition(String name, String release, String beginDate, String endDate,
String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
this.name = name;
this.release = release;
filters = new Filters(beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, reportItemCount);
}
@JsonProperty("@Name")
public String getName() {
return name;
}
@JsonProperty("@Release")
public String getRelease() {
return release;
}
@JsonProperty("Filters")
public Filters getFilters() {
return filters;
}
}

View File

@ -0,0 +1,58 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by tsampikos on 23/11/2016.
*/
public class ReportException {
private String created;
private String number;
private String severity;
private String message;
private String data;
public ReportException() {
}
public ReportException(String number, String severity, String message, String data) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
Date date = new Date();
created = dateFormat.format(date);
this.number = number;
this.severity = severity;
this.message = message;
this.data = data;
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonProperty("Number")
public String getNumber() {
return number;
}
@JsonProperty("Severity")
public String getSeverity() {
return severity;
}
@JsonProperty("Message")
public String getMessage() {
return message;
}
@JsonProperty("Data")
public String getData() {
return data;
}
}

View File

@ -0,0 +1,25 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class ReportResponseWrapper {
private ReportResponse reportResponse;
public ReportResponseWrapper() {}
public ReportResponseWrapper(ReportResponse reportResponse) {
this.reportResponse = reportResponse;
}
@JsonProperty("ReportResponse")
public ReportResponse getReportResponse() {
return reportResponse;
}
public void setReportResponse(ReportResponse reportResponse) {
this.reportResponse = reportResponse;
}
}

View File

@ -0,0 +1,37 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Customer {
private String id = null;
public void setReportItems(List<ReportItem> reportItems) {
this.reportItems = reportItems;
}
private List<ReportItem> reportItems = new ArrayList<>();
public Customer() {
}
public Customer(String id, List<ReportItem> reportItems) {
this.id = id;
this.reportItems = reportItems;
}
@JsonProperty("ID")
public String getId() {
return id;
}
@JsonProperty("ReportItems")
public List<ReportItem> getReportItems() {
return reportItems;
}
}

View File

@ -0,0 +1,22 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Contact {
@JsonProperty("Contact")
public String getContact() {
return "OpenAIRE Helpdesk";
}
@JsonProperty("E-mail")
public String getEmail() {
return "helpdesk@openaire.eu";
}
public Contact() {
}
}

BIN
trunk/.svn/wc.db Executable file

Binary file not shown.

46
trunk/pom.xml Executable file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
<version>1.0.0-SNAPSHOT</version>
<!--
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
-->
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.6</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

View File

@ -0,0 +1,22 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Contact {
@JsonProperty("Contact")
public String getContact() {
return "OpenAIRE Helpdesk";
}
@JsonProperty("E-mail")
public String getEmail() {
return "helpdesk@openaire.eu";
}
public Contact() {
}
}

View File

@ -0,0 +1,37 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Customer {
private String id = null;
public void setReportItems(List<ReportItem> reportItems) {
this.reportItems = reportItems;
}
private List<ReportItem> reportItems = new ArrayList<>();
public Customer() {
}
public Customer(String id, List<ReportItem> reportItems) {
this.id = id;
this.reportItems = reportItems;
}
@JsonProperty("ID")
public String getId() {
return id;
}
@JsonProperty("ReportItems")
public List<ReportItem> getReportItems() {
return reportItems;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Filter {
private String name = null;
private String value = null;
public Filter() {
}
public Filter(String name, String value) {
this.name = name;
this.value = value;
}
@JsonProperty("Name")
public String getName() {
return name;
}
@JsonProperty("Value")
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,53 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Filters {
private UsageDateRange usageDateRange = null;
private List<Filter> filter = new ArrayList<>();
private List<Filter> reportAttribute = new ArrayList<>();
public Filters() {
}
public Filters(String beginDate, String endDate, String repositoryIdentifier,
String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
usageDateRange = new UsageDateRange(beginDate, endDate);
if (repositoryIdentifier != null && !repositoryIdentifier.equals("")) {
filter.add(new Filter("RepositoryIdentifier", repositoryIdentifier));
}
if (itemIdentifier != null && !itemIdentifier.equals("")) {
filter.add(new Filter("ItemIdentifier", itemIdentifier));
}
if (itemDataType != null && !itemDataType.equals("")) {
filter.add(new Filter("ItemDataType", itemDataType));
}
reportAttribute.add(new Filter("Granularity", granularity));
if (reportItemCount != null && !reportItemCount.equals("")) {
reportAttribute.add(new Filter("ReportItemCount", reportItemCount));
}
}
@JsonProperty("UsageDateRange")
public UsageDateRange getUsageDateRange() {
return usageDateRange;
}
@JsonProperty("Filter")
public List<Filter> getFilter() {
return filter;
}
@JsonProperty("ReportAttribute")
public List<Filter> getReportAttribute() {
return reportAttribute;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Instance {
private String metricType;
private String count;
public Instance() {
}
public Instance(String type, String count) {
this.metricType = type;
this.count = count;
}
@JsonProperty("MetricType")
public String getMetricType() {
return metricType;
}
@JsonProperty("Count")
public String getCount() {
return count;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ItemIdentifier {
private String type;
private String value;
public ItemIdentifier() {
}
public ItemIdentifier(String type, String value) {
this.type = type;
this.value = value;
}
@JsonProperty("Type")
public String getType() {
return type;
}
@JsonProperty("Value")
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,38 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ItemPerformance {
private Period period;
private List<Instance> instances = new ArrayList<>();
public ItemPerformance() {
}
public ItemPerformance(String start, String end, String ft_count, String abstr) {
period = new Period(start, end);
instances.add(new Instance("ft_total", ft_count));
instances.add(new Instance("abstract", abstr));
}
@JsonProperty("Period")
public Period getPeriod() {
return period;
}
@JsonProperty("Category")
public String getCategory() {
return "Requests";
}
@JsonProperty("Instance")
public List<Instance> getInstance() {
return instances;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 31/10/2016.
*/
public class Period {
private String begin;
private String end;
public Period() {
}
public Period(String begin, String end) {
this.begin = begin;
this.end = end;
}
@JsonProperty("Begin")
public String getBegin() {
return begin;
}
@JsonProperty("End")
public String getEnd() {
return end;
}
}

View File

@ -0,0 +1,50 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class Report {
private String created;
private String version;
private String name;
private Vendor vendor = new Vendor();
private Customer customer;
public Report() {
}
public Report(String created, String name, String version, String requestor, List<ReportItem> reportItems) {
this.created = created;
this.version = version;
this.name = name + ":" + version;
this.customer = new Customer(requestor, reportItems);
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonProperty("@Version")
public String getVersion() {
return version;
}
@JsonProperty("@Name")
public String getName() {
return name;
}
@JsonProperty("Vendor")
public Vendor getVendor() {
return vendor;
}
@JsonProperty("Customer")
public Customer getCustomer() {
return customer;
}
}

View File

@ -0,0 +1,39 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 25/10/2016.
*/
public class ReportDefinition {
private String name;
private String release;
private Filters filters;
public ReportDefinition() {
}
public ReportDefinition(String name, String release, String beginDate, String endDate,
String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
this.name = name;
this.release = release;
filters = new Filters(beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, reportItemCount);
}
@JsonProperty("@Name")
public String getName() {
return name;
}
@JsonProperty("@Release")
public String getRelease() {
return release;
}
@JsonProperty("Filters")
public Filters getFilters() {
return filters;
}
}

View File

@ -0,0 +1,58 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by tsampikos on 23/11/2016.
*/
public class ReportException {
private String created;
private String number;
private String severity;
private String message;
private String data;
public ReportException() {
}
public ReportException(String number, String severity, String message, String data) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
Date date = new Date();
created = dateFormat.format(date);
this.number = number;
this.severity = severity;
this.message = message;
this.data = data;
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonProperty("Number")
public String getNumber() {
return number;
}
@JsonProperty("Severity")
public String getSeverity() {
return severity;
}
@JsonProperty("Message")
public String getMessage() {
return message;
}
@JsonProperty("Data")
public String getData() {
return data;
}
}

View File

@ -0,0 +1,75 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tsampikos on 31/10/2016.
*/
public class ReportItem {
private List<ItemIdentifier> itemIdentifiers = new ArrayList<>();
private String itemPublisher;
private String itemPlatform;
private String itemDataType;
private String itemName;
private List<ItemPerformance> itemPerformances = new ArrayList<>();
public ReportItem() {
}
public ReportItem(String itemPublisher, String itemPlatform, String itemDataType, String itemName) {
this.itemPublisher = itemPublisher;
this.itemPlatform = itemPlatform;
this.itemDataType = itemDataType;
this.itemName = itemName;
}
@JsonProperty("ItemIdentifier")
public List<ItemIdentifier> getItemIdentifiers() {
return itemIdentifiers;
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("ItemPublisher")
public String getItemPublisher() {
return itemPublisher;
}
@JsonProperty("ItemPlatform")
public String getItemPlatform() {
return itemPlatform;
}
@JsonProperty("ItemDataType")
public String getItemDataType() {
return itemDataType;
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("ItemName")
public String getItemName() {
return itemName;
}
@JsonProperty("ItemPerformance")
public List<ItemPerformance> getItemPerformances() {
return itemPerformances;
}
public void addIdentifier(ItemIdentifier itemIdentifier) {
itemIdentifiers.add(itemIdentifier);
}
public void addPerformance(ItemPerformance itemPerformance) {
itemPerformances.add(itemPerformance);
}
public void setItemPlatform(String itemPlatform) {
this.itemPlatform = itemPlatform;
}
}

View File

@ -0,0 +1,72 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by tsampikos on 25/10/2016.
*/
public class ReportResponse {
private String created;
private List<ReportException> reportExceptions = new ArrayList<>();
private Requestor requestor;
private ReportDefinition reportDefinition;
private ReportWrapper reportWrapper;
public ReportResponse() {
}
public ReportResponse(String reportName, String release, String requestorId, String beginDate,
String endDate, String repositoryIdentifier, String itemIdentifier,
String itemDataType, String hasDoi, String granularity, String callback, List<ReportItem> reportItems, List<ReportException> reportExceptions) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
Date date = new Date();
created = dateFormat.format(date);
if (!reportExceptions.isEmpty()) {
this.reportExceptions = reportExceptions;
}
requestor = new Requestor(requestorId);
reportDefinition = new ReportDefinition(reportName, release, beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, Integer.toString(reportItems.size()));
Report report = new Report(created, reportName, release, requestorId, reportItems);
reportWrapper = new ReportWrapper(report);
}
@JsonProperty("@Created")
public String getCreated() {
return created;
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("Exception")
public List<ReportException> getReportExceptions() {
return reportExceptions;
}
@JsonProperty("Requestor")
public Requestor getRequestor() {
return requestor;
}
@JsonProperty("ReportDefinition")
public ReportDefinition getReportDefinition() {
return reportDefinition;
}
@JsonProperty("Report")
public ReportWrapper getReportWrapper() {
return reportWrapper;
}
}

View File

@ -0,0 +1,25 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class ReportResponseWrapper {
private ReportResponse reportResponse;
public ReportResponseWrapper() {}
public ReportResponseWrapper(ReportResponse reportResponse) {
this.reportResponse = reportResponse;
}
@JsonProperty("ReportResponse")
public ReportResponse getReportResponse() {
return reportResponse;
}
public void setReportResponse(ReportResponse reportResponse) {
this.reportResponse = reportResponse;
}
}

View File

@ -0,0 +1,26 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class ReportWrapper {
private Report report;
public ReportWrapper() {
}
public ReportWrapper(Report report) {
this.report = report;
}
@JsonProperty("Report")
public Report getReport() {
return report;
}
public void setReport(Report report) {
this.report = report;
}
}

View File

@ -0,0 +1,23 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 25/10/2016.
*/
public class Requestor {
private String id;
public Requestor() {
}
public Requestor(String id) {
this.id = id;
}
@JsonProperty("ID")
public String getID() {
return id;
}
}

View File

@ -0,0 +1,29 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class UsageDateRange {
private String begin;
private String end;
public UsageDateRange() {
}
public UsageDateRange(String begin, String end) {
this.begin = begin;
this.end = end;
}
@JsonProperty("Begin")
public String getBegin() {
return begin;
}
@JsonProperty("End")
public String getEnd() {
return end;
}
}

View File

@ -0,0 +1,24 @@
package eu.dnetlib.usagestats.sushilite.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Created by tsampikos on 26/10/2016.
*/
public class Vendor {
private Contact contact = new Contact();
public Vendor() {
}
@JsonProperty("Name")
public String getName() {
return "OpenAIRE";
}
@JsonProperty("Contact")
public Contact getContact() {
return contact;
}
}