From 74d1a1877d4d4999bc20aa4eba2bc9b3071bcdd9 Mon Sep 17 00:00:00 2001 From: Dimitris Date: Mon, 22 Feb 2021 19:38:10 +0200 Subject: [PATCH] Commit 22022021 --- ...fier.java => COUNTER_Item_Attributes.java} | 8 +- .../domain/COUNTER_Item_Component.java | 45 +++++ .../domain/COUNTER_Item_Contributors.java | 35 ++++ ...itutionID.java => COUNTER_Item_Dates.java} | 10 +- .../domain/COUNTER_Item_Identifier.java | 29 +++ .../domain/COUNTER_Item_Identifiers.java | 27 +++ .../sushilite/domain/COUNTER_Item_Parent.java | 44 +++++ ...nce.java => COUNTER_Item_Performance.java} | 6 +- .../sushilite/domain/COUNTER_Item_Report.java | 59 ++++++ .../sushilite/domain/COUNTER_Item_Usage.java | 171 ++++++++++++++++++ .../domain/COUNTER_Platform_Report.java | 59 ++++++ ...tItem.java => COUNTER_Platform_Usage.java} | 30 +-- .../domain/COUNTER_Publisher_Identifiers.java | 27 +++ .../domain/COUNTER_Title_Report.java | 59 ++++++ .../sushilite/domain/COUNTER_Title_Usage.java | 98 ++++++++++ .../usagestats/sushilite/domain/Customer.java | 8 +- .../usagestats/sushilite/domain/Report.java | 2 +- .../usagestats/sushilite/domain/ReportPR.java | 87 --------- .../sushilite/domain/ReportResponse.java | 6 +- ...tException.java => SUSHI_Error_Model.java} | 28 ++- .../domain/SUSHI_Org_Identifiers.java | 27 +++ ...HeaderPR.java => SUSHI_Report_Header.java} | 19 +- 22 files changed, 732 insertions(+), 152 deletions(-) rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{ItemIdentifier.java => COUNTER_Item_Attributes.java} (70%) create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Component.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Contributors.java rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{InstitutionID.java => COUNTER_Item_Dates.java} (72%) mode change 100755 => 100644 create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifier.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifiers.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Parent.java rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{ItemPerformance.java => COUNTER_Item_Performance.java} (87%) create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Report.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Usage.java create mode 100755 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Report.java rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{ReportItem.java => COUNTER_Platform_Usage.java} (59%) create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Publisher_Identifiers.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Report.java create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Usage.java delete mode 100755 src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{ReportException.java => SUSHI_Error_Model.java} (56%) create mode 100644 src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Org_Identifiers.java rename src/main/java/eu/dnetlib/usagestats/sushilite/domain/{ReportHeaderPR.java => SUSHI_Report_Header.java} (86%) diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Attributes.java similarity index 70% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Attributes.java index 09bbe70..e80fafb 100644 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Attributes.java @@ -3,16 +3,16 @@ package eu.dnetlib.usagestats.sushilite.domain; import com.fasterxml.jackson.annotation.JsonProperty; /** - * Created by tsampikos on 31/10/2016. + * Created by D.Pierrakos */ -public class ItemIdentifier { +public class COUNTER_Item_Attributes { private String type; private String value; - public ItemIdentifier() { + public COUNTER_Item_Attributes() { } - public ItemIdentifier(String type, String value) { + public COUNTER_Item_Attributes(String type, String value) { this.type = type; this.value = value; } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Component.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Component.java new file mode 100644 index 0000000..ee6ef5b --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Component.java @@ -0,0 +1,45 @@ +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 D.Pierrakos + */ + +@JsonPropertyOrder({"Platform", "Data_Type", "Access_Method", "Performance"}) +//old ReportItem class +public class COUNTER_Item_Component { + + private String itemName; + private List itemIdentifiers = new ArrayList<>(); + private List itemContributors = new ArrayList<>(); + private List itemDates = new ArrayList<>(); + private List itemAttributes = new ArrayList<>(); + private String dataType; + private List itemPerformance = new ArrayList<>(); + + public COUNTER_Item_Component() { + } + + public COUNTER_Item_Component(String publisher, String platform, String dataType, + String accessMethod, String itemName) { + this.dataType = dataType; + this.itemName = itemName; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Data_Type") + public String getDataType() { + return dataType; + } + + + public void addIdentifier(COUNTER_Item_Identifier itemIdentifier) { + itemIdentifiers.add(itemIdentifier); + } +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Contributors.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Contributors.java new file mode 100644 index 0000000..fb65994 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Contributors.java @@ -0,0 +1,35 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by D.Pierrakos + */ +public class COUNTER_Item_Contributors { + + private String type = null; + private String name = null; + private String identifier = null; + + public COUNTER_Item_Contributors(String type, String name, String identifier) { + this.type = type; + this.name = name; + this.identifier = identifier; + } + + @JsonProperty("Type") + public String getType() { + return type; + } + + @JsonProperty("Name") + public String getName() { + return name; + } + + @JsonProperty("Identifier") + public String getIdentifier() { + return identifier; + } + +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Dates.java old mode 100755 new mode 100644 similarity index 72% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Dates.java index 955ae0f..ff987f8 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/InstitutionID.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Dates.java @@ -1,19 +1,18 @@ package eu.dnetlib.usagestats.sushilite.domain; - import com.fasterxml.jackson.annotation.JsonProperty; /** - * Created by dpie on 04/01/2020. + * Created by D.Pierrakos */ -public class InstitutionID { +public class COUNTER_Item_Dates { private String type; private String value; - public InstitutionID() { + public COUNTER_Item_Dates() { } - public InstitutionID(String type, String value) { + public COUNTER_Item_Dates(String type, String value) { this.type = type; this.value = value; } @@ -27,5 +26,4 @@ public class InstitutionID { public String getValue() { return value; } - } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifier.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifier.java new file mode 100644 index 0000000..2c5892e --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifier.java @@ -0,0 +1,29 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by D.Pierrakos + */ +public class COUNTER_Item_Identifier { + private String type; + private String value; + + public COUNTER_Item_Identifier() { + } + + public COUNTER_Item_Identifier(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/COUNTER_Item_Identifiers.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifiers.java new file mode 100644 index 0000000..af50777 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Identifiers.java @@ -0,0 +1,27 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 15/01/2021. + */ +public class COUNTER_Item_Identifiers { + + private String type = null; + private String value = null; + + public COUNTER_Item_Identifiers(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/COUNTER_Item_Parent.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Parent.java new file mode 100644 index 0000000..14026ef --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Parent.java @@ -0,0 +1,44 @@ +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 D.Pierrakos + */ + +@JsonPropertyOrder({"Platform", "Data_Type", "Access_Method", "Performance"}) +//old ReportItem class +public class COUNTER_Item_Parent { + + private String itemName; + private List itemIdentifiers = new ArrayList<>(); + private List itemContributors = new ArrayList<>(); + private List itemDates = new ArrayList<>(); + private List itemAttributes = new ArrayList<>(); + private String dataType; + + public COUNTER_Item_Parent() { + } + + public COUNTER_Item_Parent(String publisher, String platform, String dataType, + String accessMethod, String itemName) { + this.dataType = dataType; + this.itemName = itemName; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Data_Type") + public String getDataType() { + return dataType; + } + + + public void addIdentifier(COUNTER_Item_Identifier itemIdentifier) { + itemIdentifiers.add(itemIdentifier); + } +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Performance.java similarity index 87% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Performance.java index 5cb7e9f..0691a5c 100755 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Performance.java @@ -8,15 +8,15 @@ import java.util.List; /** * Created by tsampikos on 31/10/2016. */ -public class ItemPerformance { +public class COUNTER_Item_Performance { private Period period; private List instances = new ArrayList<>(); - public ItemPerformance() { + public COUNTER_Item_Performance() { } - public ItemPerformance(String start, String end, String ft_count, + public COUNTER_Item_Performance(String start, String end, String ft_count, String abstr) { period = new Period(start, end); if (ft_count != null && abstr != null) { diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Report.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Report.java new file mode 100644 index 0000000..ae44657 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Report.java @@ -0,0 +1,59 @@ +/* + * 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 java.util.ArrayList; +import java.util.List; + +/** + * Created by D.Pierrakos + */ +//@JsonPropertyOrder({"Description", "Service_Active", "Registry_URL", "Note", "Alerts"}) +public class COUNTER_Item_Report { + + private SUSHI_Report_Header reportHeader; + private List reportItems = new ArrayList(); + final String createdBy="OpenAIRE UsageCounts Service"; + + + public COUNTER_Item_Report(String created,String customerID, String reportID, String reportName, String insitutionName, List institutionID, List exceptions, + List reportFilters,List reportItems) { + + + this.reportHeader = new SUSHI_Report_Header(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 SUSHI_Report_Header getReportHeader() { + return reportHeader; + } + @JsonProperty("Report_Items") + public List getReportItems() { + return reportItems; + } + +public void setReportPR(SUSHI_Report_Header reportHeader) { + this.reportHeader = reportHeader; + } + } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Usage.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Usage.java new file mode 100644 index 0000000..ba0152b --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Item_Usage.java @@ -0,0 +1,171 @@ +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 D.Pierrakos + */ +@JsonPropertyOrder({"Platform", "Data_Type", "Access_Method", "Performance"}) +//old ReportItem class +public class COUNTER_Item_Usage { + + private String item; + private List itemIdentifiers = new ArrayList<>(); + private List itemContributors = new ArrayList<>(); + private List itemDates = new ArrayList<>(); + private List itemAttributes = new ArrayList<>(); + private String platform; + private String publisher; + private List publisherIdentifiers = new ArrayList<>(); + private COUNTER_Item_Parent itemParent = new COUNTER_Item_Parent(); + private List itemComponents = new ArrayList<>(); + private String dataType; + private String yop; + private String accessType; + private String accessMethod; + + private List itemPerformances = new ArrayList<>(); + + public COUNTER_Item_Usage() { + } + + public COUNTER_Item_Usage(String item, String publisher, String platform, String dataType, + String yop, String acccesType, String accessMethod) { + this.item = item; + this.publisher = publisher; + this.platform = platform; + this.dataType = dataType; + this.yop = yop; + this.accessType = acccesType; + this.accessMethod = accessMethod; + this.itemIdentifiers = null; + this.itemContributors = null; + this.itemDates = null; + this.itemAttributes = null; + this.publisherIdentifiers = null; + this.itemParent = null; + this.itemComponents = null; + + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item") + public String getItem() { + return item; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_ID") + public List getItemIdentifiers() { + return itemIdentifiers; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_Contributors") + public List getItemContributors() { + return itemContributors; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_Dates") + public List getItemDates() { + return itemDates; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_Attributes") + public List getItemAttributes() { + return itemAttributes; + } + + @JsonProperty("Platform") + public String getItemPlatform() { + return platform; + } + + @JsonProperty("Publisher") + public String getItemPPublisher() { + return publisher; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Publisher_ID") + public List getPublisherIdentifiers() { + return publisherIdentifiers; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_Parent") + public COUNTER_Item_Parent getItemParent() { + return itemParent; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Item_Component") + public List getItemComponents() { + return itemComponents; + } + + @JsonProperty("Data_Type") + public String getDataType() { + return dataType; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("YOP") + public String getYop() { + return yop; + } + + @JsonProperty("Access_Type") + public String getAccessType() { + return accessType; + } + + @JsonProperty("Access_Method") + public String getAccessMethod() { + return accessMethod; + } + + @JsonProperty("Performance") + public List getItemPerformances() { + return itemPerformances; + } + + public void addIdentifier(COUNTER_Item_Identifier itemIdentifier) { + itemIdentifiers.add(itemIdentifier); + } + + public void addItemContributors(COUNTER_Item_Contributors itemContributor) { + itemContributors.add(itemContributor); + } + + public void addItemDates(COUNTER_Item_Dates itemDate) { + itemDates.add(itemDate); + } + + public void addItemAttributes(COUNTER_Item_Attributes itemAttribute) { + itemAttributes.add(itemAttribute); + } + + public void addPublisherIdentifiers(COUNTER_Publisher_Identifiers publisherIdentifier) { + publisherIdentifiers.add(publisherIdentifier); + } + + public void addItemParent(COUNTER_Item_Parent itemParent) { + this.itemParent = itemParent; + } + + public void addItemComponent(COUNTER_Item_Component itemComponent) { + itemComponents.add(itemComponent); + } + + public void addPerformance(COUNTER_Item_Performance itemPerformance) { + itemPerformances.add(itemPerformance); + } +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Report.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Report.java new file mode 100755 index 0000000..57b126a --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Report.java @@ -0,0 +1,59 @@ +/* + * 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 java.util.ArrayList; +import java.util.List; + +/** + * Created by dpie on 23/12/2020. + */ +//@JsonPropertyOrder({"Description", "Service_Active", "Registry_URL", "Note", "Alerts"}) +public class COUNTER_Platform_Report { + + private SUSHI_Report_Header reportHeader; + private List reportItems = new ArrayList(); + final String createdBy="OpenAIRE Usage Counts Service"; + + + public COUNTER_Platform_Report(String created,String customerID, String reportID, String reportName, String insitutionName, List institutionID, List exceptions, + List reportFilters,List reportItems) { + + + this.reportHeader = new SUSHI_Report_Header(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 SUSHI_Report_Header getReportHeader() { + return reportHeader; + } + @JsonProperty("Report_Items") + public List getReportItems() { + return reportItems; + } + +public void setReportPR(SUSHI_Report_Header reportHeader) { + this.reportHeader = reportHeader; + } + } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Usage.java similarity index 59% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Usage.java index 27ca613..3884a16 100755 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Platform_Usage.java @@ -8,38 +8,32 @@ import java.util.ArrayList; import java.util.List; /** - * Created by dpie on 04/01/2021. + * Created by D.Pierrakos */ - @JsonPropertyOrder({"Platform", "Data_Type", "Access_Method", "Performance"}) -public class ReportItem { +//old ReportItem class +public class COUNTER_Platform_Usage { - private List itemIdentifiers = new ArrayList<>(); - - private String itemPublisher; private String platform; private String dataType; private String accessMethod; - private String itemName; - private List itemPerformances = new ArrayList<>(); + private List itemPerformances = new ArrayList<>(); - public ReportItem() { + public COUNTER_Platform_Usage() { } - public ReportItem(String itemPublisher, String platform, String dataType, - String accessMethod, String itemName) { - this.itemPublisher = itemPublisher; + public COUNTER_Platform_Usage(String platform, String dataType, String accessMethod) { this.platform = platform; this.dataType = dataType; this.accessMethod = accessMethod; - this.itemName = itemName; } @JsonProperty("Platform") public String getItemPlatform() { return platform; } + @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("Data_Type") public String getDataType() { @@ -52,15 +46,11 @@ public class ReportItem { } @JsonProperty("Performance") - public List getItemPerformances() { + public List getItemPerformances() { return itemPerformances; } - public void addIdentifier(ItemIdentifier itemIdentifier) { - itemIdentifiers.add(itemIdentifier); - } - - public void addPerformance(ItemPerformance itemPerformance) { + public void addPerformance(COUNTER_Item_Performance itemPerformance) { itemPerformances.add(itemPerformance); -} + } } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Publisher_Identifiers.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Publisher_Identifiers.java new file mode 100644 index 0000000..287e8b9 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Publisher_Identifiers.java @@ -0,0 +1,27 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 15/01/2021. + */ +public class COUNTER_Publisher_Identifiers { + + private String type = null; + private String value = null; + + public COUNTER_Publisher_Identifiers(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/COUNTER_Title_Report.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Report.java new file mode 100644 index 0000000..9374146 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Report.java @@ -0,0 +1,59 @@ +/* + * 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 java.util.ArrayList; +import java.util.List; + +/** + * Created by D.Pierrakos + */ +//@JsonPropertyOrder({"Description", "Service_Active", "Registry_URL", "Note", "Alerts"}) +public class COUNTER_Title_Report { + + private SUSHI_Report_Header reportHeader; + private List reportItems = new ArrayList(); + final String createdBy="OpenAIRE Usage Counts Service"; + + + public COUNTER_Title_Report(String created,String customerID, String reportID, String reportName, String insitutionName, List institutionID, List exceptions, + List reportFilters,List reportItems) { + + + this.reportHeader = new SUSHI_Report_Header(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 SUSHI_Report_Header getReportHeader() { + return reportHeader; + } + @JsonProperty("Report_Items") + public List getReportItems() { + return reportItems; + } + +public void setReportPR(SUSHI_Report_Header reportHeader) { + this.reportHeader = reportHeader; + } + } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Usage.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Usage.java new file mode 100644 index 0000000..d3dba08 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/COUNTER_Title_Usage.java @@ -0,0 +1,98 @@ +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 dpie on 04/01/2021. + */ +@JsonPropertyOrder({"Title", "Item_ID", "Platform", "Publisher", "Publisher_ID", "Data_Type", "Section_Type", "YOP", "Access_Type", "Access_Method", "Performance"}) +//old ReportItem class +public class COUNTER_Title_Usage { + + private String title; + private List itemIdentifiers = new ArrayList<>(); + private String platform; + private String publisher; + private List publisherIdentifiers = new ArrayList<>(); + private String dataType; + private String sectionType; + private String yop; + private String accessType; + private String accessMethod; + private List itemPerformances = new ArrayList<>(); + + public COUNTER_Title_Usage() { + } + + public COUNTER_Title_Usage(String title, String publisher, String platform, String dataType, + String accessMethod, String itemName) { + this.title = title; + this.platform = platform; + this.dataType = dataType; + this.accessMethod = accessMethod; + } + + @JsonProperty("Title") + public String getTitle() { + return title; + } + + @JsonProperty("Item_ID") + public List getItemIdentifiers() { + return itemIdentifiers; + } + + @JsonProperty("Platform") + public String getItemPlatform() { + return platform; + } + + @JsonProperty("Publisher") + public String getPublisher() { + return publisher; + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("Data_Type") + public String getDataType() { + return dataType; + } + + @JsonProperty("Section_Type") + public String getSectionType() { + return sectionType; + } + + @JsonProperty("YOP") + public String getYOP() { + return yop; + } + + @JsonProperty("Access_Type") + public String getAccessType() { + return accessType; + } + + @JsonProperty("Access_Method") + public String getAccessMethod() { + return accessMethod; + } + + @JsonProperty("Performance") + public List getItemPerformances() { + return itemPerformances; + } + + public void addIdentifier(COUNTER_Item_Identifiers itemIdentifier) { + itemIdentifiers.add(itemIdentifier); + } + + public void addPerformance(COUNTER_Item_Performance itemPerformance) { + itemPerformances.add(itemPerformance); + } +} diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java index c26f88f..18f5296 100644 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java @@ -11,16 +11,16 @@ import java.util.List; public class Customer { private String id = null; - public void setReportItems(List reportItems) { + public void setReportItems(List reportItems) { this.reportItems = reportItems; } - private List reportItems = new ArrayList<>(); + private List reportItems = new ArrayList<>(); public Customer() { } - public Customer(String id, List reportItems) { + public Customer(String id, List reportItems) { this.id = id; this.reportItems = reportItems; } @@ -31,7 +31,7 @@ public class Customer { } @JsonProperty("ReportItems") - public List getReportItems() { + public List getReportItems() { return reportItems; } } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java index 8ac2c28..f5ac4bd 100644 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java @@ -16,7 +16,7 @@ public class Report { public Report() { } - public Report(String created, String name, String version, String requestor, List reportItems) { + public Report(String created, String name, String version, String requestor, List reportItems) { this.created = created; this.version = version; this.name = name + ":" + version; diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java deleted file mode 100755 index 23d352b..0000000 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportPR.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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/ReportResponse.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java index de31fbb..833dee4 100644 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java @@ -15,7 +15,7 @@ import java.util.List; public class ReportResponse { private String created; - private List reportExceptions = new ArrayList<>(); + private List reportExceptions = new ArrayList<>(); private Requestor requestor; private ReportDefinition reportDefinition; private ReportWrapper reportWrapper; @@ -25,7 +25,7 @@ public class 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) { + 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); @@ -50,7 +50,7 @@ public class ReportResponse { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("Exception") - public List getReportExceptions() { + public List getReportExceptions() { return reportExceptions; } diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Error_Model.java similarity index 56% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Error_Model.java index 6f42275..3aa1e0b 100644 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Error_Model.java @@ -9,36 +9,34 @@ import java.util.Date; /** * Created by tsampikos on 23/11/2016. */ -public class ReportException { - private String created; - private String number; +public class SUSHI_Error_Model { + private String code; private String severity; private String message; + private String helpURL; private String data; - public ReportException() { + public SUSHI_Error_Model() { } - public ReportException(String number, String severity, String message, String data) { + public SUSHI_Error_Model(String code, String severity, String message, String helpURL, String data) { - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ"); - Date date = new Date(); - created = dateFormat.format(date); + this.helpURL = helpURL; - this.number = number; + this.code = code; this.severity = severity; this.message = message; this.data = data; } - @JsonProperty("@Created") - public String getCreated() { - return created; + @JsonProperty("Help_URL") + public String getHelpURL() { + return helpURL; } - @JsonProperty("Number") - public String getNumber() { - return number; + @JsonProperty("Code") + public String getCode() { + return code; } @JsonProperty("Severity") diff --git a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Org_Identifiers.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Org_Identifiers.java new file mode 100644 index 0000000..c871ae6 --- /dev/null +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Org_Identifiers.java @@ -0,0 +1,27 @@ +package eu.dnetlib.usagestats.sushilite.domain; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by dpie on 15/01/2021. + */ +public class SUSHI_Org_Identifiers { + + private String type = null; + private String value = null; + + public SUSHI_Org_Identifiers(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/ReportHeaderPR.java b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Report_Header.java similarity index 86% rename from src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java rename to src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Report_Header.java index 1bc65fa..440b878 100755 --- a/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportHeaderPR.java +++ b/src/main/java/eu/dnetlib/usagestats/sushilite/domain/SUSHI_Report_Header.java @@ -15,7 +15,7 @@ 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 { +public class SUSHI_Report_Header { private String created; private String createdBy; @@ -24,17 +24,18 @@ public class ReportHeaderPR { private String release; private String reportName; private String institutionName; + private List institutionID = new ArrayList(); private List reportFiters = new ArrayList(); private List reportAttributes = new ArrayList(); - private List exceptions = new ArrayList(); - private List institutionID = new ArrayList(); + private List exceptions = new ArrayList(); + - public ReportHeaderPR() { + public SUSHI_Report_Header() { } - public ReportHeaderPR(String createdBy, String customerID, String reportID, + public SUSHI_Report_Header(String createdBy, String customerID, String reportID, String release, String reportName, String institutionName, - List institutionID) { + List institutionID) { //this.created = created; this.createdBy = createdBy; this.customerID = customerID; @@ -77,7 +78,7 @@ public class ReportHeaderPR { } @JsonProperty("Institution_ID") - public List getInstitutionID() { + public List getInstitutionID() { return institutionID; } @@ -93,7 +94,7 @@ public class ReportHeaderPR { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("Exceptions") - public List getExceptions() { + public List getExceptions() { return exceptions; } @@ -130,7 +131,7 @@ public class ReportHeaderPR { this.reportAttributes = reportAttributes; } - public void setExceptions(List exceptions) { + public void setExceptions(List exceptions) { this.exceptions = exceptions; } }