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.impl;
23
24 import org.opencastproject.usertracking.api.UserAction;
25 import org.opencastproject.usertracking.api.UserActionList;
26
27 import java.util.ArrayList;
28 import java.util.Collection;
29 import java.util.LinkedList;
30 import java.util.List;
31
32 import javax.xml.bind.annotation.XmlAccessType;
33 import javax.xml.bind.annotation.XmlAccessorType;
34 import javax.xml.bind.annotation.XmlAttribute;
35 import javax.xml.bind.annotation.XmlElement;
36 import javax.xml.bind.annotation.XmlRootElement;
37 import javax.xml.bind.annotation.XmlType;
38
39
40
41
42 @XmlType(name = "actions", namespace = "http://usertracking.opencastproject.org")
43 @XmlRootElement(name = "actions", namespace = "http://usertracking.opencastproject.org")
44 @XmlAccessorType(XmlAccessType.FIELD)
45 public class UserActionListImpl implements UserActionList {
46
47 @XmlAttribute(name = "total")
48 private int total;
49
50 @XmlAttribute(name = "offset")
51 private int offset;
52
53 @XmlAttribute(name = "limit")
54 private int limit;
55
56 @XmlElement(name = "action", namespace = "http://usertracking.opencastproject.org")
57 private List<UserActionImpl> actions;
58
59 public void add(UserAction annotation) {
60 actions.add((UserActionImpl) annotation);
61 }
62
63 public void add(Collection<UserAction> userActions) {
64 for (UserAction userAction : userActions) {
65 add((UserActionImpl)userAction);
66 }
67 }
68
69
70
71
72 public UserActionListImpl() {
73 this.actions = new ArrayList<UserActionImpl>();
74 }
75
76 public void setTotal(int total) {
77 this.total = total;
78 }
79
80 public void setLimit(int limit) {
81 this.limit = limit;
82 }
83
84 public void setOffset(int offset) {
85 this.offset = offset;
86 }
87
88 public int getTotal() {
89 return total;
90 }
91
92 public int getLimit() {
93 return limit;
94 }
95
96 public int getOffset() {
97 return offset;
98 }
99
100 public List<UserAction> getUserActions() {
101 List<UserAction> userActions = new LinkedList<UserAction>();
102 for (UserActionImpl userActionImpl : actions) {
103 userActions.add(userActionImpl);
104 }
105 return userActions;
106 }
107 }