org.alfresco.repo.web.scripts.workflow
Class AbstractWorkflowWebscript

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractWebScript
      extended by org.springframework.extensions.webscripts.DeclarativeWebScript
          extended by org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript
All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
Direct Known Subclasses:
TaskInstanceGet, TaskInstancePut, TaskInstancesGet, WorkflowDefinitionGet, WorkflowDefinitionsGet, WorkflowInstanceDelete, WorkflowInstanceGet, WorkflowInstancesForNodeGet, WorkflowInstancesGet

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

Base class for all workflow REST API implementations.

Since:
3.4

Nested Class Summary
 class AbstractWorkflowWebscript.ExcludeFilter
          Helper class to check for excluded items.
 
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
 
Field Summary
protected  org.alfresco.service.cmr.security.AuthenticationService authenticationService
           
protected  org.alfresco.service.cmr.security.AuthorityService authorityService
           
static int DEFAULT_MAX_ITEMS
           
static int DEFAULT_SKIP_COUNT
           
protected  org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
           
static java.lang.String EMPTY
           
protected  org.alfresco.service.namespace.NamespaceService namespaceService
           
protected  org.alfresco.service.cmr.repository.NodeService nodeService
           
static java.lang.String NULL
           
static java.lang.String PARAM_EXCLUDE
           
static java.lang.String PARAM_MAX_ITEMS
           
static java.lang.String PARAM_SKIP_COUNT
           
protected  org.alfresco.service.cmr.security.PersonService personService
           
protected  org.alfresco.service.cmr.workflow.WorkflowService workflowService
           
 
Constructor Summary
AbstractWorkflowWebscript()
           
 
Method Summary
protected  java.util.List applyPagination(java.util.List results, int maxItems, int skipCount)
          Make the pagination for given list of objects
protected abstract  java.util.Map buildModel(WorkflowModelBuilder modelBuilder, org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
          This method uses a WorkflowModelBuilder to build up the model to return.
protected  java.util.Map createResultModel(org.springframework.extensions.webscripts.WebScriptRequest req, java.lang.String dataPropertyName, java.util.List results)
          Builds the results model, applying pagination to the results if necessary.
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.util.Date getDateParameter(org.springframework.extensions.webscripts.WebScriptRequest req, java.lang.String paramName)
          Retrieves the named paramter as a date.
protected  int getIntParameter(org.springframework.extensions.webscripts.WebScriptRequest req, java.lang.String paramName, int defaultValue)
          Retrieves the named parameter as an integer, if the parameter is not present the default value is returned
protected  boolean isDateMatchForFilter(java.util.Date date, java.lang.Object filterValue, boolean dateBeforeFilter)
          Determines whether the given date is a match for the given filter value.
protected  void processDateFilter(org.springframework.extensions.webscripts.WebScriptRequest req, java.lang.String paramName, java.util.Map filters)
          Processes the given date filter parameter from the provided webscript request.
 void setAuthenticationService(org.alfresco.service.cmr.security.AuthenticationService authenticationService)
           
 void setAuthorityService(org.alfresco.service.cmr.security.AuthorityService authorityService)
           
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setPersonService(org.alfresco.service.cmr.security.PersonService personService)
           
 void setWorkflowService(org.alfresco.service.cmr.workflow.WorkflowService workflowService)
           
 
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

NULL

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

EMPTY

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

PARAM_MAX_ITEMS

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

PARAM_SKIP_COUNT

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

PARAM_EXCLUDE

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

DEFAULT_MAX_ITEMS

public static final int DEFAULT_MAX_ITEMS
See Also:
Constant Field Values

DEFAULT_SKIP_COUNT

public static final int DEFAULT_SKIP_COUNT
See Also:
Constant Field Values

namespaceService

protected org.alfresco.service.namespace.NamespaceService namespaceService

nodeService

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

personService

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

dictionaryService

protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService

authenticationService

protected org.alfresco.service.cmr.security.AuthenticationService authenticationService

authorityService

protected org.alfresco.service.cmr.security.AuthorityService authorityService

workflowService

protected org.alfresco.service.cmr.workflow.WorkflowService workflowService
Constructor Detail

AbstractWorkflowWebscript

public AbstractWorkflowWebscript()
Method Detail

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

setNamespaceService

public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)

setNodeService

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

setPersonService

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

setDictionaryService

public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)

setAuthenticationService

public void setAuthenticationService(org.alfresco.service.cmr.security.AuthenticationService authenticationService)

setAuthorityService

public void setAuthorityService(org.alfresco.service.cmr.security.AuthorityService authorityService)

setWorkflowService

public void setWorkflowService(org.alfresco.service.cmr.workflow.WorkflowService workflowService)

buildModel

protected abstract java.util.Map buildModel(WorkflowModelBuilder modelBuilder,
                                            org.springframework.extensions.webscripts.WebScriptRequest req,
                                            org.springframework.extensions.webscripts.Status status,
                                            org.springframework.extensions.webscripts.Cache cache)
This method uses a WorkflowModelBuilder to build up the model to return.

Parameters:
modelBuilder - A WorkflowModelBuilder.
req - the WebScriptRequest
status - the Status
cache - the Cache
Returns:
the data model.

processDateFilter

protected void processDateFilter(org.springframework.extensions.webscripts.WebScriptRequest req,
                                 java.lang.String paramName,
                                 java.util.Map filters)
Processes the given date filter parameter from the provided webscript request. If the parameter is present but set to an empty string or to "null" the date is added to the given filters Map as "", if the parameter contains an ISO8601 date it's added as a Date object to the filters.

Parameters:
req - The WebScript request
paramName - The name of the parameter to look for
filters - Map of filters to add the date to

getDateParameter

protected java.util.Date getDateParameter(org.springframework.extensions.webscripts.WebScriptRequest req,
                                          java.lang.String paramName)
Retrieves the named paramter as a date.

Parameters:
req - The WebScript request
paramName - The name of parameter to look for
Returns:
The request parameter value or null if the parameter is not present

getIntParameter

protected int getIntParameter(org.springframework.extensions.webscripts.WebScriptRequest req,
                              java.lang.String paramName,
                              int defaultValue)
Retrieves the named parameter as an integer, if the parameter is not present the default value is returned

Parameters:
req - The WebScript request
paramName - The name of parameter to look for
defaultValue - The default value that should be returned if parameter is not present in request or if it is not positive
Returns:
The request parameter or default value

createResultModel

protected java.util.Map createResultModel(org.springframework.extensions.webscripts.WebScriptRequest req,
                                          java.lang.String dataPropertyName,
                                          java.util.List results)
Builds the results model, applying pagination to the results if necessary.

Parameters:
req - The WebScript request
dataPropertyName - The name of the property to use in the model
results - The full set of results
Returns:
List of results to return to the callee

applyPagination

protected java.util.List applyPagination(java.util.List results,
                                         int maxItems,
                                         int skipCount)
Make the pagination for given list of objects

Parameters:
results - the initial list of objects for pagination
maxItems - maximum count of elements that should be included in paging result
skipCount - the count of elements that should be skipped
Returns:
List of paginated results

isDateMatchForFilter

protected boolean isDateMatchForFilter(java.util.Date date,
                                       java.lang.Object filterValue,
                                       boolean dateBeforeFilter)
Determines whether the given date is a match for the given filter value.

Parameters:
date - The date to check against
filterValue - The value of the filter, either an empty String or a Date object
dateBeforeFilter - true to test the date is before the filterValue, false to test the date is after the filterValue
Returns:
true if the date is a match for the filterValue


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