Class SpaceUtils

java.lang.Object
org.exoplatform.social.core.space.SpaceUtils

public class SpaceUtils extends Object
SpaceUtils Utility for working with space
  • Field Details

  • Constructor Details

    • SpaceUtils

      public SpaceUtils()
  • Method Details

    • cleanString

      public static String cleanString(String str)
      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

      public static String 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 - String
      creator - 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

      public static boolean isSpaceNameExisted(String spaceName)
      Checks if a space exists
      Parameters:
      spaceName -
      Returns:
      boolean if existed return true, else return false
    • addCreatorToGroup

      public static void addCreatorToGroup(String creator, String groupId)
      When user chooses an existing group, that user will be added to that group as a manager
      Parameters:
      creator - String
      groupId - String
    • addUserToGroupWithMemberMembership

      public static void addUserToGroupWithMemberMembership(String remoteId, String groupId)
      Adds the user to group with the membership (member).
      Parameters:
      remoteId -
      groupId -
      Since:
      1.2.0-GA
    • addUserToGroupWithRedactorMembership

      public static void addUserToGroupWithRedactorMembership(String remoteId, String groupId)
      Adds the user to group with the membership (redactor).
      Parameters:
      remoteId -
      groupId -
    • addUserToGroupWithPublisherMembership

      public static void addUserToGroupWithPublisherMembership(String remoteId, String groupId)
      Adds the user to group with the membership (publisher).
      Parameters:
      remoteId -
      groupId -
    • addUserToGroupWithManagerMembership

      public static void addUserToGroupWithManagerMembership(String remoteId, String groupId)
      Adds the user to group with the membership (manager).
      Parameters:
      remoteId -
      groupId -
      Since:
      1.2.0-GA
    • removeUserFromGroupWithMemberMembership

      public static void removeUserFromGroupWithMemberMembership(String remoteId, String groupId)
      Removes the user from group with member membership.
      Parameters:
      remoteId -
      groupId -
      Since:
      1.2.0-GA
    • removeUserFromGroupWithRedactorMembership

      public static void removeUserFromGroupWithRedactorMembership(String remoteId, String groupId)
      Removes the user from group with redactor membership.
      Parameters:
      remoteId -
      groupId -
    • removeUserFromGroupWithPublisherMembership

      public static void removeUserFromGroupWithPublisherMembership(String remoteId, String groupId)
      Removes the user from group with publisher membership.
      Parameters:
      remoteId -
      groupId -
    • removeUserFromGroupWithManagerMembership

      public static void removeUserFromGroupWithManagerMembership(String remoteId, String groupId)
      Removes the user from group with manager membership.
      Parameters:
      remoteId -
      groupId -
      Since:
      1.2.0-GA
    • removeUserFromGroupWithAnyMembership

      public static void removeUserFromGroupWithAnyMembership(String remoteId, String groupId)
      Removes the user from group with any(*) membership.
      Parameters:
      remoteId - target user remote id
      groupId - group id
    • getGroupNavigationContext

      public static org.exoplatform.portal.mop.navigation.NavigationContext getGroupNavigationContext(String groupId)
      Gets NavigationContext by a space's groupId
      Parameters:
      groupId -
    • getOrganizationService

      public static org.exoplatform.services.organization.OrganizationService getOrganizationService()
      Gets Organization Service
      Returns:
    • buildGroupId

      public static String buildGroupId(String prettyName, String parentGroupId)
      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()
    • setPermissionsFromTemplate

      public static void setPermissionsFromTemplate(Supplier<List<String>> permissionsSupplier, Consumer<List<String>> permissionsConsumer, String groupId)
    • getSpaceIdentityIds

      public static List<String> getSpaceIdentityIds(String userName, List<String> spaceIds)
    • getUserPermissionsIdentityIds

      public static Set<String> getUserPermissionsIdentityIds(org.exoplatform.social.core.identity.model.Identity ownerIdentity)
    • getUserPermissionsIdentityIds

      public static Set<String> getUserPermissionsIdentityIds(Collection<String> groupIds)