public class

CachingPortalPageStore

extends Object
implements PortalPageStore
java.lang.Object
   ↳ com.atlassian.jira.portal.CachingPortalPageStore

Class Overview

Caching store for PortalPage. The cache stores a id -> PortalPage and a portalPage.owner -> id mapping.

Summary

Public Constructors
CachingPortalPageStore(PortalPageStore delegateStore, CacheManager cacheManager)
Public Methods
PortalPage adjustFavouriteCount(SharedEntity portalPage, int incrementValue)
Updates the favourite count of the PortalPage in the database.
PortalPage create(PortalPage portalPage)
Creates a PortalPage in the database
void delete(Long portalPageId)
Deletes the PortalPage with the specified portalPageId
void flush()
Flushes any caches that may exist
EnclosedIterable<PortalPage> get(SharedEntityAccessor.RetrievalDescriptor ids)
Get a EnclosedIterable of PortalPages for the specified List of ids.
EnclosedIterable<PortalPage> getAll()
Get a EnclosedIterable of all PortalPages in the database.
Collection<PortalPage> getAllOwnedPortalPages(ApplicationUser owner)
Gets all the PortalPage's owned by the specified User
Collection<PortalPage> getAllOwnedPortalPages(String userKey)
Gets all the PortalPage's owned by the specified User
PortalPage getPortalPage(Long portalPageId)
Gets the PortalPage with the specified portalPageId
PortalPage getPortalPageByOwnerAndName(ApplicationUser owner, String portalPageName)
Gets the specified PortalPage that is owned by the User and has the specified portalPageName
PortalPage getSystemDefaultPortalPage()
Goes to the database and fetches the system default dashboard configuration.
@EventListener void onClearCache(ClearCacheEvent event)
PortalPage update(PortalPage portalPage)
Updates the PortalPage in the database.
boolean updatePortalPageOptimisticLock(Long portalPageId, Long currentVersion)
This method will increment the version of the given portalPage by one.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.portal.PortalPageStore

Public Constructors

public CachingPortalPageStore (PortalPageStore delegateStore, CacheManager cacheManager)

Public Methods

public PortalPage adjustFavouriteCount (SharedEntity portalPage, int incrementValue)

Updates the favourite count of the PortalPage in the database.

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.

public PortalPage create (PortalPage portalPage)

Creates a PortalPage in the database

Parameters
portalPage the PortalPage to create
Returns
  • the new PortalPage with its new database id

public void delete (Long portalPageId)

Deletes the PortalPage with the specified portalPageId

Parameters
portalPageId the id of the PortalPage to delete

public void flush ()

Flushes any caches that may exist

public EnclosedIterable<PortalPage> get (SharedEntityAccessor.RetrievalDescriptor ids)

Get a EnclosedIterable of PortalPages for the specified List of ids.

Parameters
ids retrieval descriptor
Returns
  • CloseableIterable that contains reference to PortalPages with the specified ids.

public EnclosedIterable<PortalPage> getAll ()

Get a EnclosedIterable of all PortalPages in the database.

Returns
  • CloseableIterable that contains reference to all PortalPages.

public Collection<PortalPage> getAllOwnedPortalPages (ApplicationUser owner)

Gets all the PortalPage's owned by the specified User

Parameters
owner the user who is the owner of the PortalPage's
Returns
  • a Collection of PortalPage objects owner by the User

public Collection<PortalPage> getAllOwnedPortalPages (String userKey)

Gets all the PortalPage's owned by the specified User

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

public PortalPage getPortalPage (Long portalPageId)

Gets the PortalPage with the specified portalPageId

Parameters
portalPageId the id of the PortalPage to locate
Returns
  • a PortalPage or null if it cant be found

public PortalPage getPortalPageByOwnerAndName (ApplicationUser owner, String portalPageName)

Gets the specified PortalPage that is owned by the User and has the specified portalPageName

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

public PortalPage getSystemDefaultPortalPage ()

Goes to the database and fetches the system default dashboard configuration.

Returns
  • the system default portal page.

@EventListener public void onClearCache (ClearCacheEvent event)

public PortalPage update (PortalPage portalPage)

Updates the PortalPage in the database.

Parameters
portalPage the PortalPage to update
Returns
  • a newly updated PortalPage object

public boolean updatePortalPageOptimisticLock (Long portalPageId, Long currentVersion)

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.

Parameters
portalPageId The dashboard to update
currentVersion The current version for this dashboard
Returns
  • true if the update is successful, false otherwise