Class DefaultSynchronyEvictionDao
- java.lang.Object
-
- com.atlassian.confluence.pages.persistence.dao.DefaultSynchronyEvictionDao
-
- All Implemented Interfaces:
SynchronyEvictionDao
public class DefaultSynchronyEvictionDao extends Object implements SynchronyEvictionDao
Runs operations on synchrony tables (EVENTS, SNAPSHOTS) and Confluence <-> Synchrony mapping in content properties- Since:
- 7.0.0
-
-
Constructor Summary
Constructors Constructor Description DefaultSynchronyEvictionDao(org.hibernate.SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Long>findContentWithAnyEventOlderThan(int eventThresholdHours, int limit)Get at most {@param limit} content ids from synchrony events table, for each at least one event is older than {@param eventThresholdHours} hours from now.List<Long>findContentWithAnySnapshotOlderThan(int snapshotThresholdHours, int limit)Get at most {@param limit} content ids from synchrony snapshot table, for each at least one event is older than {@param snapshotThresholdHours} hours from now.List<Long>findSafeContentWithHistoryOlderThan(int synchronyThresholdHours, int draftThresholdHours, int limit)Get at most {@param limit} content ids from synchrony tables, for each all events are older than {@param synchronyThresholdHours} hours from now.longgetEventsCount(Long contentId)longgetSnapshotsCount(Long contentId)intremoveAllSynchronyDataFor(Collection<Long> contentIds)Remove all synchrony data matching {@param contentId}intremoveApplicationIds(Collection<String> applicationIds)voidremoveContentProperties()
-
-
-
Method Detail
-
findSafeContentWithHistoryOlderThan
public List<Long> findSafeContentWithHistoryOlderThan(int synchronyThresholdHours, int draftThresholdHours, int limit)
Description copied from interface:SynchronyEvictionDaoGet at most {@param limit} content ids from synchrony tables, for each all events are older than {@param synchronyThresholdHours} hours from now. Also, check that last modification day of the draft is at least {@param draftThresholdHours}. This is important to ensure that nobody has the editor open with this content right now.- Specified by:
findSafeContentWithHistoryOlderThanin interfaceSynchronyEvictionDao
-
findContentWithAnyEventOlderThan
public List<Long> findContentWithAnyEventOlderThan(int eventThresholdHours, int limit)
Description copied from interface:SynchronyEvictionDaoGet at most {@param limit} content ids from synchrony events table, for each at least one event is older than {@param eventThresholdHours} hours from now.- Specified by:
findContentWithAnyEventOlderThanin interfaceSynchronyEvictionDao
-
findContentWithAnySnapshotOlderThan
public List<Long> findContentWithAnySnapshotOlderThan(int snapshotThresholdHours, int limit)
Description copied from interface:SynchronyEvictionDaoGet at most {@param limit} content ids from synchrony snapshot table, for each at least one event is older than {@param snapshotThresholdHours} hours from now.- Specified by:
findContentWithAnySnapshotOlderThanin interfaceSynchronyEvictionDao
-
removeAllSynchronyDataFor
public int removeAllSynchronyDataFor(Collection<Long> contentIds)
Description copied from interface:SynchronyEvictionDaoRemove all synchrony data matching {@param contentId}- Specified by:
removeAllSynchronyDataForin interfaceSynchronyEvictionDao- Returns:
- actual number of rows removed from the DB
-
getEventsCount
public long getEventsCount(Long contentId)
- Specified by:
getEventsCountin interfaceSynchronyEvictionDao- Returns:
- if {@param contentId} is not null, returns the number of Synchrony event rows related to the entity. Otherwise returns the total number of Synchrony events in the DB.
-
getSnapshotsCount
public long getSnapshotsCount(Long contentId)
- Specified by:
getSnapshotsCountin interfaceSynchronyEvictionDao- Returns:
- if {@param contentId} is not null, returns the number of Synchrony snapshot rows related to the entity. Otherwise returns the total number of Synchrony snapshots in the DB.
-
removeApplicationIds
public int removeApplicationIds(Collection<String> applicationIds)
- Specified by:
removeApplicationIdsin interfaceSynchronyEvictionDao
-
removeContentProperties
public void removeContentProperties() throws javax.persistence.PersistenceException- Specified by:
removeContentPropertiesin interfaceSynchronyEvictionDao- Throws:
javax.persistence.PersistenceException
-
-