Package com.groiss.notification
Class BasicNotificationItem
java.lang.Object
com.groiss.notification.BasicNotificationItem
- All Implemented Interfaces:
NotificationItem
,Serializable
A default implementation for
NotificationItem
.
Can be used on its own or as extension point for further derivations.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Topic string which could be used for "generic" NotificationItems -
Constructor Summary
ConstructorDescriptionPublic constructor.BasicNotificationItem
(Application application, Agent agent, OrgUnit dept, Serializable payload) Construct a BasicNotificationItem. -
Method Summary
Modifier and TypeMethodDescriptiongetAgent()
The agent the item is to be destined for.The application of the item.getDept()
The department of the item.Get the session this item is destined for.Returns null.getTopic()
Returns null.short
getType()
Get the type of the NotificationEvent.boolean
Check, if an item is for private notification without substitution.void
Set the items agent.void
setApplication
(Application application) Sets the items application.void
void
setHttpSessionId
(String sessionId) Set the sessionId (HttpSession.getId() for this notification Item.void
setPayload
(Serializable payload) Set the Object to transport to the clients.void
setPrivate
(boolean isPrivate) Can be used to designate an item for private notification without substitution ('for your eyes only'); agent must be a User.void
setType
(short type) toString()
-
Field Details
-
COMMON_TOPIC
Topic string which could be used for "generic" NotificationItems- See Also:
-
-
Constructor Details
-
BasicNotificationItem
public BasicNotificationItem(Application application, Agent agent, OrgUnit dept, Serializable payload) Construct a BasicNotificationItem.- Parameters:
application
- set items Applicationagent
- the items Agentdept
- the items Orgunitpayload
- the object to transport
-
BasicNotificationItem
public BasicNotificationItem()Public constructor.
-
-
Method Details
-
getType
public short getType()Get the type of the NotificationEvent.- Returns:
- the type of the NotificationEvent used to sent the item
-
setType
public void setType(short type) -
setPayload
Set the Object to transport to the clients.- Parameters:
payload
-
-
getPayload
-
setApplication
Sets the items application.- Parameters:
application
- the application to set.
-
getApplication
Description copied from interface:NotificationItem
The application of the item. Needed when the items agent is a hierarchic role.- Specified by:
getApplication
in interfaceNotificationItem
- Returns:
- the items agent.
-
setAgent
Set the items agent.- Parameters:
agent
- the agent to set.
-
getAgent
Description copied from interface:NotificationItem
The agent the item is to be destined for. See also the special agentNames.EVERYBODY
.- Specified by:
getAgent
in interfaceNotificationItem
- Returns:
- the items agent.
-
setDept
-
getDept
Description copied from interface:NotificationItem
The department of the item. Needed when the items agent is a local or a hierarchic role.- Specified by:
getDept
in interfaceNotificationItem
- Returns:
- the items department.
-
toString
-
getTopic
Returns null. Should be overridden in subclasses when the items are destined for smartclients.- Specified by:
getTopic
in interfaceNotificationItem
- Returns:
- the topic to send for smartclients
- See Also:
-
getJsonPayload
Returns null. Should be overridden in subclasses when the items are destined for smartclients.- Specified by:
getJsonPayload
in interfaceNotificationItem
- Returns:
- the JSON-Representation that is send to the smartclients.
- See Also:
-
setPrivate
public void setPrivate(boolean isPrivate) Can be used to designate an item for private notification without substitution ('for your eyes only'); agent must be a User. -
isPrivate
public boolean isPrivate()Check, if an item is for private notification without substitution. -
getHttpSessionId
Get the session this item is destined for. Note that the agent must still match.- Returns:
- the session this item is destined for.
-
setHttpSessionId
Set the sessionId (HttpSession.getId() for this notification Item. It will only be dispatches within the current cluster node to the appropriate session. Note, that there may be multiple notification/cometd sessions for one HTTP session (multiple tabs, ...). Implicitly, isPrivate() is true for such items.- Parameters:
sessionId
-
-