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
FieldsModifier and TypeFieldDescriptionprivate BeCPGAuditServiceprivate static final StringConstantPARAM_ASCENDING_ORDER="asc"private static final StringConstantPARAM_DB_ASCENDING_ORDER="dbAsc"private static final StringConstantPARAM_FILTER="filter"private static final StringConstantPARAM_FROM_DATE="fromDate"private static final StringConstantPARAM_MAX_RESULTS="maxResults"private static final StringConstantPARAM_SORT_BY="sortBy"private static final StringConstantPARAM_START_AFTER_ID="startAfterId"private static final StringConstantPARAM_TO_DATE="toDate"private static final StringConstantPARAM_TYPE="type"private static final StringConstantRESP_NEXT_START_AFTER_ID="nextStartAfterId"private static final StringConstantRESP_SCAN_INTERRUPTED="scanInterrupted"private static final StringConstantRESP_STATISTICS="statistics" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidapplyCreationDateRange(org.springframework.extensions.webscripts.WebScriptRequest req, AuditQuery auditQuery) Restrict the query to the entries written between the 'fromDate' and 'toDate' parameters, both inclusive.private AuditQuerybuildAuditQuery(org.springframework.extensions.webscripts.WebScriptRequest req) buildAuditQuery.voidexecute(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 AuditTypegetAuditType(String reqType) getAuditType.private DateparseDate(org.springframework.extensions.webscripts.WebScriptRequest req, String paramName, boolean isUpperBound) parseDate.voidsetBeCPGAuditService(BeCPGAuditService beCPGAuditService) Setter for the fieldbeCPGAuditService.private voidwritePage.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
-
PARAM_TYPE
ConstantPARAM_TYPE="type"- See Also:
-
PARAM_SORT_BY
ConstantPARAM_SORT_BY="sortBy"- See Also:
-
PARAM_FILTER
ConstantPARAM_FILTER="filter"- See Also:
-
PARAM_MAX_RESULTS
ConstantPARAM_MAX_RESULTS="maxResults"- See Also:
-
PARAM_ASCENDING_ORDER
ConstantPARAM_ASCENDING_ORDER="asc"- See Also:
-
PARAM_DB_ASCENDING_ORDER
ConstantPARAM_DB_ASCENDING_ORDER="dbAsc"- See Also:
-
PARAM_FROM_DATE
ConstantPARAM_FROM_DATE="fromDate"- See Also:
-
PARAM_TO_DATE
ConstantPARAM_TO_DATE="toDate"- See Also:
-
PARAM_START_AFTER_ID
ConstantPARAM_START_AFTER_ID="startAfterId"- See Also:
-
RESP_STATISTICS
ConstantRESP_STATISTICS="statistics"- See Also:
-
RESP_NEXT_START_AFTER_ID
ConstantRESP_NEXT_START_AFTER_ID="nextStartAfterId"- See Also:
-
RESP_SCAN_INTERRUPTED
ConstantRESP_SCAN_INTERRUPTED="scanInterrupted"- See Also:
-
beCPGAuditService
-
-
Constructor Details
-
GetStatisticsWebScript
public GetStatisticsWebScript()
-
-
Method Details
-
setBeCPGAuditService
Setter for the field
beCPGAuditService.- Parameters:
beCPGAuditService- aBeCPGAuditServiceobject
-
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
buildAuditQuery.
- Parameters:
req- aWebScriptRequestobject- Returns:
- a
AuditQueryobject
-
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- aWebScriptRequestobjectauditQuery- aAuditQueryobject- 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- aWebScriptRequestobject 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 dateisUpperBound- 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- aWebScriptResponseobjectpage- aAuditPageobject- Throws:
IOException- if the response cannot be written
-
getAuditType
getAuditType.
-