Project

General

Profile

« Previous | Next » 

Revision 62511

View differences:

modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filter.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class Filter {
9
    private String name = null;
10
    private String value = null;
11

  
12
    public Filter() {
13
    }
14

  
15
    public Filter(String name, String value) {
16
        this.name = name;
17
        this.value = value;
18
    }
19

  
20
    @JsonProperty("Name")
21
    public String getName() {
22
        return name;
23
    }
24

  
25
    @JsonProperty("Value")
26
    public String getValue() {
27
        return value;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Requestor.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 25/10/2016.
7
 */
8
public class Requestor {
9
    private String id;
10

  
11
    public Requestor() {
12
    }
13

  
14
    public Requestor(String id) {
15
        this.id = id;
16
    }
17

  
18
    @JsonProperty("ID")
19
    public String getID() {
20
        return id;
21
    }
22

  
23
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonInclude;
4
import com.fasterxml.jackson.annotation.JsonProperty;
5

  
6
import java.util.ArrayList;
7
import java.util.List;
8

  
9
/**
10
 * Created by tsampikos on 31/10/2016.
11
 */
12
public class ReportItem {
13
    private List<ItemIdentifier> itemIdentifiers = new ArrayList<>();
14

  
15
    private String itemPublisher;
16
    private String itemPlatform;
17
    private String itemDataType;
18
    private String itemName;
19

  
20
    private List<ItemPerformance> itemPerformances = new ArrayList<>();
21

  
22
    public ReportItem() {
23
    }
24

  
25
    public ReportItem(String itemPublisher, String itemPlatform, String itemDataType, String itemName) {
26
        this.itemPublisher = itemPublisher;
27
        this.itemPlatform = itemPlatform;
28
        this.itemDataType = itemDataType;
29
        this.itemName = itemName;
30
    }
31

  
32
    @JsonProperty("ItemIdentifier")
33
    public List<ItemIdentifier> getItemIdentifiers() {
34
        return itemIdentifiers;
35
    }
36

  
37
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
38
    @JsonProperty("ItemPublisher")
39
    public String getItemPublisher() {
40
        return itemPublisher;
41
    }
42

  
43
    @JsonProperty("ItemPlatform")
44
    public String getItemPlatform() {
45
        return itemPlatform;
46
    }
47

  
48
    @JsonProperty("ItemDataType")
49
    public String getItemDataType() {
50
        return itemDataType;
51
    }
52

  
53
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
54
    @JsonProperty("ItemName")
55
    public String getItemName() {
56
        return itemName;
57
    }
58

  
59
    @JsonProperty("ItemPerformance")
60
    public List<ItemPerformance> getItemPerformances() {
61
        return itemPerformances;
62
    }
63

  
64
    public void addIdentifier(ItemIdentifier itemIdentifier) {
65
        itemIdentifiers.add(itemIdentifier);
66
    }
67

  
68
    public void addPerformance(ItemPerformance itemPerformance) {
69
        itemPerformances.add(itemPerformance);
70
    }
71

  
72
    public void setItemPlatform(String itemPlatform) {
73
        this.itemPlatform = itemPlatform;
74
    }
75
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonInclude;
4
import com.fasterxml.jackson.annotation.JsonProperty;
5

  
6
import java.text.DateFormat;
7
import java.text.SimpleDateFormat;
8
import java.util.ArrayList;
9
import java.util.Date;
10
import java.util.List;
11

  
12
/**
13
 * Created by tsampikos on 25/10/2016.
14
 */
15
public class ReportResponse {
16

  
17
    private String created;
18
    private List<ReportException> reportExceptions = new ArrayList<>();
19
    private Requestor requestor;
20
    private ReportDefinition reportDefinition;
21
    private ReportWrapper reportWrapper;
22

  
23
    public ReportResponse() {
24
    }
25

  
26
    public ReportResponse(String reportName, String release, String requestorId, String beginDate,
27
                          String endDate, String repositoryIdentifier, String itemIdentifier,
28
                          String itemDataType, String hasDoi, String granularity, String callback, List<ReportItem> reportItems, List<ReportException> reportExceptions) {
29
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
30
        Date date = new Date();
31
        created = dateFormat.format(date);
32

  
33
        if (!reportExceptions.isEmpty()) {
34
            this.reportExceptions = reportExceptions;
35
        }
36

  
37
        requestor = new Requestor(requestorId);
38

  
39
        reportDefinition = new ReportDefinition(reportName, release, beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, Integer.toString(reportItems.size()));
40

  
41
        Report report = new Report(created, reportName, release, requestorId, reportItems);
42
        reportWrapper = new ReportWrapper(report);
43
    }
44

  
45
    @JsonProperty("@Created")
46
    public String getCreated() {
47
        return created;
48
    }
49

  
50

  
51
    @JsonInclude(JsonInclude.Include.NON_NULL)
52
    @JsonProperty("Exception")
53
    public List<ReportException> getReportExceptions() {
54
        return reportExceptions;
55
    }
56

  
57
    @JsonProperty("Requestor")
58
    public Requestor getRequestor() {
59
        return requestor;
60
    }
61

  
62
    @JsonProperty("ReportDefinition")
63
    public ReportDefinition getReportDefinition() {
64
        return reportDefinition;
65
    }
66

  
67
    @JsonProperty("Report")
68
    public ReportWrapper getReportWrapper() {
69
        return reportWrapper;
70
    }
71

  
72
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.text.DateFormat;
6
import java.text.SimpleDateFormat;
7
import java.util.Date;
8

  
9
/**
10
 * Created by tsampikos on 23/11/2016.
11
 */
12
public class ReportException {
13
    private String created;
14
    private String number;
15
    private String severity;
16
    private String message;
17
    private String data;
18

  
19
    public ReportException() {
20
    }
21

  
22
    public ReportException(String number, String severity, String message, String data) {
23

  
24
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
25
        Date date = new Date();
26
        created = dateFormat.format(date);
27

  
28
        this.number = number;
29
        this.severity = severity;
30
        this.message = message;
31
        this.data = data;
32
    }
33

  
34
    @JsonProperty("@Created")
35
    public String getCreated() {
36
        return created;
37
    }
38

  
39
    @JsonProperty("Number")
40
    public String getNumber() {
41
        return number;
42
    }
43

  
44
    @JsonProperty("Severity")
45
    public String getSeverity() {
46
        return severity;
47
    }
48

  
49
    @JsonProperty("Message")
50
    public String getMessage() {
51
        return message;
52
    }
53

  
54
    @JsonProperty("Data")
55
    public String getData() {
56
        return data;
57
    }
58
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Contact.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class Contact {
9

  
10
    @JsonProperty("Contact")
11
    public String getContact() {
12
        return "OpenAIRE Helpdesk";
13
    }
14

  
15
    @JsonProperty("E-mail")
16
    public String getEmail() {
17
        return "helpdesk@openaire.eu";
18
    }
19

  
20
    public Contact() {
21
    }
22
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponseWrapper.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class ReportResponseWrapper {
9
    private ReportResponse reportResponse;
10

  
11
    public ReportResponseWrapper() {}
12

  
13
    public ReportResponseWrapper(ReportResponse reportResponse) {
14
        this.reportResponse = reportResponse;
15
    }
16

  
17
    @JsonProperty("ReportResponse")
18
    public ReportResponse getReportResponse() {
19
        return reportResponse;
20
    }
21

  
22
    public void setReportResponse(ReportResponse reportResponse) {
23
        this.reportResponse = reportResponse;
24
    }
25
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Vendor.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class Vendor {
9

  
10
    private Contact contact = new Contact();
11

  
12
    public Vendor() {
13
    }
14

  
15
    @JsonProperty("Name")
16
    public String getName() {
17
        return "OpenAIRE";
18
    }
19

  
20
    @JsonProperty("Contact")
21
    public Contact getContact() {
22
        return contact;
23
    }
24
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 31/10/2016.
10
 */
11
public class Customer {
12
    private String id = null;
13

  
14
    public void setReportItems(List<ReportItem> reportItems) {
15
        this.reportItems = reportItems;
16
    }
17

  
18
    private List<ReportItem> reportItems = new ArrayList<>();
19

  
20
    public Customer() {
21
    }
22

  
23
    public Customer(String id, List<ReportItem> reportItems) {
24
        this.id = id;
25
        this.reportItems = reportItems;
26
    }
27

  
28
    @JsonProperty("ID")
29
    public String getId() {
30
        return id;
31
    }
32

  
33
    @JsonProperty("ReportItems")
34
    public List<ReportItem> getReportItems() {
35
        return reportItems;
36
    }
37
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class ItemIdentifier {
9
    private String type;
10
    private String value;
11

  
12
    public ItemIdentifier() {
13
    }
14

  
15
    public ItemIdentifier(String type, String value) {
16
        this.type = type;
17
        this.value = value;
18
    }
19

  
20
    @JsonProperty("Type")
21
    public String getType() {
22
        return type;
23
    }
24

  
25
    @JsonProperty("Value")
26
    public String getValue() {
27
        return value;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Instance.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class Instance {
9
    private String metricType;
10
    private String count;
11

  
12
    public Instance() {
13
    }
14

  
15
    public Instance(String type, String count) {
16
        this.metricType = type;
17
        this.count = count;
18
    }
19

  
20
    @JsonProperty("MetricType")
21
    public String getMetricType() {
22
        return metricType;
23
    }
24

  
25
    @JsonProperty("Count")
26
    public String getCount() {
27
        return count;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filters.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 26/10/2016.
10
 */
11
public class Filters {
12
    private UsageDateRange usageDateRange = null;
13
    private List<Filter> filter = new ArrayList<>();
14
    private List<Filter> reportAttribute = new ArrayList<>();
15

  
16
    public Filters() {
17
    }
18

  
19
    public Filters(String beginDate, String endDate, String repositoryIdentifier,
20
                   String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
21
        usageDateRange = new UsageDateRange(beginDate, endDate);
22

  
23
        if (repositoryIdentifier != null && !repositoryIdentifier.equals("")) {
24
            filter.add(new Filter("RepositoryIdentifier", repositoryIdentifier));
25
        }
26
        if (itemIdentifier != null && !itemIdentifier.equals("")) {
27
            filter.add(new Filter("ItemIdentifier", itemIdentifier));
28
        }
29
        if (itemDataType != null && !itemDataType.equals("")) {
30
            filter.add(new Filter("ItemDataType", itemDataType));
31
        }
32

  
33
        reportAttribute.add(new Filter("Granularity", granularity));
34
        if (reportItemCount != null && !reportItemCount.equals("")) {
35
            reportAttribute.add(new Filter("ReportItemCount", reportItemCount));
36
        }
37
    }
38

  
39
    @JsonProperty("UsageDateRange")
40
    public UsageDateRange getUsageDateRange() {
41
        return usageDateRange;
42
    }
43

  
44
    @JsonProperty("Filter")
45
    public List<Filter> getFilter() {
46
        return filter;
47
    }
48

  
49
    @JsonProperty("ReportAttribute")
50
    public List<Filter> getReportAttribute() {
51
        return reportAttribute;
52
    }
53
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.List;
6

  
7
public class Report {
8
    private String created;
9
    private String version;
10
    private String name;
11

  
12
    private Vendor vendor = new Vendor();
13

  
14
    private Customer customer;
15

  
16
    public Report() {
17
    }
18

  
19
    public Report(String created, String name, String version, String requestor, List<ReportItem> reportItems) {
20
        this.created = created;
21
        this.version = version;
22
        this.name = name + ":" + version;
23
        this.customer = new Customer(requestor, reportItems);
24
    }
25

  
26
    @JsonProperty("@Created")
27
    public String getCreated() {
28
        return created;
29
    }
30

  
31
    @JsonProperty("@Version")
32
    public String getVersion() {
33
        return version;
34
    }
35

  
36
    @JsonProperty("@Name")
37
    public String getName() {
38
        return name;
39
    }
40

  
41
    @JsonProperty("Vendor")
42
    public Vendor getVendor() {
43
        return vendor;
44
    }
45

  
46
    @JsonProperty("Customer")
47
    public Customer getCustomer() {
48
        return customer;
49
    }
50
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportWrapper.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class ReportWrapper {
9
    private Report report;
10

  
11
    public ReportWrapper() {
12
    }
13

  
14
    public ReportWrapper(Report report) {
15
        this.report = report;
16
    }
17

  
18
    @JsonProperty("Report")
19
    public Report getReport() {
20
        return report;
21
    }
22

  
23
    public void setReport(Report report) {
24
        this.report = report;
25
    }
26
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/UsageDateRange.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class UsageDateRange {
9
    private String begin;
10
    private String end;
11

  
12
    public UsageDateRange() {
13
    }
14

  
15
    public UsageDateRange(String begin, String end) {
16
        this.begin = begin;
17
        this.end = end;
18
    }
19

  
20
    @JsonProperty("Begin")
21
    public String getBegin() {
22
        return begin;
23
    }
24

  
25
    @JsonProperty("End")
26
    public String getEnd() {
27
        return end;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 31/10/2016.
10
 */
11
public class ItemPerformance {
12
    private Period period;
13
    private List<Instance> instances = new ArrayList<>();
14

  
15
    public ItemPerformance() {
16
    }
17

  
18
    public ItemPerformance(String start, String end, String ft_count, String abstr) {
19
        period = new Period(start, end);
20
        instances.add(new Instance("ft_total", ft_count));
21
        instances.add(new Instance("abstract", abstr));
22
    }
23

  
24
    @JsonProperty("Period")
25
    public Period getPeriod() {
26
        return period;
27
    }
28

  
29
    @JsonProperty("Category")
30
    public String getCategory() {
31
        return "Requests";
32
    }
33

  
34
    @JsonProperty("Instance")
35
    public List<Instance> getInstance() {
36
        return instances;
37
    }
38
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Period.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class Period {
9
    private String begin;
10
    private String end;
11

  
12
    public Period() {
13
    }
14

  
15
    public Period(String begin, String end) {
16
        this.begin = begin;
17
        this.end = end;
18
    }
19

  
20
    @JsonProperty("Begin")
21
    public String getBegin() {
22
        return begin;
23
    }
24

  
25
    @JsonProperty("End")
26
    public String getEnd() {
27
        return end;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportDefinition.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 25/10/2016.
7
 */
8
public class ReportDefinition {
9
    private String name;
10
    private String release;
11
    private Filters filters;
12

  
13
    public ReportDefinition() {
14
    }
15

  
16
    public ReportDefinition(String name, String release, String beginDate, String endDate,
17
                            String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
18
        this.name = name;
19
        this.release = release;
20

  
21
        filters = new Filters(beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, reportItemCount);
22
    }
23

  
24
    @JsonProperty("@Name")
25
    public String getName() {
26
        return name;
27
    }
28

  
29
    @JsonProperty("@Release")
30
    public String getRelease() {
31
        return release;
32
    }
33

  
34
    @JsonProperty("Filters")
35
    public Filters getFilters() {
36
        return filters;
37
    }
38

  
39
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
    <modelVersion>4.0.0</modelVersion>
4

  
5
    <groupId>eu.dnetlib</groupId>
6
    <artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
7
    <version>1.0.0</version>
8

  
9
    <scm>
10
        <connection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0</connection>
11
        <developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0</developerConnection>
12
        <url>https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0</url>
13
    </scm>
14

  
15
    <!--
16
    <parent>
17
        <groupId>org.springframework.boot</groupId>
18
        <artifactId>spring-boot-starter-parent</artifactId>
19
        <version>1.5.9.RELEASE</version>
20
    </parent>
21

  
22
    <dependencies>
23
        <dependency>
24
            <groupId>org.springframework.boot</groupId>
25
            <artifactId>spring-boot-starter-web</artifactId>
26
            <exclusions>
27
                <exclusion>
28
                    <groupId>org.springframework.boot</groupId>
29
                    <artifactId>spring-boot-starter-logging</artifactId>
30
                </exclusion>
31
            </exclusions>
32
        </dependency>
33
    </dependencies>
34
    -->
35

  
36
    <dependencies>
37
        <dependency>
38
            <groupId>com.fasterxml.jackson.core</groupId>
39
            <artifactId>jackson-annotations</artifactId>
40
            <version>2.9.6</version>
41
        </dependency>
42
    </dependencies>
43

  
44
    <properties>
45
        <java.version>1.8</java.version>
46
        <maven.compiler.source>1.8</maven.compiler.source>
47
        <maven.compiler.target>1.8</maven.compiler.target>
48
    </properties>
49

  
50
</project>
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Customer.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 31/10/2016.
10
 */
11
public class Customer {
12
    private String id = null;
13

  
14
    public void setReportItems(List<ReportItem> reportItems) {
15
        this.reportItems = reportItems;
16
    }
17

  
18
    private List<ReportItem> reportItems = new ArrayList<>();
19

  
20
    public Customer() {
21
    }
22

  
23
    public Customer(String id, List<ReportItem> reportItems) {
24
        this.id = id;
25
        this.reportItems = reportItems;
26
    }
27

  
28
    @JsonProperty("ID")
29
    public String getId() {
30
        return id;
31
    }
32

  
33
    @JsonProperty("ReportItems")
34
    public List<ReportItem> getReportItems() {
35
        return reportItems;
36
    }
37
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemIdentifier.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class ItemIdentifier {
9
    private String type;
10
    private String value;
11

  
12
    public ItemIdentifier() {
13
    }
14

  
15
    public ItemIdentifier(String type, String value) {
16
        this.type = type;
17
        this.value = value;
18
    }
19

  
20
    @JsonProperty("Type")
21
    public String getType() {
22
        return type;
23
    }
24

  
25
    @JsonProperty("Value")
26
    public String getValue() {
27
        return value;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Instance.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class Instance {
9
    private String metricType;
10
    private String count;
11

  
12
    public Instance() {
13
    }
14

  
15
    public Instance(String type, String count) {
16
        this.metricType = type;
17
        this.count = count;
18
    }
19

  
20
    @JsonProperty("MetricType")
21
    public String getMetricType() {
22
        return metricType;
23
    }
24

  
25
    @JsonProperty("Count")
26
    public String getCount() {
27
        return count;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filters.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 26/10/2016.
10
 */
11
public class Filters {
12
    private UsageDateRange usageDateRange = null;
13
    private List<Filter> filter = new ArrayList<>();
14
    private List<Filter> reportAttribute = new ArrayList<>();
15

  
16
    public Filters() {
17
    }
18

  
19
    public Filters(String beginDate, String endDate, String repositoryIdentifier,
20
                   String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
21
        usageDateRange = new UsageDateRange(beginDate, endDate);
22

  
23
        if (repositoryIdentifier != null && !repositoryIdentifier.equals("")) {
24
            filter.add(new Filter("RepositoryIdentifier", repositoryIdentifier));
25
        }
26
        if (itemIdentifier != null && !itemIdentifier.equals("")) {
27
            filter.add(new Filter("ItemIdentifier", itemIdentifier));
28
        }
29
        if (itemDataType != null && !itemDataType.equals("")) {
30
            filter.add(new Filter("ItemDataType", itemDataType));
31
        }
32

  
33
        reportAttribute.add(new Filter("Granularity", granularity));
34
        if (reportItemCount != null && !reportItemCount.equals("")) {
35
            reportAttribute.add(new Filter("ReportItemCount", reportItemCount));
36
        }
37
    }
38

  
39
    @JsonProperty("UsageDateRange")
40
    public UsageDateRange getUsageDateRange() {
41
        return usageDateRange;
42
    }
43

  
44
    @JsonProperty("Filter")
45
    public List<Filter> getFilter() {
46
        return filter;
47
    }
48

  
49
    @JsonProperty("ReportAttribute")
50
    public List<Filter> getReportAttribute() {
51
        return reportAttribute;
52
    }
53
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Report.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.List;
6

  
7
public class Report {
8
    private String created;
9
    private String version;
10
    private String name;
11

  
12
    private Vendor vendor = new Vendor();
13

  
14
    private Customer customer;
15

  
16
    public Report() {
17
    }
18

  
19
    public Report(String created, String name, String version, String requestor, List<ReportItem> reportItems) {
20
        this.created = created;
21
        this.version = version;
22
        this.name = name + ":" + version;
23
        this.customer = new Customer(requestor, reportItems);
24
    }
25

  
26
    @JsonProperty("@Created")
27
    public String getCreated() {
28
        return created;
29
    }
30

  
31
    @JsonProperty("@Version")
32
    public String getVersion() {
33
        return version;
34
    }
35

  
36
    @JsonProperty("@Name")
37
    public String getName() {
38
        return name;
39
    }
40

  
41
    @JsonProperty("Vendor")
42
    public Vendor getVendor() {
43
        return vendor;
44
    }
45

  
46
    @JsonProperty("Customer")
47
    public Customer getCustomer() {
48
        return customer;
49
    }
50
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportWrapper.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class ReportWrapper {
9
    private Report report;
10

  
11
    public ReportWrapper() {
12
    }
13

  
14
    public ReportWrapper(Report report) {
15
        this.report = report;
16
    }
17

  
18
    @JsonProperty("Report")
19
    public Report getReport() {
20
        return report;
21
    }
22

  
23
    public void setReport(Report report) {
24
        this.report = report;
25
    }
26
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/UsageDateRange.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class UsageDateRange {
9
    private String begin;
10
    private String end;
11

  
12
    public UsageDateRange() {
13
    }
14

  
15
    public UsageDateRange(String begin, String end) {
16
        this.begin = begin;
17
        this.end = end;
18
    }
19

  
20
    @JsonProperty("Begin")
21
    public String getBegin() {
22
        return begin;
23
    }
24

  
25
    @JsonProperty("End")
26
    public String getEnd() {
27
        return end;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ItemPerformance.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.util.ArrayList;
6
import java.util.List;
7

  
8
/**
9
 * Created by tsampikos on 31/10/2016.
10
 */
11
public class ItemPerformance {
12
    private Period period;
13
    private List<Instance> instances = new ArrayList<>();
14

  
15
    public ItemPerformance() {
16
    }
17

  
18
    public ItemPerformance(String start, String end, String ft_count, String abstr) {
19
        period = new Period(start, end);
20
        instances.add(new Instance("ft_total", ft_count));
21
        instances.add(new Instance("abstract", abstr));
22
    }
23

  
24
    @JsonProperty("Period")
25
    public Period getPeriod() {
26
        return period;
27
    }
28

  
29
    @JsonProperty("Category")
30
    public String getCategory() {
31
        return "Requests";
32
    }
33

  
34
    @JsonProperty("Instance")
35
    public List<Instance> getInstance() {
36
        return instances;
37
    }
38
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Period.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 31/10/2016.
7
 */
8
public class Period {
9
    private String begin;
10
    private String end;
11

  
12
    public Period() {
13
    }
14

  
15
    public Period(String begin, String end) {
16
        this.begin = begin;
17
        this.end = end;
18
    }
19

  
20
    @JsonProperty("Begin")
21
    public String getBegin() {
22
        return begin;
23
    }
24

  
25
    @JsonProperty("End")
26
    public String getEnd() {
27
        return end;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportDefinition.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 25/10/2016.
7
 */
8
public class ReportDefinition {
9
    private String name;
10
    private String release;
11
    private Filters filters;
12

  
13
    public ReportDefinition() {
14
    }
15

  
16
    public ReportDefinition(String name, String release, String beginDate, String endDate,
17
                            String repositoryIdentifier, String itemIdentifier, String itemDataType, String granularity, String reportItemCount) {
18
        this.name = name;
19
        this.release = release;
20

  
21
        filters = new Filters(beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, reportItemCount);
22
    }
23

  
24
    @JsonProperty("@Name")
25
    public String getName() {
26
        return name;
27
    }
28

  
29
    @JsonProperty("@Release")
30
    public String getRelease() {
31
        return release;
32
    }
33

  
34
    @JsonProperty("Filters")
35
    public Filters getFilters() {
36
        return filters;
37
    }
38

  
39
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Filter.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 26/10/2016.
7
 */
8
public class Filter {
9
    private String name = null;
10
    private String value = null;
11

  
12
    public Filter() {
13
    }
14

  
15
    public Filter(String name, String value) {
16
        this.name = name;
17
        this.value = value;
18
    }
19

  
20
    @JsonProperty("Name")
21
    public String getName() {
22
        return name;
23
    }
24

  
25
    @JsonProperty("Value")
26
    public String getValue() {
27
        return value;
28
    }
29
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/Requestor.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
/**
6
 * Created by tsampikos on 25/10/2016.
7
 */
8
public class Requestor {
9
    private String id;
10

  
11
    public Requestor() {
12
    }
13

  
14
    public Requestor(String id) {
15
        this.id = id;
16
    }
17

  
18
    @JsonProperty("ID")
19
    public String getID() {
20
        return id;
21
    }
22

  
23
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportItem.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonInclude;
4
import com.fasterxml.jackson.annotation.JsonProperty;
5

  
6
import java.util.ArrayList;
7
import java.util.List;
8

  
9
/**
10
 * Created by tsampikos on 31/10/2016.
11
 */
12
public class ReportItem {
13
    private List<ItemIdentifier> itemIdentifiers = new ArrayList<>();
14

  
15
    private String itemPublisher;
16
    private String itemPlatform;
17
    private String itemDataType;
18
    private String itemName;
19

  
20
    private List<ItemPerformance> itemPerformances = new ArrayList<>();
21

  
22
    public ReportItem() {
23
    }
24

  
25
    public ReportItem(String itemPublisher, String itemPlatform, String itemDataType, String itemName) {
26
        this.itemPublisher = itemPublisher;
27
        this.itemPlatform = itemPlatform;
28
        this.itemDataType = itemDataType;
29
        this.itemName = itemName;
30
    }
31

  
32
    @JsonProperty("ItemIdentifier")
33
    public List<ItemIdentifier> getItemIdentifiers() {
34
        return itemIdentifiers;
35
    }
36

  
37
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
38
    @JsonProperty("ItemPublisher")
39
    public String getItemPublisher() {
40
        return itemPublisher;
41
    }
42

  
43
    @JsonProperty("ItemPlatform")
44
    public String getItemPlatform() {
45
        return itemPlatform;
46
    }
47

  
48
    @JsonProperty("ItemDataType")
49
    public String getItemDataType() {
50
        return itemDataType;
51
    }
52

  
53
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
54
    @JsonProperty("ItemName")
55
    public String getItemName() {
56
        return itemName;
57
    }
58

  
59
    @JsonProperty("ItemPerformance")
60
    public List<ItemPerformance> getItemPerformances() {
61
        return itemPerformances;
62
    }
63

  
64
    public void addIdentifier(ItemIdentifier itemIdentifier) {
65
        itemIdentifiers.add(itemIdentifier);
66
    }
67

  
68
    public void addPerformance(ItemPerformance itemPerformance) {
69
        itemPerformances.add(itemPerformance);
70
    }
71

  
72
    public void setItemPlatform(String itemPlatform) {
73
        this.itemPlatform = itemPlatform;
74
    }
75
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportResponse.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonInclude;
4
import com.fasterxml.jackson.annotation.JsonProperty;
5

  
6
import java.text.DateFormat;
7
import java.text.SimpleDateFormat;
8
import java.util.ArrayList;
9
import java.util.Date;
10
import java.util.List;
11

  
12
/**
13
 * Created by tsampikos on 25/10/2016.
14
 */
15
public class ReportResponse {
16

  
17
    private String created;
18
    private List<ReportException> reportExceptions = new ArrayList<>();
19
    private Requestor requestor;
20
    private ReportDefinition reportDefinition;
21
    private ReportWrapper reportWrapper;
22

  
23
    public ReportResponse() {
24
    }
25

  
26
    public ReportResponse(String reportName, String release, String requestorId, String beginDate,
27
                          String endDate, String repositoryIdentifier, String itemIdentifier,
28
                          String itemDataType, String hasDoi, String granularity, String callback, List<ReportItem> reportItems, List<ReportException> reportExceptions) {
29
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
30
        Date date = new Date();
31
        created = dateFormat.format(date);
32

  
33
        if (!reportExceptions.isEmpty()) {
34
            this.reportExceptions = reportExceptions;
35
        }
36

  
37
        requestor = new Requestor(requestorId);
38

  
39
        reportDefinition = new ReportDefinition(reportName, release, beginDate, endDate, repositoryIdentifier, itemIdentifier, itemDataType, granularity, Integer.toString(reportItems.size()));
40

  
41
        Report report = new Report(created, reportName, release, requestorId, reportItems);
42
        reportWrapper = new ReportWrapper(report);
43
    }
44

  
45
    @JsonProperty("@Created")
46
    public String getCreated() {
47
        return created;
48
    }
49

  
50

  
51
    @JsonInclude(JsonInclude.Include.NON_NULL)
52
    @JsonProperty("Exception")
53
    public List<ReportException> getReportExceptions() {
54
        return reportExceptions;
55
    }
56

  
57
    @JsonProperty("Requestor")
58
    public Requestor getRequestor() {
59
        return requestor;
60
    }
61

  
62
    @JsonProperty("ReportDefinition")
63
    public ReportDefinition getReportDefinition() {
64
        return reportDefinition;
65
    }
66

  
67
    @JsonProperty("Report")
68
    public ReportWrapper getReportWrapper() {
69
        return reportWrapper;
70
    }
71

  
72
}
modules/dnet-openaire-usage-stats-sushilite/tags/1.0.0/trunk/src/main/java/eu/dnetlib/usagestats/sushilite/domain/ReportException.java
1
package eu.dnetlib.usagestats.sushilite.domain;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4

  
5
import java.text.DateFormat;
6
import java.text.SimpleDateFormat;
7
import java.util.Date;
8

  
9
/**
10
 * Created by tsampikos on 23/11/2016.
11
 */
12
public class ReportException {
13
    private String created;
14
    private String number;
15
    private String severity;
16
    private String message;
17
    private String data;
18

  
19
    public ReportException() {
20
    }
21

  
22
    public ReportException(String number, String severity, String message, String data) {
23

  
24
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
25
        Date date = new Date();
26
        created = dateFormat.format(date);
27

  
28
        this.number = number;
29
        this.severity = severity;
30
        this.message = message;
31
        this.data = data;
32
    }
33

  
34
    @JsonProperty("@Created")
35
    public String getCreated() {
36
        return created;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff