Class AbstractResourceEvent<T extends Serializable>
- java.lang.Object
-
- org.silverpeas.core.notification.system.AbstractResourceEvent<T>
-
- All Implemented Interfaces:
Serializable
,ResourceEvent<T>
- Direct Known Subclasses:
AttachmentEvent
,AttendeeLifeCycleEvent
,CalendarEventLifeCycleEvent
,CalendarEventOccurrenceLifeCycleEvent
,CalendarLifeCycleEvent
,CommentEvent
,ComponentInstanceEvent
,GroupEvent
,GroupUserLinkEvent
,NodeEvent
,PublicationEvent
,RelationShipEvent
,ReplacementEvent
,SpaceEvent
,UserEvent
,UserPreferenceEvent
,WysiwygEvent
public abstract class AbstractResourceEvent<T extends Serializable> extends Object implements ResourceEvent<T>
It is an abstract implementation of a notification event on a resource's state change. It defines the common properties all the concrete events should have. A concrete resource event can extend this class to inherit the basic properties without to implement them by itself.The properties of this abstract class are all annotated with JAXB annotations so that they are ready to be serialized into a text stream (in XML or in JSON). This is particularly useful when the event has to be delivered to external/remote software components.
- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.silverpeas.core.notification.system.ResourceEvent
ResourceEvent.Type
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractResourceEvent()
AbstractResourceEvent(ResourceEvent.Type type, @NotNull T... resource)
Constructs a new instance representing the specified event type in relation to the specified state change of the concerned resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Set<String>
getParameters()
Gets the set of this event resource's parameters.String
getParameterValue(String name)
Gets the value of the specified parameter.StateTransition<T>
getTransition()
Gets the state transition implying by a change on the resource.ResourceEvent.Type
getType()
Gets the type of the event.int
hashCode()
void
putParameter(String name, String value)
Puts a new parameter to this resource.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.notification.system.ResourceEvent
isOnCreation, isOnDeletion, isOnRecovery, isOnRemoving, isOnUpdate
-
-
-
-
Constructor Detail
-
AbstractResourceEvent
protected AbstractResourceEvent()
-
AbstractResourceEvent
public AbstractResourceEvent(ResourceEvent.Type type, @NotNull @NotNull T... resource)
Constructs a new instance representing the specified event type in relation to the specified state change of the concerned resource.- Parameters:
type
- the type of the event.resource
- the resources implied in the event. For an update, two instances of the same resource is expected: the first being the resource before the update, the second being the resource after the update (the result of the update).
-
-
Method Detail
-
getType
public ResourceEvent.Type getType()
Description copied from interface:ResourceEvent
Gets the type of the event. The type of the event carries the cause: a creation, an update, a removing or a deletion of the related resource. It defines then the state in the life-cycle of the resource.- Specified by:
getType
in interfaceResourceEvent<T extends Serializable>
- Returns:
- the type of the event (creation, update, deletion, ...)
-
getTransition
public StateTransition<T> getTransition()
Description copied from interface:ResourceEvent
Gets the state transition implying by a change on the resource. The transition carries two instances of the resource: the resource before the change at the origin of this event, the the resource after the change has occurred. According to the type of the event, one of the state can be null or the two instances can be identical:- for a creation, the instance before the transition is null whereas the instance after the transition is the created resource,
- for an update, the instance before the transition is the resource before the update whereas the instance after the transition is the resource after the update,
- for a removing, the two instances are identical (as the resource is existent and recoverable),
- for a deletion, the instance before the transition is the resource whereas the instance after the deletion is null.
- Specified by:
getTransition
in interfaceResourceEvent<T extends Serializable>
- Returns:
- a state transition with two instances of the resource related by this event: one being the resource before the change, the second being the resource after the change.
-
putParameter
public void putParameter(String name, String value)
Puts a new parameter to this resource. Parameters in event resource carries additional information and has to be simple.- Parameters:
name
- the parameter name.value
- the parameter value.
-
getParameterValue
public String getParameterValue(String name)
Gets the value of the specified parameter. If the parameter isn't set in the event resource, then null is returned.- Parameters:
name
- the name of the parameter to get.- Returns:
- the value of the parameter or null if no such parameter is set in this notification.
-
getParameters
public Set<String> getParameters()
Gets the set of this event resource's parameters.- Returns:
- an unmodifiable set of parameter names.
-
-