Class AbstractWorkflowWebscript
- java.lang.Object
-
- org.springframework.extensions.webscripts.AbstractWebScript
-
- org.springframework.extensions.webscripts.DeclarativeWebScript
-
- 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
- Author:
- Nick Smith, Gavin Cornwell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractWorkflowWebscript.ExcludeFilter
Helper class to check for excluded items.
-
Field Summary
Fields Modifier and Type Field Description protected AuthenticationService
authenticationService
protected AuthorityService
authorityService
static int
DEFAULT_MAX_ITEMS
static int
DEFAULT_SKIP_COUNT
protected DictionaryService
dictionaryService
static String
EMPTY
protected NamespaceService
namespaceService
protected NodeService
nodeService
static String
NULL
static String
PARAM_EXCLUDE
static String
PARAM_MAX_ITEMS
static String
PARAM_SKIP_COUNT
protected PersonService
personService
protected WorkflowService
workflowService
-
Constructor Summary
Constructors Constructor Description AbstractWorkflowWebscript()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected List<Map<String,Object>>
applyPagination(List<Map<String,Object>> results, int maxItems, int skipCount)
Make the pagination for given list of objectsprotected abstract Map<String,Object>
buildModel(WorkflowModelBuilder modelBuilder, org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
This method uses aWorkflowModelBuilder
to build up the model to return.protected Map<String,Object>
createResultModel(org.springframework.extensions.webscripts.WebScriptRequest req, String dataPropertyName, List<Map<String,Object>> results)
Builds the results model, applying pagination to the results if necessary.protected Map<String,Object>
executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
protected Date
getDateParameter(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName)
Retrieves the named paramter as a date.protected int
getIntParameter(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName, int defaultValue)
Retrieves the named parameter as an integer, if the parameter is not present the default value is returnedprotected boolean
isDateMatchForFilter(Date date, 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, String paramName, Map<String,Object> filters)
Processes the given date filter parameter from the provided webscript request.void
setAuthenticationService(AuthenticationService authenticationService)
void
setAuthorityService(AuthorityService authorityService)
void
setDictionaryService(DictionaryService dictionaryService)
void
setNamespaceService(NamespaceService namespaceService)
void
setNodeService(NodeService nodeService)
void
setPersonService(PersonService personService)
void
setWorkflowService(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
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
-
-
-
Field Detail
-
NULL
public static final String NULL
- See Also:
- Constant Field Values
-
EMPTY
public static final String EMPTY
- See Also:
- Constant Field Values
-
PARAM_MAX_ITEMS
public static final String PARAM_MAX_ITEMS
- See Also:
- Constant Field Values
-
PARAM_SKIP_COUNT
public static final String PARAM_SKIP_COUNT
- See Also:
- Constant Field Values
-
PARAM_EXCLUDE
public static final 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 NamespaceService namespaceService
-
nodeService
protected NodeService nodeService
-
personService
protected PersonService personService
-
dictionaryService
protected DictionaryService dictionaryService
-
authenticationService
protected AuthenticationService authenticationService
-
authorityService
protected AuthorityService authorityService
-
workflowService
protected WorkflowService workflowService
-
-
Method Detail
-
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:
executeImpl
in classorg.springframework.extensions.webscripts.DeclarativeWebScript
-
setNamespaceService
public void setNamespaceService(NamespaceService namespaceService)
-
setNodeService
public void setNodeService(NodeService nodeService)
-
setPersonService
public void setPersonService(PersonService personService)
-
setDictionaryService
public void setDictionaryService(DictionaryService dictionaryService)
-
setAuthenticationService
public void setAuthenticationService(AuthenticationService authenticationService)
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
-
setWorkflowService
public void setWorkflowService(WorkflowService workflowService)
-
buildModel
protected abstract Map<String,Object> buildModel(WorkflowModelBuilder modelBuilder, org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
This method uses aWorkflowModelBuilder
to build up the model to return.- Parameters:
modelBuilder
- AWorkflowModelBuilder
.req
- theWebScriptRequest
status
- theStatus
cache
- theCache
- Returns:
- the data model.
-
processDateFilter
protected void processDateFilter(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName, Map<String,Object> 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 requestparamName
- The name of the parameter to look forfilters
- Map of filters to add the date to
-
getDateParameter
protected Date getDateParameter(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName)
Retrieves the named paramter as a date.- Parameters:
req
- The WebScript requestparamName
- 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, 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 requestparamName
- The name of parameter to look fordefaultValue
- 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 Map<String,Object> createResultModel(org.springframework.extensions.webscripts.WebScriptRequest req, String dataPropertyName, List<Map<String,Object>> results)
Builds the results model, applying pagination to the results if necessary.- Parameters:
req
- The WebScript requestdataPropertyName
- The name of the property to use in the modelresults
- The full set of results- Returns:
- List of results to return to the callee
-
applyPagination
protected List<Map<String,Object>> applyPagination(List<Map<String,Object>> results, int maxItems, int skipCount)
Make the pagination for given list of objects- Parameters:
results
- the initial list of objects for paginationmaxItems
- maximum count of elements that should be included in paging resultskipCount
- the count of elements that should be skipped- Returns:
- List of paginated results
-
isDateMatchForFilter
protected boolean isDateMatchForFilter(Date date, Object filterValue, boolean dateBeforeFilter)
Determines whether the given date is a match for the given filter value.- Parameters:
date
- The date to check againstfilterValue
- The value of the filter, either an empty String or a Date objectdateBeforeFilter
- 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
-
-