-
Notifications
You must be signed in to change notification settings - Fork 342
Expand file tree
/
Copy pathPublisherStatistics.java
More file actions
100 lines (78 loc) · 2.65 KB
/
Copy pathPublisherStatistics.java
File metadata and controls
100 lines (78 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/** ******************************************************************************
* Copyright (c) 2024 Precies. Software OU and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
* ****************************************************************************** */
package org.eclipse.openvsx.entities;
import jakarta.persistence.*;
import org.eclipse.openvsx.json.PublisherStatisticsJson;
import java.util.*;
@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "year", "month"})})
public class PublisherStatistics {
@Id
@GeneratedValue(generator = "publisherStatisticsSeq")
@SequenceGenerator(name = "publisherStatisticsSeq", sequenceName = "publisher_statistics_seq")
private long id;
@ManyToOne
@JoinColumn(name = "user_data")
private UserData user;
private int year;
private int month;
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "extension_identifier")
@Column(name = "downloads")
private Map<String, Long> extensionDownloads;
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "extension_identifier")
@Column(name = "downloads")
private Map<String, Long> extensionTotalDownloads;
public PublisherStatisticsJson toJson() {
var json = new PublisherStatisticsJson();
json.setYear(year);
json.setMonth(month);
json.setExtensionDownloads(extensionDownloads);
json.setExtensionTotalDownloads(extensionTotalDownloads);
return json;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public UserData getUser() {
return user;
}
public void setUser(UserData user) {
this.user = user;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public Map<String, Long> getExtensionDownloads() {
return extensionDownloads;
}
public void setExtensionDownloads(Map<String, Long> extensionDownloads) {
this.extensionDownloads = extensionDownloads;
}
public Map<String, Long> getExtensionTotalDownloads() {
return extensionTotalDownloads;
}
public void setExtensionTotalDownloads(Map<String, Long> extensionTotalDownloads) {
this.extensionTotalDownloads = extensionTotalDownloads;
}
}