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
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript

        org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
      protected org.alfresco.query.PagingResults<org.alfresco.service.cmr.discussion.TopicInfo> doSearch​(org.alfresco.util.Pair<java.lang.String,​java.lang.String> searchQuery, boolean sortAscending, org.alfresco.query.PagingRequest paging)
      Do the actual search
      protected java.util.Map<java.lang.String,​java.lang.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)  
      protected java.util.Map<java.lang.String,​java.lang.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
      protected java.lang.String getDateXDaysAgo​(int daysAgo)
      Get the date x days ago in the format 'yyyy-MM-dd'
      protected org.alfresco.util.Pair<java.lang.String,​java.lang.String> getSearchQuery​(org.alfresco.service.cmr.site.SiteInfo site, java.lang.String author, int daysAgo)
      Build the search query from the passed in parameters and SEARCH_QUERY constant
      void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)
      Sets the searchService.
      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
      • Methods inherited from class org.springframework.extensions.webscripts.DeclarativeWebScript

        execute, executeFinallyImpl, executeImpl, executeImpl, getTemplateModel, renderFormatTemplate
      • Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript

        addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_TOPIC_AUTHOR

        protected static final java.lang.String DEFAULT_TOPIC_AUTHOR
        See Also:
        Constant Field Values
      • 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 java.util.Map<java.lang.String,​java.lang.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 java.util.Map<java.lang.String,​java.lang.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<java.lang.String,​java.lang.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<java.lang.String,​java.lang.String> getSearchQuery​(org.alfresco.service.cmr.site.SiteInfo site,
                                                                                                 java.lang.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 java.lang.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