Class CommunityWebManager
- java.lang.Object
-
- org.silverpeas.components.community.CommunityWebManager
-
@Service public class CommunityWebManager extends Object
WEB manager which allows to centralize code to be used by REST Web Services and Web Component Controller.- Author:
- silveryocha
-
-
Field Summary
Fields Modifier and Type Field Description static org.silverpeas.core.admin.PaginationPageNO_PAGINATION
-
Constructor Summary
Constructors Modifier Constructor Description protectedCommunityWebManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendMembershipOf(CommunityOfUsers community, org.silverpeas.core.admin.user.model.User member)Makes the given user leaving the given community.static CommunityWebManagerget()Gets the singleton instance of the provider.org.silverpeas.core.util.SilverpeasList<CommunityMembership>getHistory(CommunityOfUsers community, org.silverpeas.core.admin.PaginationPage page)Gets history of the given community.org.silverpeas.core.util.SilverpeasList<CommunityMembership>getMembers(CommunityOfUsers community, org.silverpeas.core.admin.PaginationPage page)Gets members of the given community.org.silverpeas.core.util.SilverpeasList<CommunityMembership>getMembersToValidate(CommunityOfUsers community, org.silverpeas.core.admin.PaginationPage page)Gets members pending validation of the given community.Set<org.silverpeas.core.admin.user.model.SilverpeasRole>getUserRoleOn(CommunityOfUsers community)Gets the roles the current requester has on the given community.booleanisMemberOf(CommunityOfUsers community)Indicates if the current requester is a member.booleanisMembershipPendingFor(CommunityOfUsers community)Indicates if the current requester has membership pending validation.voidjoin(CommunityOfUsers community)Makes the current user joining the given community.voidleave(CommunityOfUsers community, int reason, String message, boolean contactInFuture)Makes the current user leaving the given community.voidsetDisplayCharterOnSpaceHomepage(CommunityOfUsers community, boolean value)Saves into instance parameter of the given community the value of parameter 'displayCharterOnSpaceHomepage'.voidvalidateRequestOf(org.silverpeas.core.admin.user.model.User requester, CommunityOfUsers community, boolean accept, String message)Validates the membership request of user given in parameters on specified community.
-
-
-
Method Detail
-
get
public static CommunityWebManager get()
Gets the singleton instance of the provider.
-
join
public void join(CommunityOfUsers community)
Makes the current user joining the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.
-
validateRequestOf
public void validateRequestOf(org.silverpeas.core.admin.user.model.User requester, CommunityOfUsers community, boolean accept, String message)Validates the membership request of user given in parameters on specified community.- Parameters:
requester- the user behind the request to join the community.community- the community the user accesses.accept- true to accept the request, false to refuse.message- message linked to the acceptation or refuse.
-
endMembershipOf
public void endMembershipOf(CommunityOfUsers community, org.silverpeas.core.admin.user.model.User member)
Makes the given user leaving the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.member- the member to manage.
-
leave
public void leave(CommunityOfUsers community, int reason, String message, boolean contactInFuture)
Makes the current user leaving the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.reason- the index of the reason of the leaving.message- a message to explain more precisely the member leaving.contactInFuture- boolean, true to indicate that the member accepts to be contacted in the future about its leaving.
-
setDisplayCharterOnSpaceHomepage
public void setDisplayCharterOnSpaceHomepage(CommunityOfUsers community, boolean value)
Saves into instance parameter of the given community the value of parameter 'displayCharterOnSpaceHomepage'.- Parameters:
community-CommunityOfUsersinstance representing the community.value- true to display the charter, false otherwise.
-
getMembersToValidate
public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getMembersToValidate(@Nonnull CommunityOfUsers community, @Nullable org.silverpeas.core.admin.PaginationPage page)
Gets members pending validation of the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.page- the pending members to get are paginated. Indicates the page to return. If null, all the pending members are got.- Returns:
- list of
CommunityMembershipinstance, representing each one a pending member.
-
getMembers
public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getMembers(@Nonnull CommunityOfUsers community, @Nullable org.silverpeas.core.admin.PaginationPage page)
Gets members of the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.page- the members to get are paginated. Indicates the page to return. If null, all the members are got.- Returns:
- list of
CommunityMembershipinstance, representing each one a committed member.
-
getHistory
public org.silverpeas.core.util.SilverpeasList<CommunityMembership> getHistory(@Nonnull CommunityOfUsers community, @Nullable org.silverpeas.core.admin.PaginationPage page)
Gets history of the given community.- Parameters:
community-CommunityOfUsersinstance representing the community.page- the members to get are paginated. Indicates the page to return. If null, all the members are got.- Returns:
- list of
CommunityMembershipinstance, representing each one a membership whatever its status.
-
isMemberOf
public boolean isMemberOf(CommunityOfUsers community)
Indicates if the current requester is a member.A member MUST be directly specified into ADMIN, PUBLISHER, WRITER or READER role of direct parent space.
- Parameters:
community-CommunityOfUsersinstance.- Returns:
- true if member, false otherwise.
-
isMembershipPendingFor
public boolean isMembershipPendingFor(CommunityOfUsers community)
Indicates if the current requester has membership pending validation.A member MUST be directly specified into ADMIN, PUBLISHER, WRITER or READER role of direct parent space.
- Parameters:
community-CommunityOfUsersinstance.- Returns:
- true if member, false otherwise.
-
getUserRoleOn
public Set<org.silverpeas.core.admin.user.model.SilverpeasRole> getUserRoleOn(CommunityOfUsers community)
Gets the roles the current requester has on the given community.- Parameters:
community-CommunityOfUsersinstance.- Returns:
- a set of
SilverpeasRole.
-
-