View Javadoc
1   package org.exoplatform.social.notification.mock;
2   
3   import org.exoplatform.commons.api.notification.model.NotificationInfo;
4   import org.exoplatform.commons.api.notification.model.WebNotificationFilter;
5   import org.exoplatform.commons.api.notification.service.storage.WebNotificationStorage;
6   
7   import java.util.ArrayList;
8   import java.util.HashMap;
9   import java.util.List;
10  import java.util.Map;
11  
12  /**
13   * Created by exo on 22/06/18.
14   */
15  public class MockWebNotificationStorage implements WebNotificationStorage {
16  
17    private Map<String, NotificationInfo> map = new HashMap<String, NotificationInfo>();
18  
19    public Map<String, NotificationInfo> getMap() {
20      return this.map;
21    }
22  
23    @Override
24    public void save(NotificationInfo notification) {
25      this.map.put(notification.getId(), notification);
26    }
27  
28    @Override
29    public void update(NotificationInfo notification, boolean moveTop) {
30      // TODO Auto-generated method stub
31  
32    }
33  
34    @Override
35    public void markRead(String notificationId) {
36      // TODO Auto-generated method stub
37  
38    }
39  
40    @Override
41    public void markAllRead(String userId) {
42      // TODO Auto-generated method stub
43  
44    }
45  
46    @Override
47    public void hidePopover(String notificationId) {
48      // TODO Auto-generated method stub
49  
50    }
51  
52    @Override
53    public List<NotificationInfo> get(WebNotificationFilter filter, int offset, int limit) {
54      return new ArrayList<NotificationInfo>(this.map.values());
55    }
56  
57    @Override
58    public NotificationInfo get(String notificationId) {
59      return this.map.get(notificationId);
60    }
61  
62    @Override
63    public boolean remove(String notificationId) {
64      if (notificationId == null) {
65        this.map.clear();
66      } else {
67        this.map.remove(notificationId);
68      }
69      return false;
70    }
71  
72    @Override
73    public boolean remove(String userId, long seconds) {
74      // TODO Auto-generated method stub
75      return false;
76    }
77  
78    @Override
79    public NotificationInfo getUnreadNotification(String pluginId, String activityId, String owner) {
80      // TODO Auto-generated method stub
81      return null;
82    }
83  
84    @Override
85    public int getNumberOnBadge(String userId) {
86      // TODO Auto-generated method stub
87      return 0;
88    }
89  
90    @Override
91    public void resetNumberOnBadge(String userId) {
92      // TODO Auto-generated method stub
93  
94    }
95  
96    @Override
97    public boolean remove(long seconds) {
98      // TODO Auto-generated method stub
99      return false;
100   }
101 }