commit d602848b2e4d93dad1f4052634c9cccadddbbc92 Author: dimitrispie Date: Tue Jan 24 15:01:43 2023 +0200 1st commit 24012023 diff --git a/trunk/.svn/entries b/trunk/.svn/entries new file mode 100755 index 0000000..48082f7 --- /dev/null +++ b/trunk/.svn/entries @@ -0,0 +1 @@ +12 diff --git a/trunk/.svn/format b/trunk/.svn/format new file mode 100755 index 0000000..48082f7 --- /dev/null +++ b/trunk/.svn/format @@ -0,0 +1 @@ +12 diff --git a/trunk/.svn/pristine/24/2462df53dc4ef02edb939e57ed73b15745f8f4de.svn-base b/trunk/.svn/pristine/24/2462df53dc4ef02edb939e57ed73b15745f8f4de.svn-base new file mode 100755 index 0000000..de31fbb --- /dev/null +++ b/trunk/.svn/pristine/24/2462df53dc4ef02edb939e57ed73b15745f8f4de.svn-base @@ -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 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 reportItems, List 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 getReportExceptions() { + return reportExceptions; + } + + @JsonProperty("Requestor") + public Requestor getRequestor() { + return requestor; + } + + @JsonProperty("ReportDefinition") + public ReportDefinition getReportDefinition() { + return reportDefinition; + } + + @JsonProperty("Report") + public ReportWrapper getReportWrapper() { + return reportWrapper; + } + +} diff --git a/trunk/.svn/pristine/2e/2e1f9d4e67ac58be97dcdcea496f53d57d1e84ab.svn-base b/trunk/.svn/pristine/2e/2e1f9d4e67ac58be97dcdcea496f53d57d1e84ab.svn-base new file mode 100755 index 0000000..498eaed --- /dev/null +++ b/trunk/.svn/pristine/2e/2e1f9d4e67ac58be97dcdcea496f53d57d1e84ab.svn-base @@ -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 = new ArrayList<>(); + private List 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 getFilter() { + return filter; + } + + @JsonProperty("ReportAttribute") + public List getReportAttribute() { + return reportAttribute; + } +} diff --git a/trunk/.svn/pristine/34/34915230a1784343665bd296747e8399a5a71af2.svn-base b/trunk/.svn/pristine/34/34915230a1784343665bd296747e8399a5a71af2.svn-base new file mode 100755 index 0000000..9a128f8 --- /dev/null +++ b/trunk/.svn/pristine/34/34915230a1784343665bd296747e8399a5a71af2.svn-base @@ -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; + } + +} diff --git a/trunk/.svn/pristine/3b/3b71e3b9a382d7244ce3c2c68b1eed32fe642b65.svn-base b/trunk/.svn/pristine/3b/3b71e3b9a382d7244ce3c2c68b1eed32fe642b65.svn-base new file mode 100755 index 0000000..ac0096b --- /dev/null +++ b/trunk/.svn/pristine/3b/3b71e3b9a382d7244ce3c2c68b1eed32fe642b65.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/3d/3dadb0d3a8580386a7782ea8d080a6cd2673190f.svn-base b/trunk/.svn/pristine/3d/3dadb0d3a8580386a7782ea8d080a6cd2673190f.svn-base new file mode 100755 index 0000000..d67d0cb --- /dev/null +++ b/trunk/.svn/pristine/3d/3dadb0d3a8580386a7782ea8d080a6cd2673190f.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/42/42b8e90c44afcf7b197010c00a2d47c0692d7eb4.svn-base b/trunk/.svn/pristine/42/42b8e90c44afcf7b197010c00a2d47c0692d7eb4.svn-base new file mode 100755 index 0000000..761ec9c --- /dev/null +++ b/trunk/.svn/pristine/42/42b8e90c44afcf7b197010c00a2d47c0692d7eb4.svn-base @@ -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 itemIdentifiers = new ArrayList<>(); + + private String itemPublisher; + private String itemPlatform; + private String itemDataType; + private String itemName; + + private List 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 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 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; + } +} diff --git a/trunk/.svn/pristine/54/548d4ec44cb6491670f538293bc2657a798dc40b.svn-base b/trunk/.svn/pristine/54/548d4ec44cb6491670f538293bc2657a798dc40b.svn-base new file mode 100755 index 0000000..6e66818 --- /dev/null +++ b/trunk/.svn/pristine/54/548d4ec44cb6491670f538293bc2657a798dc40b.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/58/587257fd1c6234917f9feabf9754fc73c6c94079.svn-base b/trunk/.svn/pristine/58/587257fd1c6234917f9feabf9754fc73c6c94079.svn-base new file mode 100755 index 0000000..3ef7964 --- /dev/null +++ b/trunk/.svn/pristine/58/587257fd1c6234917f9feabf9754fc73c6c94079.svn-base @@ -0,0 +1,46 @@ + + + 4.0.0 + + eu.dnetlib + dnet-openaire-usage-stats-sushilite + 1.0.0-SNAPSHOT + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.6 + + + + + 1.8 + 1.8 + 1.8 + + + diff --git a/trunk/.svn/pristine/60/60d42dacda9ec1d22ba3441f389fe72cd8841860.svn-base b/trunk/.svn/pristine/60/60d42dacda9ec1d22ba3441f389fe72cd8841860.svn-base new file mode 100755 index 0000000..0b853c4 --- /dev/null +++ b/trunk/.svn/pristine/60/60d42dacda9ec1d22ba3441f389fe72cd8841860.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/70/70b425d90c8cd09d524e788d8ea4a3b86b9fcdd3.svn-base b/trunk/.svn/pristine/70/70b425d90c8cd09d524e788d8ea4a3b86b9fcdd3.svn-base new file mode 100755 index 0000000..e48ca9e --- /dev/null +++ b/trunk/.svn/pristine/70/70b425d90c8cd09d524e788d8ea4a3b86b9fcdd3.svn-base @@ -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 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 getInstance() { + return instances; + } +} diff --git a/trunk/.svn/pristine/a3/a353091748eb10e0d4b88d792391439a62f17739.svn-base b/trunk/.svn/pristine/a3/a353091748eb10e0d4b88d792391439a62f17739.svn-base new file mode 100755 index 0000000..8ac2c28 --- /dev/null +++ b/trunk/.svn/pristine/a3/a353091748eb10e0d4b88d792391439a62f17739.svn-base @@ -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 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; + } +} diff --git a/trunk/.svn/pristine/b9/b99e1bb8ebb9a884bb2414af146d5a13ef08021f.svn-base b/trunk/.svn/pristine/b9/b99e1bb8ebb9a884bb2414af146d5a13ef08021f.svn-base new file mode 100755 index 0000000..f9a6b0b --- /dev/null +++ b/trunk/.svn/pristine/b9/b99e1bb8ebb9a884bb2414af146d5a13ef08021f.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/bc/bc07525b3207632cd1d8cd07aada4bdfd5546671.svn-base b/trunk/.svn/pristine/bc/bc07525b3207632cd1d8cd07aada4bdfd5546671.svn-base new file mode 100755 index 0000000..06c575d --- /dev/null +++ b/trunk/.svn/pristine/bc/bc07525b3207632cd1d8cd07aada4bdfd5546671.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/c2/c250e3348465b7f29ba1db13f4898960f1f1cc38.svn-base b/trunk/.svn/pristine/c2/c250e3348465b7f29ba1db13f4898960f1f1cc38.svn-base new file mode 100755 index 0000000..09bbe70 --- /dev/null +++ b/trunk/.svn/pristine/c2/c250e3348465b7f29ba1db13f4898960f1f1cc38.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/db/db542e38205c6064a975b62ad30ef58378aba46e.svn-base b/trunk/.svn/pristine/db/db542e38205c6064a975b62ad30ef58378aba46e.svn-base new file mode 100755 index 0000000..43ec61c --- /dev/null +++ b/trunk/.svn/pristine/db/db542e38205c6064a975b62ad30ef58378aba46e.svn-base @@ -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; + } + +} diff --git a/trunk/.svn/pristine/e3/e35a28778d832216d3ee10211d6a8d847f3c83ce.svn-base b/trunk/.svn/pristine/e3/e35a28778d832216d3ee10211d6a8d847f3c83ce.svn-base new file mode 100755 index 0000000..6f42275 --- /dev/null +++ b/trunk/.svn/pristine/e3/e35a28778d832216d3ee10211d6a8d847f3c83ce.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/e3/e389840e4952bd7a843ed5208475a4780d82412b.svn-base b/trunk/.svn/pristine/e3/e389840e4952bd7a843ed5208475a4780d82412b.svn-base new file mode 100755 index 0000000..dd68026 --- /dev/null +++ b/trunk/.svn/pristine/e3/e389840e4952bd7a843ed5208475a4780d82412b.svn-base @@ -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; + } +} diff --git a/trunk/.svn/pristine/fa/fa18ad74c33f304e8f5fc486fcd69ffabe1559f1.svn-base b/trunk/.svn/pristine/fa/fa18ad74c33f304e8f5fc486fcd69ffabe1559f1.svn-base new file mode 100755 index 0000000..c26f88f --- /dev/null +++ b/trunk/.svn/pristine/fa/fa18ad74c33f304e8f5fc486fcd69ffabe1559f1.svn-base @@ -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 reportItems) { + this.reportItems = reportItems; + } + + private List reportItems = new ArrayList<>(); + + public Customer() { + } + + public Customer(String id, List reportItems) { + this.id = id; + this.reportItems = reportItems; + } + + @JsonProperty("ID") + public String getId() { + return id; + } + + @JsonProperty("ReportItems") + public List getReportItems() { + return reportItems; + } +} diff --git a/trunk/.svn/pristine/fd/fd31249c44178b310ebc418647d4336cba151696.svn-base b/trunk/.svn/pristine/fd/fd31249c44178b310ebc418647d4336cba151696.svn-base new file mode 100755 index 0000000..28cdeeb --- /dev/null +++ b/trunk/.svn/pristine/fd/fd31249c44178b310ebc418647d4336cba151696.svn-base @@ -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() { + } +} diff --git a/trunk/.svn/wc.db b/trunk/.svn/wc.db new file mode 100755 index 0000000..af1edf6 Binary files /dev/null and b/trunk/.svn/wc.db differ diff --git a/trunk/pom.xml b/trunk/pom.xml new file mode 100755 index 0000000..3ef7964 --- /dev/null +++ b/trunk/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + eu.dnetlib + dnet-openaire-usage-stats-sushilite + 1.0.0-SNAPSHOT + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.6 + + + + + 1.8 + 1.8 + 1.8 + + + diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Contact.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Contact.java new file mode 100755 index 0000000..28cdeeb --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Contact.java @@ -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() { + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java new file mode 100755 index 0000000..c26f88f --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java @@ -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 reportItems) { + this.reportItems = reportItems; + } + + private List reportItems = new ArrayList<>(); + + public Customer() { + } + + public Customer(String id, List reportItems) { + this.id = id; + this.reportItems = reportItems; + } + + @JsonProperty("ID") + public String getId() { + return id; + } + + @JsonProperty("ReportItems") + public List getReportItems() { + return reportItems; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filter.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filter.java new file mode 100755 index 0000000..ac0096b --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filter.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filters.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filters.java new file mode 100755 index 0000000..498eaed --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filters.java @@ -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 = new ArrayList<>(); + private List 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 getFilter() { + return filter; + } + + @JsonProperty("ReportAttribute") + public List getReportAttribute() { + return reportAttribute; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Instance.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Instance.java new file mode 100755 index 0000000..06c575d --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Instance.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java new file mode 100755 index 0000000..09bbe70 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java new file mode 100755 index 0000000..e48ca9e --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java @@ -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 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 getInstance() { + return instances; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Period.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Period.java new file mode 100755 index 0000000..f9a6b0b --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Period.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java new file mode 100755 index 0000000..8ac2c28 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java @@ -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 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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportDefinition.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportDefinition.java new file mode 100755 index 0000000..43ec61c --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportDefinition.java @@ -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; + } + +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java new file mode 100755 index 0000000..6f42275 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java new file mode 100755 index 0000000..761ec9c --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java @@ -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 itemIdentifiers = new ArrayList<>(); + + private String itemPublisher; + private String itemPlatform; + private String itemDataType; + private String itemName; + + private List 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 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 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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java new file mode 100755 index 0000000..de31fbb --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java @@ -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 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 reportItems, List 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 getReportExceptions() { + return reportExceptions; + } + + @JsonProperty("Requestor") + public Requestor getRequestor() { + return requestor; + } + + @JsonProperty("ReportDefinition") + public ReportDefinition getReportDefinition() { + return reportDefinition; + } + + @JsonProperty("Report") + public ReportWrapper getReportWrapper() { + return reportWrapper; + } + +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponseWrapper.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponseWrapper.java new file mode 100755 index 0000000..dd68026 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponseWrapper.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportWrapper.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportWrapper.java new file mode 100755 index 0000000..d67d0cb --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportWrapper.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Requestor.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Requestor.java new file mode 100755 index 0000000..9a128f8 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Requestor.java @@ -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; + } + +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/UsageDateRange.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/UsageDateRange.java new file mode 100755 index 0000000..0b853c4 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/UsageDateRange.java @@ -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; + } +} diff --git a/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Vendor.java b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Vendor.java new file mode 100755 index 0000000..6e66818 --- /dev/null +++ b/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Vendor.java @@ -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; + } +}