Interface WbeHostManager

  • All Known Implementing Classes:
    DefaultWbeHostManager

    public interface WbeHostManager
    In charge of the management of Web Browser Edition contexts.

    Web Browser Edition services (WBE services) can use directly the implementation of this interface in order to use the provided functionalities.

    Author:
    silveryocha
    • Method Detail

      • clear

        void clear()
        Clears all the context of the Web Browser Edition.

        Client implementations will also be cleared.

      • getClientAdministrationAccesses

        List<org.silverpeas.kernel.util.Pair<String,​String>> getClientAdministrationAccesses​(String language)
        Provides the data that permits to access administrations of Web Browser Edition clients.
        Parameters:
        language - the user language.
        Returns:
        an optional URL as string.
      • notifyEditionWith

        void notifyEditionWith​(WbeFile file,
                               Set<String> userIds)
        Notifies the manager of the number of users which are editing the given file at an instant.
        Parameters:
        file - a WbeFile a file.
        userIds - set of WBE user identifiers.
      • getEditedFilesBy

        List<WbeFile> getEditedFilesBy​(WbeUser user)
        Gets the list of file edited by the given user.
        Parameters:
        user - a WbeUser instance.
        Returns:
        a list of WbeFile.
      • getEditorsOfFile

        List<WbeUser> getEditorsOfFile​(WbeFile file)
        Gets the list of users which are editor of the given file.
        Parameters:
        file - a WbeFile instance.
        Returns:
        a list of WbeUser.
      • enable

        void enable​(boolean enable)
        Enables the services.

        This usable only in the case of WBE is enable by setting property file.
        When enabled by setting file, it is possible the enable/disable the services in order to get as fast as possible control on WBE exchanges.

        Parameters:
        enable - true to enable, false to disable.
      • isEnabled

        boolean isEnabled()
        Indicates if the Web Browser Edition is enabled.
        Returns:
        true if enabled, false otherwise.
      • isHandled

        boolean isHandled​(WbeFile file)
        Indicates if given WbeFile is handled by WBE client.
        Parameters:
        file - the WBE file to check.
        Returns:
        true if handled, false otherwise.
      • prepareEditionWith

        <T extends WbeEditionOptional<T> prepareEditionWith​(SilverpeasUserSession spUserSession,
                                                              WbeFile file)
        Prepares a WBE edition from given data.

        If WBE is enabled and if the file is handled by the WBE client, a WbeEdition instance is returned. It contains the necessary data to initialize an edition from the WEB services.

        Type Parameters:
        T - a WbeEdition type.
        Parameters:
        spUserSession - the silverpeas session from which the edition is needed.
        file - a Silverpeas's WBE file.
        Returns:
        an optional WbeEdition instance.
      • getEditionContextFrom

        <R> R getEditionContextFrom​(String fileId,
                                    String accessToken,
                                    BiFunction<Optional<WbeUser>,​Optional<WbeFile>,​R> contextInitializer)
        Gets the edition context from a WBE file identifier and an access token.

        If no file exists into context against the given file identifier, then the given optional WBE file to context initializer is empty.

        If no user exists into context against the given access token, then the given optional WBE user to context initializer is empty.

        Type Parameters:
        R - the type of the context.
        Parameters:
        fileId - a file identifier as string.
        accessToken - an access token as string.
        contextInitializer - the context initializer.
        Returns:
        an initialized context.
      • revokeUser

        void revokeUser​(WbeUser user)
        Revokes from the WBE context the given WBE user.

        The revocation is done from instance data and not directly from the instance reference.

        Parameters:
        user - a WbeUser instance.
      • revokeFile

        void revokeFile​(WbeFile file)
        Revokes from the WBE edition context the given WBE file.

        The revocation is done from instance data and not directly from the instance reference.

        Parameters:
        file - a WbeFile instance.
      • listCurrentUsers

        List<WbeUser> listCurrentUsers()
        Gets the list of WBE users from the context.
        Returns:
        a list of WbeUser instances.
      • listCurrentFiles

        List<WbeFile> listCurrentFiles()
        Gets the list of WBE files from the context.
        Returns:
        a list of WbeFile instances.