Class GetStatisticsWebScript

java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
fr.becpg.repo.web.scripts.statistics.GetStatisticsWebScript
All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript

public class GetStatisticsWebScript extends org.springframework.extensions.webscripts.AbstractWebScript

GetStatisticsWebScript class.

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

    Fields
    Modifier and Type
    Field
    Description
     
    private static final String
    Constant PARAM_ASCENDING_ORDER="asc"
    private static final String
    Constant PARAM_DB_ASCENDING_ORDER="dbAsc"
    private static final String
    Constant PARAM_FILTER="filter"
    private static final String
    Constant PARAM_FROM_DATE="fromDate"
    private static final String
    Constant PARAM_MAX_RESULTS="maxResults"
    private static final String
    Constant PARAM_SORT_BY="sortBy"
    private static final String
    Constant PARAM_START_AFTER_ID="startAfterId"
    private static final String
    Constant PARAM_TO_DATE="toDate"
    private static final String
    Constant PARAM_TYPE="type"
    private static final String
    Constant RESP_NEXT_START_AFTER_ID="nextStartAfterId"
    private static final String
    Constant RESP_SCAN_INTERRUPTED="scanInterrupted"
    private static final String
    Constant RESP_STATISTICS="statistics"
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    applyCreationDateRange(org.springframework.extensions.webscripts.WebScriptRequest req, AuditQuery auditQuery)
    Restrict the query to the entries written between the 'fromDate' and 'toDate' parameters, both inclusive.
    private AuditQuery
    buildAuditQuery(org.springframework.extensions.webscripts.WebScriptRequest req)
    buildAuditQuery.
    void
    execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res)
    A malformed parameter, a filter on an unknown key or a filter value the audit query cannot hold is a client error, reported as such rather than as a server failure.
    private AuditType
    getAuditType.
    private Date
    parseDate(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName, boolean isUpperBound)
    parseDate.
    void
    Setter for the field beCPGAuditService.
    private void
    writePage(org.springframework.extensions.webscripts.WebScriptResponse res, AuditPage page)
    writePage.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • PARAM_TYPE

      private static final String PARAM_TYPE
      Constant PARAM_TYPE="type"
      See Also:
    • PARAM_SORT_BY

      private static final String PARAM_SORT_BY
      Constant PARAM_SORT_BY="sortBy"
      See Also:
    • PARAM_FILTER

      private static final String PARAM_FILTER
      Constant PARAM_FILTER="filter"
      See Also:
    • PARAM_MAX_RESULTS

      private static final String PARAM_MAX_RESULTS
      Constant PARAM_MAX_RESULTS="maxResults"
      See Also:
    • PARAM_ASCENDING_ORDER

      private static final String PARAM_ASCENDING_ORDER
      Constant PARAM_ASCENDING_ORDER="asc"
      See Also:
    • PARAM_DB_ASCENDING_ORDER

      private static final String PARAM_DB_ASCENDING_ORDER
      Constant PARAM_DB_ASCENDING_ORDER="dbAsc"
      See Also:
    • PARAM_FROM_DATE

      private static final String PARAM_FROM_DATE
      Constant PARAM_FROM_DATE="fromDate"
      See Also:
    • PARAM_TO_DATE

      private static final String PARAM_TO_DATE
      Constant PARAM_TO_DATE="toDate"
      See Also:
    • PARAM_START_AFTER_ID

      private static final String PARAM_START_AFTER_ID
      Constant PARAM_START_AFTER_ID="startAfterId"
      See Also:
    • RESP_STATISTICS

      private static final String RESP_STATISTICS
      Constant RESP_STATISTICS="statistics"
      See Also:
    • RESP_NEXT_START_AFTER_ID

      private static final String RESP_NEXT_START_AFTER_ID
      Constant RESP_NEXT_START_AFTER_ID="nextStartAfterId"
      See Also:
    • RESP_SCAN_INTERRUPTED

      private static final String RESP_SCAN_INTERRUPTED
      Constant RESP_SCAN_INTERRUPTED="scanInterrupted"
      See Also:
    • beCPGAuditService

      private BeCPGAuditService beCPGAuditService
  • Constructor Details

    • GetStatisticsWebScript

      public GetStatisticsWebScript()
  • Method Details

    • setBeCPGAuditService

      public void setBeCPGAuditService(BeCPGAuditService beCPGAuditService)

      Setter for the field beCPGAuditService.

      Parameters:
      beCPGAuditService - a BeCPGAuditService object
    • execute

      public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res) throws IOException
      A malformed parameter, a filter on an unknown key or a filter value the audit query cannot hold is a client error, reported as such rather than as a server failure.
      Throws:
      IOException
    • buildAuditQuery

      private AuditQuery buildAuditQuery(org.springframework.extensions.webscripts.WebScriptRequest req)

      buildAuditQuery.

      Parameters:
      req - a WebScriptRequest object
      Returns:
      a AuditQuery object
    • applyCreationDateRange

      private void applyCreationDateRange(org.springframework.extensions.webscripts.WebScriptRequest req, AuditQuery auditQuery)
      Restrict the query to the entries written between the 'fromDate' and 'toDate' parameters, both inclusive. A missing bound leaves the range open on its side. A 'toDate' without time stands for the whole day, up to its last millisecond. The date is the one the audit entry was written at: an entry completed after its start is written again, so that it then holds its completion date.
      Parameters:
      req - a WebScriptRequest object
      auditQuery - a AuditQuery object
      Throws:
      org.springframework.extensions.webscripts.WebScriptException - if a bound is not an ISO 8601 date or the range is reversed
    • parseDate

      private Date parseDate(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName, boolean isUpperBound)

      parseDate.

      Parameters:
      req - a WebScriptRequest object A date without time is read as the start of that day in the server time zone, or as its last millisecond when it is an upper bound.
      paramName - the name of the parameter holding an ISO 8601 date
      isUpperBound - whether the date closes a range
      Returns:
      the parsed date, or null when the parameter is missing or blank
      Throws:
      org.springframework.extensions.webscripts.WebScriptException - if the parameter is not an ISO 8601 date
    • writePage

      private void writePage(org.springframework.extensions.webscripts.WebScriptResponse res, AuditPage page) throws IOException

      writePage.

      Parameters:
      res - a WebScriptResponse object
      page - a AuditPage object
      Throws:
      IOException - if the response cannot be written
    • getAuditType

      private AuditType getAuditType(String reqType)

      getAuditType.

      Parameters:
      reqType - a String object
      Returns:
      a AuditType object