Class Request
A request is executed by calling the method execute().
Multi-threading
Note that this class is not synchronized.
Performance
See Setting a fetch size
on optimization with respect to the expected size of the RequestResult
and the limitations when using PostgreSQL as the underlying database.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionexecute()Executes the request and returns the result.intReturns the current filter, if any.booleanpaginate()Returns a new object to be used to paginate over the result of this request.voidsetFetchSize(int rows) Provides a hint to the underlying database as to the number of records to fetch at a time from the result ofexecutingthis request.voidsetIncludeOcculting(boolean includeOcculting) If the argument istrue, this method specifies that the request result will include records in occulting mode.voidSets a locale to the request.voidSpecifies that the request result will be sorted by primary key in ascending order.voidsetSession(Session aSession) Sets the user session on the request.voidsetSortCriteria(RequestSortCriteria aSortCriteria) Specifies that the request result will be sorted according to the specified criteria.voidsetSpecificFilter(AdaptationFilter aFilter) Specifies that the request result will only include the records that satisfy the filter passed as an argument.voidsetXPathFilter(XPathFilter anXPathFilter) Specifies that the request result will only include the records which satisfy the specified XPath filter.voidsetXPathFilter(String aPredicateExpression) Specifies that the request result will only include the records which satisfy the specified XPath predicate.voidsetXPathParameter(String aParameterName, Object aParameterValue) For the current XPath filter, sets the value of the specified parameter.toString()
-
Method Details
-
isIncludeOcculting
public boolean isIncludeOcculting()- See Also:
-
setIncludeOcculting
public void setIncludeOcculting(boolean includeOcculting) If the argument istrue, this method specifies that the request result will include records in occulting mode.If the argument is
false, records in occulting mode are not included in the result. If the property is not set, it is considered to befalse. -
getLocale
- Since:
- 5.5.0
- See Also:
-
setLocale
Sets a locale to the request. It may be needed if the request filter is locale-dependent, i.e. a predicate filter of the formosd:label(./localized_field)='A'.- Since:
- 5.5.0
- See Also:
-
setSession
Sets the user session on the request. This activates the permission rules on the result and sets the session locale.- Since:
- 5.5.0
- See Also:
-
getSortCriteria
- See Also:
-
setOrderByPrimaryKey
public void setOrderByPrimaryKey()Specifies that the request result will be sorted by primary key in ascending order.- See Also:
-
setSortCriteria
Specifies that the request result will be sorted according to the specified criteria.If this method is not called, the default sort order is undefined, in which case the results will be sorted according to the order of whichever index is selected for computing the request. If no filter is specified, the result will be ordered according to the primary key fields (ascending).
- Throws:
IllegalArgumentException- if the specified sort is not consistent with the table structure.- See Also:
-
getSpecificFilter
Returns the current filter, if any. If an XPath filter has been specified, returns its programmatic version. -
setSpecificFilter
Specifies that the request result will only include the records that satisfy the filter passed as an argument.If not set, the value of this property is
null, and no specific filtering will be performed.If a filter has been specified by means of a method
setXPathFilter, it is replaced by the specified filter.- See Also:
-
setXPathFilter
Specifies that the request result will only include the records which satisfy the specified XPath predicate.This method is equivalent to:
XPathFilter xpf = XPathFilter.newFilter(false, aPredicateExpression); this.setXPathFilter(xpf);
Performance considerations: If the specified predicate must be often reused by multiple
Requestobjects, it is recommended to use a cached filter. Parameterized expressions also help reuse.- See Also:
-
setXPathFilter
Specifies that the request result will only include the records which satisfy the specified XPath filter.If a filter has been specified by means of the method
, it is replaced by the specified XPath filter.setSpecificFilter(AdaptationFilter)It is recommended to use the XPath filter when the predicate must be applied more than once, with different values. It allows using parameters and avoiding parsing the same predicate expression each time it is used.
- Since:
- 5.7.0
- See Also:
-
setXPathParameter
For the current XPath filter, sets the value of the specified parameter.For example, if the current filter is the XPath predicate
./lastName=$myName, to set the parametermyNameto 'Smith', the method must be invoked this way:aRequest.setXPathParameter("myName", "Smith");- Parameters:
aParameterName- name of the parameteraParameterValue- value of the parameter- Throws:
IllegalArgumentException- if one of the specified arguments is not defined or if the specified parameter name has basic inconsistencies.IllegalStateException- if no XPath filter has been specified.- Since:
- 5.7.0
- See Also:
-
getFetchSize
public int getFetchSize()- See Also:
-
setFetchSize
public void setFetchSize(int rows) Provides a hint to the underlying database as to the number of records to fetch at a time from the result ofexecutingthis request. If the fetch size specified is '0', the underlying implementation determines the fetch size independently.See Setting a fetch size for the limitations when using PostgreSQL as the underlying database.
- Parameters:
rows- the number of rows to fetch- See Also:
-
execute
Executes the request and returns the result.- Throws:
IncompatibleChangeError
-
paginate
Returns a new object to be used to paginate over the result of this request.- Since:
- 5.8.0
-
toString
-