Class CachingPortalPageStore

java.lang.Object
com.atlassian.jira.portal.CachingPortalPageStore
All Implemented Interfaces:
InitializingComponent, PortalPageStore

public class CachingPortalPageStore extends Object implements PortalPageStore, InitializingComponent
Caching store for PortalPage. The cache stores a id -> PortalPage and a portalPage.owner -> id mapping.
Since:
v3.13
  • Constructor Details

    • CachingPortalPageStore

      public CachingPortalPageStore(PortalPageStore delegateStore, com.atlassian.cache.CacheManager cacheManager)
  • Method Details

    • afterInstantiation

      public void afterInstantiation() throws Exception
      Description copied from interface: InitializingComponent
      Called after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.
      Specified by:
      afterInstantiation in interface InitializingComponent
      Throws:
      Exception
    • onClearCache

      @EventListener public void onClearCache(ClearCacheEvent event)
    • onUserKeyInPortalPageFKChangedEvent

      @EventListener public void onUserKeyInPortalPageFKChangedEvent(UserKeyInPortalPageFKChangedEvent event)
    • get

      Description copied from interface: PortalPageStore
      Get a EnclosedIterable of PortalPages for the specified List of ids.
      Specified by:
      get in interface PortalPageStore
      Parameters:
      ids - retrieval descriptor
      Returns:
      CloseableIterable that contains reference to PortalPages with the specified ids.
    • getAll

      public EnclosedIterable<PortalPage> getAll()
      Description copied from interface: PortalPageStore
      Get a EnclosedIterable of all PortalPages in the database.
      Specified by:
      getAll in interface PortalPageStore
      Returns:
      CloseableIterable that contains reference to all PortalPages.
    • getSystemDefaultPortalPage

      public PortalPage getSystemDefaultPortalPage()
      Description copied from interface: PortalPageStore
      Goes to the database and fetches the system default dashboard configuration.
      Specified by:
      getSystemDefaultPortalPage in interface PortalPageStore
      Returns:
      the system default portal page.
    • getAllOwnedPortalPages

      public Collection<PortalPage> getAllOwnedPortalPages(@Nonnull ApplicationUser owner)
      Description copied from interface: PortalPageStore
      Gets all the PortalPage's owned by the specified User
      Specified by:
      getAllOwnedPortalPages in interface PortalPageStore
      Parameters:
      owner - the user who is the owner of the PortalPage's
      Returns:
      a Collection of PortalPage objects owner by the User
    • getAllOwnedPortalPages

      public Collection<PortalPage> getAllOwnedPortalPages(@Nonnull String userKey)
      Description copied from interface: PortalPageStore
      Gets all the PortalPage's owned by the specified User
      Specified by:
      getAllOwnedPortalPages in interface PortalPageStore
      Parameters:
      userKey - The key of the user who is the owner of the PortalPage's
      Returns:
      a Collection of PortalPage objects owner by the User
    • getPortalPageByOwnerAndName

      public PortalPage getPortalPageByOwnerAndName(ApplicationUser owner, String portalPageName)
      Description copied from interface: PortalPageStore
      Gets the specified PortalPage that is owned by the User and has the specified portalPageName
      Specified by:
      getPortalPageByOwnerAndName in interface PortalPageStore
      Parameters:
      owner - the User how is the owner of the PortalPage
      portalPageName - the name of the PortalPage
      Returns:
      a PortalPage object or null if it cant be found
    • getPortalPage

      public PortalPage getPortalPage(Long portalPageId)
      Description copied from interface: PortalPageStore
      Gets the PortalPage with the specified portalPageId
      Specified by:
      getPortalPage in interface PortalPageStore
      Parameters:
      portalPageId - the id of the PortalPage to locate
      Returns:
      a PortalPage or null if it cant be found
    • create

      public PortalPage create(PortalPage portalPage)
      Description copied from interface: PortalPageStore
      Creates a PortalPage in the database
      Specified by:
      create in interface PortalPageStore
      Parameters:
      portalPage - the PortalPage to create
      Returns:
      the new PortalPage with its new database id
    • update

      public PortalPage update(PortalPage portalPage)
      Description copied from interface: PortalPageStore
      Updates the PortalPage in the database.
      Specified by:
      update in interface PortalPageStore
      Parameters:
      portalPage - the PortalPage to update
      Returns:
      a newly updated PortalPage object
    • updatePortalPageOptimisticLock

      public boolean updatePortalPageOptimisticLock(Long portalPageId, Long currentVersion)
      Description copied from interface: PortalPageStore
      This method will increment the version of the given portalPage by one. When doing this, it will check that the version currently equals what was passed in. If the update is successful, this method returns true. False otherwise

      In JIRA since we don't have transactions, this method should be called inside a pessimistic lock (potentially striped by portalPageId) and all update operations should follow while holding this same lock.

      Specified by:
      updatePortalPageOptimisticLock in interface PortalPageStore
      Parameters:
      portalPageId - The dashboard to update
      currentVersion - The current version for this dashboard
      Returns:
      true if the update is successful, false otherwise
    • adjustFavouriteCount

      public PortalPage adjustFavouriteCount(SharedEntity portalPage, int incrementValue)
      Description copied from interface: PortalPageStore
      Updates the favourite count of the PortalPage in the database.
      Specified by:
      adjustFavouriteCount in interface PortalPageStore
      Parameters:
      portalPage - the portal page to change.
      incrementValue - the value to increase the favourite count by. Can be a number < 0 to decrease the favourite count.
      Returns:
      a newly updated PortalPage object.
    • delete

      public void delete(Long portalPageId)
      Description copied from interface: PortalPageStore
      Deletes the PortalPage with the specified portalPageId
      Specified by:
      delete in interface PortalPageStore
      Parameters:
      portalPageId - the id of the PortalPage to delete
    • flush

      public void flush()
      Description copied from interface: PortalPageStore
      Flushes any caches that may exist
      Specified by:
      flush in interface PortalPageStore