From 5b95e6e3c67dbab29ad9cb7b7abae427b59d3ee4 Mon Sep 17 00:00:00 2001 From: dimitrispie Date: Tue, 5 Jan 2021 14:22:04 +0200 Subject: [PATCH] Commit 05122021 --- .../usagestats/sushilite/domain/Alert.java | 31 ++++ .../sushilite/domain/InstitutionID.java | 31 ++++ .../sushilite/domain/ItemPerformance.java | 12 +- .../sushilite/domain/ReportAttribute.java | 39 +++++ .../sushilite/domain/ReportHeaderPR.java | 135 ++++++++++++++++++ .../sushilite/domain/ReportItem.java | 55 +++---- .../usagestats/sushilite/domain/ReportPR.java | 87 +++++++++++ .../sushilite/domain/ReportStatus.java | 67 +++++++++ .../sushilite/domain/ReportSupported.java | 48 +++++++ 9 files changed, 467 insertions(+), 38 deletions(-) create mode 100755 src/main/java/eu/dnetlib/usagestats/sushilite/domain/Alert.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportAttribute.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java create mode 100755 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportStatus.java create mode 100755 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportSupported.java diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Alert.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Alert.java new file mode 100755 index 0000000..40a3fae --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Alert.java @@ -0,0 +1,31 @@ +package eu.dnetlib.usagestats.sushilite.domain; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 28/10/2019. + */ +public class Alert { + private String dateTime; + private String alert; + + public Alert() { + } + + public Alert(String dateTime, String alert) { + this.dateTime = dateTime; + this.alert = alert; + } + + @JsonProperty("Date_Time") + public String getDateTime() { + return dateTime; + } + + @JsonProperty("Alert") + public String getAlert() { + return alert; + } + +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java new file mode 100644 index 0000000..955ae0f --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java @@ -0,0 +1,31 @@ +package eu.dnetlib.usagestats.sushilite.domain; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 04/01/2020. + */ +public class InstitutionID { + private String type; + private String value; + + public InstitutionID() { + } + + public InstitutionID(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/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java index e48ca9e..a3e7c32 100755 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java @@ -17,8 +17,8 @@ public class 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)); + instances.add(new Instance("Total_Items_Requests", ft_count)); + instances.add(new Instance("Total_Items_Investigations", abstr)); } @JsonProperty("Period") @@ -26,10 +26,10 @@ public class ItemPerformance { return period; } - @JsonProperty("Category") - public String getCategory() { - return "Requests"; - } +// @JsonProperty("Category") +// public String getCategory() { +// return "Requests"; +// } @JsonProperty("Instance") public List getInstance() { diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportAttribute.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportAttribute.java new file mode 100644 index 0000000..05e5237 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportAttribute.java @@ -0,0 +1,39 @@ +package eu.dnetlib.usagestats.sushilite.domain; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 04/01/2021. + */ +public class ReportAttribute { + private String name; + private String value; + + public ReportAttribute() { + } + + public ReportAttribute(String name, String value) { + this.name = name; + this.value = value; + } + + @JsonProperty("Name") + public String getName() { + return name; + } + + @JsonProperty("Value") + public String getValue() { + return value; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java new file mode 100644 index 0000000..a851ac7 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java @@ -0,0 +1,135 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Created by dpie on 25/10/2019. + */ +@JsonPropertyOrder({"Created", "Created_By", "Customer_ID", "Report_ID", "Release", "Report_Name", "Institution_Name", "Institution_ID", "Report_Filters", "Report_Attributes","Exceptions"}) +public class ReportHeaderPR { + + private String created; + private String createdBy; + private String customerID; + private String reportID; + private String release; + private String reportName; + private String institutionName; + private List reportFiters = new ArrayList(); + private List reportAttributes = new ArrayList(); + private List exceptions = new ArrayList(); + private List institutionID = new ArrayList(); + + + public ReportHeaderPR() { + } + + + public ReportHeaderPR(String createdBy, String customerID, String reportID, String release, String reportName, String institutionName, List institutionID) { + //this.created = created; + this.createdBy = createdBy; + this.customerID = customerID; + this.reportID = reportID; + this.release = release; + this.reportName = reportName; + this.institutionName = institutionName; + this.institutionID = institutionID; + + } + + @JsonProperty("Created") + public String getCreated() { + return created; + } + + @JsonProperty("Created_By") + public String getCreatedBy() { + return createdBy; + } + + @JsonProperty("Customer_ID") + public String getCustomerID() { + return customerID; + } + + @JsonProperty("Report_ID") + public String getReportID() { + return reportID; + } + + @JsonProperty("Report_Name") + public String getReportName() { + return reportName; + } + + @JsonProperty("Institution_Name") + public String getInstitutionName() { + return institutionName; + } + + @JsonProperty("Institution_ID") + public List getInstitutionID() { + return institutionID; + } + + @JsonProperty("Report_Filters") + public List getReportFilters() { + return reportFiters; + } + + @JsonProperty("Report_Attributes") + public List getReportAttributes() { + return reportAttributes; + } + + @JsonProperty("Exceptions") + public List getExceptions() { + return exceptions; + } + + public void setReportName(String reportName) { + this.reportName = reportName; + } + + public void setCreated(String created) { + this.created = created; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public void setReportFiters(List reportFiters) { + this.reportFiters = reportFiters; + } + +// @JsonIgnore +// public Date getBeginDate() { +// return beginDate; +// } +// +// @JsonIgnore +// public Date getEndDate() { +// return endDate; +// } +// +// public void setReportAttributes(List reportAttributes) { +// this.reportAttributes = reportAttributes; +// } + + public void setReportAttributes(List reportAttributes) { + this.reportAttributes = reportAttributes; + } + + public void setExceptions(List exceptions) { + this.exceptions = exceptions; + } +} \ No newline at end of file diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java index 761ec9c..e962f15 100755 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java @@ -2,19 +2,24 @@ package eu.dnetlib.usagestats.sushilite.domain; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.ArrayList; import java.util.List; /** - * Created by tsampikos on 31/10/2016. + * Created by dpie on 04/01/2021. */ + +@JsonPropertyOrder({"Platform", "Data_Type", "Access_Method", "Performance"}) public class ReportItem { + private List itemIdentifiers = new ArrayList<>(); private String itemPublisher; - private String itemPlatform; - private String itemDataType; + private String platform; + private String dataType; + private String accessMethod; private String itemName; private List itemPerformances = new ArrayList<>(); @@ -22,41 +27,31 @@ public class ReportItem { public ReportItem() { } - public ReportItem(String itemPublisher, String itemPlatform, String itemDataType, String itemName) { + public ReportItem(String itemPublisher, String platform, String dataType, + String accessMethod, String itemName) { this.itemPublisher = itemPublisher; - this.itemPlatform = itemPlatform; - this.itemDataType = itemDataType; + this.platform = platform; + this.dataType = dataType; + this.accessMethod = accessMethod; this.itemName = itemName; } - @JsonProperty("ItemIdentifier") - public List getItemIdentifiers() { - return itemIdentifiers; - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("ItemPublisher") - public String getItemPublisher() { - return itemPublisher; - } - - @JsonProperty("ItemPlatform") + @JsonProperty("Platform") public String getItemPlatform() { - return itemPlatform; + return platform; } - @JsonProperty("ItemDataType") - public String getItemDataType() { - return itemDataType; + @JsonProperty("Data_Type") + public String getDataType() { + return dataType; } - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("ItemName") - public String getItemName() { - return itemName; + @JsonProperty("Access_Method") + public String getAccessMethod() { + return accessMethod; } - @JsonProperty("ItemPerformance") + @JsonProperty("Performance") public List getItemPerformances() { return itemPerformances; } @@ -67,9 +62,5 @@ public class ReportItem { public void addPerformance(ItemPerformance itemPerformance) { itemPerformances.add(itemPerformance); - } - - public void setItemPlatform(String itemPlatform) { - this.itemPlatform = itemPlatform; - } +} } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java new file mode 100644 index 0000000..23d352b --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java @@ -0,0 +1,87 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package eu.dnetlib.usagestats.sushilite.domain; + +/** + * + * @author dpie + */ + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by dpie on 25/10/2016. + */ +//@JsonPropertyOrder({"Description", "Service_Active", "Registry_URL", "Note", "Alerts"}) +public class ReportPR { + + private ReportHeaderPR reportHeader; + private boolean serviceActive; + private String registry_url; + private String note; + private List alerts = new ArrayList(); + private List reportItems = new ArrayList(); + final String createdBy="OpenAIRE Usage Counts Service"; + +// public ReportPR() { +// } + + public ReportPR(String created,String customerID, String reportID, String reportName, String insitutionName, List institutionID, List exceptions, + List reportFilters,List reportItems) { + + + this.reportHeader = new ReportHeaderPR(createdBy, customerID, reportID, "5", reportName, insitutionName, institutionID); + this.reportItems = reportItems; + + List reportAttributes=new ArrayList(); + reportAttributes.add(new ReportAttribute("Attributes_To_Show",("Data_Type|Access_Method" ))); + + reportHeader.setExceptions(exceptions); + reportHeader.setCreated(created); + reportHeader.setReportFiters(reportFilters); + reportHeader.setReportAttributes(reportAttributes); + reportHeader.setExceptions(exceptions); + + } + + @JsonProperty("Report_Header") + public ReportHeaderPR getReportHeader() { + return reportHeader; + } + @JsonProperty("Report_Items") + public List getReportItems() { + return reportItems; + } + + + +// @JsonProperty("ServiceActive") +// public boolean getServiceActive() { +// return serviceActive; +// } +// +// @JsonProperty("Registry_URL") +// public String getRegistryURL() { +// return registry_url; +// } +// +// @JsonProperty("Note") +// public String getNote() { +// return note; +// } +// +// @JsonProperty("Alerts") +// public List getAlerts() { +// return alerts; +// } +public void setReportPR(ReportHeaderPR reportHeader) { + this.reportHeader = reportHeader; + } + } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportStatus.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportStatus.java new file mode 100755 index 0000000..a773193 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportStatus.java @@ -0,0 +1,67 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package eu.dnetlib.usagestats.sushilite.domain; + +/** + * + * @author dpie + */ + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by dpie on 25/10/2016. + */ +@JsonPropertyOrder({"Description", "Service_Active", "Registry_URL", "Note", "Alerts"}) +public class ReportStatus { + + private String description; + private boolean serviceActive; + private String registry_url; + private String note; + private List alerts = new ArrayList(); + + public ReportStatus() { + } + + public ReportStatus(String description, boolean serviceActive, String registry_url, String note,List alerts) { + this.description = description; + this.serviceActive = serviceActive; + this.registry_url = registry_url; + this.note = note; + this.alerts = alerts; + } + + @JsonProperty("Description") + public String getDescription() { + return description; + } + + @JsonProperty("ServiceActive") + public boolean getServiceActive() { + return serviceActive; + } + + @JsonProperty("Registry_URL") + public String getRegistryURL() { + return registry_url; + } + + @JsonProperty("Note") + public String getNote() { + return note; + } + + @JsonProperty("Alerts") + public List getAlerts() { + return alerts; + } + + } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportSupported.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportSupported.java new file mode 100755 index 0000000..79a21e7 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportSupported.java @@ -0,0 +1,48 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.List; + +@JsonPropertyOrder({"Report_Name", "Report_ID", "Release", "Report_Description", "Path"}) +public class ReportSupported { + private String report_name; + private String report_id; + private String release; + private String description; + private String path; + + public ReportSupported(String report_name, String report_id, String release, String description, String path) { + this.report_name = report_name; + this.report_id = report_id; + this.release = release; + this.description = description; + this.path = path; + } + + @JsonProperty("Report_Name") + public String getReport_Name() { + return report_name; + } + + @JsonProperty("Report_ID") + public String getReport_ID() { + return report_id; + } + + @JsonProperty("Release") + public String getRelease() { + return release; + } + + @JsonProperty("Report_Description") + public String getReport_Description() { + return description; + } + + @JsonProperty("Path") + public String getPath() { + return path; + } +}