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
    • Field Detail

      • DEFAULT_TOPIC_LATEST_POST_DAYS_AGO

        protected static final int DEFAULT_TOPIC_LATEST_POST_DAYS_AGO
        See Also:
        Constant Field Values
      • SPACES_STORE

        protected static final org.alfresco.service.cmr.repository.StoreRef SPACES_STORE
    • Constructor Detail

      • ForumTopicsFilteredGet

        public ForumTopicsFilteredGet()
    • Method Detail

      • setSearchService

        public void setSearchService​(org.alfresco.service.cmr.search.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​(org.alfresco.service.cmr.site.SiteInfo site,
                                                       org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                       org.alfresco.service.cmr.discussion.TopicInfo topic,
                                                       org.alfresco.service.cmr.discussion.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<org.alfresco.service.cmr.discussion.TopicInfo> doSearch​(org.alfresco.util.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 org.alfresco.util.Pair<String,​String> getSearchQuery​(org.alfresco.service.cmr.site.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<org.alfresco.service.cmr.discussion.TopicInfo> wrap​(org.alfresco.service.cmr.search.ResultSet finalResults,
                                                                                                       org.alfresco.query.PagingRequest paging)
        Wrap up search results as TopicInfo instances
        Parameters:
        finalResults - ResultSet
        paging - PagingRequest