Class SpaceStorage
java.lang.Object
org.exoplatform.social.core.jpa.storage.SpaceStorage
- Direct Known Subclasses:
CachedSpaceStorage
-
Constructor Summary
ConstructorsConstructorDescriptionSpaceStorage(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 Summary
Modifier and TypeMethodDescriptionintcountCommonSpaces(String userId, String otherUserId) intcountExternalMembers(Long spaceId) intcountPendingSpaceRequestsToManage(String username) intcountUserSpaces(String viewerUsername, String profileOwnerUsername, io.meeds.social.space.constant.UserSpacesScope scope) Counts the spaces returned bygetUserSpaces(String, String, UserSpacesScope, Sorting, long, long).voidvoiddeleteSpace(String id) voiddeleteSpaceExternalInvitation(org.exoplatform.social.core.model.SpaceExternalInvitation spaceExternalInvitation) org.exoplatform.social.core.model.SpaceExternalInvitationfindSpaceExternalInvitationById(String invitationId) List<org.exoplatform.social.core.model.SpaceExternalInvitation> List<org.exoplatform.social.core.space.model.Space> getAccessibleSpaces(String userId) List<org.exoplatform.social.core.space.model.Space> getAccessibleSpaces(String userId, long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getAccessibleSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetAccessibleSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) intgetAccessibleSpacesCount(String userId) List<org.exoplatform.social.core.space.model.Space> intgetAllSpacesByFilterCount(org.exoplatform.social.core.space.SpaceFilter spaceFilter) intList<org.exoplatform.social.core.space.model.Space> getCommonSpaces(String userId, String otherUserId, int offset, int limit) getFavoriteSpaceIdentityIds(String userIdentityId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, int offset, int limit) List<org.exoplatform.social.core.space.model.Space> getFavoriteSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetFavoriteSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) List<org.exoplatform.social.core.space.model.Space> getInvitedSpaces(String userId) List<org.exoplatform.social.core.space.model.Space> getInvitedSpaces(String userId, long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getInvitedSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetInvitedSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) intgetInvitedSpacesCount(String userId) List<org.exoplatform.social.core.space.model.Space> getLastAccessedSpace(org.exoplatform.social.core.space.SpaceFilter spaceFilter, int offset, int limit) intgetLastAccessedSpaceCount(org.exoplatform.social.core.space.SpaceFilter spaceFilter) List<org.exoplatform.social.core.space.model.Space> getLastSpaces(int limit) getManagerRoleSpaceIds(String identityId, int offset, int limit) List<org.exoplatform.social.core.space.model.Space> getManagerSpaces(String userId, long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getManagerSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetManagerSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) intgetManagerSpacesCount(String userId) getMemberRoleSpaceIdentityIds(String identityId, int offset, int limit) getMemberRoleSpaceIds(String identityId, int offset, int limit) List<org.exoplatform.social.core.space.model.Space> getMemberSpaces(String userId) List<org.exoplatform.social.core.space.model.Space> getMemberSpaces(String userId, long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getMemberSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetMemberSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) intgetMemberSpacesCount(String userId) List<org.exoplatform.social.core.space.model.Space> getPendingSpaceRequestsToManage(String username, int offset, int limit) List<org.exoplatform.social.core.space.model.Space> getPendingSpaces(String userId) List<org.exoplatform.social.core.space.model.Space> getPendingSpaces(String userId, long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getPendingSpacesByFilter(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetPendingSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) intgetPendingSpacesCount(String userId) org.exoplatform.social.core.space.model.SpacegetSpaceByGroupId(String groupId) org.exoplatform.social.core.space.model.SpacegetSpaceById(long spaceId) org.exoplatform.social.core.space.model.SpacegetSpaceByPrettyName(String spacePrettyName) getSpaceIdentityIdsByUserRole(String remoteId, String status, int offset, int limit) getSpaceMembershipDate(long spaceId, String username) List<org.exoplatform.social.core.space.model.Space> getSpaces(long offset, long limit) List<org.exoplatform.social.core.space.model.Space> getSpacesByFilter(org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) 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.List<org.exoplatform.social.core.space.model.Space> getVisibleSpaces(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) List<org.exoplatform.social.core.space.model.Space> getVisibleSpaces(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter, long offset, long limit) intgetVisibleSpacesCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) voidignoreSpace(String spaceId, String userId) booleanisSpaceIgnored(String spaceId, String userId) protected io.meeds.social.space.constant.UserSpacesScopenormalizeUserSpacesScope(io.meeds.social.space.constant.UserSpacesScope scope) Normalises the scope of a profile spaces listing: a missing scope is the restrictive one.voidrenameSpace(org.exoplatform.social.core.space.model.Space space) org.exoplatform.social.core.space.model.SpacesaveSpace(org.exoplatform.social.core.space.model.Space space, boolean isNew) org.exoplatform.social.core.space.model.SpacevoidsaveSpaceExternalInvitation(String spaceId, String email, String tokenId) voidsetIdentityStorage(org.exoplatform.social.core.storage.api.IdentityStorage identityStorage) voidupdateSpaceAccessed(String remoteId, org.exoplatform.social.core.space.model.Space space) protected voidvalidateUserSpacesArguments(String viewerUsername, String profileOwnerUsername) Refuses a profile spaces listing that carries no viewer.
-
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
- 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
-
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
-
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
-
getManagerSpaces
-
getManagerSpacesByFilter
-
getManagerSpacesCount
-
getManagerSpacesByFilterCount
public int getManagerSpacesByFilterCount(String userId, org.exoplatform.social.core.space.SpaceFilter spaceFilter) -
getSpaceIdentityIdsByUserRole
-
getFavoriteSpaceIdentityIds
-
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
-
getFavoriteSpacesByFilter
-
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
-
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
-
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
-
isSpaceIgnored
-
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
-
countPendingSpaceRequestsToManage
-
findSpaceExternalInvitationsBySpaceId
-
saveSpaceExternalInvitation
-
findSpaceExternalInvitationById
public org.exoplatform.social.core.model.SpaceExternalInvitation findSpaceExternalInvitationById(String invitationId) -
deleteSpaceExternalInvitation
public void deleteSpaceExternalInvitation(org.exoplatform.social.core.model.SpaceExternalInvitation spaceExternalInvitation) -
findExternalInvitationsSpacesByEmail
-
deleteExternalUserInvitations
-
countExternalMembers
-
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 definitionprofileOwnerUsername- remote id of the profile ownerscope- effectiveUserSpacesScope, as decided by the Servicesorting- theSortingto applyoffset- The starting pointlimit- The maximum number of returned results- Returns:
ListofSpace- 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) Counts the spaces returned bygetUserSpaces(String, String, UserSpacesScope, Sorting, long, long).- Parameters:
viewerUsername- remote id of the viewer, mandatoryprofileOwnerUsername- remote id of the profile ownerscope- effectiveUserSpacesScope, as decided by the Service- Returns:
- the number of spaces
- Throws:
IllegalArgumentException- when the viewer or the profile owner is missing
-
validateUserSpacesArguments
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 viewerprofileOwnerUsername- 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 requestedUserSpacesScope, possibly null- Returns:
- the scope to apply, never null
-
getCommonSpaces
-
countCommonSpaces
-
countSpacesByTemplate
-
getSpaceCategoryIds
-
setIdentityStorage
public void setIdentityStorage(org.exoplatform.social.core.storage.api.IdentityStorage identityStorage)
-