1
|
package eu.dnetlib.api.functionality;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.dnetlib.api.DriverService;
|
6
|
import eu.dnetlib.domain.functionality.Community;
|
7
|
import eu.dnetlib.domain.functionality.CommunitySearchCriteria;
|
8
|
|
9
|
/**
|
10
|
* The class that manages Community objects
|
11
|
*
|
12
|
*/
|
13
|
public interface CommunityService extends DriverService {
|
14
|
/**
|
15
|
* Create or edit a community.
|
16
|
* @param community the community to save
|
17
|
* @return the community just saved
|
18
|
* @throws CommunityServiceException if any errors occur
|
19
|
*/
|
20
|
public Community saveCommunity(Community community) throws CommunityServiceException;
|
21
|
|
22
|
/**
|
23
|
* Delete a community.
|
24
|
* @param community the community to delete
|
25
|
* @throws CommunityServiceException if any errors occur
|
26
|
*/
|
27
|
public void deleteCommunity(Community community) throws CommunityServiceException;
|
28
|
|
29
|
/**
|
30
|
* Delete a community.
|
31
|
* @param id the id of the community to delete
|
32
|
* @throws CommunityServiceException if any errors occur
|
33
|
*/
|
34
|
public void deleteCommunityById(String id) throws CommunityServiceException;
|
35
|
|
36
|
/**
|
37
|
* Search for a community by id
|
38
|
* @param id the id of the community to search for
|
39
|
* @return the community with the specified id or null if no such community exists
|
40
|
* @throws CommunityServiceException
|
41
|
*/
|
42
|
public Community getCommunityById(String id) throws CommunityServiceException;
|
43
|
|
44
|
/**
|
45
|
* Search for communities by the specified criteria.
|
46
|
* @param criteria the search criteria to match
|
47
|
* @return a list containing all the communities that match the specified criteria
|
48
|
* @throws CommunityServiceException if any errors occur
|
49
|
*/
|
50
|
public List<Community> searchCommunities(CommunitySearchCriteria criteria)
|
51
|
throws CommunityServiceException;
|
52
|
|
53
|
/**
|
54
|
* Search for communities by the specified criteria.
|
55
|
* @param criteria the search criteria to match
|
56
|
* @return a list containing the ids of all the communities that match the specified criteria
|
57
|
* @throws CommunityServiceException if any errors occur
|
58
|
*/
|
59
|
public List<String> searchCommunityIds(CommunitySearchCriteria criteria)
|
60
|
throws CommunityServiceException;
|
61
|
|
62
|
/**
|
63
|
* Check if a user is owner of a community.
|
64
|
* @param communityId the id of the community to check for
|
65
|
* @param userId the id of the user to check for
|
66
|
* @return true if the user is owner of the community; false otherwise
|
67
|
* @throws CommunityServiceException if any errors occur
|
68
|
*/
|
69
|
public boolean isOwner(String communityId, String userId) throws CommunityServiceException;
|
70
|
|
71
|
/**
|
72
|
* Check if a user is manager of a community.
|
73
|
* @param communityId the id of the community to check for
|
74
|
* @param userId the id of the user to check for
|
75
|
* @return true if the user is manager of the community; false otherwise
|
76
|
* @throws CommunityServiceException
|
77
|
*/
|
78
|
public boolean isManager(String communityId, String userId) throws CommunityServiceException;
|
79
|
}
|