Class AncestorsDao


  • @Internal
    public class AncestorsDao
    extends Object
    JDBC methods for operations with CONFANCESTORS table
    Since:
    6.14.0
    • Constructor Detail

      • AncestorsDao

        public AncestorsDao​(org.hibernate.SessionFactory sessionFactory,
                            com.atlassian.event.api.EventPublisher eventPublisher)
    • Method Detail

      • getAllChildrenFromDB

        @Transactional(readOnly=true)
        public Map<Long,​List<Long>> getAllChildrenFromDB​(@NonNull List<Long> pageIdList)
        Returns map with children, where keys are passed page ids and values are list of corresponding children
        Parameters:
        pageIdList - - list of pages
        Returns:
      • getAncestorsFromConfancestorsTable

        @Transactional(readOnly=true)
        public Map<Long,​List<Long>> getAncestorsFromConfancestorsTable​(@NonNull List<Long> pageIdList)
        getAncestorsFromConfancestorsTable reads ancestors from confancestors table in batches It receives a list of page ids and returns a map where keys are page ids and values are lists of ancestors Just for better performance
      • getTopLevelPages

        @Transactional(readOnly=true)
        public List<Long> getTopLevelPages​(@NonNull Long spaceId)
        getTopLevelPages returns a list of top-level pages in the space top-level means that the page does not have a parent
      • deleteAllAncestors

        @Transactional(propagation=REQUIRES_NEW)
        public void deleteAllAncestors​(@NonNull Long pageId)
        Deletes all ancestors for the particular page
      • addsAncestor

        @Transactional(propagation=REQUIRES_NEW)
        public void addsAncestor​(@NonNull Long pageId,
                                 @NonNull Long ancestorId,
                                 @org.checkerframework.checker.nullness.qual.NonNull int position)
        Adds one record to CONFANCESTORS table
      • fixAncestorsForOnePage

        @Transactional(propagation=REQUIRES_NEW)
        public void fixAncestorsForOnePage​(Long pageId,
                                           List<Long> ancestors)
        1. Deletes records from CONFANCESTORS page for one page 2. Inserts valid records to CONFANCESTORS for this page
      • fixPages

        @Transactional(propagation=REQUIRES_NEW)
        public void fixPages​(List<com.atlassian.confluence.pages.ancestors.PageWithAncestors> pagesToFix)
        fixes a bunch of pages in one transaction