Class RDBMSIdentityStorageImpl

java.lang.Object
org.exoplatform.social.core.jpa.storage.RDBMSIdentityStorageImpl
All Implemented Interfaces:
org.exoplatform.social.core.storage.api.IdentityStorage

public class RDBMSIdentityStorageImpl extends Object implements org.exoplatform.social.core.storage.api.IdentityStorage
  • Constructor Details

    • RDBMSIdentityStorageImpl

      public RDBMSIdentityStorageImpl(IdentityDAO identityDAO, SpaceMemberDAO spaceMemberDAO, org.exoplatform.commons.file.services.FileService fileService, org.exoplatform.services.organization.OrganizationService orgService)
  • Method Details

    • getProfileSearchConnector

      public ProfileSearchConnector getProfileSearchConnector()
    • setProfileSearchConnector

      public void setProfileSearchConnector(ProfileSearchConnector profileSearchConnector)
    • saveIdentity

      public void saveIdentity(org.exoplatform.social.core.identity.model.Identity identity) throws org.exoplatform.social.core.storage.IdentityStorageException
      Saves identity.
      Specified by:
      saveIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - the identity
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • updateIdentity

      public org.exoplatform.social.core.identity.model.Identity updateIdentity(org.exoplatform.social.core.identity.model.Identity identity) throws org.exoplatform.social.core.storage.IdentityStorageException
      Updates existing identity's properties.
      Specified by:
      updateIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - the identity to be updated.
      Returns:
      the updated identity.
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
      Since:
      1.2.0-GA
    • updateIdentityMembership

      public void updateIdentityMembership(String remoteId) throws org.exoplatform.social.core.storage.IdentityStorageException
      Updates existing identity's membership in OrganizationService.
      Specified by:
      updateIdentityMembership in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      remoteId - the remoteId to be updated membership.
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
      Since:
      4.0.0
    • findIdentityById

      public org.exoplatform.social.core.identity.model.Identity findIdentityById(String nodeId) throws org.exoplatform.social.core.storage.IdentityStorageException
      Gets the identity by his id.
      Specified by:
      findIdentityById in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      nodeId - the id of identity
      Returns:
      the identity
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • deleteIdentity

      public void deleteIdentity(org.exoplatform.social.core.identity.model.Identity identity) throws org.exoplatform.social.core.storage.IdentityStorageException
      Deletes an identity
      Specified by:
      deleteIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - the Identity to be deleted
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • hardDeleteIdentity

      public void hardDeleteIdentity(org.exoplatform.social.core.identity.model.Identity identity) throws org.exoplatform.social.core.storage.IdentityStorageException
      Hard delete an identity
      Specified by:
      hardDeleteIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - the identity to be deleted
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • loadProfile

      public org.exoplatform.social.core.identity.model.Profile loadProfile(org.exoplatform.social.core.identity.model.Profile profile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Load profile.
      Specified by:
      loadProfile in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      profile - the profile
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • findIdentity

      public org.exoplatform.social.core.identity.model.Identity findIdentity(String providerId, String remoteId) throws org.exoplatform.social.core.storage.IdentityStorageException
      Gets the identity by remote id.
      Specified by:
      findIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      providerId - the identity provider
      remoteId - the id
      Returns:
      the identity by remote id
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • findIdentityId

      public String findIdentityId(String providerId, String remoteId) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      findIdentityId in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • saveProfile

      public void saveProfile(org.exoplatform.social.core.identity.model.Profile profile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Saves profile.
      Specified by:
      saveProfile in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      profile - the profile
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • updateProfile

      public void updateProfile(org.exoplatform.social.core.identity.model.Profile profile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Updates profile.
      Specified by:
      updateProfile in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      profile - the profile
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
      Since:
      1.2.0-GA
    • getIdentitiesCount

      public int getIdentitiesCount(String providerId) throws org.exoplatform.social.core.storage.IdentityStorageException
      Gets total number of identities in storage depend on providerId.
      Specified by:
      getIdentitiesCount in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • addOrModifyProfileProperties

      public void addOrModifyProfileProperties(org.exoplatform.social.core.identity.model.Profile profile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Add or modify properties of profile and persist to database. Profile parameter is a lightweight that contains only the property that you want to add or modify. NOTE: The method will not delete the properties on old profile when the param profile have not those keys.
      Parameters:
      profile - the profile
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException - if has any error
    • updateProfileActivityId

      public void updateProfileActivityId(org.exoplatform.social.core.identity.model.Identity identity, String activityId, org.exoplatform.social.core.identity.model.Profile.AttachedActivityType type)
      Updates profile activity id by type.
      Specified by:
      updateProfileActivityId in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - the identity
      activityId - the activity id
      type - Type of activity id to get.
      Since:
      4.0.0.Alpha1
    • getProfileActivityId

      public String getProfileActivityId(org.exoplatform.social.core.identity.model.Profile profile, org.exoplatform.social.core.identity.model.Profile.AttachedActivityType type)
      Gets profile activity id by type.
      Specified by:
      getProfileActivityId in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      profile - the Profile
      type - Type of activity id to get.
      Returns:
      Profile activity id.
      Since:
      4.0.0.Alpha1
    • getActiveUsers

      public Set<String> getActiveUsers(org.exoplatform.social.core.identity.model.ActiveIdentityFilter filter)
      Gets the active user list base on the given ActiveIdentityFilter. 1. N days who last login less than N days. 2. UserGroup who belongs to this group.
      Parameters:
      filter - the filter
      Returns:
      set of identity ids
      Since:
      4.1.0
    • processEnabledIdentity

      public void processEnabledIdentity(org.exoplatform.social.core.identity.model.Identity identity, boolean isEnable)
      Process enable/disable Identity
      Specified by:
      processEnabledIdentity in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Parameters:
      identity - The Identity enable
      isEnable - true if the user is enable, false if not
      Since:
      4.2.x
    • getIdentitiesForMentions

      public List<org.exoplatform.social.core.identity.model.Identity> getIdentitiesForMentions(String providerId, org.exoplatform.social.core.profile.ProfileFilter profileFilter, org.exoplatform.social.core.relationship.model.Relationship.Type type, long offset, long limit, boolean forceLoadOrReloadProfile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesForMentions in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentitiesForMentionsCount

      public int getIdentitiesForMentionsCount(String providerId, org.exoplatform.social.core.profile.ProfileFilter profileFilter, org.exoplatform.social.core.relationship.model.Relationship.Type type) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesForMentionsCount in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentitiesByProfileFilterCount

      public int getIdentitiesByProfileFilterCount(String providerId, org.exoplatform.social.core.profile.ProfileFilter profileFilter) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesByProfileFilterCount in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentitiesForUnifiedSearch

      public List<org.exoplatform.social.core.identity.model.Identity> getIdentitiesForUnifiedSearch(String providerId, org.exoplatform.social.core.profile.ProfileFilter profileFilter, long offset, long limit) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesForUnifiedSearch in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getSpaceMemberIdentitiesByProfileFilter

      public List<org.exoplatform.social.core.identity.model.Identity> getSpaceMemberIdentitiesByProfileFilter(org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.profile.ProfileFilter profileFilter, org.exoplatform.social.core.identity.SpaceMemberFilterListAccess.Type type, long offset, long limit) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getSpaceMemberIdentitiesByProfileFilter in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • countSpaceMemberIdentitiesByProfileFilter

      public int countSpaceMemberIdentitiesByProfileFilter(org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.profile.ProfileFilter profileFilter, org.exoplatform.social.core.identity.SpaceMemberFilterListAccess.Type type)
      Specified by:
      countSpaceMemberIdentitiesByProfileFilter in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • getIdentitiesByProfileFilter

      public List<org.exoplatform.social.core.identity.model.Identity> getIdentitiesByProfileFilter(String providerId, org.exoplatform.social.core.profile.ProfileFilter profileFilter, long offset, long limit, boolean forceLoadOrReloadProfile) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesByProfileFilter in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentities

      public List<org.exoplatform.social.core.identity.model.Identity> getIdentities(String providerId, String sortField, String sortDirection, boolean isEnabled, String userType, Boolean isConnected, String enrollmentStatus, List<String> remoteIds, long offset, long limit)
      Specified by:
      getIdentities in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • getIdentityIds

      public List<String> getIdentityIds(String providerId, String sortField, String sortDirection, boolean isEnabled, String userType, Boolean isConnected, String enrollmentStatus, List<String> remoteIds, long offset, long limit)
      Specified by:
      getIdentityIds in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • getIdentities

      public List<org.exoplatform.social.core.identity.model.Identity> getIdentities(String providerId, long offset, long limit) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentities in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentitiesWithRelationships

      public List<org.exoplatform.social.core.identity.model.IdentityWithRelationship> getIdentitiesWithRelationships(String identityId, int offset, int limit) throws org.exoplatform.social.core.storage.IdentityStorageException
      Specified by:
      getIdentitiesWithRelationships in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      org.exoplatform.social.core.storage.IdentityStorageException
    • getIdentitiesWithRelationships

      public List<org.exoplatform.social.core.identity.model.IdentityWithRelationship> getIdentitiesWithRelationships(String identityId, String sortFieldName, String sortDirection, int offset, int limit)
      Specified by:
      getIdentitiesWithRelationships in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • countIdentitiesWithRelationships

      public int countIdentitiesWithRelationships(String identityId) throws Exception
      Specified by:
      countIdentitiesWithRelationships in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      Exception
    • findByFilter

      public org.exoplatform.commons.utils.ListAccess<org.exoplatform.social.core.identity.model.Identity> findByFilter(ExtendProfileFilter filter)
    • removeIdentity

      public void removeIdentity(org.exoplatform.social.core.identity.model.Identity identity)
      This method is introduced to clean totally identity from database It's used in unit test
      Parameters:
      identity - the Identity
    • getAvatarInputStreamById

      public InputStream getAvatarInputStreamById(org.exoplatform.social.core.identity.model.Identity identity) throws IOException
      Specified by:
      getAvatarInputStreamById in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      IOException
    • getAvatarFile

      public org.exoplatform.commons.file.model.FileItem getAvatarFile(org.exoplatform.social.core.identity.model.Identity identity)
      Specified by:
      getAvatarFile in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • getBannerInputStreamById

      public InputStream getBannerInputStreamById(org.exoplatform.social.core.identity.model.Identity identity) throws IOException
      Specified by:
      getBannerInputStreamById in interface org.exoplatform.social.core.storage.api.IdentityStorage
      Throws:
      IOException
    • getDisabledSpaceMembers

      public List<String> getDisabledSpaceMembers(Long spaceId)
      Specified by:
      getDisabledSpaceMembers in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • getIdentityProvider

      public org.exoplatform.social.core.identity.IdentityProvider<?> getIdentityProvider(String providerId)
    • getRDBMSCachedIdentityStorage

      public org.exoplatform.social.core.storage.api.IdentityStorage getRDBMSCachedIdentityStorage()
    • getActivityStorage

      public org.exoplatform.social.core.storage.api.ActivityStorage getActivityStorage()
    • getSpaceStorage

      public SpaceStorage getSpaceStorage()
    • sortIdentities

      public List<String> sortIdentities(List<String> identityRemoteIds, String sortField, String sortDirection)
      Specified by:
      sortIdentities in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • sortIdentities

      public List<String> sortIdentities(List<String> identityRemoteIds, String sortField, String sortDirection, boolean filterDisabled)
      Specified by:
      sortIdentities in interface org.exoplatform.social.core.storage.api.IdentityStorage
    • setImageUploadLimit

      public void setImageUploadLimit(int imageUploadLimit)
      Specified by:
      setImageUploadLimit in interface org.exoplatform.social.core.storage.api.IdentityStorage