Class AbstractCommentsWebScript

  • All Implemented Interfaces:
    org.springframework.extensions.webscripts.WebScript
    Direct Known Subclasses:
    CommentDelete, CommentsPost

    public abstract class AbstractCommentsWebScript
    extends org.springframework.extensions.webscripts.DeclarativeWebScript
    This class is the abstract controller for the comments web scripts (delete and post)
    Since:
    4.2.6
    Author:
    Ramona Popa
    • 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 Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.springframework.extensions.webscripts.WebScriptRequest req, 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 DeclarativeWebScript with parse request for nodeRef
      protected java.lang.String getOrNull​(org.json.simple.JSONObject json, java.lang.String key)
      get the value from JSON for given key if exists
      protected org.alfresco.service.cmr.site.SiteInfo getSiteInfo​(org.springframework.extensions.webscripts.WebScriptRequest req, boolean searchForSiteInJSON)
      returns SiteInfo needed for post activity
      protected org.json.simple.JSONObject parseJSON​(org.springframework.extensions.webscripts.WebScriptRequest req)
      parse JSON from request
      protected org.json.simple.JSONObject parseJSONFromString​(java.lang.String input)
      parse JSON for a given input string
      protected org.alfresco.service.cmr.repository.NodeRef parseRequestForNodeRef​(org.springframework.extensions.webscripts.WebScriptRequest req)
      returns the nodeRef from web script request
      protected void postActivity​(org.json.simple.JSONObject json, org.springframework.extensions.webscripts.WebScriptRequest req, org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String activityType)
      Post an activity entry for the comment added or deleted
      void setActivityService​(org.alfresco.service.cmr.activities.ActivityService activityService)  
      void setBehaviourFilter​(org.alfresco.repo.policy.BehaviourFilter behaviourFilter)  
      void setServiceRegistry​(org.alfresco.service.ServiceRegistry serviceRegistry)  
      • 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

      • COMMENTS_TOPIC_NAME

        protected static final java.lang.String COMMENTS_TOPIC_NAME
        See Also:
        Constant Field Values
      • JSON_KEY_SITE_ID

        protected static final java.lang.String JSON_KEY_SITE_ID
        See Also:
        Constant Field Values
      • JSON_KEY_ITEM_TITLE

        protected static final java.lang.String JSON_KEY_ITEM_TITLE
        See Also:
        Constant Field Values
      • JSON_KEY_PAGE_PARAMS

        protected static final java.lang.String JSON_KEY_PAGE_PARAMS
        See Also:
        Constant Field Values
      • JSON_KEY_NODEREF

        protected static final java.lang.String JSON_KEY_NODEREF
        See Also:
        Constant Field Values
      • JSON_KEY_CONTENT

        protected static final java.lang.String JSON_KEY_CONTENT
        See Also:
        Constant Field Values
      • COMMENT_CREATED_ACTIVITY

        protected static final java.lang.String COMMENT_CREATED_ACTIVITY
        See Also:
        Constant Field Values
      • COMMENT_DELETED_ACTIVITY

        protected static final java.lang.String COMMENT_DELETED_ACTIVITY
        See Also:
        Constant Field Values
      • serviceRegistry

        protected org.alfresco.service.ServiceRegistry serviceRegistry
      • nodeService

        protected org.alfresco.service.cmr.repository.NodeService nodeService
      • contentService

        protected org.alfresco.service.cmr.repository.ContentService contentService
      • personService

        protected org.alfresco.service.cmr.security.PersonService personService
      • siteService

        protected org.alfresco.service.cmr.site.SiteService siteService
      • permissionService

        protected org.alfresco.service.cmr.security.PermissionService permissionService
      • activityService

        protected org.alfresco.service.cmr.activities.ActivityService activityService
      • behaviourFilter

        protected org.alfresco.repo.policy.BehaviourFilter behaviourFilter
    • Constructor Detail

      • AbstractCommentsWebScript

        public AbstractCommentsWebScript()
    • Method Detail

      • setServiceRegistry

        public void setServiceRegistry​(org.alfresco.service.ServiceRegistry serviceRegistry)
      • setBehaviourFilter

        public void setBehaviourFilter​(org.alfresco.repo.policy.BehaviourFilter behaviourFilter)
      • setActivityService

        public void setActivityService​(org.alfresco.service.cmr.activities.ActivityService activityService)
      • parseRequestForNodeRef

        protected org.alfresco.service.cmr.repository.NodeRef parseRequestForNodeRef​(org.springframework.extensions.webscripts.WebScriptRequest req)
        returns the nodeRef from web script request
        Parameters:
        req -
        Returns:
      • getOrNull

        protected java.lang.String getOrNull​(org.json.simple.JSONObject json,
                                             java.lang.String key)
        get the value from JSON for given key if exists
        Parameters:
        json -
        key -
        Returns:
      • parseJSON

        protected org.json.simple.JSONObject parseJSON​(org.springframework.extensions.webscripts.WebScriptRequest req)
        parse JSON from request
        Parameters:
        req -
        Returns:
      • parseJSONFromString

        protected org.json.simple.JSONObject parseJSONFromString​(java.lang.String input)
        parse JSON for a given input string
        Parameters:
        input -
        Returns:
      • postActivity

        protected void postActivity​(org.json.simple.JSONObject json,
                                    org.springframework.extensions.webscripts.WebScriptRequest req,
                                    org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                    java.lang.String activityType)
        Post an activity entry for the comment added or deleted
        Parameters:
        json - - is not sent null with this activity type - only for delete
        req -
        nodeRef -
        activityType -
      • getSiteInfo

        protected org.alfresco.service.cmr.site.SiteInfo getSiteInfo​(org.springframework.extensions.webscripts.WebScriptRequest req,
                                                                     boolean searchForSiteInJSON)
        returns SiteInfo needed for post activity
        Parameters:
        req -
        Returns:
      • 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 DeclarativeWebScript with parse request for nodeRef
        Overrides:
        executeImpl in class org.springframework.extensions.webscripts.DeclarativeWebScript
      • executeImpl

        protected abstract java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                                                              org.springframework.extensions.webscripts.WebScriptRequest req,
                                                                                              org.springframework.extensions.webscripts.Status status,
                                                                                              org.springframework.extensions.webscripts.Cache cache)
        Parameters:
        nodeRef -
        req -
        status -
        cache -
        Returns: