Class ForumTopicsFilteredGet

  • All Implemented Interfaces:
    org.springframework.extensions.webscripts.WebScript

    public class ForumTopicsFilteredGet
    extends AbstractDiscussionWebScript
    Gets topics matching the filters passed to it in the URL. topics = 'mine' (searches for posts by the user) or 'all' (ignores the author in the search) history = days in the past to search resultSize = the number of topics returned in the results
    Author:
    Jamie Allison
    • Constructor Detail

      • ForumTopicsFilteredGet

        public ForumTopicsFilteredGet()
    • Method Detail

      • setSearchService

        public void setSearchService​(SearchService searchService)
        Sets the searchService.
        Parameters:
        searchService - SearchService
      • executeImpl

        protected Map<String,​Object> executeImpl​(org.springframework.extensions.webscripts.WebScriptRequest req,
                                                       org.springframework.extensions.webscripts.Status status,
                                                       org.springframework.extensions.webscripts.Cache cache)
        Overrides AbstractDiscussionWebScript to allow a null site
        Overrides:
        executeImpl in class AbstractDiscussionWebScript
        Parameters:
        req - WebScriptRequest
        status - Status
        cache - Cache
        Returns:
        Map
      • executeImpl

        protected Map<String,​Object> executeImpl​(SiteInfo site,
                                                       NodeRef nodeRef,
                                                       TopicInfo topic,
                                                       PostInfo post,
                                                       org.springframework.extensions.webscripts.WebScriptRequest req,
                                                       org.json.simple.JSONObject json,
                                                       org.springframework.extensions.webscripts.Status status,
                                                       org.springframework.extensions.webscripts.Cache cache)
        Specified by:
        executeImpl in class AbstractDiscussionWebScript
        Parameters:
        site - SiteInfo
        nodeRef - Not required. It is only included because it is overriding the parent class.
        topic - Not required. It is only included because it is overriding the parent class.
        post - Not required. It is only included because it is overriding the parent class.
        req - WebScriptRequest
        status - Not required. It is only included because it is overriding the parent class.
        cache - Not required. It is only included because it is overriding the parent class.
        Returns:
        Map
      • doSearch

        protected org.alfresco.query.PagingResults<TopicInfo> doSearch​(Pair<String,​String> searchQuery,
                                                                       boolean sortAscending,
                                                                       org.alfresco.query.PagingRequest paging)
        Do the actual search
        Parameters:
        searchQuery - Pair with query string in first and query language in second
        sortAscending - boolean
        paging - PagingRequest
      • getSearchQuery

        protected Pair<String,​String> getSearchQuery​(SiteInfo site,
                                                           String author,
                                                           int daysAgo)
        Build the search query from the passed in parameters and SEARCH_QUERY constant
        Parameters:
        site - SiteInfo
        author - String
        daysAgo - int
        Returns:
        Pair with the query string in first and query language in second
      • getDateXDaysAgo

        protected String getDateXDaysAgo​(int daysAgo)
        Get the date x days ago in the format 'yyyy-MM-dd'
        Parameters:
        daysAgo - int
        Returns:
        String
      • buildPagingRequest

        protected org.alfresco.query.PagingRequest buildPagingRequest​(org.springframework.extensions.webscripts.WebScriptRequest req)
        Builds up a listing Paging request, based on the arguments specified in the URL
        Overrides:
        buildPagingRequest in class AbstractDiscussionWebScript
        Parameters:
        req - WebScriptRequest
        Returns:
        PagingRequest
      • wrap

        protected org.alfresco.query.PagingResults<TopicInfo> wrap​(ResultSet finalResults,
                                                                   org.alfresco.query.PagingRequest paging)
        Wrap up search results as TopicInfo instances
        Parameters:
        finalResults - ResultSet
        paging - PagingRequest