View Javadoc
1   /*
2    * Copyright (C) 2003-2015 eXo Platform SAS.
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU Affero General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU Affero General Public License for more details.
13   *
14   * You should have received a copy of the GNU Affero General Public License
15   * along with this program. If not, see <http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.social.webNotification.service.test;
18  
19  import java.util.ArrayList;
20  import java.util.HashMap;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.exoplatform.commons.api.notification.model.NotificationInfo;
25  import org.exoplatform.commons.api.notification.model.WebNotificationFilter;
26  import org.exoplatform.commons.api.notification.service.storage.WebNotificationStorage;
27  
28  /**
29   * Created by The eXo Platform SAS
30   * Author : eXoPlatform
31   *          exo@exoplatform.com
32   * Feb 3, 2015  
33   */
34  public class MockWebNotificationStorage implements WebNotificationStorage {
35    
36    private Map<String, NotificationInfo> map = new HashMap<String, NotificationInfo>();
37    
38    public Map<String, NotificationInfo> getMap() {
39      return this.map;
40    }
41  
42    @Override
43    public void save(NotificationInfo notification) {
44      this.map.put(notification.getId(), notification);
45    }
46  
47    @Override
48    public void update(NotificationInfo notification, boolean moveTop) {
49      // TODO Auto-generated method stub
50      
51    }
52  
53    @Override
54    public void markRead(String notificationId) {
55      // TODO Auto-generated method stub
56      
57    }
58  
59    @Override
60    public void markAllRead(String userId) {
61      // TODO Auto-generated method stub
62      
63    }
64  
65    @Override
66    public void hidePopover(String notificationId) {
67      // TODO Auto-generated method stub
68      
69    }
70  
71    @Override
72    public List<NotificationInfo> get(WebNotificationFilter filter, int offset, int limit) {
73      return new ArrayList<NotificationInfo>(this.map.values());
74    }
75  
76    @Override
77    public NotificationInfo get(String notificationId) {
78      return this.map.get(notificationId);
79    }
80  
81    @Override
82    public boolean remove(String notificationId) {
83      if (notificationId == null) {
84        this.map.clear();
85      } else {
86        this.map.remove(notificationId);
87      }
88      return false;
89    }
90  
91    @Override
92    public boolean remove(String userId, long seconds) {
93      // TODO Auto-generated method stub
94      return false;
95    }
96  
97    @Override
98    public NotificationInfo getUnreadNotification(String pluginId, String activityId, String owner) {
99      // TODO Auto-generated method stub
100     return null;
101   }
102 
103   @Override
104   public int getNumberOnBadge(String userId) {
105     // TODO Auto-generated method stub
106     return 0;
107   }
108 
109   @Override
110   public void resetNumberOnBadge(String userId) {
111     // TODO Auto-generated method stub
112     
113   }
114 
115   @Override
116   public boolean remove(long seconds) {
117     // TODO Auto-generated method stub
118     return false;
119   }
120 }