Interface HiddenApplicationService


public interface HiddenApplicationService
Lets each user hide, for themselves only and on every device, a page application window that allows it, then show it again. The window types are contributed by HiddenApplicationPlugin beans.
  • Field Details

    • HIDE_NOT_ALLOWED

      static final String HIDE_NOT_ALLOWED
      Message code of the refusal to hide a window that doesn't allow it
      See Also:
  • Method Details

    • hide

      void hide(String type, String name, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Hides a window from its page for one user
      Parameters:
      type - application type
      name - window name
      username - user name
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the type or the window doesn't exist, or the user can't view the window
      IllegalArgumentException - with HIDE_NOT_ALLOWED when the window doesn't allow hiding
    • show

      void show(String type, String name, String username)
      Shows again, for one user, a window this user hid
      Parameters:
      type - application type
      name - window name
      username - user name, nothing done when blank
    • isHidden

      boolean isHidden(String type, String name, String username)
      Parameters:
      type - application type
      name - window name
      username - user name, null for an anonymous user
      Returns:
      true when the user hid the window. The caller combines it with whether the window still allows hiding.
    • getHiddenApplications

      List<HiddenApplication> getHiddenApplications(String username, String language)
      Parameters:
      username - user name
      language - language of the returned titles and site labels
      Returns:
      the windows the user hid which still allow hiding, are still visible to the user and, for a window on a page, are still on that page, in the order they were hidden. A window that fails to resolve is left out and logged.
    • clearHiddenChoices

      void clearHiddenChoices(String type, String name)
      Shows a window again to every user who hid it, called when its editor turns its option off. It checks nothing: the caller checks that the user may edit the window.
      Parameters:
      type - application type
      name - window name
    • copyHiddenChoices

      void copyHiddenChoices(String type, String fromName, String toName)
      Hides a window for every user who hid another one, keeping the order they hid it in: called when a window's settings are copied under a new name that the window will carry, so that its users' choices follow it. It checks nothing: the caller checks that the acting user may read the source, and the target is a window whose settings the caller has just created under that name. The users are read page after page by offset, from a query with no order: a user who shows the source again while the copy runs can shift a later user out of it, whose choice is then not copied.
      Parameters:
      type - application type
      fromName - name of the window the users hid
      toName - name of the window to hide for them
    • setHideAllowed

      void setHideAllowed(String type, String name, boolean allowed)
      Stores whether a window allows each user to hide it, for an application type that keeps no such option of its own. Turning it off shows the window again to every user who hid it: the choices are cleared first and the option removed last, so that a failed clear leaves it on and saving it off again clears the rest. The caller checks that the user may edit the window. A hide that read the option on before it was turned off may still write its choice after the clear; it hides the window again once the option is turned back on.
      Parameters:
      type - application type
      name - window name
      allowed - whether the window allows hiding
    • isHideAllowed

      boolean isHideAllowed(String type, String name)
      Parameters:
      type - application type
      name - window name
      Returns:
      the option stored with setHideAllowed(String, String, boolean), false when never stored