Interface ApplicationBadgePlugin
- All Known Implementing Classes:
WebNotificationApplicationBadgePlugin
Implementations are discovered as Spring beans, or registered explicitly
through ApplicationBadgePluginRegistry#addPlugin for addons still
wired through Kernel XML.
A plugin carries no business logic: it transfers the call to its own domain's Service layer, and never reaches a DAO or a Storage bean.
-
Method Summary
Modifier and TypeMethodDescriptionlongcountBadge(String username) Counts the items this badge reports for one user.A badge may legitimately belong to several catalog entries — an application and its timeline or dashboard variant report the same counter — so several urls may be declared.getName()The portlets whose catalog entries carry this badge, preferably asapplicationName/portletNamecontent ids — unambiguous when two addons ship a portlet of the same name.default booleanLets a plugin opt a user out entirely, so that no count is ever computed for them.default booleanWhether this plugin owns its own caching, in which case App Center callscountBadge(String)directly instead of going through its own cache.
-
Method Details
-
getName
String getName()- Returns:
- the stable identifier of this badge, e.g.
agendaPendingInvitations. It is what an administrator binds to a catalog entry, and what travels on the WebSocket frame — so it must never change once released.
-
countBadge
Counts the items this badge reports for one user. Called on the read path, so it must be cheap — or the plugin must declare itselfisSelfCached()and do its own caching.- Parameters:
username- the user the count is computed for- Returns:
- the number of items to display,
0to hide the badge
-
isEnabled
Lets a plugin opt a user out entirely, so that no count is ever computed for them. Typically used when the user has not connected the underlying account.- Parameters:
username- the user to test- Returns:
truewhen this badge applies to that user
-
isSelfCached
default boolean isSelfCached()Whether this plugin owns its own caching, in which case App Center callscountBadge(String)directly instead of going through its own cache.Meant for a source whose lifecycle sits outside the container — a third-party system App Center can neither invalidate nor observe — and whose count must stay consistent with what the same addon displays elsewhere. Such a plugin owns both its caching and its single-flight: self-cached never means uncached.
- Returns:
trueto bypass the App Center badge cache
-
getDrawerNames
A badge may legitimately belong to several catalog entries — an application and its timeline or dashboard variant report the same counter — so several urls may be declared.- Returns:
- the
urlof every catalog entry of typeDRAWERthis badge belongs to, so that the binding resolves with no administrator action, empty when none
-
getPortletNames
The portlets whose catalog entries carry this badge, preferably asapplicationName/portletNamecontent ids — unambiguous when two addons ship a portlet of the same name. A bareportlet-nameis also accepted.Note this is not what a
PORTLETentry stores: it stores the portlet instance id chosen in the administration suggester, and instance ids are generated per deployment so a plugin cannot know them. App Center maps one to the other.- Returns:
- every portlet this badge belongs to, empty when none
- See Also:
-
getDeclaredUrls
- Parameters:
type- the catalog entry type to resolve against- Returns:
- the urls this badge binds to for that type, never null
-
getDeclaredUrls
- Returns:
- every url this badge binds to, whatever the entry type, never null
-