Package io.meeds.appcenter.storage
Class ApplicationBadgePortletStorage
java.lang.Object
io.meeds.appcenter.storage.ApplicationBadgePortletStorage
Translates between a
PORTLET application's stored url and the portlet
name a badge plugin declares.
A PORTLET catalog entry stores the portlet instance
id chosen in the administration suggester, not the
portlet-name from portlet.xml. A plugin can only declare the
latter — instance ids are generated per deployment — so the two have to be
mapped.
The whole mapping is cached as a single entry, deliberately: it is read for every application of every launcher render, and resolving one instance at a time would turn that into a query per application.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDrops the mapping, so that a newly created or removed portlet instance is picked up before the cache would have expired on its own.getPortletInstanceUrls(Collection<String> declaredPortlets) Reverse lookup, used to find which applications a badge is bound to.static booleanA plugin may declare either the fullapplicationName/portletNamecontent id — unambiguous, and what the administration form matches on — or just the portlet name, as Layout's own portlet lookup also tolerates.
-
Field Details
-
CACHE_NAME
- See Also:
-
-
Constructor Details
-
ApplicationBadgePortletStorage
public ApplicationBadgePortletStorage()
-
-
Method Details
-
getPortletContentIdsByInstanceId
@Cacheable(cacheNames="app-center.badge.portlet", key="\'portletContentIdsByInstanceId\'", sync=true) public Map<String,String> getPortletContentIdsByInstanceId()- Returns:
- the
contentIdof every portlet instance, keyed by instance id as stored in an application's url
-
getPortletContentId
- Parameters:
url- an application url holding a portlet instance id- Returns:
- the corresponding
contentId, or null when unknown
-
getPortletInstanceUrls
Reverse lookup, used to find which applications a badge is bound to.- Parameters:
declaredPortlets- the portlet values a plugin declares, either acontentIdor a bareportlet-name- Returns:
- the urls of the matching portlet instances
-
matches
A plugin may declare either the fullapplicationName/portletNamecontent id — unambiguous, and what the administration form matches on — or just the portlet name, as Layout's own portlet lookup also tolerates.- Parameters:
declared- the value declared by a badge plugincontentId- the content id of a portlet instance- Returns:
- whether they designate the same portlet
-
clearCache
@CacheEvict(cacheNames="app-center.badge.portlet", key="\'portletContentIdsByInstanceId\'") public void clearCache()Drops the mapping, so that a newly created or removed portlet instance is picked up before the cache would have expired on its own.
-