Class SpaceUtils
java.lang.Object
org.exoplatform.social.core.space.SpaceUtils
SpaceUtils Utility for working with space
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCreatorToGroup(String creator, String groupId) When user chooses an existing group, that user will be added to that group as a managerstatic voidaddUserToGroupWithManagerMembership(String remoteId, String groupId) Adds the user to group with the membership (manager).static voidaddUserToGroupWithMemberMembership(String remoteId, String groupId) Adds the user to group with the membership (member).static voidaddUserToGroupWithPublisherMembership(String remoteId, String groupId) Adds the user to group with the membership (publisher).static voidaddUserToGroupWithRedactorMembership(String remoteId, String groupId) Adds the user to group with the membership (redactor).static StringbuildGroupId(String prettyName, String parentGroupId) Builds pretty name base on the basic name in case create more than one space with the same name.static StringcleanString(String str) Utility for cleaning space namestatic StringcreateGroup(String spaceName, String creator) Creates new group in /Spaces node and return groupIdstatic StringcreateGroup(String groupLabel, String spaceName, String creator) Creates new group in /Spaces node and return groupIdstatic org.exoplatform.portal.mop.navigation.NavigationContextgetGroupNavigationContext(String groupId) Gets NavigationContext by a space's groupIdstatic org.exoplatform.services.organization.OrganizationServiceGets Organization Servicestatic org.exoplatform.social.core.space.model.Spacestatic org.exoplatform.social.core.identity.model.Identitystatic org.exoplatform.social.core.space.spi.SpaceServicestatic StringGets the space url based on the current context.static booleanCheck whether is being in a space context or not.static booleanisSpaceNameExisted(String spaceName) Checks if a space existsstatic voidremoveGroup(org.exoplatform.social.core.space.model.Space space) Removes a group owning a spacestatic voidremoveMembershipFromGroup(org.exoplatform.social.core.space.model.Space space) Removes membership of users with a deleted spaces.static voidremoveUserFromGroupWithAnyMembership(String remoteId, String groupId) Removes the user from group with any(*) membership.static voidremoveUserFromGroupWithManagerMembership(String remoteId, String groupId) Removes the user from group with manager membership.static voidremoveUserFromGroupWithMemberMembership(String remoteId, String groupId) Removes the user from group with member membership.static voidremoveUserFromGroupWithPublisherMembership(String remoteId, String groupId) Removes the user from group with publisher membership.static voidremoveUserFromGroupWithRedactorMembership(String remoteId, String groupId) Removes the user from group with redactor membership.static voidsetSpaceByContext(org.exoplatform.portal.application.PortalRequestContext context, Object space)
-
Field Details
-
SPACE_GROUP
- See Also:
-
SPACE_GROUP_PREFIX
- See Also:
-
PLATFORM_USERS_GROUP
- See Also:
-
PLATFORM_EXTERNALS_GROUP
- See Also:
-
PLATFORM_PUBLISHER_GROUP
- See Also:
-
SPACE_ADMIN_REFERENCE_NAME
- See Also:
-
MANAGER
- See Also:
-
MEMBER
- See Also:
-
INTERNAL
- See Also:
-
AUTHENTICATED
- See Also:
-
EVERYONE
- See Also:
-
REDACTOR
- See Also:
-
PUBLISHER
- See Also:
-
PENDING
- See Also:
-
INVITED
- See Also:
-
IGNORED
- See Also:
-
MENU_CONTAINER
- See Also:
-
APPLICATION_CONTAINER
- See Also:
-
SPACE_URL
- See Also:
-
SPACE_SETTINGS_PAGE
- See Also:
-
PUBLIC_SITE_SPACE_ID
- See Also:
-
IS_PUBLIC_SITE_SPACE
- See Also:
-
CURRENT_SPACE
- See Also:
-
-
Constructor Details
-
SpaceUtils
public SpaceUtils()
-
-
Method Details
-
cleanString
Utility for cleaning space name- Parameters:
str-- Returns:
- cleaned string
-
isSpaceContext
public static boolean isSpaceContext()Check whether is being in a space context or not.- Returns:
- Since:
- 4.0.0-RC2
-
getSpaceUrlByContext
Gets the space url based on the current context.- Returns:
- Since:
- 4.0.0-RC2
-
getSpaceByContext
public static org.exoplatform.social.core.space.model.Space getSpaceByContext() -
setSpaceByContext
public static void setSpaceByContext(org.exoplatform.portal.application.PortalRequestContext context, Object space) -
getSpaceIdentityByContext
public static org.exoplatform.social.core.identity.model.Identity getSpaceIdentityByContext() -
createGroup
public static String createGroup(String spaceName, String creator) throws org.exoplatform.social.core.space.SpaceException Creates new group in /Spaces node and return groupId- Parameters:
spaceName- Stringcreator- String- Returns:
- groupId String
- Throws:
org.exoplatform.social.core.space.SpaceException
-
createGroup
public static String createGroup(String groupLabel, String spaceName, String creator) throws org.exoplatform.social.core.space.SpaceException Creates new group in /Spaces node and return groupId- Parameters:
groupLabel- Space Display name.spaceName- Space name.creator- Name of user who creating space.- Returns:
- groupId Id of created space group.
- Throws:
org.exoplatform.social.core.space.SpaceException
-
removeGroup
public static void removeGroup(org.exoplatform.social.core.space.model.Space space) throws org.exoplatform.social.core.space.SpaceException Removes a group owning a space- Parameters:
space-- Throws:
org.exoplatform.social.core.space.SpaceException
-
removeMembershipFromGroup
public static void removeMembershipFromGroup(org.exoplatform.social.core.space.model.Space space) Removes membership of users with a deleted spaces.- Parameters:
space-
-
isSpaceNameExisted
Checks if a space exists- Parameters:
spaceName-- Returns:
- boolean if existed return true, else return false
-
addCreatorToGroup
When user chooses an existing group, that user will be added to that group as a manager- Parameters:
creator- StringgroupId- String
-
addUserToGroupWithMemberMembership
Adds the user to group with the membership (member).- Parameters:
remoteId-groupId-- Since:
- 1.2.0-GA
-
addUserToGroupWithRedactorMembership
Adds the user to group with the membership (redactor).- Parameters:
remoteId-groupId-
-
addUserToGroupWithPublisherMembership
Adds the user to group with the membership (publisher).- Parameters:
remoteId-groupId-
-
addUserToGroupWithManagerMembership
Adds the user to group with the membership (manager).- Parameters:
remoteId-groupId-- Since:
- 1.2.0-GA
-
removeUserFromGroupWithMemberMembership
Removes the user from group with member membership.- Parameters:
remoteId-groupId-- Since:
- 1.2.0-GA
-
removeUserFromGroupWithRedactorMembership
Removes the user from group with redactor membership.- Parameters:
remoteId-groupId-
-
removeUserFromGroupWithPublisherMembership
Removes the user from group with publisher membership.- Parameters:
remoteId-groupId-
-
removeUserFromGroupWithManagerMembership
Removes the user from group with manager membership.- Parameters:
remoteId-groupId-- Since:
- 1.2.0-GA
-
removeUserFromGroupWithAnyMembership
Removes the user from group with any(*) membership.- Parameters:
remoteId- target user remote idgroupId- group id
-
getOrganizationService
public static org.exoplatform.services.organization.OrganizationService getOrganizationService()Gets Organization Service- Returns:
-
buildGroupId
Builds pretty name base on the basic name in case create more than one space with the same name.- Parameters:
prettyName-parentGroupId-- Returns:
- Since:
- 1.2.8
-
getSpaceService
public static org.exoplatform.social.core.space.spi.SpaceService getSpaceService()
-