Class DenormalisedSpacePermissionsUpdater

  • All Implemented Interfaces:
    org.springframework.beans.factory.DisposableBean

    public class DenormalisedSpacePermissionsUpdater
    extends Object
    implements org.springframework.beans.factory.DisposableBean
    Updates denormalised space view and edit permissions
    Since:
    7.10.0
    • Field Detail

      • DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT

        public static final int DEFAULT_INITIAL_SPACE_PROCESSING_LIMIT
        See Also:
        Constant Field Values
    • Method Detail

      • setInitialSpaceProcessingLimit

        public static void setInitialSpaceProcessingLimit​(int limit)
      • init

        @PostConstruct
        public void init()
      • handleSpacePermissionChangeEvent

        @EventListener
        public void handleSpacePermissionChangeEvent​(SpacePermissionChangeEvent spacePermissionChangeEvent)
      • updateSpacePermissions

        public Set<Long> updateSpacePermissions​(Set<Long> spaceIds)
        Calculates effective permissions for spaces and updates denormalised space permission records.
        Parameters:
        spaceIds - list of space id for updating
        Returns:
        list of processed spaces
      • updateSpacePermissions

        public Set<Long> updateSpacePermissions​(Set<Long> spaceIds,
                                                Long deadline)
        Calculates effective permissions for spaces and updates denormalised space permission records. As this method could process a lot of spaces at once, the processing must be stopped after the deadline. But the current space processing must be finished, so the denormalised data will be consistent.
        Parameters:
        spaceIds - list of space id for updating
        deadline - processing should stop after this time. Null means "no deadline"
        Returns:
        list of processed spaces
      • updateAllSpacePermissions

        public int updateAllSpacePermissions​(AtomicBoolean schedulingEnabled,
                                             Supplier<DenormalisedPermissionServiceState> spaceServiceStateSupplier)
                                      throws ExecutionException,
                                             InterruptedException
        Updates all space permissions. Space permissions are updated in batches, each batch is processed in its own separate transaction. As a result, if a server is restarted, some denormalised permissions will be created anyway.
        Parameters:
        schedulingEnabled - Reference to DenormalisedChangeLogListenerBase#schedulingEnabled Scheduled task (cron) can be disabled mid-processing, so it's necessary to keep a reference and check this value periodically. For example, it would happen when Confluence is shutting down.
        Throws:
        ExecutionException
        InterruptedException
      • destroy

        public void destroy()
                     throws Exception
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        Exception