@JsModule(value="./field-highlighter/src/vaadin-field-highlighter.js") public class CollaborationEngine extends Object
collaboration topics.
Use getInstance() to get a reference to the singleton object.
| Modifier and Type | Method and Description |
|---|---|
static CollaborationEngine |
configure(VaadinService vaadinService,
CollaborationEngineConfiguration configuration)
Sets the configuration for the Collaboration Engine associated with the
given Vaadin service.
|
static CollaborationEngine |
getInstance()
Gets the
CollaborationEngine instance from the current
VaadinService. |
static CollaborationEngine |
getInstance(VaadinService vaadinService)
Gets the
CollaborationEngine instance from the provided
VaadinService. |
TopicConnectionRegistration |
openTopicConnection(Component component,
String topicId,
UserInfo localUser,
SerializableFunction<TopicConnection,Registration> connectionActivationCallback)
Opens a connection to the collaboration topic with the provided id based
on a component instance.
|
TopicConnectionRegistration |
openTopicConnection(ConnectionContext context,
String topicId,
UserInfo localUser,
SerializableFunction<TopicConnection,Registration> connectionActivationCallback)
Opens a connection to the collaboration topic with the provided id based
on a generic context definition.
|
void |
requestAccess(ConnectionContext context,
UserInfo user,
Consumer<AccessResponse> requestCallback)
Requests access for a user to Collaboration Engine.
|
void |
requestAccess(UserInfo user,
Consumer<AccessResponse> requestCallback)
Requests access for a user to Collaboration Engine.
|
public static CollaborationEngine getInstance()
CollaborationEngine instance from the current
VaadinService.CollaborationEngine instancepublic static CollaborationEngine getInstance(VaadinService vaadinService)
CollaborationEngine instance from the provided
VaadinService.CollaborationEngine instancepublic static CollaborationEngine configure(VaadinService vaadinService, CollaborationEngineConfiguration configuration)
You should register a VaadinServiceInitListener where you call
this method with the service returned by
ServiceInitEvent.getSource().
vaadinService - the Vaadin service for which to configure the Collaboration
Engineconfiguration - the configuration to provide for the Collaboration Enginepublic TopicConnectionRegistration openTopicConnection(Component component, String topicId, UserInfo localUser, SerializableFunction<TopicConnection,Registration> connectionActivationCallback)
component - the component which hold UI access, not nulltopicId - the id of the topic to connect to, not nulllocalUser - the user who is related to the topic connection, a
SystemUserInfo can be used for non-interaction
threads. Not null.connectionActivationCallback - the callback to be executed when a connection is activated,
not nullpublic TopicConnectionRegistration openTopicConnection(ConnectionContext context, String topicId, UserInfo localUser, SerializableFunction<TopicConnection,Registration> connectionActivationCallback)
context - context for the connectiontopicId - the id of the topic to connect to, not nulllocalUser - the user who is related to the topic connection, a
SystemUserInfo can be used for non-interaction
threads. Not null.connectionActivationCallback - the callback to be executed when a connection is activated,
not nullpublic void requestAccess(UserInfo user, Consumer<AccessResponse> requestCallback)
This method can be used to check if the user has access to the Collaboration Engine, e.g. if the license is not expired and there is quota for that user; depending on the response, it's then possible to adapt the UI enabling or disabling collaboration features.
To avoid calling this method multiple times per user, it is suggested to cache the result during the login process (e.g. in the session).
In the callback, you can check from the response whether the user has
access or not with the AccessResponse.hasAccess() method. It
returns true if access has been granted for the user.
The current UI is accessed to run the callback, which means that
UI updates in the callback are pushed to the client in real-time. Because
of depending on the current UI, the method can be called only in the
request processing thread, or it will throw.
user - the user requesting accessrequestCallback - the callback to accept the responsepublic void requestAccess(ConnectionContext context, UserInfo user, Consumer<AccessResponse> requestCallback)
This method can be used to check if the user has access to the Collaboration Engine, e.g. if the license is not expired and there is quota for that user; depending on the response, it's then possible to adapt the UI enabling or disabling collaboration features.
To avoid calling this method multiple times per user, it is suggested to cache the result during the login process (e.g. in the session).
In the callback, you can check from the response whether the user has
access or not with the AccessResponse.hasAccess() method. It
returns true if access has been granted for the user.
context - context for the connectionuser - the user requesting accessrequestCallback - the callback to accept the responseCopyright © 2021. All rights reserved.