org.alfresco.repo.web.scripts.discussion
Class AbstractDiscussionWebScript

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractWebScript
      extended by org.springframework.extensions.webscripts.DeclarativeWebScript
          extended by org.alfresco.repo.web.scripts.discussion.AbstractDiscussionWebScript
All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
Direct Known Subclasses:
ForumPostDelete, ForumPostGet, ForumPostPut, ForumPostRepliesGet, ForumPostRepliesPost, ForumTopicPost, ForumTopicsGet, ForumTopicsHotGet, ForumTopicsMineGet, ForumTopicsRecentGet

public abstract class AbstractDiscussionWebScript
extends org.springframework.extensions.webscripts.DeclarativeWebScript

Since:
4.0

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
 
Field Summary
protected  org.alfresco.service.cmr.activities.ActivityService activityService
           
static java.lang.String DISCUSSIONS_SERVICE_ACTIVITY_APP_NAME
           
protected  org.alfresco.service.cmr.discussion.DiscussionService discussionService
           
protected static java.lang.String KEY_AUTHOR
           
protected static java.lang.String KEY_CAN_EDIT
           
protected static java.lang.String KEY_IS_TOPIC_POST
           
protected static java.lang.String KEY_POST
           
protected static java.lang.String KEY_POSTDATA
           
protected static java.lang.String KEY_TOPIC
           
protected static int MAX_QUERY_ENTRY_COUNT
          When no maximum or paging info is given, what should we use?
protected  org.alfresco.service.cmr.repository.NodeService nodeService
           
protected  org.alfresco.service.cmr.security.PermissionService permissionService
           
protected  org.alfresco.service.cmr.security.PersonService personService
           
protected  org.alfresco.service.cmr.site.SiteService siteService
           
 
Constructor Summary
AbstractDiscussionWebScript()
           
 
Method Summary
protected  void addActivityEntry(java.lang.String thing, java.lang.String event, org.alfresco.service.cmr.discussion.TopicInfo topic, org.alfresco.service.cmr.discussion.PostInfo post, org.alfresco.service.cmr.site.SiteInfo site, org.springframework.extensions.webscripts.WebScriptRequest req, org.json.simple.JSONObject json)
          Generates an activity entry for the discussion item
protected  java.util.Map buildCommonModel(org.alfresco.service.cmr.site.SiteInfo site, org.alfresco.service.cmr.discussion.TopicInfo topic, org.alfresco.service.cmr.discussion.PostInfo post, org.springframework.extensions.webscripts.WebScriptRequest req)
           
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  java.lang.Object buildPerson(java.lang.String username)
           
protected  boolean canUserEditPost(org.alfresco.service.cmr.discussion.PostInfo post, org.alfresco.service.cmr.site.SiteInfo site)
          Is the current user allowed to edit this post? In order to be deemed allowed, you first need write permissions on the underlying node of the post.
protected abstract  java.util.Map 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 executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
           
protected  java.lang.String getOrNull(org.json.simple.JSONObject json, java.lang.String key)
           
protected  java.util.List getTags(org.json.simple.JSONObject json)
           
protected  java.util.Map renderPost(org.alfresco.service.cmr.discussion.PostInfo post, org.alfresco.service.cmr.site.SiteInfo site)
           
protected  java.util.Map renderTopic(org.alfresco.service.cmr.discussion.TopicInfo topic, org.alfresco.service.cmr.site.SiteInfo site)
           
protected  java.util.Map renderTopics(java.util.List topics, org.alfresco.util.Pair size, org.alfresco.query.PagingRequest paging, org.alfresco.service.cmr.site.SiteInfo site)
           
protected  java.util.Map renderTopics(org.alfresco.query.PagingResults topics, org.alfresco.query.PagingRequest paging, org.alfresco.service.cmr.site.SiteInfo site)
           
 void setActivityService(org.alfresco.service.cmr.activities.ActivityService activityService)
           
 void setDiscussionService(org.alfresco.service.cmr.discussion.DiscussionService discussionService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
           
 void setPersonService(org.alfresco.service.cmr.security.PersonService personService)
           
 void setSiteService(org.alfresco.service.cmr.site.SiteService siteService)
           
 
Methods inherited from class org.springframework.extensions.webscripts.DeclarativeWebScript
execute, executeFinallyImpl, executeImpl, executeImpl, getTemplateModel, renderFormatTemplate
 
Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
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

DISCUSSIONS_SERVICE_ACTIVITY_APP_NAME

public static final java.lang.String DISCUSSIONS_SERVICE_ACTIVITY_APP_NAME
See Also:
Constant Field Values

MAX_QUERY_ENTRY_COUNT

protected static final int MAX_QUERY_ENTRY_COUNT
When no maximum or paging info is given, what should we use?

See Also:
Constant Field Values

KEY_POSTDATA

protected static final java.lang.String KEY_POSTDATA
See Also:
Constant Field Values

KEY_IS_TOPIC_POST

protected static final java.lang.String KEY_IS_TOPIC_POST
See Also:
Constant Field Values

KEY_TOPIC

protected static final java.lang.String KEY_TOPIC
See Also:
Constant Field Values

KEY_POST

protected static final java.lang.String KEY_POST
See Also:
Constant Field Values

KEY_CAN_EDIT

protected static final java.lang.String KEY_CAN_EDIT
See Also:
Constant Field Values

KEY_AUTHOR

protected static final java.lang.String KEY_AUTHOR
See Also:
Constant Field Values

nodeService

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

siteService

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

personService

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

activityService

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

discussionService

protected org.alfresco.service.cmr.discussion.DiscussionService discussionService

permissionService

protected org.alfresco.service.cmr.security.PermissionService permissionService
Constructor Detail

AbstractDiscussionWebScript

public AbstractDiscussionWebScript()
Method Detail

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)

setSiteService

public void setSiteService(org.alfresco.service.cmr.site.SiteService siteService)

setPersonService

public void setPersonService(org.alfresco.service.cmr.security.PersonService personService)

setActivityService

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

setDiscussionService

public void setDiscussionService(org.alfresco.service.cmr.discussion.DiscussionService discussionService)

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)

getOrNull

protected java.lang.String getOrNull(org.json.simple.JSONObject json,
                                     java.lang.String key)

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


getTags

protected java.util.List getTags(org.json.simple.JSONObject json)

addActivityEntry

protected void addActivityEntry(java.lang.String thing,
                                java.lang.String event,
                                org.alfresco.service.cmr.discussion.TopicInfo topic,
                                org.alfresco.service.cmr.discussion.PostInfo post,
                                org.alfresco.service.cmr.site.SiteInfo site,
                                org.springframework.extensions.webscripts.WebScriptRequest req,
                                org.json.simple.JSONObject json)
Generates an activity entry for the discussion item

Parameters:
thing - Either post or reply
event - One of created, updated, deleted

canUserEditPost

protected boolean canUserEditPost(org.alfresco.service.cmr.discussion.PostInfo post,
                                  org.alfresco.service.cmr.site.SiteInfo site)
Is the current user allowed to edit this post? In order to be deemed allowed, you first need write permissions on the underlying node of the post. You then also need to either be the cm:creator of the post node, or a site manager


buildPerson

protected java.lang.Object buildPerson(java.lang.String username)

renderPost

protected java.util.Map renderPost(org.alfresco.service.cmr.discussion.PostInfo post,
                                   org.alfresco.service.cmr.site.SiteInfo site)

renderTopic

protected java.util.Map renderTopic(org.alfresco.service.cmr.discussion.TopicInfo topic,
                                    org.alfresco.service.cmr.site.SiteInfo site)

renderTopics

protected java.util.Map renderTopics(org.alfresco.query.PagingResults topics,
                                     org.alfresco.query.PagingRequest paging,
                                     org.alfresco.service.cmr.site.SiteInfo site)

renderTopics

protected java.util.Map renderTopics(java.util.List topics,
                                     org.alfresco.util.Pair size,
                                     org.alfresco.query.PagingRequest paging,
                                     org.alfresco.service.cmr.site.SiteInfo site)

buildCommonModel

protected java.util.Map buildCommonModel(org.alfresco.service.cmr.site.SiteInfo site,
                                         org.alfresco.service.cmr.discussion.TopicInfo topic,
                                         org.alfresco.service.cmr.discussion.PostInfo post,
                                         org.springframework.extensions.webscripts.WebScriptRequest req)

executeImpl

protected java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req,
                                    org.springframework.extensions.webscripts.Status status,
                                    org.springframework.extensions.webscripts.Cache cache)
Overrides:
executeImpl in class org.springframework.extensions.webscripts.DeclarativeWebScript

executeImpl

protected abstract java.util.Map 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)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.