public class ItemContext
extends java.lang.Object
Typical example for using this class are:
A client application storing list/table settings
SessionControl sc = ... ItemContext current = sc.getCurrentContext(Item.SAMPLE); current.setRowsPerPage(50); current.setPage(0); current.setSortProperty("name"); current.setSortDirection(SortDirection.DESC); current.setPropertyFilter( new PropertyFilter("name", Operator.LIKE, "Nicklas%", Type.STRING) ); ItemQuery query = Sample.getQuery(); current.configureQuery(query, true); // The query will now return the 50 first samples with a // a name starting with 'Nicklas' sorted in descending order
A client application using filter information when creating new items
SessionControl sc = ... DbControl dc = sc.newDbControl(); ItemContext current = sc.getCurrentContext(Item.SAMPLE); Sample sample = Sample.getNew(dc); if (current.getPropertyValue("name") != null) { sample.setName(current.getPropertyValue("name")); } // The name is now 'Nicklas%'
Plugin finds out which items in a list has been selected
SessionControl sc = ... ItemContext current = sc.getCurrentContext(Item.SAMPLE); ItemQuery query = Sample.getQuery(); Set selected = current.getSelected(); if (selected != null && selected.size() > 0) { query.restrict( Restrictions.in(Hql.property("id"), Expressions.parameter("selected", selected, Type.INT)) ); ) // The query will now return the selected items only
An import plugin asks client application for a file with a specific file type
public RequestInformation getRequestInformation(GuiContext context, String command) throws BaseException { RequestInformation requestInformation = null; if (command.equals(Request.COMMAND_CONFIGURE_PLUGIN)) { requestInformation = getConfigurePluginParameters(context); } else if (command.equals(Request.COMMAND_CONFIGURE_JOB)) { requestInformation = getConfigureJobParameters(context); ItemContext fileContext = sc.getCurrentContext(Item.FILE); fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER)); } return requestInformation; }
SessionControl.getCurrentContext(Item)
,
SessionControl.saveCurrentContextAs(Item, String, boolean, boolean)
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ItemContext.PropertyFilterPair
Holds a pair of filter.
|
static class |
ItemContext.SortDirection
Enumeration used to specify the sort direction.
|
Modifier and Type | Field and Description |
---|---|
private static JepFunction |
ch |
private int |
contextId |
static java.lang.String |
DEFAULT_NAME
This is the name of the default context which is automatically saved
when a user is logging out.
|
private java.util.Set<Include> |
include |
private int |
itemId |
private Item |
itemType |
private java.lang.String |
message |
private static JepFunction |
mrep |
private java.lang.String |
name |
private static java.util.Set<java.lang.String> |
NO_AUTO_JOIN_PREFIXES |
private boolean |
noPaging |
private int |
numFilterRows |
private java.util.Map<java.lang.String,java.lang.Object> |
objects |
private int |
page |
private Permission |
permission |
private java.util.Map<java.lang.String,ItemContext.PropertyFilterPair> |
propertyFilters |
private Filter<java.lang.String> |
propertyInspector |
private Query |
query |
private static JepFunction |
raw |
private static JepFunction |
rawCh |
private static JepFunction |
rep |
private int |
rowsPerPage |
private java.util.Set<java.lang.Integer> |
selected |
private java.util.Map<java.lang.String,java.lang.String> |
settings |
private ItemContext.SortDirection |
sortDirection |
private java.lang.String |
sortProperty |
private java.lang.String |
subContext |
Constructor and Description |
---|
ItemContext(ContextData context)
Create a new context from a loaded database object.
|
ItemContext(Item itemType,
ItemListSyncFilterData syncFilter)
Initialize the context from an item list synchronization filter.
|
ItemContext(Item itemType,
java.lang.String subContext,
java.lang.String name)
Create a new empty context.
|
ItemContext(java.lang.String sortProperty,
ItemContext.SortDirection sortDirection,
int rowsPerPage,
int page)
Create a new context.
|
Modifier and Type | Method and Description |
---|---|
int |
addFilterRows(int numRows)
Add filter rows to the table.
|
void |
clearAllRecent()
Clear all recently used values lists.
|
void |
clearRecent(Item itemType)
Clear the recently used items list from items of the specified type.
|
void |
clearRecent(Item itemType,
ItemSubtype subtype)
Clear the recently used items list from items of the specified type.
|
void |
clearRecent(Item itemType,
java.lang.String subList)
Clear the recently used items sublist from items of the specified type.
|
void |
clearRecent(java.lang.String key)
Clear the recently used values list.
|
void |
configureQuery(DbControl dc,
AbstractSqlQuery query,
java.util.List<java.lang.String> selectionList)
Deprecated.
In 3.1, use
configureQuery(DbControl, SqlQuery, List) instead |
void |
configureQuery(DbControl dc,
EntityQuery query,
boolean autoLeftJoin)
Use the settings in this context to configure a query.
|
void |
configureQuery(DbControl dc,
SqlQuery query,
java.util.List<java.lang.String> selectionList)
Use the settings in this context to configure a dynamic query.
|
(package private) void |
copyFrom(ItemContext other,
boolean forceAll)
Copy settings from another context to this context.
|
(package private) void |
copyFromSyncFilter(ItemListSyncFilterData syncFilter) |
void |
copyObjectsAndTemporaryFilters(ItemContext other)
Copies all objects and temporary filters from this context
to another context.
|
(package private) void |
copyToSyncFilter(ItemListSyncFilterData syncFilter)
Create a new item list synchronization filter from this context.
|
void |
filterOnSelectedItems(EntityQuery query)
Add a filter to the given query that restricts it to only return items that
have been selected.
|
int |
getContextId()
Get the database ID of this context.
|
(package private) ContextData |
getData(java.lang.String name,
UserData user,
ClientData client,
boolean isPublic)
Create a new database context object from this context.
|
static Expression |
getDynamicExpression(DbControl dc,
SqlQuery query,
java.lang.String propertyDef)
Create an
Expression from a string. |
static Expression |
getDynamicExpression(DbControl dc,
java.lang.String propertyDef)
Deprecated.
In 3.9.2, use
getDynamicExpression(DbControl, SqlQuery, String) instead |
static Select |
getDynamicSelect(DbControl dc,
SqlQuery query,
java.lang.String propertyDef)
Same as
getDynamicExpression(DbControl, String) but generates
a select object instead. |
static Select |
getDynamicSelect(DbControl dc,
java.lang.String propertyDef)
Deprecated.
In 3.9.2, use
getDynamicSelect(DbControl, SqlQuery, String) instead |
Restriction |
getFilterRestriction(java.lang.String property,
DbControl dc,
EntityQuery query)
Create a restriction from a property filter on filter row 0.
|
Restriction |
getFilterRestriction(java.lang.String property,
int filterRow,
DbControl dc,
EntityQuery query)
Create a restriction from a property filter on the given filter row.
|
int |
getFilterRows()
Get the number of filter rows to display on the list page.
|
int |
getId()
Get the ID of the current item in this context.
|
java.util.Set<Include> |
getInclude()
Get a
Set object to specify Include options for
a query. |
Permission |
getItemPermission()
The permission the logged in user must have for items returned
by a query.
|
Item |
getItemType()
Get the type of item this object is storing context for.
|
java.lang.String |
getMessage()
Get a message that should be displayed by a client application as
soon as it is appropriate to do so.
|
java.lang.String |
getName()
Get the name of this context.
|
int |
getNumPropertyFilters()
Get the total number of property filters stored in this
context.
|
int |
getNumPropertyFilters(int filterRow)
Get the number of property filters stored in this
context for the given filter row.
|
int |
getNumRecent(Item itemType)
Get the number of recently used items in the list.
|
int |
getNumRecent(Item itemType,
ItemSubtype subtype)
Get the number of recently used items in the list.
|
int |
getNumRecent(Item itemType,
java.lang.String subList)
Get the number of recently used items in a list with a sublist.
|
int |
getNumRecent(java.lang.String key)
Get the number of recently used value in the list.
|
java.lang.Object |
getObject(java.lang.String name)
Get an object.
|
int |
getPage()
Get the current table page.
|
PropertyFilter |
getPropertyFilter(java.lang.String property)
Get a filter for a property on filter row 0.
|
PropertyFilter |
getPropertyFilter(java.lang.String property,
int filterRow)
Get a filter for a property.
|
java.util.Collection<PropertyFilter> |
getPropertyFilters()
Get a collection of all property filters stored in this context.
|
java.util.Collection<PropertyFilter> |
getPropertyFilters(int filterRow)
Get a collection of all property filters stored in this context for
a given filter row.
|
java.lang.Object |
getPropertyObject(java.lang.String property) |
java.lang.String |
getPropertyValue(java.lang.String property)
Get the value of a property filter on row 0.
|
java.lang.String |
getPropertyValue(java.lang.String property,
int filterRow)
Get the value of a property filter on the given filter row.
|
Query |
getQuery() |
java.util.List<? extends BasicItem> |
getRecent(DbControl dc,
Item itemType)
Get all recently used items of the specified type.
|
BasicItem |
getRecent(DbControl dc,
Item itemType,
int index) |
java.util.List<? extends BasicItem> |
getRecent(DbControl dc,
Item itemType,
ItemSubtype subtype)
Get all recently used items of the specified type.
|
java.util.List<? extends BasicItem> |
getRecent(DbControl dc,
Item itemType,
java.lang.String subList)
Get all recently used items of the specified type in a given sublist.
|
BasicItem |
getRecent(DbControl dc,
Item itemType,
java.lang.String subList,
int index) |
java.util.List<java.lang.String> |
getRecent(java.lang.String key)
Get all recently used values for the specified key.
|
java.lang.String |
getRecent(java.lang.String key,
int index) |
private java.lang.String |
getRecentSettingName(java.lang.String key) |
int |
getRowsPerPage()
Get the number of rows the current table page is displaying.
|
java.util.Set<java.lang.Integer> |
getSelected()
Get a
Set object to specify the ID:s of all items that are
currently selected. |
java.lang.String |
getSetting(java.lang.String name)
Get a value.
|
ItemContext.SortDirection |
getSortDirection()
If the items are sorted in ascending or descending order.
|
Order |
getSortOrder()
Get the current sort property as an
Order instance. |
java.lang.String |
getSortProperty()
Get the name of the property the current listing is sorted by.
|
java.lang.String |
getSubContext()
Get the sub-context name of this context.
|
boolean |
hasPropertyFilter(java.lang.String property)
Checks if there is a filter for the given property regardless of
filter row.
|
private void |
initPropertyFilters(java.util.Map<java.lang.String,PropertyFilterData> filterData)
Initialize the property filters by loading them from the given map.
|
private java.util.List<? extends BasicItem> |
loadRecent(DbControl dc,
Item itemType,
java.lang.String key) |
private BasicItem |
loadRecent(DbControl dc,
Item itemType,
java.lang.String key,
int index) |
void |
removeAllPropertyFilters()
Remove all property filter from this context.
|
void |
removeAllTemporaryFilters()
Remove all temporary filters.
|
int |
removeFilterRow(int filterIndex)
Remove all filters from the specified filter row.
|
java.lang.Object |
removeObject(java.lang.String name)
Remove a value.
|
void |
removePropertyFilter(java.lang.String property)
Remove a property filter on filter row 0.
|
void |
removePropertyFilter(java.lang.String property,
int filterRow)
Remove a property filter on the given filter row.
|
java.lang.String |
removeSetting(java.lang.String name)
Remove a value.
|
void |
removeTemporaryFilter(java.lang.String property)
Remote a temporary filter for the given property on filter row 0.
|
void |
removeTemporaryFilter(java.lang.String property,
int filterRow)
Remote a temporary filter for the given property.
|
void |
setId(int id)
Set the ID of the current item in this context.
|
void |
setItemPermission(Permission permission)
Specify the permission the logged in user must have for items returned
by a query.
|
void |
setMessage(java.lang.String message)
Set a message to be displayed by a client application as soon as
it is appropriate to do so.
|
java.lang.Object |
setObject(java.lang.String name,
java.lang.Object value)
Set a value.
|
void |
setPage(int page)
Set the current table page.
|
void |
setPropertyFilter(PropertyFilter filter)
Set a property filter.
|
void |
setPropertyInspector(Filter<java.lang.String> filter)
Set a filter for this context that is used to inspect which properties
that are allowed to be used in queries.
|
void |
setQuery(Query query) |
void |
setRecent(BasicItem item,
int maxInList)
Add an item to the "recently used items" list.
|
void |
setRecent(BasicItem item,
ItemSubtype subtype,
int maxInList)
Add an item to the "recently used items" list when used for a specific
item subtype.
|
void |
setRecent(BasicItem item,
java.lang.String subList,
int maxInList)
Add an item to the "recently used items" list.
|
private void |
setRecent(java.lang.String key,
java.util.List<java.lang.String> recent) |
void |
setRecent(java.lang.String key,
java.lang.String value,
int maxInList)
Add a value to the list of recently used values for the specified key.
|
void |
setRowsPerPage(int rowsPerPage)
Set the number of rows the current table page should show.
|
java.lang.String |
setSetting(java.lang.String name,
java.lang.String value)
Set a value.
|
void |
setSortDirection(ItemContext.SortDirection sortDirection)
Set the sort direction (ascending or descending) of the current listing.
|
void |
setSortProperty(java.lang.String sortProperty)
Set the name of the property that the current listing is sorted by.
|
private void |
storePropertyFilters(java.util.Map<java.lang.String,PropertyFilterData> filterData)
Store the current property filters and save them in the give filterData
map.
|
public static final java.lang.String DEFAULT_NAME
private static final JepFunction ch
private static final JepFunction rawCh
private static final JepFunction raw
private static final JepFunction rep
private static final JepFunction mrep
private final java.lang.String name
private final Item itemType
private final java.lang.String subContext
private int contextId
private int itemId
private java.util.Set<java.lang.Integer> selected
private boolean noPaging
private int rowsPerPage
private int page
private int numFilterRows
private java.lang.String sortProperty
private java.lang.String message
private ItemContext.SortDirection sortDirection
private java.util.Set<Include> include
private Permission permission
private java.util.Map<java.lang.String,ItemContext.PropertyFilterPair> propertyFilters
private java.util.Map<java.lang.String,java.lang.String> settings
private java.util.Map<java.lang.String,java.lang.Object> objects
private Query query
private Filter<java.lang.String> propertyInspector
private static final java.util.Set<java.lang.String> NO_AUTO_JOIN_PREFIXES
public ItemContext(java.lang.String sortProperty, ItemContext.SortDirection sortDirection, int rowsPerPage, int page)
sortProperty
- The property used to sort a listsortDirection
- If the items should be sorted in ascending or descending orderrowsPerPage
- The number of rows to display on a single pagepage
- The page number of the currently displayed page, starting at 0ItemContext(Item itemType, java.lang.String subContext, java.lang.String name)
ItemContext(ContextData context)
ItemContext(Item itemType, ItemListSyncFilterData syncFilter)
SyncFilter
. It should
not be used for representing context in a GUI. To do this start
with a regular context and the use copyFromSyncFilter(ItemListSyncFilterData)
instead.ContextData getData(java.lang.String name, UserData user, ClientData client, boolean isPublic)
name
- The name to use, or null if the current name should be useduser
- The user that should own the context objectclient
- The client application currently in useisPublic
- If the context should be public or notvoid copyToSyncFilter(ItemListSyncFilterData syncFilter)
getData(String, UserData, ClientData, boolean)
but only
keep filter-related settings.void copyFromSyncFilter(ItemListSyncFilterData syncFilter)
private void storePropertyFilters(java.util.Map<java.lang.String,PropertyFilterData> filterData)
private void initPropertyFilters(java.util.Map<java.lang.String,PropertyFilterData> filterData)
storePropertyFilters(Map)
.public Item getItemType()
public java.lang.String getSubContext()
public java.lang.String getName()
public int getContextId()
public int getId()
public void setId(int id)
id
- The ID of the item, or 0 if no item is currentpublic int getRowsPerPage()
public void setRowsPerPage(int rowsPerPage)
rowsPerPage
- The number of rows to show on a pagepublic int getPage()
public void setPage(int page)
page
- The number of the page, starting at 0public int getFilterRows()
public int addFilterRows(int numRows)
numRows
- The number of rows to add, must be greater than 0public int removeFilterRow(int filterIndex)
filterIndex
- A value between 0 and number of filter rows (-1)public java.lang.String getSortProperty()
public void setSortProperty(java.lang.String sortProperty)
getSortDirection()
,
but this can be overridden by using '+' or '-' as a prefix for
a property.
This property is stored in the database.sortProperty
- The name of the propertypublic ItemContext.SortDirection getSortDirection()
public void setSortDirection(ItemContext.SortDirection sortDirection)
sortDirection
- The sort directionpublic Order getSortOrder()
Order
instance.
If multiple properties are used for sorting, this method only
returns the first property.public java.lang.String getMessage()
configureQuery(DbControl, EntityQuery, boolean)
sets an error message if it couldn't configure the query for some reason.public void setMessage(java.lang.String message)
configureQuery(DbControl, EntityQuery, boolean)
sets an error message if it couldn't configure the query for some reason.
This property is not stored in the database.message
- The messagepublic java.util.Set<Include> getInclude()
Set
object to specify Include
options for
a query. This property is stored in the database.EntityQuery
public void setItemPermission(Permission permission)
public Permission getItemPermission()
EntityQuery.getItemPermission()
public java.util.Set<java.lang.Integer> getSelected()
Set
object to specify the ID:s of all items that are
currently selected. This property is not stored in the database.public void setPropertyFilter(PropertyFilter filter)
filter
- The new property filterPropertyFilter.isTemporary()
public PropertyFilter getPropertyFilter(java.lang.String property)
getPropertyFilter(String, int)
public PropertyFilter getPropertyFilter(java.lang.String property, int filterRow)
property
- The name of the propertyfilterRow
- The index of the filter row should be between 0 and number of filter rows (-1)PropertyFilter
object or
null if no filter existspublic java.util.Collection<PropertyFilter> getPropertyFilters()
public java.util.Collection<PropertyFilter> getPropertyFilters(int filterRow)
filterRow
- The index of the filter row should be between 0 and number of filter rows (-1)public int getNumPropertyFilters()
public int getNumPropertyFilters(int filterRow)
filterRow
- The index of the filter row should be between 0 and number of filter rows (-1)public boolean hasPropertyFilter(java.lang.String property)
getPropertyFilter(String, int)
for non-null.property
- The name of the propertypublic java.lang.String getPropertyValue(java.lang.String property)
getPropertyValue(String, int)
public java.lang.String getPropertyValue(java.lang.String property, int filterRow)
getPropertyFilter(property, filterRow).getValue()
but also handles the case of a non-existing filter for the
specfied property.property
- The name of the propertyfilterRow
- The index of the filter row should be between 0 and number of filter rows (-1)public void removePropertyFilter(java.lang.String property)
removePropertyFilter(String, int)
public void removePropertyFilter(java.lang.String property, int filterRow)
property
- The name of the propertyfilterRow
- The index of the filter row should be between 0 and number of filter rows (-1)public void removeTemporaryFilter(java.lang.String property)
removeTemporaryFilter(String, int)
public void removeTemporaryFilter(java.lang.String property, int filterRow)
property
- The name of the propertyfilterRow
- The index of the filter row should be between 0 and number of filter rows (-1)public java.lang.Object getPropertyObject(java.lang.String property)
public void removeAllPropertyFilters()
public void removeAllTemporaryFilters()
public Restriction getFilterRestriction(java.lang.String property, DbControl dc, EntityQuery query)
getFilterRestriction(String, int, DbControl, EntityQuery)
public Restriction getFilterRestriction(java.lang.String property, int filterRow, DbControl dc, EntityQuery query)
property
- The propertyfilterRow
- The index of the filter row should be between 0 and number of filter rows (-1)dc
- A DbControl that should be used if database access is neededquery
- The query that the filter is going to be used in (can be
null for most properties)public void setRecent(BasicItem item, int maxInList)
maxInList
items.
Note! The lists are stored as string of colon-separated ID:s in
the setting given by the item type. For example the recently used
protocols are found in the setting:
getSetting("PROTOCOL.recent")
. Client code is advised to
not change these settings.
item
- The item to addmaxInList
- The maximum number of items in the listpublic void setRecent(BasicItem item, ItemSubtype subtype, int maxInList)
maxInList
items.
Note! The lists are stored as string of colon-separated ID:s in
the setting given by the item type. For example the recently used
protocols are found in the setting:
getSetting("PROTOCOL.#subtype-id.recent")
. Client code is advised to
not change these settings.
item
- The item to addsubtype
- The subtype of the parent item (can be null)maxInList
- The maximum number of items in the listpublic void setRecent(BasicItem item, java.lang.String subList, int maxInList)
maxInList
items.
Note! The lists are stored as string of colon-separated ID:s in
the setting given by the item type and sublist name. For example the
recently used protocols are found in the setting:
getSetting("PROTOCOL.subList.recent")
. Client code is advised to
not change these settings.
item
- The item to addsubList
- The sublistmaxInList
- The maximum number of items in the listpublic void setRecent(java.lang.String key, java.lang.String value, int maxInList)
maxInList
values. If the value is already in the list
it is moved to the front of the list.
Note! The lists are stored as string of colon-separated ID:s in
the setting given by the key. For example, if key is "RAWDATATYPE",
the recently used values are found in the setting:
getSetting("RAWDATATYPE.recent")
. Client code is advised to
not change these settings.
key
- The key to the listvalue
- The value to addmaxInList
- The maximum number of values in the listpublic int getNumRecent(Item itemType)
itemType
- The type of itemspublic int getNumRecent(Item itemType, ItemSubtype subtype)
itemType
- The type of itemssubtype
- The subtype of the parent item (can be null)public int getNumRecent(Item itemType, java.lang.String subList)
itemType
- The type of itemssubList
- The name of the sublistpublic int getNumRecent(java.lang.String key)
key
- The key to the listpublic java.util.List<? extends BasicItem> getRecent(DbControl dc, Item itemType)
getNumRecent(Item)
may return a larger number than what is actually returned in this
list.dc
- The DbControl used to access the databaseitemType
- The type of itemspublic java.util.List<? extends BasicItem> getRecent(DbControl dc, Item itemType, ItemSubtype subtype)
getNumRecent(Item, ItemSubtype)
may return a larger number than what is actually returned in this
list.dc
- The DbControl used to access the databaseitemType
- The type of itemssubtype
- The subtype of the parent item (can be null)public java.util.List<? extends BasicItem> getRecent(DbControl dc, Item itemType, java.lang.String subList)
getNumRecent(Item)
may return a larger number than what is actually returned in this
list.dc
- The DbControl used to access the databaseitemType
- The type of itemssubList
- The name of the sublistprivate java.util.List<? extends BasicItem> loadRecent(DbControl dc, Item itemType, java.lang.String key)
public BasicItem getRecent(DbControl dc, Item itemType, java.lang.String subList, int index)
private BasicItem loadRecent(DbControl dc, Item itemType, java.lang.String key, int index)
public java.util.List<java.lang.String> getRecent(java.lang.String key)
setRecent(String, String, int)
instead.key
- The key to the listpublic java.lang.String getRecent(java.lang.String key, int index)
public void clearRecent(Item itemType)
itemType
- The type of itemspublic void clearRecent(Item itemType, ItemSubtype subtype)
itemType
- The type of itemssubtype
- The subtype of the parent item (can be null)public void clearRecent(Item itemType, java.lang.String subList)
itemType
- The type of itemssubList
- The name of the sublistpublic void clearRecent(java.lang.String key)
key
- The key to the listpublic void clearAllRecent()
private java.lang.String getRecentSettingName(java.lang.String key)
private void setRecent(java.lang.String key, java.util.List<java.lang.String> recent)
public java.lang.String getSetting(java.lang.String name)
name
- The name of the valuesetSetting(String, String)
public java.lang.String setSetting(java.lang.String name, java.lang.String value)
name
- The name of the valuevalue
- The valuegetSetting(String)
public java.lang.String removeSetting(java.lang.String name)
name
- The name of the valuepublic java.lang.Object getObject(java.lang.String name)
name
- The name of the valuesetObject(String, Object)
public java.lang.Object setObject(java.lang.String name, java.lang.Object value)
name
- The name of the valuevalue
- The valuegetObject(String)
public java.lang.Object removeObject(java.lang.String name)
name
- The name of the valuepublic void copyObjectsAndTemporaryFilters(ItemContext other)
public Query getQuery()
public void setQuery(Query query)
public void setPropertyInspector(Filter<java.lang.String> filter)
configureQuery(DbControl, EntityQuery, boolean)
and
configureQuery(DbControl, SqlQuery, List)
methods will
check each property before it is used for sorting, filtering, etc.filter
- A filter or null to disable property inspectionpublic void configureQuery(DbControl dc, EntityQuery query, boolean autoLeftJoin) throws BaseException
Query.setReturnTotalCount(boolean)
is set to true.
Query.setFirstResult(int)
and Query.setMaxResults(int)
is set using getPage()
and getRowsPerPage()
settings.
getSortProperty()
and getSortDirection()
is
used to sort the query. If the sort property starts with a dollar ($)
sign it is interpreted as a alias.property
value, ignoring
the root alias of the query. The sort property may contain multiple properties
if they are separated by a comma. Each property may also be prefixed by
a '+' (ASC) or '-' (DESC) to override the global sort direction.
getInclude()
is used to set EntityQuery.include(Include[])
or @link EntityQuery#exclude(Include[])} options.
Restriction
:s to the
query.
dc
- The DbControl that will be used to execute the queryquery
- The query to configureautoLeftJoin
- If true, and the sort property and filters are checked
for associations to other items, which are automatically left joined to
the query (instead of the hibernate default of inner join) (this feature
is experimental)BaseException
- If configuring the query fails.void copyFrom(ItemContext other, boolean forceAll)
forceAll
parameter is set.public void filterOnSelectedItems(EntityQuery query)
query
- The query to filter@Deprecated public void configureQuery(DbControl dc, AbstractSqlQuery query, java.util.List<java.lang.String> selectionList)
configureQuery(DbControl, SqlQuery, List)
insteadpublic void configureQuery(DbControl dc, SqlQuery query, java.util.List<java.lang.String> selectionList) throws BaseException
AbstractQuery.setReturnTotalCount(boolean)
is set to true.
AbstractQuery.setFirstResult(int)
and AbstractQuery.setMaxResults(int)
is set using getPage()
and getRowsPerPage()
settings.
dc
- A DbControl to use if the database needs to be accessedquery
- The query to configureselectionList
- A list of expression that we want to select
from the queryBaseException
- If the configuring the query fails.@Deprecated public static Expression getDynamicExpression(DbControl dc, java.lang.String propertyDef)
getDynamicExpression(DbControl, SqlQuery, String)
insteadpublic static Expression getDynamicExpression(DbControl dc, SqlQuery query, java.lang.String propertyDef)
Expression
from a string. If the string starts with:
Dynamic.column(VirtualColumn)
to create the expression
for VirtualColumn.channelRaw(int)
Dynamic.rawData(String)
to create the expression.
Dynamic.reporter(String, Boolean)
with to create the
expression. The second parameter is FALSE to force using the master
reporter table.
Dynamic.reporter(String)
to create the expression
and let the query decide if it should use the cloned or master
reporter table.
Dynamic.extraValue(ExtraValue)
to create the expression and
DynamicSpotQuery.joinExtraValue(ExtraValue, JoinType)
to automatically
join the extra values.
Jep.formulaToExpression(String, JepFunction[])
method.
Dynamic.column(VirtualColumn)
method:
VirtualColumn.POSITION
VirtualColumn.COLUMN
dc
- A DbControl to use if the database needs to be accessedpropertyDef
- The string to use for creating the expression.@Deprecated public static Select getDynamicSelect(DbControl dc, java.lang.String propertyDef)
getDynamicSelect(DbControl, SqlQuery, String)
insteadpublic static Select getDynamicSelect(DbControl dc, SqlQuery query, java.lang.String propertyDef)
getDynamicExpression(DbControl, String)
but generates
a select object instead.dc
- DbControl used to access the databasepropertyDef
- The string to use for creating the expression.