@SuppressWarnings ({ "UnusedDeclaration" }) @EventListener public void onClearCache(final ClearCacheEvent event) { flush(); }
@Override public Collection<PortalPage> getAllOwnedPortalPages(final ApplicationUser owner) { Assertions.notNull("owner", owner); return getAllOwnedPortalPages(owner.getKey()); }
@Override public Collection<PortalPage> getAllOwnedPortalPages(final String userKey) { Assertions.notNull("userKey", userKey); Collection<Long> ownedPageIds = cacheByUser.get(userKey); final Collection<PortalPage> returnPages = new ArrayList<PortalPage>(ownedPageIds.size()); for (final Long id : ownedPageIds) { final PortalPage portalPage = getPortalPage(id); if (portalPage != null) { returnPages.add(portalPage); } } return returnPages; }
public PortalPage getPortalPage(final Long portalPageId) { Assertions.notNull("portalPageId", portalPageId); return copyPortalPage(cacheById.get(portalPageId).getValue()); }
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UL_UNRELEASED_LOCK_EXCEPTION_PATH", justification="This appears to be doing exactly the right thing with the finally-clause to release the lock") public PortalPage create(final PortalPage portalPage) { Assertions.notNull("portalPage", portalPage); Assertions.notNull("portalPage.name", portalPage.getName()); Assertions.notNull("portalPage.owner", portalPage.getOwner()); PortalPage returnPage = null; try { returnPage = delegateStore.create(portalPage); } finally { if (returnPage != null) { cacheByUser.remove(portalPage.getOwner().getKey()); cacheById.remove(returnPage.getId()); } } return copyPortalPage(returnPage); }
public PortalPage getSystemDefaultPortalPage() { // this can be called by two threads at the same time. They should both return the same value so // we don't need to stop them. if (systemDefaultPortalPageId == null) { final PortalPage page = delegateStore.getSystemDefaultPortalPage(); if (page != null) { systemDefaultPortalPageId = page.getId(); } } if (systemDefaultPortalPageId != null) { return getPortalPage(systemDefaultPortalPageId); } else { return null; } }