Class UserPreferencesHelper

java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.mobileapp.UserPreferencesHelper
All Implemented Interfaces:
LogEnabled, Component, Serviceable

Helper to store/retreive conf per user
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getUserImpactedTokens

      Get the list of impacted tokens for each feeds, for a user
      Parameters:
      user - user to check
      feedIds - list of feeds to check
      Returns:
      a map with a Set of tokens for each feedId
    • getUserImpactedTokens

      public Map<String,Set<String>> getUserImpactedTokens(UserIdentity user, Project project, String eventType)
      Get the list of impacted tokens for each feeds, for a user
      Parameters:
      user - user to check
      project - test if a notification should be sent for this project
      eventType - test if a notification should be sent for this event type
      Returns:
      a map with a the set of tokens impacted for each languages
    • addTokenToMap

      protected Map<String,Set<String>> addTokenToMap(String token, List<String> feedIds, Map<String,Set<String>> existingMap)
      Add a token in a map, with the feeds impacted
      Parameters:
      token - the token to test
      feedIds - the feeds impacted
      existingMap - the existing map of feed -> set of tokens
      Returns:
      the map, with the token added
    • addNotificationToken

      public void addNotificationToken(String pushToken, String lang)
      Add a notification token for the current user
      Parameters:
      pushToken - the token to store
      lang - lang of this device
    • addNotificationToken

      public void addNotificationToken(String pushToken, String lang, UserIdentity user)
      Add a notification token for a user
      Parameters:
      pushToken - the token to store
      lang - lang of this device
      user - the user impacted
    • getNotificationTokens

      Get all notification tokens for current user
      Returns:
      the list of notification tokens
    • getNotificationTokens

      Get all notification tokens a user
      Parameters:
      user - the user impacted
      Returns:
      the list of notification tokens
    • removeNotificationToken

      public void removeNotificationToken(String pushToken)
      Removes a notification token for the current user
      Parameters:
      pushToken - the token to remove
    • removeNotificationToken

      public void removeNotificationToken(String pushToken, UserIdentity user)
      Removes a notification token for a user
      Parameters:
      pushToken - the token to remove
      user - the user impacted
    • removeAllNotificationTokens

      Remove all the notification tokens for a user
      Parameters:
      user - the user impacted
    • setNotificationSettings

      public void setNotificationSettings(String pushToken, List<String> feeds, List<String> projects, List<String> types, String lang)
      Save the notification settings for the current user
      Parameters:
      pushToken - the token to impact
      feeds - list of feeds ID for notifications
      projects - list of project ID for notifications
      types - list of notifications types for notifications in projects
      lang - lang of this device
    • setNotificationSettings

      public void setNotificationSettings(String pushToken, List<String> feeds, List<String> projects, List<String> types, String lang, UserIdentity user)
      Save the notification settings for a user
      Parameters:
      pushToken - token impacted by this settings
      feeds - list of feeds ID for notifications
      projects - list of project ID for notifications
      types - list of notifications types for notifications in projects
      lang - lang of this device
      user - the user impacted
    • getNotificationSettings

      Get the notification settings for a token
      Parameters:
      pushToken - the token to read
      user - the user impacted
      Returns:
      a map containing feeds, projects and types as Set<String>, and epochDay as the last modification date