Interface WopiFileEditionManager

  • All Known Implementing Classes:
    DefaultWopiFileEditionManager

    public interface WopiFileEditionManager
    In charge of the management of WOPI contexts.

    WOPI services can use directly the implementation of this interface in order to use the provided functionalities.

    Author:
    silveryocha
    • Method Detail

      • notifyEditionWith

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

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

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

        void enable​(boolean enable)
        Enables the services.

        This usable only in the case of WOPI 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 WOPI exchanges.

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

        boolean isEnabled()
        Indicates if the WOPI edition is enabled.
        Returns:
        true if enabled, false otherwise.
      • isHandled

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

        Optional<WopiEdition> prepareEditionWith​(SilverpeasUserSession spUserSession,
                                                 WopiFile file)
        Prepares a WOPI edition from given data.

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

        Parameters:
        spUserSession - the silverpeas session from which the edition is needed.
        file - a Silverpeas's WOPI file.
        Returns:
        an optional WopiEdition instance.
      • getEditionContextFrom

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

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

        If no user exists into context against the given access token, then the given optional WOPI 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​(WopiUser user)
        Revokes from the WOPI edition context the given WOPI user.

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

        Parameters:
        user - a WopiUser instance.
      • revokeFile

        void revokeFile​(WopiFile file)
        Revokes from the WOPI edition context the given WOPI file.

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

        Parameters:
        file - a WopiFile instance.
      • listCurrentUsers

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

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