Class DefaultEventType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.repository.events.DefaultEventType
- All Implemented Interfaces:
EventType
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
WorkspacesEventType
public class DefaultEventType
extends AbstractLogEnabled
implements Configurable, EventType, Serviceable, PluginAware
Default implementation for
EventType
storing event in JCR-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected UserHelper
Helper to get usersstatic final String
Constant for event's author JSON key.static final String
Constant for event's date JSON key.static final String
Constant for event's name JSON key.static final String
Constant for event's type JSON key.Fields inherited from interface org.ametys.plugins.repository.events.EventType
EVENT_AUTHOR, EVENT_DATE, EVENT_TYPE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected UserIdentity
_getAuthor
(javax.jcr.Node eventNode) Gets the identity of the author of the given eventvoid
configure
(Configuration configuration) event2JSON
(javax.jcr.Node eventNode) Format an event node to JSONGet the ids of the supported event typesboolean
Determines if two events can be mergedmergeEvents
(List<Map<String, Object>> events) Merge events into one event.void
service
(ServiceManager serviceManager) void
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.protected void
storeAdditionalEventData
(javax.jcr.Node eventNode, Map<String, Object> parameters) Store additional data on eventjavax.jcr.Node
storeEvent
(String eventId, Map<String, Object> parameters, EventHolder eventHolder) Store an event with the given event id under the given event holder nodeMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
NAME
Constant for event's name JSON key. The stored value is aString
.- See Also:
-
TYPE
Constant for event's type JSON key. The stored value is aString
.- See Also:
-
DATE
Constant for event's date JSON key. The stored value is aCalendar
.- See Also:
-
AUTHOR
Constant for event's author JSON key. The stored value is aMap
.- See Also:
-
_currentUserProvider
The current user provider -
_userHelper
Helper to get users
-
-
Constructor Details
-
DefaultEventType
public DefaultEventType()
-
-
Method Details
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSupportedTypes
Description copied from interface:EventType
Get the ids of the supported event types- Specified by:
getSupportedTypes
in interfaceEventType
- Returns:
- the ids of the supported event types
-
storeEvent
public javax.jcr.Node storeEvent(String eventId, Map<String, Object> parameters, EventHolder eventHolder) throws javax.jcr.RepositoryExceptionDescription copied from interface:EventType
Store an event with the given event id under the given event holder node- Specified by:
storeEvent
in interfaceEventType
- Parameters:
eventId
- the id of the event to storeparameters
- the event parameterseventHolder
- the event holder- Returns:
- the stored node
- Throws:
javax.jcr.RepositoryException
- if an error occurs while manipulating the repository
-
storeAdditionalEventData
protected void storeAdditionalEventData(javax.jcr.Node eventNode, Map<String, Object> parameters) throws javax.jcr.RepositoryExceptionStore additional data on event- Parameters:
eventNode
- The event nodeparameters
- The event's parameters- Throws:
javax.jcr.RepositoryException
- if an error occurred
-
event2JSON
Description copied from interface:EventType
Format an event node to JSON- Specified by:
event2JSON
in interfaceEventType
- Parameters:
eventNode
- the node of an event- Returns:
- the JSON for the node
- Throws:
javax.jcr.RepositoryException
- if an error occurs while manipulating the repository
-
_getAuthor
Gets the identity of the author of the given event- Parameters:
eventNode
- The node of the event- Returns:
- the identity of the author of the given event
- Throws:
javax.jcr.RepositoryException
- if an error occurs while manipulating the repository
-
isMergeable
Description copied from interface:EventType
Determines if two events can be merged- Specified by:
isMergeable
in interfaceEventType
- Parameters:
event1
- The first eventevent2
- The second event- Returns:
- true if the events can be merged
-
mergeEvents
Description copied from interface:EventType
Merge events into one event. Be careful : be sure that the events can be merged calling isMergeable method before- Specified by:
mergeEvents
in interfaceEventType
- Parameters:
events
- The events to merge- Returns:
- Merged event
-