1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.opencastproject.usertracking.endpoint;
23
24 import org.opencastproject.usertracking.api.Report;
25 import org.opencastproject.usertracking.api.ReportItem;
26
27 import java.util.ArrayList;
28 import java.util.Calendar;
29 import java.util.List;
30
31 import javax.xml.bind.annotation.XmlAccessType;
32 import javax.xml.bind.annotation.XmlAccessorType;
33 import javax.xml.bind.annotation.XmlAttribute;
34 import javax.xml.bind.annotation.XmlElement;
35 import javax.xml.bind.annotation.XmlRootElement;
36 import javax.xml.bind.annotation.XmlType;
37
38
39
40
41 @XmlType(name = "report", namespace = "http://usertracking.opencastproject.org")
42 @XmlRootElement(name = "report", namespace = "http://usertracking.opencastproject.org")
43 @XmlAccessorType(XmlAccessType.FIELD)
44 public class ReportImpl implements Report {
45
46 @XmlAttribute(name = "from")
47 protected Calendar from;
48
49 @XmlAttribute(name = "to")
50 protected Calendar to;
51
52 @XmlAttribute(name = "views")
53 protected int views;
54
55 @XmlAttribute(name = "played")
56 protected long played;
57
58 @XmlAttribute(name = "total")
59 protected int total;
60
61 @XmlAttribute(name = "offset")
62 protected int offset;
63
64 @XmlAttribute(name = "limit")
65 protected int limit;
66
67 @XmlElement(name = "report-item")
68 protected List<ReportItemImpl> reportItems;
69
70 public void add(ReportItem reportItem) {
71 reportItems.add((ReportItemImpl) reportItem);
72 total = reportItems.size();
73 played += reportItem.getPlayed();
74 views += reportItem.getViews();
75 }
76
77
78
79
80 public ReportImpl() {
81 this.reportItems = new ArrayList<ReportItemImpl>();
82 }
83
84 public void setTotal(int total) {
85 this.total = total;
86 }
87
88 public void setLimit(int limit) {
89 this.limit = limit;
90 }
91
92 public void setOffset(int offset) {
93 this.offset = offset;
94 }
95
96 public Calendar getFrom() {
97 return from;
98 }
99
100 public void setFrom(Calendar from) {
101 this.from = from;
102 }
103
104 public Calendar getTo() {
105 return to;
106 }
107
108 public void setTo(Calendar to) {
109 this.to = to;
110 }
111
112 public int getViews() {
113 return views;
114 }
115
116 public void setViews(int views) {
117 this.views = views;
118 }
119
120 public long getPlayed() {
121 return played;
122 }
123
124 public void setPlayed(long played) {
125 this.played = played;
126 }
127
128 public int getTotal() {
129 return total;
130 }
131
132 public int getOffset() {
133 return offset;
134 }
135
136 public int getLimit() {
137 return limit;
138 }
139 }