Package org.openbravo.service.json
Class DataEntityQueryService
- java.lang.Object
-
- org.openbravo.service.json.DataEntityQueryService
-
public class DataEntityQueryService extends Object
Implements a service which can handle different types of query and paging options. This class supports standard parameters for paging and flexible parameters for filtering queries. Sorting is supported on one property. This service class only supports querying for oneEntity
. This service class can not be used as a singleton.- Author:
- mtaal
-
-
Field Summary
Fields Modifier and Type Field Description static String
PARAM_DELIMITER
-
Constructor Summary
Constructors Constructor Description DataEntityQueryService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFilterParameter(String key, String value)
OBQuery<BaseOBObject>
buildOBQuery()
Build an OBQuery object using the generated where, order by and select clauses.void
clearCachedValues()
int
count()
Count the records which fit in the filter criteria.String
getDistinct()
String
getEntityName()
Integer
getFirstResult()
Integer
getMaxResults()
AdvancedQueryBuilder
getQueryBuilder()
int
getRowNumber(String targetRecordId)
List<String>
getSummaryFields()
String
getSummarySettings()
String
getWhereClause()
boolean
isFilterOnActive()
boolean
isFilterOnReadableClients()
boolean
isFilterOnReadableOrganizations()
List<BaseOBObject>
list()
Return the list ofBaseOBObject
objects retrieved by querying using the filter criteria.org.hibernate.ScrollableResults
scroll()
void
setAdditionalProperties(List<String> additionalProperties)
void
setCriteria(org.codehaus.jettison.json.JSONObject criteria)
void
setDistinct(String distinct)
void
setDoOrExpression()
If called then the where clause filters will be considered to be an or expression.void
setEntityName(String entityName)
void
setFilterOnActive(boolean filterOnActive)
void
setFilterOnReadableClients(boolean filterOnReadableClients)
void
setFilterOnReadableOrganizations(boolean filterOnReadableOrganizations)
void
setFirstResult(Integer firstResult)
void
setJoinAssociatedEntities(boolean joinAssociatedEntities)
void
setMaxResults(Integer maxResults)
void
setOrderBy(String orderBy)
void
setSubEntity(String subEntityName, DataEntityQueryService dataEntityQueryService, Property distinctProperty)
Deprecated.void
setSummarySettings(String summarySettings)
void
setTextMatching(String textMatchingName)
The text matching strategy used.void
setUseAlias()
Tells the query builder to use theJsonConstants.MAIN_ALIAS
as the alias for prefixing all properties in the where clause and order by.
-
-
-
Field Detail
-
PARAM_DELIMITER
public static final String PARAM_DELIMITER
- See Also:
- Constant Field Values
-
-
Method Detail
-
count
public int count()
Count the records which fit in the filter criteria.- Returns:
- the number of records in the filter.
-
list
public List<BaseOBObject> list()
Return the list ofBaseOBObject
objects retrieved by querying using the filter criteria.- Returns:
- the list of retrieved objects from the db.
-
scroll
public org.hibernate.ScrollableResults scroll()
- Returns:
- a result which can be scrolled forward only and the results are not cached
-
getWhereClause
public String getWhereClause()
-
buildOBQuery
public OBQuery<BaseOBObject> buildOBQuery()
Build an OBQuery object using the generated where, order by and select clauses.
-
getQueryBuilder
public AdvancedQueryBuilder getQueryBuilder()
-
getRowNumber
public int getRowNumber(String targetRecordId)
-
getFirstResult
public Integer getFirstResult()
-
setFirstResult
public void setFirstResult(Integer firstResult)
-
getMaxResults
public Integer getMaxResults()
-
setMaxResults
public void setMaxResults(Integer maxResults)
-
setOrderBy
public void setOrderBy(String orderBy)
-
getEntityName
public String getEntityName()
-
setEntityName
public void setEntityName(String entityName)
-
setTextMatching
public void setTextMatching(String textMatchingName)
The text matching strategy used. See here for a description: http://www.smartclient.com/docs/7.0rc2/a/b/c/go.html#attr..ComboBoxItem.textMatchStyle- Parameters:
textMatchingName
- the following values are allowed: startsWith, substring, exact
-
setCriteria
public void setCriteria(org.codehaus.jettison.json.JSONObject criteria)
-
setDoOrExpression
public void setDoOrExpression()
If called then the where clause filters will be considered to be an or expression.
-
setUseAlias
public void setUseAlias()
Tells the query builder to use theJsonConstants.MAIN_ALIAS
as the alias for prefixing all properties in the where clause and order by.
-
isFilterOnActive
public boolean isFilterOnActive()
-
setFilterOnActive
public void setFilterOnActive(boolean filterOnActive)
-
setJoinAssociatedEntities
public void setJoinAssociatedEntities(boolean joinAssociatedEntities)
-
clearCachedValues
public void clearCachedValues()
-
getDistinct
public String getDistinct()
-
setDistinct
public void setDistinct(String distinct)
-
getSummarySettings
public String getSummarySettings()
-
setSummarySettings
public void setSummarySettings(String summarySettings)
-
isFilterOnReadableOrganizations
public boolean isFilterOnReadableOrganizations()
-
setFilterOnReadableOrganizations
public void setFilterOnReadableOrganizations(boolean filterOnReadableOrganizations)
-
isFilterOnReadableClients
public boolean isFilterOnReadableClients()
-
setFilterOnReadableClients
public void setFilterOnReadableClients(boolean filterOnReadableClients)
-
setSubEntity
@Deprecated public void setSubEntity(String subEntityName, DataEntityQueryService dataEntityQueryService, Property distinctProperty)
Deprecated.
-
-