Project

General

Profile

1
package eu.dnetlib.api.functionality;
2

    
3
import java.util.Date;
4
import java.util.List;
5
import java.util.Set;
6

    
7
import eu.dnetlib.api.DriverService;
8
import eu.dnetlib.domain.functionality.Recommendation;
9

    
10
/**
11
 * The class that manages Recommendation objects
12
 */
13
public interface RecommendationService extends DriverService {
14

    
15
	/**
16
	 * creates a new recommendation of type announcement
17
	 * 
18
	 * @param recommendationText
19
	 *            the text of the recommendation
20
	 * @param creationDate
21
	 *            the creation date of the announcement
22
	 * @param expirationDate
23
	 *            the date the announcement expires
24
	 * @return the id of the new recommendation
25
	 * @throws RecommendationWebServiceException
26
	 *             if the announcement cannot be created
27
	 */
28
	public String generateAnnouncement(int index, boolean active,
29
			String announcementTitle, String announcementText,
30
			Date creationDate, Date expirationDate)
31
			throws RecommendationServiceException;
32

    
33
	/**
34
	 * Swap the index of 2 announcements
35
	 * 
36
	 * @param announcementId1
37
	 *            the id of the fist announcement
38
	 * @param announcementId2
39
	 *            the id of the second announcement
40
	 */
41
	public void swapAnnouncements(String announcementId1, String announcementId2)
42
			throws RecommendationServiceException;
43

    
44
	/**
45
	 * Swap the index of 2 user recommendaitons
46
	 * 
47
	 * @param announcementId1
48
	 *            the id of the fist announcement
49
	 * @param announcementId2
50
	 *            the id of the second announcement
51
	 */
52
	public void swapUserRecommendations(String announcementId1, String announcementId2) 
53
			throws RecommendationServiceException;;
54
		
55
	/**
56
	 * Swap the index of 2 community recommendations
57
	 * 
58
	 * @param announcementId1
59
	 *            the id of the fist announcement
60
	 * @param announcementId2
61
	 *            the id of the second announcement
62
	 */
63
	public void swapCommunityRecommendations(String announcementId1, String announcementId2)
64
			throws RecommendationServiceException;
65
		
66
	/**
67
	 * creates a new recommendation
68
	 * 
69
	 * @param index
70
	 *            the recommendation index
71
	 * @param active
72
	 *            the state of the recommendaiton, is it active or not #param
73
	 *            title the title of the recommendation
74
	 * @param rText
75
	 *            the recommendation text
76
	 * @param creationDate
77
	 *            the date the recommendation was created
78
	 * @param expirationDate
79
	 *            the date the recommendation expires
80
	 * @return the id of the recommendation
81
	 * @throws RecommendationServiceException
82
	 *             if the recommendation cannot be created
83
	 */
84
	public Recommendation generateRecommendation(int index, boolean active,
85
			String title, String recommendationText, Date creationDate,
86
			Date expirationDate) throws RecommendationServiceException;
87

    
88
	/**
89
	 * creates a new recommendation of type community
90
	 * 
91
	 * @param recommendationText
92
	 *            the recommendation text
93
	 * @param creationDate
94
	 * @param expirationDate
95
	 * @param communityId
96
	 *            the ids of the associated communities
97
	 * @return the id of the recommendation
98
	 * @throws RecommendationServiceException
99
	 *             if the community recommendation cannot be created
100
	 */
101
	public String generateCommunityRecommendation(int index, boolean active,
102
			String title, String recommendationText, Date creationDate,
103
			Date expirationDate, Set<String> communityIds)
104
			throws RecommendationServiceException;
105

    
106
	/**
107
	 * creates a new recommendation of type user
108
	 * 
109
	 * @param recommendationText
110
	 * @param creationDate
111
	 * @param expirationDate
112
	 * @return the id of the recommendation
113
	 * @throws RecommendationServiceException
114
	 *             if the user recommendation cannot be created
115
	 */
116
	public String generateUserRecommendation(int index, boolean active,
117
			String title, String userId, String recommendationText,
118
			Date creationDate, Date expirationDate)
119
			throws RecommendationServiceException;
120

    
121
	/**
122
	 * retrieves the recommendation text of all announcements that haven't
123
	 * expired
124
	 * 
125
	 * @return the announcements' recommendation text
126
	 * @throws RecommendationServiceException
127
	 */
128
	public List<String> getAnnouncements()
129
			throws RecommendationServiceException;
130

    
131
	/**
132
	 * retrieves ths ids of all announcements
133
	 * 
134
	 * @throws RecommendationServiceException
135
	 */
136
	public List<String> getAllAnnouncementIds()
137
			throws RecommendationServiceException;
138

    
139
	/**
140
	 * retrieves the recommendation text of all announcements
141
	 * 
142
	 * @return the recommendation text of all announcements
143
	 * @throws RecommendationServiceException
144
	 */
145
	public List<Recommendation> getAllAnnouncements()
146
			throws RecommendationServiceException;
147

    
148
	/**
149
	 * retrieves all recommendations of type community, only the content
150
	 * 
151
	 * @return the recommendation text of all community recommendations
152
	 * @throws RecommendationServiceException
153
	 */
154
	public List<String> getAllCommunityRecommendations()
155
			throws RecommendationServiceException;
156

    
157
	/**
158
	 * retrieves all recommendations of type community, the objects
159
	 * 
160
	 * @return the recommendation text of all community recommendations
161
	 * @throws RecommendationServiceException
162
	 */
163
	public List<Recommendation> getAllCommunityRecommendationsObj()
164
			throws RecommendationServiceException;
165

    
166
	public List<String> getCommunityRecommendations(String communityId)
167
			throws RecommendationServiceException;
168

    
169
	public List<Recommendation> getCommunityRecommendationsObj(
170
			String communityId) throws RecommendationServiceException;
171

    
172
	/**
173
	 * retrieves all community recommendation content that are associated with a
174
	 * community
175
	 * 
176
	 * @param communityId
177
	 *            the id of the community
178
	 * @return the recommendation text of the community recommendations
179
	 * @throws RecommendationServiceException
180
	 */
181
	public List<String> getAllCommunityRecommendations(String communityId)
182
			throws RecommendationServiceException;
183

    
184
	/**
185
	 * retrieves all community recommendation objects that are associated with a
186
	 * community.
187
	 * 
188
	 * @param communityId
189
	 *            the id of the community
190
	 * @return the recommendation text of the community recommendations
191
	 * @throws RecommendationServiceException
192
	 */
193
	public List<Recommendation> getAllCommunityRecommendationsObj(
194
			String communityId) throws RecommendationServiceException;
195

    
196
	public List<String> getAllUserRecommendations(String userId)
197
			throws RecommendationServiceException;
198

    
199
	/**
200
	 * retrieves a recommendation
201
	 * 
202
	 * @param recommendationId
203
	 *            the recommendation id
204
	 * @return the recommendation or null if the recommendation does not exist
205
	 * @throws RecommendationServiceException
206
	 * 
207
	 */
208

    
209
	public Recommendation getRecommendation(String recommendationId)
210
			throws RecommendationServiceException;
211

    
212
	/**
213
	 * retrieves the text of a recommendation
214
	 * 
215
	 * @param recommendationId
216
	 *            the id of the recommendation
217
	 * @return the recommendation text or null if the recommendation does not
218
	 *         exist
219
	 * @throws RecommendationServiceException
220
	 * 
221
	 */
222
	public String getRecommendationText(String recommendationId)
223
			throws RecommendationServiceException;
224

    
225
	/**
226
	 * retrieves the recommendation text of a Set of recommendations
227
	 * 
228
	 * @param recommendationIds
229
	 *            the ids of the recommendations
230
	 * @return a Set of the recommendations' text
231
	 * @throws RecommendationServiceException
232
	 * 
233
	 */
234
	public List<String> getRecommendations(List<String> recommendationIds)
235
			throws RecommendationServiceException;
236

    
237
	/**
238
	 * removes a recommendation
239
	 * 
240
	 * @param recommendationId
241
	 *            the id of the recommendation
242
	 * @throws RecommendationServiceException
243
	 *             if the recommendation does not exist or cannot be updated
244
	 */
245
	public void removeRecommendation(String recommendationId)
246
			throws RecommendationServiceException;
247

    
248
	/**
249
	 * removes a recommendation of type announcement
250
	 * 
251
	 * @param announcementId
252
	 *            the id of the announcement
253
	 * @throws RecommendationServiceException
254
	 *             if the announcement does not exist or cannot be updated
255
	 */
256
	public void removeAnnouncement(String announcementId)
257
			throws RecommendationServiceException;
258

    
259
	/**
260
	 * removes a recommendation of type community
261
	 * 
262
	 * @param recommendationId
263
	 *            the id of the recommendation
264
	 * @param communityId
265
	 *            the id of the community
266
	 * @throws RecommendationServiceException
267
	 */
268
	public void removeCommunityRecommendation(String recommendationId)
269
			throws RecommendationServiceException;
270

    
271
	public void removeUserRecommendation(String recommendationId)
272
			throws RecommendationServiceException;
273

    
274
	/**
275
	 * updates a recommendation
276
	 * 
277
	 * @param recommendationId
278
	 *            the id of the recommendation
279
	 * @param recommendationText
280
	 *            the text of the recommendation
281
	 * @param creationDate
282
	 *            the date the recommendation is created
283
	 * @param expirationDate
284
	 *            the date the recommendation expires
285
	 * @throws RecommendationServiceException
286
	 *             if the recommendation does not exist or cannot be updated
287
	 */
288
	public void updateRecommendation(String recommendationId, int index,
289
			boolean active, String title, String recommendationText,
290
			Date creationDate, Date expirationDate)
291
			throws RecommendationServiceException;
292

    
293
	/**
294
	 * updates an announcement and the corresponding recommendation
295
	 * 
296
	 * @param announcementId
297
	 *            the id of the announcement
298
	 * @param recommendationText
299
	 *            the text of the corresponding recommendation
300
	 * @param creationDate
301
	 *            the creation date of the announcement
302
	 * @param expirationDate
303
	 *            the expiration date of the announcement
304
	 * @throws RecommendationServiceException
305
	 *             if the announcement recommendation does not exist or cannot
306
	 *             be updated
307
	 */
308
	public void updateAnnouncement(String announcementId, int index,
309
			boolean active, String announcementTitle, String announcementText,
310
			Date creationDate, Date expirationDate)
311
			throws RecommendationServiceException;
312

    
313
	public void updateCommunityRecommendation(String recommendationId,
314
			int index, boolean active, String title, String recommendationText,
315
			Date creationDate, Date expirationDate, Set<String> communityIds)
316
			throws RecommendationServiceException;
317

    
318
	/*
319
	 * /** sends an e-mail to all users with the recommendation text of an
320
	 * announcement
321
	 * 
322
	 * @param announcementId the id of the announcement @throws
323
	 * RecommendationServiceException if the announcement or recommendation does
324
	 * not exist
325
	 * 
326
	 * public void sendAnnouncement( String announcementId ) throws
327
	 * RecommendationServiceException;
328
	 */
329

    
330
	public void addRecommendationToUser(String recommendationId, String userId)
331
			throws RecommendationServiceException;
332

    
333
	/**
334
	 * gets all the community recommendation for a specific user
335
	 * 
336
	 * @throws RecommendationServiceException
337
	 */
338
	public List<String> getCommunityRecommendationsForUser(String userId)
339
			throws RecommendationServiceException;
340

    
341
	/**
342
	 * gets all the community recommendation objects for a specific user
343
	 * 
344
	 * @throws RecommendationServiceException
345
	 */
346
	public List<Recommendation> getCommunityRecommendationsForUserObj(
347
			String userId) throws RecommendationServiceException;
348
}
(17-17/23)