Class SpaceStorage

java.lang.Object
org.exoplatform.social.core.jpa.storage.SpaceStorage
Direct Known Subclasses:
CachedSpaceStorage

public class SpaceStorage extends Object
  • Constructor Details

    • SpaceStorage

      public SpaceStorage(SpaceDAO spaceDAO, SpaceMemberDAO spaceMemberDAO, org.exoplatform.social.core.storage.api.IdentityStorage identityStorage, IdentityDAO identityDAO, ActivityDAO activityDAO, SpaceExternalInvitationDAO spaceExternalInvitationDAO, org.exoplatform.social.metadata.favorite.FavoriteService favoriteService, org.exoplatform.web.security.security.RemindPasswordTokenService remindPasswordTokenService)
  • Method Details

    • deleteSpace

      public void deleteSpace(String id) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAccessibleSpaces

      public List<org.exoplatform.social.core.space.model.Space> getAccessibleSpaces(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAccessibleSpaces

      public List<org.exoplatform.social.core.space.model.Space> getAccessibleSpaces(String userId, long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAccessibleSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getAccessibleSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getAccessibleSpacesByFilterCount

      public int getAccessibleSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getAccessibleSpacesCount

      public int getAccessibleSpacesCount(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAllSpaces

      public List<org.exoplatform.social.core.space.model.Space> getAllSpaces() throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getAllSpacesByFilterCount

      public int getAllSpacesByFilterCount(org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getAllSpacesCount

      public int getAllSpacesCount() throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getInvitedSpaces

      public List<org.exoplatform.social.core.space.model.Space> getInvitedSpaces(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getInvitedSpaces

      public List<org.exoplatform.social.core.space.model.Space> getInvitedSpaces(String userId, long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getInvitedSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getInvitedSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getInvitedSpacesByFilterCount

      public int getInvitedSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getInvitedSpacesCount

      public int getInvitedSpacesCount(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getLastAccessedSpace

      public List<org.exoplatform.social.core.space.model.Space> getLastAccessedSpace(org.exoplatform.social.core.space.SpaceFilter spaceFilter, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getLastAccessedSpaceCount

      public int getLastAccessedSpaceCount(org.exoplatform.social.core.space.SpaceFilter spaceFilter) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getLastSpaces

      public List<org.exoplatform.social.core.space.model.Space> getLastSpaces(int limit)
    • getManagerSpaces

      public List<org.exoplatform.social.core.space.model.Space> getManagerSpaces(String userId, long offset, long limit)
    • getManagerSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getManagerSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getManagerSpacesCount

      public int getManagerSpacesCount(String userId)
    • getManagerSpacesByFilterCount

      public int getManagerSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getSpaceIdentityIdsByUserRole

      public List<String> getSpaceIdentityIdsByUserRole(String remoteId, String status, int offset, int limit)
    • getFavoriteSpaceIdentityIds

      public List<String> getFavoriteSpaceIdentityIds(String userIdentityId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, int offset, int limit)
    • getMemberRoleSpaceIdentityIds

      public List<String> getMemberRoleSpaceIdentityIds(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getMemberRoleSpaceIds

      public List<String> getMemberRoleSpaceIds(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getManagerRoleSpaceIds

      public List<String> getManagerRoleSpaceIds(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getMemberSpaces

      public List<org.exoplatform.social.core.space.model.Space> getMemberSpaces(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getMemberSpaces

      public List<org.exoplatform.social.core.space.model.Space> getMemberSpaces(String userId, long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getMemberSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getMemberSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getFavoriteSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getFavoriteSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getFavoriteSpacesByFilterCount

      public int getFavoriteSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getMemberSpacesByFilterCount

      public int getMemberSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getMemberSpacesCount

      public int getMemberSpacesCount(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getPendingSpaces

      public List<org.exoplatform.social.core.space.model.Space> getPendingSpaces(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getPendingSpaces

      public List<org.exoplatform.social.core.space.model.Space> getPendingSpaces(String userId, long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getPendingSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getPendingSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getPendingSpacesByFilterCount

      public int getPendingSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter)
    • getPendingSpacesCount

      public int getPendingSpacesCount(String userId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceByGroupId

      public org.exoplatform.social.core.space.model.Space getSpaceByGroupId(String groupId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceById

      public org.exoplatform.social.core.space.model.Space getSpaceById(long spaceId) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceByPrettyName

      public org.exoplatform.social.core.space.model.Space getSpaceByPrettyName(String spacePrettyName) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaces

      public List<org.exoplatform.social.core.space.model.Space> getSpaces(long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpacesByFilter

      public List<org.exoplatform.social.core.space.model.Space> getSpacesByFilter(org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit)
    • getVisibleSpaces

      public List<org.exoplatform.social.core.space.model.Space> getVisibleSpaces(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getVisibleSpaces

      public List<org.exoplatform.social.core.space.model.Space> getVisibleSpaces(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getVisibleSpacesCount

      public int getVisibleSpacesCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • getSpaceMembershipDate

      public Instant getSpaceMembershipDate(long spaceId, String username)
    • renameSpace

      public void renameSpace(org.exoplatform.social.core.space.model.Space space) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • ignoreSpace

      public void ignoreSpace(String spaceId, String userId)
    • isSpaceIgnored

      public boolean isSpaceIgnored(String spaceId, String userId)
    • saveSpace

      public org.exoplatform.social.core.space.model.Space saveSpace(org.exoplatform.social.core.space.model.Space space, Long parentSpaceId, boolean isNew) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • saveSpace

      public org.exoplatform.social.core.space.model.Space saveSpace(org.exoplatform.social.core.space.model.Space space, boolean isNew) throws org.exoplatform.social.core.storage.SpaceStorageException
      Throws:
      org.exoplatform.social.core.storage.SpaceStorageException
    • updateSpaceAccessed

      public void updateSpaceAccessed(String remoteId, org.exoplatform.social.core.space.model.Space space)
    • getPendingSpaceRequestsToManage

      public List<org.exoplatform.social.core.space.model.Space> getPendingSpaceRequestsToManage(String username, int offset, int limit)
    • countPendingSpaceRequestsToManage

      public int countPendingSpaceRequestsToManage(String username)
    • findSpaceExternalInvitationsBySpaceId

      public List<org.exoplatform.social.core.model.SpaceExternalInvitation> findSpaceExternalInvitationsBySpaceId(String spaceId)
    • saveSpaceExternalInvitation

      public void saveSpaceExternalInvitation(String spaceId, String email, String tokenId)
    • findSpaceExternalInvitationById

      public org.exoplatform.social.core.model.SpaceExternalInvitation findSpaceExternalInvitationById(String invitationId)
    • deleteSpaceExternalInvitation

      public void deleteSpaceExternalInvitation(org.exoplatform.social.core.model.SpaceExternalInvitation spaceExternalInvitation)
    • findExternalInvitationsSpacesByEmail

      public List<String> findExternalInvitationsSpacesByEmail(String email)
    • deleteExternalUserInvitations

      public void deleteExternalUserInvitations(String email)
    • countExternalMembers

      public int countExternalMembers(Long spaceId)
    • getUserSpaces

      public List<org.exoplatform.social.core.space.model.Space> getUserSpaces(String viewerUsername, String profileOwnerUsername, io.meeds.social.space.constant.UserSpacesScope scope, org.exoplatform.social.core.search.Sorting sorting, long offset, long limit)
      Lists the spaces where a profile owner has the member role, restricted to what a viewer is allowed to see. The access decision itself belongs to the Service layer: this method only translates an already decided scope into a datastore filter.
      Parameters:
      viewerUsername - remote id of the viewer, mandatory. When it is the profile owner themselves, both scopes list every space they are a member of, hidden ones included — the viewer is a member of all of them by definition
      profileOwnerUsername - remote id of the profile owner
      scope - effective UserSpacesScope, as decided by the Service
      sorting - the Sorting to apply
      offset - The starting point
      limit - The maximum number of returned results
      Returns:
      List of Space
      Throws:
      IllegalArgumentException - when the viewer or the profile owner is missing
    • countUserSpaces

      public int countUserSpaces(String viewerUsername, String profileOwnerUsername, io.meeds.social.space.constant.UserSpacesScope scope)
      Parameters:
      viewerUsername - remote id of the viewer, mandatory
      profileOwnerUsername - remote id of the profile owner
      scope - effective UserSpacesScope, as decided by the Service
      Returns:
      the number of spaces
      Throws:
      IllegalArgumentException - when the viewer or the profile owner is missing
    • validateUserSpacesArguments

      protected void validateUserSpacesArguments(String viewerUsername, String profileOwnerUsername)
      Refuses a profile spaces listing that carries no viewer. An absent viewer is a caller error, not a licence to list the owner's hidden spaces, so it must never degenerate into the unfiltered listing. Validated by the cached storage before the cache is consulted, so the exception is not raised from inside a cache loader — which would surface it wrapped.
      Parameters:
      viewerUsername - remote id of the viewer
      profileOwnerUsername - remote id of the profile owner
      Throws:
      IllegalArgumentException - when either is missing
    • normalizeUserSpacesScope

      protected io.meeds.social.space.constant.UserSpacesScope normalizeUserSpacesScope(io.meeds.social.space.constant.UserSpacesScope scope)
      Normalises the scope of a profile spaces listing: a missing scope is the restrictive one. The effective scope is decided by the Service, and this layer must never widen when it was not told which scope to apply. Both the filter and the cached storage's key derive from this single method, so the predicate and the cache key can never disagree on what a null scope means — a disagreement there is an access-control defect, not a staleness one.
      Parameters:
      scope - the requested UserSpacesScope, possibly null
      Returns:
      the scope to apply, never null
    • getCommonSpaces

      public List<org.exoplatform.social.core.space.model.Space> getCommonSpaces(String userId, String otherUserId, int offset, int limit)
    • countCommonSpaces

      public int countCommonSpaces(String userId, String otherUserId)
    • countSpacesByTemplate

      public Map<Long,Long> countSpacesByTemplate()
    • getSpaceCategoryIds

      public List<Long> getSpaceCategoryIds()
    • setIdentityStorage

      public void setIdentityStorage(org.exoplatform.social.core.storage.api.IdentityStorage identityStorage)