Package com.atlassian.jira.portal
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 Summary
ConstructorsConstructorDescriptionCachingPortalPageStore
(PortalPageStore delegateStore, com.atlassian.cache.CacheManager cacheManager) -
Method Summary
Modifier and TypeMethodDescriptionadjustFavouriteCount
(SharedEntity portalPage, int incrementValue) Updates the favourite count of the PortalPage in the database.void
Called after all the beans are constructed and the ApplicationContext is fully populated.create
(PortalPage portalPage) Creates a PortalPage in the databasevoid
Deletes the PortalPage with the specified portalPageIdvoid
flush()
Flushes any caches that may existGet aEnclosedIterable
of PortalPages for the specified List of ids.getAll()
Get aEnclosedIterable
of all PortalPages in the database.Gets all the PortalPage's owned by the specified UsergetAllOwnedPortalPages
(String userKey) Gets all the PortalPage's owned by the specified UsergetPortalPage
(Long portalPageId) Gets the PortalPage with the specified portalPageIdgetPortalPageByOwnerAndName
(ApplicationUser owner, String portalPageName) Gets the specified PortalPage that is owned by the User and has the specified portalPageNameGoes to the database and fetches the system default dashboard configuration.void
onClearCache
(ClearCacheEvent event) void
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.
-
Constructor Details
-
CachingPortalPageStore
public CachingPortalPageStore(PortalPageStore delegateStore, com.atlassian.cache.CacheManager cacheManager)
-
-
Method Details
-
afterInstantiation
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 interfaceInitializingComponent
- Throws:
Exception
-
onClearCache
-
onUserKeyInPortalPageFKChangedEvent
@EventListener public void onUserKeyInPortalPageFKChangedEvent(UserKeyInPortalPageFKChangedEvent event) -
getAll
Description copied from interface:PortalPageStore
Get aEnclosedIterable
of all PortalPages in the database.- Specified by:
getAll
in interfacePortalPageStore
- Returns:
- CloseableIterable that contains reference to all PortalPages.
-
getSystemDefaultPortalPage
Description copied from interface:PortalPageStore
Goes to the database and fetches the system default dashboard configuration.- Specified by:
getSystemDefaultPortalPage
in interfacePortalPageStore
- Returns:
- the system default portal page.
-
getAllOwnedPortalPages
Description copied from interface:PortalPageStore
Gets all the PortalPage's owned by the specified User- Specified by:
getAllOwnedPortalPages
in interfacePortalPageStore
- Parameters:
owner
- the user who is the owner of the PortalPage's- Returns:
- a Collection of PortalPage objects owner by the User
-
getAllOwnedPortalPages
Description copied from interface:PortalPageStore
Gets all the PortalPage's owned by the specified User- Specified by:
getAllOwnedPortalPages
in interfacePortalPageStore
- 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
Description copied from interface:PortalPageStore
Gets the specified PortalPage that is owned by the User and has the specified portalPageName- Specified by:
getPortalPageByOwnerAndName
in interfacePortalPageStore
- Parameters:
owner
- the User how is the owner of the PortalPageportalPageName
- the name of the PortalPage- Returns:
- a PortalPage object or null if it cant be found
-
getPortalPage
Description copied from interface:PortalPageStore
Gets the PortalPage with the specified portalPageId- Specified by:
getPortalPage
in interfacePortalPageStore
- Parameters:
portalPageId
- the id of the PortalPage to locate- Returns:
- a PortalPage or null if it cant be found
-
create
Description copied from interface:PortalPageStore
Creates a PortalPage in the database- Specified by:
create
in interfacePortalPageStore
- Parameters:
portalPage
- the PortalPage to create- Returns:
- the new PortalPage with its new database id
-
update
Description copied from interface:PortalPageStore
Updates the PortalPage in the database.- Specified by:
update
in interfacePortalPageStore
- Parameters:
portalPage
- the PortalPage to update- Returns:
- a newly updated PortalPage object
-
updatePortalPageOptimisticLock
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 otherwiseIn 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 interfacePortalPageStore
- Parameters:
portalPageId
- The dashboard to updatecurrentVersion
- The current version for this dashboard- Returns:
- true if the update is successful, false otherwise
-
delete
Description copied from interface:PortalPageStore
Deletes the PortalPage with the specified portalPageId- Specified by:
delete
in interfacePortalPageStore
- 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 interfacePortalPageStore
-