Interface ItemDAO


  • public interface ItemDAO
    • Method Detail

      • getChildrenByPathTotal

        int getChildrenByPathTotal​(@Param("siteId")
                                   Long siteId,
                                   @Param("path")
                                   String path,
                                   @Param("localeCode")
                                   String localeCode,
                                   @Param("keyword")
                                   String keyword,
                                   @Param("systemTypes")
                                   List<String> systemTypes,
                                   @Param("excludes")
                                   List<String> excludes)
        Get total number of children for given path
        Parameters:
        siteId - site identifier
        path - path to get children for
        localeCode - local code
        keyword - filter by keyword
        systemTypes - filter by type
        excludes - exclude items by path
        Returns:
        total number of children
      • getChildrenByPath

        List<Item> getChildrenByPath​(@Param("siteId")
                                     Long siteId,
                                     @Param("path")
                                     String path,
                                     @Param("systemTypeFolder")
                                     String systemTypeFolder,
                                     @Param("localeCode")
                                     String localeCode,
                                     @Param("keyword")
                                     String keyword,
                                     @Param("systemTypes")
                                     List<String> systemTypes,
                                     @Param("excludes")
                                     List<String> excludes,
                                     @Param("sortStrategy")
                                     String sortStrategy,
                                     @Param("order")
                                     String order,
                                     @Param("offset")
                                     int offset,
                                     @Param("limit")
                                     int limit)
        Get children for given path from database
        Parameters:
        siteId - site identifier
        path - path to get children for
        systemTypeFolder - system type value for folder
        localeCode - locale code
        keyword - filter by keyword
        systemTypes - filter by type
        excludes - exclude items by path
        sortStrategy - sort strategy
        order - order of children
        offset - offset of the first record to return
        limit - number of children to return
        Returns:
        list of items (parent, level descriptor, children)
      • upsertEntry

        void upsertEntry​(Item item)
        insert or update item
        Parameters:
        item - item to insert/update
      • upsertEntries

        void upsertEntries​(@Param("entries")
                           List<Item> entries)
        Insert or update items
        Parameters:
        entries - list of items to insert
      • getItemById

        DetailedItem getItemById​(@Param("id")
                                 long id,
                                 @Param("siteId")
                                 String siteId,
                                 @Param("systemTypeFolder")
                                 String systemTypeFolder,
                                 @Param("completedState")
                                 String completedState,
                                 @Param("stagingEnvironment")
                                 String stagingEnvironment,
                                 @Param("liveEnvironment")
                                 String liveEnvironment)
        Get item by id
        Parameters:
        id - item id
        siteId - site identifier
        systemTypeFolder - value for system type folder
        completedState - completed state
        liveEnvironment - live environment
        stagingEnvironment - staging environment
        Returns:
        item identified by given id
      • getItemBySiteIdAndPath

        DetailedItem getItemBySiteIdAndPath​(@Param("siteId")
                                            long siteId,
                                            @Param("path")
                                            String path,
                                            @Param("systemTypeFolder")
                                            String systemTypeFolder,
                                            @Param("completedState")
                                            String completedState,
                                            @Param("stagingEnvironment")
                                            String stagingEnvironment,
                                            @Param("liveEnvironment")
                                            String liveEnvironment)
        Get item for given site and path
        Parameters:
        siteId - site identifier
        path - path of the item
        systemTypeFolder - value for system type folder
        completedState - completed state
        liveEnvironment - live environment
        stagingEnvironment - staging environment
        Returns:
        item for given site and path
      • getItemBySiteIdAndPathPreferContent

        DetailedItem getItemBySiteIdAndPathPreferContent​(@Param("siteId")
                                                         long siteId,
                                                         @Param("path")
                                                         String path,
                                                         @Param("systemTypeFolder")
                                                         String systemTypeFolder,
                                                         @Param("completedState")
                                                         String completedState,
                                                         @Param("stagingEnvironment")
                                                         String stagingEnvironment,
                                                         @Param("liveEnvironment")
                                                         String liveEnvironment)
        Get item with prefer content option for given site and path
        Parameters:
        siteId - site identifier
        path - path of the item
        systemTypeFolder - value for system type folder
        completedState - completed state
        liveEnvironment - live environment
        stagingEnvironment - staging environment
        Returns:
        item for given site and path
      • updateItem

        void updateItem​(Item item)
        Update item
        Parameters:
        item - item to update
      • deleteById

        void deleteById​(@Param("id")
                        long id)
        Delete item
        Parameters:
        id - id of the item to delete
      • deleteBySiteAndPath

        void deleteBySiteAndPath​(@Param("siteId")
                                 long siteId,
                                 @Param("path")
                                 String path)
        Delete item
        Parameters:
        siteId - site identifier
        path - path of item to delete
      • setStatesBySiteAndPathBulk

        void setStatesBySiteAndPathBulk​(@Param("siteId")
                                        long siteId,
                                        @Param("paths")
                                        List<String> paths,
                                        @Param("statesBitMap")
                                        long statesBitMap)
        Set items state
        Parameters:
        siteId - site identifier
        paths - paths of items
        statesBitMap - states bit map to be set
      • setStatesByIdBulk

        void setStatesByIdBulk​(@Param("itemIds")
                               List<Long> itemIds,
                               @Param("statesBitMap")
                               long statesBitMap)
        Set items state
        Parameters:
        itemIds - ids of items
        statesBitMap - states bit map to be set
      • resetStatesBySiteAndPathBulk

        void resetStatesBySiteAndPathBulk​(@Param("siteId")
                                          long siteId,
                                          @Param("paths")
                                          List<String> paths,
                                          @Param("statesBitMap")
                                          long statesBitMap)
        Reset items state
        Parameters:
        siteId - site identifier
        paths - paths of items
        statesBitMap - states bit map to be reset
      • resetStatesByIdBulk

        void resetStatesByIdBulk​(@Param("itemIds")
                                 List<Long> itemIds,
                                 @Param("statesBitMap")
                                 long statesBitMap)
        Reset items state
        Parameters:
        itemIds - ids of items
        statesBitMap - states bit map to be reset
      • updateStatesBySiteAndPathBulk

        void updateStatesBySiteAndPathBulk​(@Param("siteId")
                                           long siteId,
                                           @Param("paths")
                                           Collection<String> paths,
                                           @Param("onStatesBitMap")
                                           long onStatesBitMap,
                                           @Param("offStatesBitMap")
                                           long offStatesBitMap)
        Update states to flip on list off states and flip off another list of states for items
        Parameters:
        siteId - site identifier
        paths - list of paths to update states for
        onStatesBitMap - state bitmap to flip on
        offStatesBitMap - state bitmap to flip off
      • updateStatesByIdBulk

        void updateStatesByIdBulk​(@Param("itemIds")
                                  List<Long> itemIds,
                                  @Param("onStatesBitMap")
                                  long onStatesBitMap,
                                  @Param("offStatesBitMap")
                                  long offStatesBitMap)
        Update states to flip on list off states and flip off another list of states for items
        Parameters:
        itemIds - list of item identifiers
        onStatesBitMap - state bitmap to flip on
        offStatesBitMap - state bitmap to flip off
      • updateStatesForSite

        void updateStatesForSite​(@Param("siteId")
                                 long siteId,
                                 @Param("onStatesBitMap")
                                 long onStatesBitMap,
                                 @Param("offStatesBitMap")
                                 long offStatesBitMap)
        Update states to flip on list off states and flip off another list of states for items
        Parameters:
        siteId - site identifier
        onStatesBitMap - state bitmap to flip on
        offStatesBitMap - state bitmap to flip off
      • deleteItemsForSite

        void deleteItemsForSite​(@Param("siteId")
                                long siteId)
        Delete all items for site
        Parameters:
        siteId - site id
      • deleteItemsById

        void deleteItemsById​(@Param("itemIds")
                             List<Long> itemIds)
        Delete items by id
        Parameters:
        itemIds - item ids
      • deleteItemsForSiteAndPath

        void deleteItemsForSiteAndPath​(@Param("siteId")
                                       long siteId,
                                       @Param("paths")
                                       List<String> paths)
        Delete items for site and paths
        Parameters:
        siteId - site id
        paths - paths of the items
      • deleteBySiteAndPathForFolder

        void deleteBySiteAndPathForFolder​(@Param("siteId")
                                          long siteId,
                                          @Param("folderPath")
                                          String path)
        Delete items for site and folder path
        Parameters:
        siteId - site id
        path - path of the folder
      • getContentDashboardTotal

        int getContentDashboardTotal​(@Param("siteId")
                                     String siteId,
                                     @Param("path")
                                     String path,
                                     @Param("modifier")
                                     String modifier,
                                     @Param("contentType")
                                     String contentType,
                                     @Param("state")
                                     long state,
                                     @Param("dateFrom")
                                     ZonedDateTime dateFrom,
                                     @Param("dateTo")
                                     ZonedDateTime dateTo)
        Get total number of records for content dashboard
        Parameters:
        siteId - site identifier
        path - path regular expression to apply as filter for result set
        modifier - filter results by user
        contentType - filter results by content type
        state - filter results by state
        dateFrom - lower boundary for modified date
        dateTo - upper boundary for modified date
        Returns:
        total number of records in result set
      • getContentDashboard

        List<Item> getContentDashboard​(@Param("siteId")
                                       String siteId,
                                       @Param("path")
                                       String path,
                                       @Param("modifier")
                                       String modifier,
                                       @Param("contentType")
                                       String contentType,
                                       @Param("state")
                                       long state,
                                       @Param("dateFrom")
                                       ZonedDateTime dateFrom,
                                       @Param("dateTo")
                                       ZonedDateTime dateTo,
                                       @Param("sortStrategy")
                                       String sort,
                                       @Param("order")
                                       String order,
                                       @Param("offset")
                                       int offset,
                                       @Param("limit")
                                       int limit)
        Get result set for content dashboard
        Parameters:
        siteId - site identifier
        path - path regular expression to apply as filter for result set
        modifier - filter results by user
        contentType - filter results by content type
        state - filter results by state
        dateFrom - lower boundary for modified date
        dateTo - upper boundary for modified date
        sort - sort results by column
        order - order of results
        offset - offset of the first record in result set
        limit - number of records to return
        Returns:
        list of item metadata records
      • moveItem

        void moveItem​(@Param("siteId")
                      String siteId,
                      @Param("oldPath")
                      String oldPath,
                      @Param("newPath")
                      String newPath,
                      @Param("parentId")
                      Long parentId,
                      @Param("oldPreviewUrl")
                      String oldPreviewUrl,
                      @Param("newPreviewUrl")
                      String newPreviewUrl,
                      @Param("label")
                      String label,
                      @Param("onStatesBitMap")
                      long onStatesBitMap,
                      @Param("offStatesBitMap")
                      long offStatesBitMap)
        Move item
        Parameters:
        siteId - site identifier
        oldPath - old path
        newPath - new path
        parentId - new parent ID
        oldPreviewUrl - old preview url
        newPreviewUrl - new preview url
        label - the new label
        onStatesBitMap - state bitmap to flip on
        offStatesBitMap - state bitmap to flip off
      • getItemByPath

        DetailedItem getItemByPath​(@Param("siteId")
                                   Long siteId,
                                   @Param("path")
                                   String path,
                                   @Param("systemTypeFolder")
                                   String systemTypeFolder,
                                   @Param("completedState")
                                   String completedState,
                                   @Param("stagingEnvironment")
                                   String stagingEnvironment,
                                   @Param("liveEnvironment")
                                   String liveEnvironment)
        Get item for given path from database
        Parameters:
        siteId - site identifier
        path - path of the item
        systemTypeFolder - value for system type folder
        completedState - completed state
        liveEnvironment - live environment
        stagingEnvironment - staging environment
        Returns:
        item
      • getItemByPathPreferContent

        DetailedItem getItemByPathPreferContent​(@Param("siteId")
                                                Long siteId,
                                                @Param("path")
                                                String path,
                                                @Param("systemTypeFolder")
                                                String systemTypeFolder,
                                                @Param("completedState")
                                                String completedState,
                                                @Param("stagingEnvironment")
                                                String stagingEnvironment,
                                                @Param("liveEnvironment")
                                                String liveEnvironment)
        Get item with prefer content option for given path from database
        Parameters:
        siteId - site identifier
        path - path of the item
        systemTypeFolder - value for system type folder
        completedState - completed state
        liveEnvironment - live environment
        stagingEnvironment - staging environment
        Returns:
        item
      • moveItems

        void moveItems​(@Param("siteId")
                       String siteId,
                       @Param("oldPath")
                       String oldPath,
                       @Param("newPath")
                       String newPath,
                       @Param("parentId")
                       Long parentId,
                       @Param("oldPreviewUrl")
                       String oldPreviewUrl,
                       @Param("newPreviewUrl")
                       String newPreviewUrl,
                       @Param("label")
                       String label,
                       @Param("onStatesBitMap")
                       long onStatesBitMap,
                       @Param("offStatesBitMap")
                       long offStatesBitMap)
        Move items
        Parameters:
        siteId - site identifier
        oldPath - old path
        newPath - new path
        parentId - new parent id, if null parent will not be changed
        oldPreviewUrl - old preview url
        newPreviewUrl - new preview url
        label - the new label
        onStatesBitMap - state bitmap to flip on
        offStatesBitMap - state bitmap to flip off
      • getSandboxItemsByPath

        List<Item> getSandboxItemsByPath​(@Param("siteId")
                                         Long siteId,
                                         @Param("paths")
                                         List<String> paths,
                                         @Param("systemTypeFolder")
                                         String systemTypeFolder,
                                         @Param("preferContent")
                                         boolean preferContent)
        Get sandbox items for given paths
        Parameters:
        siteId - site identifier
        paths - paths to get items for
        systemTypeFolder - value for system type folder
        preferContent - indicates if pages should be returned instead of folders when available
        Returns:
        list of items
      • getSandboxItemsByIdPreferContent

        List<Item> getSandboxItemsByIdPreferContent​(@Param("itemIds")
                                                    List<Long> itemIds,
                                                    @Param("systemTypeFolder")
                                                    String systemTypeFolder)
        Get sandbox items for given ids with prefer content option
        Parameters:
        itemIds - item ids
        systemTypeFolder - value for system type folder
        Returns:
        list of items
      • getSandboxItemsById

        List<Item> getSandboxItemsById​(@Param("itemIds")
                                       List<Long> itemIds,
                                       @Param("systemTypeFolder")
                                       String systemTypeFolder)
        Get sandbox items for given ids
        Parameters:
        itemIds - item ids
        systemTypeFolder - value for system type folder
        Returns:
        list of items
      • getMandatoryParentsForPublishing

        List<String> getMandatoryParentsForPublishing​(@Param("siteId")
                                                      String siteId,
                                                      @Param("possibleParents")
                                                      List<String> possibleParents,
                                                      @Param("newMask")
                                                      long newMask,
                                                      @Param("modifiedMask")
                                                      long modifiedMask)
        Get mandatory parents for publishing
        Parameters:
        siteId - site identifier
        possibleParents - possible parents
        newMask - states mask for detecting new items
        modifiedMask - states mask for detecting modified items
        Returns:
        list of mandatory parents
      • getExistingRenamedChildrenOfMandatoryParentsForPublishing

        List<String> getExistingRenamedChildrenOfMandatoryParentsForPublishing​(@Param("siteId")
                                                                               String siteId,
                                                                               @Param("parents")
                                                                               List<String> parents,
                                                                               @Param("newMask")
                                                                               long newMask,
                                                                               @Param("modifiedMask")
                                                                               long modifiedMask)
      • countAllContentItems

        int countAllContentItems​(@Param("nonContentItemTypes")
                                 List<String> nonContentItemTypes)
        Count all content items in the system
        Returns:
        number of content items in the system
      • clearPreviousPath

        void clearPreviousPath​(@Param("siteId")
                               String siteId,
                               @Param("path")
                               String path)
        Clear previous path of the content
        Parameters:
        siteId - site identifier
        path - path of the content
      • getInProgressItems

        List<Item> getInProgressItems​(@Param("siteId")
                                      String siteId,
                                      @Param("inProgressMask")
                                      long inProgressMask)
        Get in progress items from DB
        Parameters:
        siteId - site identifier
        inProgressMask - in progress states mask
        Returns:
        list of items
      • getSubmittedItems

        List<Item> getSubmittedItems​(@Param("siteId")
                                     String siteId,
                                     @Param("submittedMask")
                                     long submittedMask)
        Get submitted items from DB
        Parameters:
        siteId - site identifier
        submittedMask - mask with submitted states turned on
        Returns:
        list of items
      • countPreviousPaths

        int countPreviousPaths​(@Param("siteId")
                               String siteId,
                               @Param("previousPath")
                               String previousPath)
        Count items having previous path property set to given path
        Parameters:
        siteId - site identifier
        previousPath - path to check
        Returns:
        number of items
      • updateCommitId

        void updateCommitId​(@Param("siteId")
                            String siteId,
                            @Param("path")
                            String path,
                            @Param("commitId")
                            String commitId)
        Update commit id for item
        Parameters:
        siteId - site identifier
        path - path of the item
        commitId - commit id
      • getChangeSetForSubtree

        List<String> getChangeSetForSubtree​(@Param("siteId")
                                            String siteId,
                                            @Param("path")
                                            String path,
                                            @Param("likePath")
                                            String likePath,
                                            @Param("nonContentItemTypes")
                                            List<String> nonContentItemTypes,
                                            @Param("inProgressMask")
                                            long inProgressMask)
        Get change set for subtree
        Parameters:
        siteId - site identifier
        path - path of subtree root
        likePath - like path for query
        nonContentItemTypes - non content item types
        inProgressMask - in progress state mask
        Returns:
        list of items
      • getSameCommitItems

        List<String> getSameCommitItems​(@Param("siteId")
                                        String siteId,
                                        @Param("path")
                                        String path)
        Get items edited on same commit id for given item
        Parameters:
        siteId - site identifier
        path - path of content item
        Returns:
        list of items paths
      • updateLastPublishedOn

        void updateLastPublishedOn​(@Param("siteId")
                                   String siteId,
                                   @Param("path")
                                   String path,
                                   @Param("lastPublishedOn")
                                   ZonedDateTime lastPublishedOn)
        Update last published date for item
        Parameters:
        siteId - site identifier
        path - path of the item
        lastPublishedOn - published date
      • updateLastPublishedOnBulk

        void updateLastPublishedOnBulk​(@Param("siteId")
                                       String siteId,
                                       @Param("paths")
                                       List<String> paths,
                                       @Param("lastPublishedOn")
                                       ZonedDateTime lastPublishedOn)
        Update last published date for item
        Parameters:
        siteId - site identifier
        paths - list of paths
        lastPublishedOn - published date
      • getContentTypeUsages

        List<Item> getContentTypeUsages​(@Param("siteId")
                                        String siteId,
                                        @Param("contentType")
                                        String contentType,
                                        @Param("scriptPath")
                                        String scriptPath)
        Finds all items related to a given content-type
        Parameters:
        siteId - the id of the site
        contentType - the id of the content-type
        scriptPath - the path of the controller script
        Returns:
        the list of items
      • lockItemByPath

        void lockItemByPath​(@Param("siteId")
                            String siteId,
                            @Param("path")
                            String path,
                            @Param("lockOwnerId")
                            long lockOwnerId,
                            @Param("lockedBitOn")
                            long lockedBitOn,
                            @Param("systemTypeFolder")
                            String systemTypeFolder)
        Lock item
        Parameters:
        siteId - site identifier
        path - path of the item
        lockOwnerId - lock owner
        lockedBitOn - state bit mask with LOCKED bit on
        systemTypeFolder - value for system type folder
      • lockItemsByPath

        void lockItemsByPath​(@Param("siteId")
                             String siteId,
                             @Param("paths")
                             List<String> paths,
                             @Param("lockOwnerId")
                             long lockOwnerId,
                             @Param("lockedBitOn")
                             long lockedBitOn,
                             @Param("systemTypeFolder")
                             String systemTypeFolder)
        Lock items
        Parameters:
        siteId - site identifier
        paths - list of item paths
        lockOwnerId - lock owner
        lockedBitOn - state bit mask with LOCKED bit on
        systemTypeFolder - value for system type folder
      • unlockItemByPath

        void unlockItemByPath​(@Param("siteId")
                              String siteId,
                              @Param("path")
                              String path,
                              @Param("lockedBitOff")
                              long lockedBitOff)
        Lock item
        Parameters:
        siteId - site identifier
        path - path of the item
        lockedBitOff - state bit mask with LOCKED bit off
      • getItemStatesTotal

        int getItemStatesTotal​(@Param("siteId")
                               String siteId,
                               @Param("path")
                               String path,
                               @Param("statesBitMap")
                               Long states)
        Get total number of item states records for given filters by path regex and states mask
        Parameters:
        siteId - site identifier
        path - path regex to filter items
        states - states mask to filter items by state
        Returns:
        number of records
      • getItemStates

        List<Item> getItemStates​(@Param("siteId")
                                 String siteId,
                                 @Param("path")
                                 String path,
                                 @Param("statesBitMap")
                                 Long states,
                                 @Param("offset")
                                 int offset,
                                 @Param("limit")
                                 int limit)
        Get item states for given filters by path regex and states mask
        Parameters:
        siteId - site identifier
        path - path regex to filter items
        states - states mask to filter items by state
        offset - offset for the first record in result set
        limit - number of item states records to return
        Returns:
        list of sandbox items
      • updateStatesByQuery

        void updateStatesByQuery​(@Param("siteId")
                                 String siteId,
                                 @Param("path")
                                 String path,
                                 @Param("statesBitMap")
                                 Long states,
                                 @Param("onStatesBitMap")
                                 long setStatesMask,
                                 @Param("offStatesBitMap")
                                 long resetStatesMask)
        Update item state by query
        Parameters:
        siteId - site identifier
        path - path regex to filter items to be updated
        states - states bitmap mask to filter items to be updated
        setStatesMask - states bitmap mask to set states on
        resetStatesMask - states bitmap mask to set states off
      • getSubtreeForDelete

        List<String> getSubtreeForDelete​(@Param("siteId")
                                         String siteId,
                                         @Param("likePath")
                                         String likePath)
        Get subtree for delete
        Parameters:
        siteId - site identifier
        likePath - like path for query
        Returns:
        list of items
      • updateNewPageChildren

        void updateNewPageChildren​(@Param("siteId")
                                   String siteId,
                                   @Param("path")
                                   String folderPath)
        When creating a new page in an already existing folder, we need to update the children of the folder to become the children of the page. This method will find the direct children of the given folder, and update their parent id to be the id the new page (the item with path = folderPath + /index.xml).
        Parameters:
        siteId - site identifier
        folderPath - path of the folder