Class AbstractEntityWebScript
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
- Direct Known Subclasses:
AiSearchWebScript,BranchEntityWebScript,CheckEntityWebScript,CreateEntityWebScript,DeleteEntityWebScript,EntityDictionaryWebScript,EntityReportWebScript,EntitySecurityWebScript,FormulateEntityWebScript,GetActivitiesWebScript,GetContentWebScript,GetEntityDataWebScript,GetEntityWebScript,ListEntitiesWebScript,MergeEntityWebScript,UpdateEntityDataWebScript,UpdateEntityWebScript
- Version:
- $Id: $Id
- Author:
- matthieu
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AdvSearchServiceprivate static final StringConstantBASE_64_PREFIX="b64-"protected static final StringConstantJSON_PARAM="jsonParam"protected static final org.apache.commons.logging.LogConstantloggerprotected org.alfresco.service.cmr.repository.MimetypeServiceprotected org.alfresco.service.namespace.NamespaceServiceprotected org.alfresco.service.cmr.repository.NodeServiceServicesprotected static final StringConstantPARAM_ALL_VERSION="allVersion"protected static final StringConstantPARAM_EXCLUDE_SYSTEMS="excludeSystems"protected static final StringConstantPARAM_FIELDS="fields"protected static final StringConstantPARAM_FORMAT="format"protected static final StringConstantPARAM_LISTS="lists"protected static final StringConstantPARAM_MAX_RESULTS="maxResults"protected static final StringConstantPARAM_NODEREF="nodeRef"protected static final StringConstantPARAM_PAGE="page"protected static final StringConstantPARAM_PARAMS="params"protected static final StringConstantPARAM_PATH="path"protected static final StringConstantPARAM_QUERY="query"protected static final StringConstantPARAM_TYPE="type"protected org.alfresco.service.cmr.security.PermissionServiceprotected RemoteEntityServiceprotected RemoteRateLimiterConstantreplacementMapsprotected SecurityServiceprivate static final intHTTP 429: absent from Surf's Status, which stops before it.protected SystemConfigurationService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName, boolean defaultValue) booleanParam.protected static StringdecodeParam(String param) decodeParam.voidexecute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) protected abstract voidexecuteInternal(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) executeInternal.private StringextractBodyRequest(org.springframework.extensions.webscripts.WebScriptRequest req) extractBodyRequest.extractFields(org.springframework.extensions.webscripts.WebScriptRequest req) extractFields.protected StringextractJsonParamName(String parameterName) extractJsonParamName.extractLists(org.springframework.extensions.webscripts.WebScriptRequest req) extractLists.protected org.json.JSONObjectextractParams(org.springframework.extensions.webscripts.WebScriptRequest req) extractParams.protected org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> findEntities(org.springframework.extensions.webscripts.WebScriptRequest req, Integer maxResults, boolean allowAdvancedSearch) findEntities.protected org.alfresco.service.cmr.repository.NodeReffindEntity(org.springframework.extensions.webscripts.WebScriptRequest req) findEntity.private StringformatListName(String list) formatListName.protected StringgetContentType(org.springframework.extensions.webscripts.WebScriptRequest req) getContentType.protected RemoteEntityFormatgetFormat(org.springframework.extensions.webscripts.WebScriptRequest req) getFormat.protected IntegerintParam.protected IntegerintParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName) intParam.protected booleanisBrokenPipe.protected IntegermaxResultsHardLimit.protected IntegermaxResultsLimit.protected voidsendOKStatus(org.alfresco.service.cmr.repository.NodeRef entityNodeRef, org.springframework.extensions.webscripts.WebScriptResponse resp, RemoteEntityFormat format) sendOKStatus.voidsetAdvSearchService(AdvSearchService advSearchService) Setter for the fieldadvSearchService.voidsetMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) Setter for the fieldmimetypeService.voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) Setter for the fieldnamespaceService.voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) Setter for the fieldnodeService.voidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService) Setter for the fieldpermissionService.voidsetRemoteEntityService(RemoteEntityService remoteEntityService) Setter for the fieldremoteEntityService.voidsetRemoteRateLimiter(RemoteRateLimiter remoteRateLimiter) Setter for the fieldremoteRateLimiter.voidsetSecurityService(SecurityService securityService) Setter for the fieldsecurityService.voidsetSystemConfigurationService(SystemConfigurationService systemConfigurationService) Setter for the fieldsystemConfigurationService.private org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> withKnownTotalCount(org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> refs, BeCPGQueryBuilder queryBuilder) Completes a page whose total is unknown with the number of matches reported by the index.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 Details
-
logger
protected static final org.apache.commons.logging.Log loggerConstantlogger -
JSON_PARAM
ConstantJSON_PARAM="jsonParam"- See Also:
-
PARAM_TYPE
ConstantPARAM_TYPE="type"- See Also:
-
PARAM_PARAMS
ConstantPARAM_PARAMS="params"- See Also:
-
PARAM_QUERY
ConstantPARAM_QUERY="query"- See Also:
-
PARAM_PATH
ConstantPARAM_PATH="path"- See Also:
-
PARAM_FORMAT
ConstantPARAM_FORMAT="format"- See Also:
-
PARAM_NODEREF
ConstantPARAM_NODEREF="nodeRef"- See Also:
-
PARAM_ALL_VERSION
ConstantPARAM_ALL_VERSION="allVersion"- See Also:
-
PARAM_FIELDS
ConstantPARAM_FIELDS="fields"- See Also:
-
PARAM_LISTS
ConstantPARAM_LISTS="lists"- See Also:
-
PARAM_EXCLUDE_SYSTEMS
ConstantPARAM_EXCLUDE_SYSTEMS="excludeSystems"- See Also:
-
PARAM_MAX_RESULTS
ConstantPARAM_MAX_RESULTS="maxResults"- See Also:
-
PARAM_PAGE
ConstantPARAM_PAGE="page"- See Also:
-
nodeService
protected org.alfresco.service.cmr.repository.NodeService nodeServiceServices -
remoteEntityService
-
mimetypeService
protected org.alfresco.service.cmr.repository.MimetypeService mimetypeService -
permissionService
protected org.alfresco.service.cmr.security.PermissionService permissionService -
namespaceService
protected org.alfresco.service.namespace.NamespaceService namespaceService -
STATUS_TOO_MANY_REQUESTS
private static final int STATUS_TOO_MANY_REQUESTSHTTP 429: absent from Surf's Status, which stops before it.- See Also:
-
remoteRateLimiter
-
systemConfigurationService
-
advSearchService
-
securityService
-
BASE_64_PREFIX
ConstantBASE_64_PREFIX="b64-"- See Also:
-
replacementMaps
ConstantreplacementMaps
-
-
Constructor Details
-
AbstractEntityWebScript
public AbstractEntityWebScript()
-
-
Method Details
-
setSecurityService
Setter for the field
securityService.- Parameters:
securityService- aSecurityServiceobject.
-
setAdvSearchService
Setter for the field
advSearchService.- Parameters:
advSearchService- aAdvSearchServiceobject
-
setSystemConfigurationService
Setter for the field
systemConfigurationService.- Parameters:
systemConfigurationService- aSystemConfigurationServiceobject
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) Setter for the field
namespaceService.- Parameters:
namespaceService- aNamespaceServiceobject
-
setMimetypeService
public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) Setter for the field
mimetypeService.- Parameters:
mimetypeService- aMimetypeServiceobject.
-
setRemoteEntityService
Setter for the field
remoteEntityService.- Parameters:
remoteEntityService- aRemoteEntityServiceobject.
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) Setter for the field
nodeService.- Parameters:
nodeService- aNodeServiceobject.
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService) Setter for the field
permissionService.- Parameters:
permissionService- aPermissionServiceobject.
-
setRemoteRateLimiter
Setter for the field
remoteRateLimiter.- Parameters:
remoteRateLimiter- aRemoteRateLimiterobject
-
maxResultsLimit
maxResultsLimit.
- Returns:
- a
Integerobject
-
maxResultsHardLimit
maxResultsHardLimit.
Ceiling up to which an explicitmaxResultsis honoured on a listing that requestsfieldsorlists, read frombeCPG.remote.maxResults.hardLimit.It is shipped equal to
beCPG.remote.maxResults.limit(256), so out of the box the behaviour is exactly the one ofmaxResultsLimit(): anything above 256 is clamped to 256. Raising it — and only raising it — lets a caller ask for a bigger window (monitoring listings and server side sorting over more than ~250 entities) whilebeCPG.remote.maxResults.limitkeeps being the default window size applied to every caller that does not ask for one. Falls back onmaxResultsLimit()when the property is missing or not a number.- Returns:
- a
Integerobject
-
execute
public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) throws IOException - Throws:
IOException
-
executeInternal
protected abstract void executeInternal(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse resp) throws IOException executeInternal.
- Parameters:
req- aWebScriptRequestobjectresp- aWebScriptResponseobject- Throws:
IOException- if any.
-
findEntities
protected org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> findEntities(org.springframework.extensions.webscripts.WebScriptRequest req, Integer maxResults, boolean allowAdvancedSearch) findEntities.
-
withKnownTotalCount
private org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> withKnownTotalCount(org.alfresco.query.PagingResults<org.alfresco.service.cmr.repository.NodeRef> refs, BeCPGQueryBuilder queryBuilder) Completes a page whose total is unknown with the number of matches reported by the index.
The transactional query engine stops counting one row past the requested page, so it cannot tell how many entities match as soon as another page follows. The index reports that number without reading the nodes back, at the cost of its eventual consistency. An index that reports fewer entities than the page holds is not answering for this query, and the total is left unknown.
- Parameters:
refs- aPagingResultsobject, the page returned by the queryqueryBuilder- aBeCPGQueryBuilderobject, the builder that ran the query- Returns:
- a
PagingResultsobject
-
extractBodyRequest
private String extractBodyRequest(org.springframework.extensions.webscripts.WebScriptRequest req) throws IOException extractBodyRequest.
- Parameters:
req- aWebScriptRequestobject- Returns:
- a
Stringobject - Throws:
IOException- if any.
-
intParam
protected Integer intParam(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName) intParam.
-
intParam
protected Integer intParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName) intParam.
-
booleanParam
protected boolean booleanParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName, boolean defaultValue) booleanParam.
- Parameters:
req- aWebScriptRequestobjectjsonParams- aJSONObjectobjectparamName- aStringobjectdefaultValue- a boolean- Returns:
- a boolean
-
findEntity
protected org.alfresco.service.cmr.repository.NodeRef findEntity(org.springframework.extensions.webscripts.WebScriptRequest req) findEntity.
- Parameters:
req- aWebScriptRequestobject.- Returns:
- a
NodeRefobject.
-
sendOKStatus
protected void sendOKStatus(org.alfresco.service.cmr.repository.NodeRef entityNodeRef, org.springframework.extensions.webscripts.WebScriptResponse resp, RemoteEntityFormat format) throws IOException sendOKStatus.
- Parameters:
entityNodeRef- aNodeRefobject.resp- aWebScriptResponseobject.format- aRemoteEntityFormatobject.- Throws:
IOException- if any.
-
getFormat
protected RemoteEntityFormat getFormat(org.springframework.extensions.webscripts.WebScriptRequest req) getFormat.
- Parameters:
req- aWebScriptRequestobject.- Returns:
- a
RemoteEntityFormatobject.
-
getContentType
getContentType.
- Parameters:
req- aWebScriptRequestobject.- Returns:
- a
Stringobject.
-
extractFields
extractFields.
- Parameters:
req- aWebScriptRequestobject.- Returns:
- a
Listobject.
-
extractLists
extractLists.
- Parameters:
req- aWebScriptRequestobject.- Returns:
- a
Listobject.
-
formatListName
formatListName.
-
decodeParam
decodeParam.
-
extractParams
protected org.json.JSONObject extractParams(org.springframework.extensions.webscripts.WebScriptRequest req) extractParams.
- Parameters:
req- aWebScriptRequestobject- Returns:
- a
JSONObjectobject
-
extractJsonParamName
extractJsonParamName.
-
isBrokenPipe
isBrokenPipe.
- Parameters:
t- aThrowableobject- Returns:
- a boolean
-