Class DefaultWbeHostManager
- java.lang.Object
-
- org.silverpeas.core.wbe.DefaultWbeHostManager
-
- All Implemented Interfaces:
WbeHostManager
@Service public class DefaultWbeHostManager extends Object implements WbeHostManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultWbeHostManager.WbeCacheCleanerJob
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultWbeHostManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all the context of the Web Browser Edition.void
enable(boolean enable)
Enables the services.List<org.silverpeas.kernel.util.Pair<String,String>>
getClientAdministrationAccesses(String language)
Provides the data that permits to access administrations of Web Browser Edition clients.List<WbeFile>
getEditedFilesBy(WbeUser user)
Gets the list of file edited by the given user.<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.List<WbeUser>
getEditorsOfFile(WbeFile file)
Gets the list of users which are editor of the given file.protected void
init()
boolean
isEnabled()
Indicates if the Web Browser Edition is enabled.boolean
isHandled(WbeFile file)
Indicates if givenWbeFile
is handled by WBE client.List<WbeFile>
listCurrentFiles()
Gets the list of WBE files from the context.List<WbeUser>
listCurrentUsers()
Gets the list of WBE users from the context.void
notifyEditionWith(WbeFile file, Set<String> userIds)
Notifies the manager of the number of users which are editing the given file at an instant.<T extends WbeEdition>
Optional<T>prepareEditionWith(SilverpeasUserSession spUserSession, WbeFile anyFile)
Prepares a WBE edition from given data.void
revokeFile(WbeFile file)
Revokes from the WBE edition context the given WBE file.void
revokeUser(WbeUser user)
Revokes from the WBE context the given WBE user.
-
-
-
Method Detail
-
init
@PostConstruct protected void init()
-
getClientAdministrationAccesses
public List<org.silverpeas.kernel.util.Pair<String,String>> getClientAdministrationAccesses(String language)
Description copied from interface:WbeHostManager
Provides the data that permits to access administrations of Web Browser Edition clients.- Specified by:
getClientAdministrationAccesses
in interfaceWbeHostManager
- Parameters:
language
- the user language.- Returns:
- an optional URL as string.
-
notifyEditionWith
public void notifyEditionWith(WbeFile file, Set<String> userIds)
Description copied from interface:WbeHostManager
Notifies the manager of the number of users which are editing the given file at an instant.- Specified by:
notifyEditionWith
in interfaceWbeHostManager
- Parameters:
file
- aWbeFile
a file.userIds
- set of WBE user identifiers.
-
getEditedFilesBy
public List<WbeFile> getEditedFilesBy(WbeUser user)
Description copied from interface:WbeHostManager
Gets the list of file edited by the given user.- Specified by:
getEditedFilesBy
in interfaceWbeHostManager
- Parameters:
user
- aWbeUser
instance.- Returns:
- a list of
WbeFile
.
-
getEditorsOfFile
public List<WbeUser> getEditorsOfFile(WbeFile file)
Description copied from interface:WbeHostManager
Gets the list of users which are editor of the given file.- Specified by:
getEditorsOfFile
in interfaceWbeHostManager
- Parameters:
file
- aWbeFile
instance.- Returns:
- a list of
WbeUser
.
-
enable
public void enable(boolean enable)
Description copied from interface:WbeHostManager
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.- Specified by:
enable
in interfaceWbeHostManager
- Parameters:
enable
- true to enable, false to disable.
-
isEnabled
public boolean isEnabled()
Description copied from interface:WbeHostManager
Indicates if the Web Browser Edition is enabled.- Specified by:
isEnabled
in interfaceWbeHostManager
- Returns:
- true if enabled, false otherwise.
-
isHandled
public boolean isHandled(WbeFile file)
Description copied from interface:WbeHostManager
Indicates if givenWbeFile
is handled by WBE client.- Specified by:
isHandled
in interfaceWbeHostManager
- Parameters:
file
- the WBE file to check.- Returns:
- true if handled, false otherwise.
-
prepareEditionWith
public <T extends WbeEdition> Optional<T> prepareEditionWith(SilverpeasUserSession spUserSession, WbeFile anyFile)
Description copied from interface:WbeHostManager
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.- Specified by:
prepareEditionWith
in interfaceWbeHostManager
- Type Parameters:
T
- aWbeEdition
type.- Parameters:
spUserSession
- the silverpeas session from which the edition is needed.anyFile
- a Silverpeas's WBE file.- Returns:
- an optional
WbeEdition
instance.
-
getEditionContextFrom
public <R> R getEditionContextFrom(String fileId, String accessToken, BiFunction<Optional<WbeUser>,Optional<WbeFile>,R> contextInitializer)
Description copied from interface:WbeHostManager
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.
- Specified by:
getEditionContextFrom
in interfaceWbeHostManager
- 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
public void revokeUser(WbeUser user)
Description copied from interface:WbeHostManager
Revokes from the WBE context the given WBE user.The revocation is done from instance data and not directly from the instance reference.
- Specified by:
revokeUser
in interfaceWbeHostManager
- Parameters:
user
- aWbeUser
instance.
-
revokeFile
public void revokeFile(WbeFile file)
Description copied from interface:WbeHostManager
Revokes from the WBE edition context the given WBE file.The revocation is done from instance data and not directly from the instance reference.
- Specified by:
revokeFile
in interfaceWbeHostManager
- Parameters:
file
- aWbeFile
instance.
-
listCurrentUsers
public List<WbeUser> listCurrentUsers()
Description copied from interface:WbeHostManager
Gets the list of WBE users from the context.- Specified by:
listCurrentUsers
in interfaceWbeHostManager
- Returns:
- a list of
WbeUser
instances.
-
listCurrentFiles
public List<WbeFile> listCurrentFiles()
Description copied from interface:WbeHostManager
Gets the list of WBE files from the context.- Specified by:
listCurrentFiles
in interfaceWbeHostManager
- Returns:
- a list of
WbeFile
instances.
-
clear
public void clear()
Description copied from interface:WbeHostManager
Clears all the context of the Web Browser Edition.Client implementations will also be cleared.
- Specified by:
clear
in interfaceWbeHostManager
-
-