@Override public PortletConfiguration getByPortletId(final Long portletId) { notNull("portletId", portletId); final CacheObject<PortletConfiguration> portletConfigurationCacheObject = cacheById.get(portletId); return portletConfigurationCacheObject != null ? copyConfiguration(portletConfigurationCacheObject.getValue()) : null; }
@Override public PortletConfiguration addDashboardItem(final Long pageId, final Long portletConfigurationId, final Integer column, final Integer row, final Option<URI> openSocialSpecUri, final Color color, final Map<String, String> userPreferences, final Option<ModuleCompleteKey> moduleKey) { notNull("pageId", pageId); notNull("column", column); notNull("row", row); notNull("userPreferences", userPreferences); notNull("color", color); PortletConfiguration returnConfig = null; try { returnConfig = delegateStore.addDashboardItem(pageId, portletConfigurationId, column, row, openSocialSpecUri, color, userPreferences, moduleKey); } finally { if (returnConfig != null) { // Remove the cached page as this will now be stale and not contain the new entry. cacheByPageId.remove(returnConfig.getDashboardPageId()); } } return copyConfiguration(returnConfig); }