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 package fr.paris.lutece.plugins.broadcastproxy.business.providers.mock;
35
36 import java.util.ArrayList;
37 import java.util.HashMap;
38 import java.util.List;
39 import java.util.Map;
40
41 import org.json.simple.JSONObject;
42
43 import fr.paris.lutece.plugins.broadcastproxy.business.Feed;
44 import fr.paris.lutece.plugins.broadcastproxy.business.IBroadcastProvider;
45 import fr.paris.lutece.plugins.broadcastproxy.business.Subscription;
46
47 public class MockProvider implements IBroadcastProvider
48 {
49
50 private static final String DEFAULT_USER_SUBSCRIPTIONS_JSON = "{\"subscriptions\":[{\"name\":\"EXAMPLE_ONE\",\"active\":\"0\"},{\"name\":\"EXAMPLE_TWO\",\"active\":\"1\",\"data\":[\"data1\",\"date2\"]}]}";
51 private static final Map<String, String> DEFAULT_USER_SUBSCRIPTIONS_MAP = createDefaultMap( );
52
53
54
55
56
57
58 private static Map<String, String> createDefaultMap( )
59 {
60 Map<String, String> myMap = new HashMap<>( );
61 myMap.put( "1", "sub1" );
62 myMap.put( "2", "sub2" );
63 return myMap;
64 }
65
66 @Override
67 public String getName( )
68 {
69 return "Mock";
70 }
71
72
73 public boolean updateSubscribtions( List<Subscription> subscriptionsList )
74 {
75 return true;
76 }
77
78
79 @Override
80 public boolean update( Subscription subscription, String strAccountId ) throws Exception
81 {
82 return true;
83 }
84
85 public List<Feed> getFeeds( )
86 {
87 List<Feed> list = new ArrayList<>( );
88
89 Feedplugins/broadcastproxy/business/Feed.html#Feed">Feed testFeed = new Feed( );
90 testFeed.setActive( true );
91 testFeed.setName( "EXAMPLE_ONE" );
92 testFeed.setId( "ONE" );
93 testFeed.setDescription( "Test" );
94 testFeed.setType( "TEST" );
95 Map<String, String> mapDatas = new HashMap<>( );
96 mapDatas.put( "T1", "theme1" );
97 mapDatas.put( "T2", "theme2" );
98 testFeed.setData( mapDatas );
99
100 list.add( testFeed );
101
102 Feedlugins/broadcastproxy/business/Feed.html#Feed">Feed testFeed2 = new Feed( );
103 testFeed2.setActive( false );
104 testFeed2.setName( "EXAMPLE_TWO" );
105 testFeed2.setId( "TWO" );
106 testFeed2.setDescription( "Test" );
107 testFeed2.setType( "TEST" );
108
109 list.add( testFeed2 );
110
111 return list;
112 }
113
114 @Override
115 public boolean updateSubscribtions( String userId, String jsonSubscriptions, String strAccountId ) throws Exception
116 {
117
118 return false;
119 }
120
121 @Override
122 public boolean updateSubscribtions( String userId, List<Subscription> subscriptionsList ) throws Exception
123 {
124
125 return false;
126 }
127
128 @Override
129 public String getAllSubscriptionByGroup( String typeSubscription, String strAccountId )
130 {
131
132 return null;
133 }
134
135 @Override
136 public List<JSONObject> getUserSubscriptionIds( String strUserId, String strAccountId )
137 {
138
139 return null;
140 }
141
142 @Override
143 public boolean updateArrondissementSubscribtions( String userId, String jsonSubscriptions, String strAccountId ) throws Exception
144 {
145
146 return false;
147 }
148 }