Class AbstractEntityWebScript

java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
fr.becpg.repo.web.scripts.remote.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

public abstract class AbstractEntityWebScript extends org.springframework.extensions.webscripts.AbstractWebScript
Abstract remote entity webscript
Version:
$Id: $Id
Author:
matthieu
  • Field Details

    • logger

      protected static final org.apache.commons.logging.Log logger
      Constant logger
    • JSON_PARAM

      protected static final String JSON_PARAM
      Constant JSON_PARAM="jsonParam"
      See Also:
    • PARAM_TYPE

      protected static final String PARAM_TYPE
      Constant PARAM_TYPE="type"
      See Also:
    • PARAM_PARAMS

      protected static final String PARAM_PARAMS
      Constant PARAM_PARAMS="params"
      See Also:
    • PARAM_QUERY

      protected static final String PARAM_QUERY
      Constant PARAM_QUERY="query"
      See Also:
    • PARAM_PATH

      protected static final String PARAM_PATH
      Constant PARAM_PATH="path"
      See Also:
    • PARAM_FORMAT

      protected static final String PARAM_FORMAT
      Constant PARAM_FORMAT="format"
      See Also:
    • PARAM_NODEREF

      protected static final String PARAM_NODEREF
      Constant PARAM_NODEREF="nodeRef"
      See Also:
    • PARAM_ALL_VERSION

      protected static final String PARAM_ALL_VERSION
      Constant PARAM_ALL_VERSION="allVersion"
      See Also:
    • PARAM_FIELDS

      protected static final String PARAM_FIELDS
      Constant PARAM_FIELDS="fields"
      See Also:
    • PARAM_LISTS

      protected static final String PARAM_LISTS
      Constant PARAM_LISTS="lists"
      See Also:
    • PARAM_EXCLUDE_SYSTEMS

      protected static final String PARAM_EXCLUDE_SYSTEMS
      Constant PARAM_EXCLUDE_SYSTEMS="excludeSystems"
      See Also:
    • PARAM_MAX_RESULTS

      protected static final String PARAM_MAX_RESULTS
      Constant PARAM_MAX_RESULTS="maxResults"
      See Also:
    • PARAM_PAGE

      protected static final String PARAM_PAGE
      Constant PARAM_PAGE="page"
      See Also:
    • nodeService

      protected org.alfresco.service.cmr.repository.NodeService nodeService
      Services
    • remoteEntityService

      protected RemoteEntityService 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_REQUESTS
      HTTP 429: absent from Surf's Status, which stops before it.
      See Also:
    • remoteRateLimiter

      protected RemoteRateLimiter remoteRateLimiter
    • systemConfigurationService

      protected SystemConfigurationService systemConfigurationService
    • advSearchService

      protected AdvSearchService advSearchService
    • securityService

      protected SecurityService securityService
    • BASE_64_PREFIX

      private static final String BASE_64_PREFIX
      Constant BASE_64_PREFIX="b64-"
      See Also:
    • replacementMaps

      private static final Map<String,String> replacementMaps
      Constant replacementMaps
  • Constructor Details

    • AbstractEntityWebScript

      public AbstractEntityWebScript()
  • Method Details

    • setSecurityService

      public void setSecurityService(SecurityService securityService)

      Setter for the field securityService.

      Parameters:
      securityService - a SecurityService object.
    • setAdvSearchService

      public void setAdvSearchService(AdvSearchService advSearchService)

      Setter for the field advSearchService.

      Parameters:
      advSearchService - a AdvSearchService object
    • setSystemConfigurationService

      public void setSystemConfigurationService(SystemConfigurationService systemConfigurationService)

      Setter for the field systemConfigurationService.

      Parameters:
      systemConfigurationService - a SystemConfigurationService object
    • setNamespaceService

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

      Setter for the field namespaceService.

      Parameters:
      namespaceService - a NamespaceService object
    • setMimetypeService

      public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)

      Setter for the field mimetypeService.

      Parameters:
      mimetypeService - a MimetypeService object.
    • setRemoteEntityService

      public void setRemoteEntityService(RemoteEntityService remoteEntityService)

      Setter for the field remoteEntityService.

      Parameters:
      remoteEntityService - a RemoteEntityService object.
    • setNodeService

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

      Setter for the field nodeService.

      Parameters:
      nodeService - a NodeService object.
    • setPermissionService

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

      Setter for the field permissionService.

      Parameters:
      permissionService - a PermissionService object.
    • setRemoteRateLimiter

      public void setRemoteRateLimiter(RemoteRateLimiter remoteRateLimiter)

      Setter for the field remoteRateLimiter.

      Parameters:
      remoteRateLimiter - a RemoteRateLimiter object
    • maxResultsLimit

      protected Integer maxResultsLimit()

      maxResultsLimit.

      Returns:
      a Integer object
    • maxResultsHardLimit

      protected Integer maxResultsHardLimit()

      maxResultsHardLimit.

      Ceiling up to which an explicit maxResults is honoured on a listing that requests fields or lists, read from beCPG.remote.maxResults.hardLimit.

      It is shipped equal to beCPG.remote.maxResults.limit (256), so out of the box the behaviour is exactly the one of maxResultsLimit() : 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) while beCPG.remote.maxResults.limit keeps being the default window size applied to every caller that does not ask for one. Falls back on maxResultsLimit() when the property is missing or not a number.

      Returns:
      a Integer object
    • 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 - a WebScriptRequest object
      resp - a WebScriptResponse object
      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.

      Parameters:
      req - a WebScriptRequest object.
      maxResults - a Integer object
      allowAdvancedSearch - a Boolean object
      Returns:
      a List object.
    • 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 - a PagingResults object, the page returned by the query
      queryBuilder - a BeCPGQueryBuilder object, the builder that ran the query
      Returns:
      a PagingResults object
    • extractBodyRequest

      private String extractBodyRequest(org.springframework.extensions.webscripts.WebScriptRequest req) throws IOException

      extractBodyRequest.

      Parameters:
      req - a WebScriptRequest object
      Returns:
      a String object
      Throws:
      IOException - if any.
    • intParam

      protected Integer intParam(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName)

      intParam.

      Parameters:
      req - a WebScriptRequest object
      paramName - a String object
      Returns:
      a Integer object
    • intParam

      protected Integer intParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName)

      intParam.

      Parameters:
      req - a WebScriptRequest object
      jsonParams - a JSONObject object
      paramName - a String object
      Returns:
      a Integer object
    • booleanParam

      protected boolean booleanParam(org.springframework.extensions.webscripts.WebScriptRequest req, org.json.JSONObject jsonParams, String paramName, boolean defaultValue)

      booleanParam.

      Parameters:
      req - a WebScriptRequest object
      jsonParams - a JSONObject object
      paramName - a String object
      defaultValue - a boolean
      Returns:
      a boolean
    • findEntity

      protected org.alfresco.service.cmr.repository.NodeRef findEntity(org.springframework.extensions.webscripts.WebScriptRequest req)

      findEntity.

      Parameters:
      req - a WebScriptRequest object.
      Returns:
      a NodeRef object.
    • sendOKStatus

      protected void sendOKStatus(org.alfresco.service.cmr.repository.NodeRef entityNodeRef, org.springframework.extensions.webscripts.WebScriptResponse resp, RemoteEntityFormat format) throws IOException

      sendOKStatus.

      Parameters:
      entityNodeRef - a NodeRef object.
      resp - a WebScriptResponse object.
      format - a RemoteEntityFormat object.
      Throws:
      IOException - if any.
    • getFormat

      protected RemoteEntityFormat getFormat(org.springframework.extensions.webscripts.WebScriptRequest req)

      getFormat.

      Parameters:
      req - a WebScriptRequest object.
      Returns:
      a RemoteEntityFormat object.
    • getContentType

      protected String getContentType(org.springframework.extensions.webscripts.WebScriptRequest req)

      getContentType.

      Parameters:
      req - a WebScriptRequest object.
      Returns:
      a String object.
    • extractFields

      public Set<String> extractFields(org.springframework.extensions.webscripts.WebScriptRequest req)

      extractFields.

      Parameters:
      req - a WebScriptRequest object.
      Returns:
      a List object.
    • extractLists

      public Set<String> extractLists(org.springframework.extensions.webscripts.WebScriptRequest req)

      extractLists.

      Parameters:
      req - a WebScriptRequest object.
      Returns:
      a List object.
    • formatListName

      private String formatListName(String list)

      formatListName.

      Parameters:
      list - a String object
      Returns:
      a String object
    • decodeParam

      protected static String decodeParam(String param)

      decodeParam.

      Parameters:
      param - a String object
      Returns:
      a String object
    • extractParams

      protected org.json.JSONObject extractParams(org.springframework.extensions.webscripts.WebScriptRequest req)

      extractParams.

      Parameters:
      req - a WebScriptRequest object
      Returns:
      a JSONObject object
    • extractJsonParamName

      protected String extractJsonParamName(String parameterName)

      extractJsonParamName.

      Parameters:
      parameterName - a String object
      Returns:
      a String object
    • isBrokenPipe

      protected boolean isBrokenPipe(Throwable t)

      isBrokenPipe.

      Parameters:
      t - a Throwable object
      Returns:
      a boolean