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

      public Map<String,Set<String>> getUserImpactedTokens(UserIdentity user, Set<String> feedIds, Site site)
      Get the list of impacted tokens for each feeds, for a user
      Parameters:
      user - user to check
      feedIds - list of feeds to check
      site - the site for the validated content
      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
    • 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, boolean enabled, boolean allFeeds, List<String> feeds, boolean allProjects, List<String> projects, boolean allTypes, List<String> types, String lang)
      Save the notification settings for the current user
      Parameters:
      pushToken - the token to impact
      enabled - if notifications are enabled
      allFeeds - if all feeds are allowed to be notified
      feeds - list of feeds ID for notifications
      allProjects - if all projects are allowed to be notified
      projects - list of project ID for notifications
      allTypes - if all types are allowed to be notified
      types - list of notifications types for notifications in projects
      lang - lang of this device
    • setNotificationSettings

      public void setNotificationSettings(String pushToken, boolean enabled, boolean allFeeds, List<String> feeds, boolean allProjects, List<String> projects, boolean allTypes, List<String> types, String lang, UserIdentity user)
      Save the notification settings for a user
      Parameters:
      pushToken - token impacted by this settings
      enabled - if notifications are enabled
      allFeeds - if all feeds are allowed to be notified
      feeds - list of feeds ID for notifications
      allProjects - if all projects are allowed to be notified
      projects - list of project ID for notifications
      allTypes - if all types are allowed to be notified
      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