Class CustomQuerySelectorDatasource
- java.lang.Object
-
- org.openbravo.service.datasource.BaseDataSourceService
-
- org.openbravo.service.datasource.DefaultDataSourceService
-
- org.openbravo.service.datasource.ReadOnlyDataSourceService
-
- org.openbravo.userinterface.selector.CustomQuerySelectorDatasource
-
- All Implemented Interfaces:
DataSourceService
public class CustomQuerySelectorDatasource extends ReadOnlyDataSourceService
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALIAS_PREFIX
-
Constructor Summary
Constructors Constructor Description CustomQuerySelectorDatasource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getCount(Map<String,String> parameters)
Returns the count of objects based on the passed parameters.protected List<Map<String,Object>>
getData(Map<String,String> parameters, int startRow, int endRow)
Read/create the set of data as a list of Maps with key-value pairs.String
parseOptionalFilters(Map<String,String> parameters, Selector selector, SimpleDateFormat xmlDateFormat, List<Object> typedParameters)
Returns the selectors HQL query.String
parseOptionalFilters(Map<String,String> parameters, Selector selector, SimpleDateFormat xmlDateFormat, List<Object> typedParameters, Map<String,Object> namedParameters)
Returns the selectors HQL query.-
Methods inherited from class org.openbravo.service.datasource.ReadOnlyDataSourceService
add, fetch, fetch, remove, sort, update
-
Methods inherited from class org.openbravo.service.datasource.DefaultDataSourceService
add, addFetchParameters, fetch, getDataSourceProperties, getInitialProperties, remove
-
Methods inherited from class org.openbravo.service.datasource.BaseDataSourceService
checkEditDatasourceAccess, checkFetchDatasourceAccess, getDataSource, getDataUrl, getEntity, getName, getTemplate, getWhereAndFilterClause, getWhereClause, handleExceptionUnsecuredDSAccess, setDataSource, setDataUrl, setEntity, setName, setWhereClause
-
-
-
-
Field Detail
-
ALIAS_PREFIX
public static final String ALIAS_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCount
protected int getCount(Map<String,String> parameters)
Description copied from class:ReadOnlyDataSourceService
Returns the count of objects based on the passed parameters.- Specified by:
getCount
in classReadOnlyDataSourceService
- Parameters:
parameters
- the parameters passed in from the request- Returns:
- the total number of objects
-
getData
protected List<Map<String,Object>> getData(Map<String,String> parameters, int startRow, int endRow)
Description copied from class:ReadOnlyDataSourceService
Read/create the set of data as a list of Maps with key-value pairs.- Specified by:
getData
in classReadOnlyDataSourceService
- Parameters:
parameters
- the parameters passed in from the requeststartRow
- the first row to read (maybe -1 to indicate no startrow)endRow
- the last row to read (maybe -1 to indicate no endrow- Returns:
- the number of objects read, note that this maybe more than endRow - startRow + 1. The startRow parameter should be strictly followed though.
-
parseOptionalFilters
public String parseOptionalFilters(Map<String,String> parameters, Selector selector, SimpleDateFormat xmlDateFormat, List<Object> typedParameters)
Returns the selectors HQL query. In case that it contains the '@additional_filters@' String it is replaced by a set of filter clauses. These include a filter clause:- for the main entity's client by the context's client.
- for the main entity's organization by an organization list see
DataSourceUtils.getOrgs(String)
- with Selector's default filter expression.
- for each default expression defined on the selector fields.
- for each selector field in case exists a value for it on the parameters param.
- Parameters:
parameters
- Map of String values with the request parameters.selector
- the selector that it is being retrieved the data.xmlDateFormat
- SimpleDataFormat to be used to parse date Strings.- Returns:
- a String with the HQL to be executed.
-
parseOptionalFilters
public String parseOptionalFilters(Map<String,String> parameters, Selector selector, SimpleDateFormat xmlDateFormat, List<Object> typedParameters, Map<String,Object> namedParameters)
Returns the selectors HQL query. In case that it contains the '@additional_filters@' String it is replaced by a set of filter clauses. These include a filter clause:- for the main entity's client by the context's client.
- for the main entity's organization by an organization list see
DataSourceUtils.getOrgs(String)
- with Selector's default filter expression.
- for each default expression defined on the selector fields.
- for each selector field in case exists a value for it on the parameters param.
- Parameters:
parameters
- Map of String values with the request parameters.selector
- the selector that it is being retrieved the data.xmlDateFormat
- SimpleDataFormat to be used to parse date Strings.typedParameters
- Typed parameters to be used in the querynamedParameters
- Named parameters to be used in the query- Returns:
- a String with the HQL to be executed.
-
-