Parses and holds the common request parameters shared by report pages: date range, selected organisations, selected filter terms and whether to include column headings in the output. A single instance is lazily parsed from the current HTTP request's parameters on first access, or can be built directly from a supplied parameter map for use outside a request, such as a background export job. The current instance can be published to a thread-local so it is reachable from code that does not have direct access to the request, such as query execution.

Implements: Serializable


Properties

PropertyReturnsDescription
finishDateEnd of the report's date range. Parsed from the "finishDate" or "toDate" request parameter on first access if this instance was not built with an explicit range, and defaults to the common report finish date if neither is present.
headingsbooleanWhether the report output should include column headings. True unless explicitly set to false when this instance was constructed.
orgIdsList<Long>Ids of the organisations selected for the report, parsed from the "term-orgs" request parameter on first access.
paramsMap<String,String>The raw, unparsed request parameters this instance was built from.
selectedTermsMap<String,List<String>>Selected filter terms, keyed by term name with the request parameter's "term-" prefix stripped, parsed on first access from every "term-*" request parameter other than "term-orgs".
startDateStart of the report's date range. Parsed from the "startDate" or "fromDate" request parameter on first access if this instance was not built with an explicit range, and defaults to the common report start date if neither is present.

Methods

getFinish()

Returns: Date

End of the report's date range. Parsed from the "finishDate" or "toDate" request parameter on first access if this instance was not built with an explicit range, and defaults to the common report finish date if neither is present.

getOrgIds()

Returns: List<Long>

Ids of the organisations selected for the report, parsed from the "term-orgs" request parameter on first access.

getSelectedTerms()

Returns: Map<String,List<String>>

Selected filter terms, keyed by term name with the request parameter's "term-" prefix stripped, parsed on first access from every "term-*" request parameter other than "term-orgs".

getStart()

Returns: Date

Start of the report's date range. Parsed from the "startDate" or "fromDate" request parameter on first access if this instance was not built with an explicit range, and defaults to the common report start date if neither is present.

isHeadings()

Returns: boolean

Whether the report output should include column headings. True unless explicitly set to false when this instance was constructed.

splitDatesByDays(ReportParams rootParams, int days)

Returns: List<ReportParams>

Splits this instance's date range into a list of consecutive ReportParams, none spanning more than the given number of days, by recursively bisecting the range around its midpoint. Each split copy shares this instance's organisation ids, selected terms and raw parameters; only the first copy in the returned list keeps this instance's headings setting.

ParameterDescription
rootParamsunused, retained for compatibility with existing callers
daysthe maximum number of days each split range may span

getParams()

Returns: Map<String,String>

The raw, unparsed request parameters this instance was built from.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.