Interface DFResultSet
-
public interface DFResultSet
This object is used for managing data for a particularDFDataTree
.The
DFResultSet
encapsulates a particular snapshot of data for theDFDataTree
. This can be all data, or a subset. The snapshot can be updated by applying a particular query or list of IDs, and the IDs at each position in theDFDataTree
hierarchy can be sorted with custom sort directives.Views (grid view, form view, …) get their data from a particular
DFResultSet
. Multiple views from the sameDFDataTree
use the sameDFResultSet
, which means their contents will be coordinated (apply a sort in one view and data in the other view will also be re-sorted accordingly).The
DFResultSet
itself does not have much functionality, but provides set ofDFResultSet.VertexState
s. EachVertexState
then contain the data for one vertex of relatedDFDataTree
. This typically (in database implementation) means that oneVertexState
represents data for one database table subset.To obtain
DFResultSet
for a particularDFDataTree
useDFResultSets.forDataTree(com.im.df.api.ddl.DFDataTree)
DFDataTree dt = ...; DFResultSet rs = DFResultSets.forDataTree(dt);
Or lower-level API -
DFSchemaDataProvider.getDefaultResultSet(com.im.df.api.ddl.DFDataTree, boolean, com.im.commons.progress.DFEnvironmentRO)
method; can be used if more control over the process is needed. First you need to haveDFSchema
instance which is the root object (useDFSchemas.find(com.im.df.api.ddl.DFItem)
to find schema from anyDFItem
). Then useDFSchema.getDataProvider()
.So the final code can look like:
DFDataTree dt = ...; DFSchema schema = DFSchemas.find(dt); DFEnvironmentRO env = EnvUtils.createDefaultEnvironmentRO("Loading data", false); DFResultSet rs = schema.getDataProvider().getDefaultResultSet(dt, true, env); env.getFeedback().finish();
The resulting
DFResultSet
instance is shared.- Author:
- Tim Dudgeon
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DFResultSet.VertexState
This object represent state of data of oneDFDataTree.Vertex
.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_LAST_EXECUTED_QUERY
static java.lang.String
PROP_QUERY_IS_RUNNING
Fired just before a new query is going to be applied or just after its application has finished.static java.lang.String
PROP_SEARCH_DOMAIN
Fired whensearch domain
for this result set is changed.static java.lang.String
PROP_WORKING_QUERY
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Registers property change listener to be notified about prop.void
applyList(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRW env)
Sets ids on master level of this result set's data tree.void
applyQuery(DFTermExpression term, com.im.commons.progress.DFEnvironmentRW env)
void
applyWorkingQuery(com.im.commons.progress.DFEnvironmentRW env)
Applies the current working query to result set.DFResultSet
createCopy()
Creates copy from the result set.void
enableFilterSearchResults(boolean b, com.im.commons.progress.DFEnvironmentRW env)
Deprecated.void
ensureLoaded(com.im.commons.progress.DFEnvironmentRO env)
Ensures that the result set is fully initialized.DFDataTree
getDataTree()
Get the DFDataTree which this result set was created for.DFTermExpression
getLastExecutedQuery()
Returns the last executed query - the query which was working whenapplyWorkingQuery(DFEnvironmentRW)
was called last time.com.im.commons.progress.DFLockable
getLockable()
Gets private lockable for modifying this result set's state.DFResultSet.VertexState
getRootVertexState()
Gets vertex state for the root vertex.DFSearchDomain
getSearchDomain()
Gets the current search domain.DFResultSet.VertexState
getVertexState(DFDataTree.Vertex vertex)
Gets the state of this result set for particular vertex from the DFDataTree.DFTermExpression
getWorkingQuery()
Gets current working query expression.boolean
isFilterSearchResults()
Deprecated.boolean
isLoadAllChildRows()
Deprecated.boolean
isLoadIds(DFResultSet.VertexState vertexState)
Retrieves whethersetLoadIds(com.im.df.api.dml.DFResultSet.VertexState)
has been called for givenDFResultSet.VertexState
.boolean
isQueryCancelRequested()
When query is running (isQueryRunning()
returns true) then this method returns provides information whether "stop query" request was already sent (usingrequestStopQuery()
).boolean
isQueryRunning()
Is query execution running now? It is also possible to register a PropertyChangeListener to this DFResultSet and listen toPROP_QUERY_IS_RUNNING
property changes.void
reload(com.im.commons.progress.DFEnvironmentRW env)
Reloads row ids (primary keys) and data for this DFResultSet.void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Unregisters property change listener.void
requestStopQuery()
If query is currently running (see alsoisQueryRunning()
then it is possible to request stop query execution.void
setLoadAllChildRows(boolean b, com.im.commons.progress.DFEnvironmentRW env)
Deprecated.void
setLoadIds(DFResultSet.VertexState vertexState)
Calling this method signals that IDs for givenDFResultSet.VertexState
should be (re)loaded from database.void
setSearchDomain(DFSearchDomain searchDomain, com.im.commons.progress.DFEnvironmentRW env)
Makes an IDs constraint for query (only subset of DB table given by domain is searched).void
setWorkingQuery(DFTermExpression workingQuery, com.im.commons.progress.DFEnvironmentRW env)
Sets the query which will be used in nextapplyWorkingQuery(DFEnvironmentRW)
method call.
-
-
-
Field Detail
-
PROP_WORKING_QUERY
static final java.lang.String PROP_WORKING_QUERY
- See Also:
- Constant Field Values
-
PROP_LAST_EXECUTED_QUERY
static final java.lang.String PROP_LAST_EXECUTED_QUERY
- See Also:
- Constant Field Values
-
PROP_QUERY_IS_RUNNING
static final java.lang.String PROP_QUERY_IS_RUNNING
Fired just before a new query is going to be applied or just after its application has finished. This might be useful for clients which are not interested in intermediate (early) results during query execution.- See Also:
- Constant Field Values
-
PROP_SEARCH_DOMAIN
static final java.lang.String PROP_SEARCH_DOMAIN
Fired whensearch domain
for this result set is changed.
-
-
Method Detail
-
getDataTree
DFDataTree getDataTree()
Get the DFDataTree which this result set was created for.- Returns:
- The data tree
-
setWorkingQuery
void setWorkingQuery(DFTermExpression workingQuery, com.im.commons.progress.DFEnvironmentRW env)
Sets the query which will be used in nextapplyWorkingQuery(DFEnvironmentRW)
method call. The query is called 'working' because it is supposed different visualizations can cooperate on it's editing - for example query in form, standard query builder, etc.- Parameters:
workingQuery
- The working queryenv
- The environment
-
getWorkingQuery
DFTermExpression getWorkingQuery()
Gets current working query expression. Never returns null, but instead of null it returnsDFTermExpression.ALL_DATA
constant.- Returns:
- The current working query expression
-
applyWorkingQuery
void applyWorkingQuery(com.im.commons.progress.DFEnvironmentRW env)
Applies the current working query to result set. The list of ids will be updated in root vertex state. This usually causes selection update, and so regeneration of content of detail vertex states, etc.- Parameters:
env
- The environment
-
applyQuery
void applyQuery(DFTermExpression term, com.im.commons.progress.DFEnvironmentRW env)
-
getLastExecutedQuery
DFTermExpression getLastExecutedQuery()
Returns the last executed query - the query which was working whenapplyWorkingQuery(DFEnvironmentRW)
was called last time. Never returns null, but instead of null it returnsDFTermExpression.ALL_DATA
constant - for example if applyList was called after last applyWorkingQuery method call.- Returns:
- The last executed query
-
applyList
void applyList(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRW env)
Sets ids on master level of this result set's data tree. The list of ids is set to root vertex entity. This usually causes selection update, and so regeneration of content of detail vertex states, etc.- Parameters:
ids
- The ids listenv
- The environment
-
reload
void reload(com.im.commons.progress.DFEnvironmentRW env)
Reloads row ids (primary keys) and data for this DFResultSet. This method does not re-execute the current (last executed) query, but it just applies the current list of ids instead. It can cause that some ids will disappear if these rows were deleted from DB, but newly added rows are not added to result set. This method also callsDFEntityDataProvider.reloadData()
for each VertexState's entity of this result set.- Parameters:
env
- The environment
-
setSearchDomain
void setSearchDomain(DFSearchDomain searchDomain, com.im.commons.progress.DFEnvironmentRW env)
Makes an IDs constraint for query (only subset of DB table given by domain is searched).- Parameters:
searchDomain
- The search domain for this DFResultSet. Never putnull
as parameter, useDFSearchDomain.DEFAULT
instead.env
- The environment
-
enableFilterSearchResults
@Deprecated void enableFilterSearchResults(boolean b, com.im.commons.progress.DFEnvironmentRW env)
Deprecated.Enables or disables the filter search results functionality. If it is enabled the child data are filtered to fulfill for the query.- Parameters:
b
- Enable or disable the filter.env
- The environment- Since:
- 15.10.19
-
isFilterSearchResults
@Deprecated boolean isFilterSearchResults()
Deprecated.Returns if filter search results are enabled.- Returns:
- If filter search results is enabled.
- Since:
- 15.10.19
-
isLoadAllChildRows
@Deprecated boolean isLoadAllChildRows()
Deprecated.Returns if all child data loading is enabled.- Returns:
- If all child data loading is enabled.
- Since:
- 16.7.25
-
setLoadAllChildRows
@Deprecated void setLoadAllChildRows(boolean b, com.im.commons.progress.DFEnvironmentRW env)
Deprecated.Enables or disables the loading all convergent child functionality. If it is enabled all child connected to parent data is loaded to convergent child.- Parameters:
b
- Enable or disable loading all data..env
- The environment- Since:
- 16.7.25
-
getSearchDomain
DFSearchDomain getSearchDomain()
Gets the current search domain. Never returnsnull
. If whole DB is searched thenDFSearchDomain.DEFAULT
is used as domain.- Returns:
- The current search domain
-
getLockable
com.im.commons.progress.DFLockable getLockable()
Gets private lockable for modifying this result set's state. This lockable must be used to lock DFResultSet when setting new sort, running new query, applying list of ids or changing the selection (selected ids) in any vertex state.- Returns:
- The lockable
-
isQueryRunning
boolean isQueryRunning()
Is query execution running now? It is also possible to register a PropertyChangeListener to this DFResultSet and listen toPROP_QUERY_IS_RUNNING
property changes.- Returns:
- true if the query is running otherwise false
-
isQueryCancelRequested
boolean isQueryCancelRequested()
When query is running (isQueryRunning()
returns true) then this method returns provides information whether "stop query" request was already sent (usingrequestStopQuery()
). When query is not running it returns false.- Returns:
- true if query is running and stopping the query was requested already
-
requestStopQuery
void requestStopQuery()
If query is currently running (see alsoisQueryRunning()
then it is possible to request stop query execution. It doesn't mean that query is stopped immediately. Query engine is just requested to stop running the query as soon as possible. When query is actually stopped depends on type of query (structure search, standard DB search) and also specific database (Oracle cartridge, local db, etc.). See alsoisQueryRunning()
andisQueryCancelRequested()
.
-
getVertexState
DFResultSet.VertexState getVertexState(DFDataTree.Vertex vertex)
Gets the state of this result set for particular vertex from the DFDataTree.- Parameters:
vertex
- the Vertex- Returns:
- The state of this result set
-
getRootVertexState
DFResultSet.VertexState getRootVertexState()
Gets vertex state for the root vertex. It allows to simplify code likeresultSet.getVertexState(resultSet.getDataTree().getRootVertex())
toresultSet.getRootVertexState()
.- Returns:
- The vertex state for the root
DFDataTree.Vertex
.
-
addPropertyChangeListener
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Registers property change listener to be notified about prop. changes of this DFResultSet- Parameters:
l
- The property change listener
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Unregisters property change listener.- Parameters:
l
- The property change listener
-
createCopy
DFResultSet createCopy()
Creates copy from the result set. The copy shares only the data tree.- Returns:
- The copied result set.
- Since:
- 14.10.20
-
ensureLoaded
void ensureLoaded(com.im.commons.progress.DFEnvironmentRO env)
Ensures that the result set is fully initialized. Loads all ids for the root entity if no query has been run before, otherwise does nothing. Loading is done only once.As loading can be slow this should not be called from EDT.
- Parameters:
env
- environment used during data loading- Since:
- 15.10.19
-
setLoadIds
void setLoadIds(DFResultSet.VertexState vertexState)
Calling this method signals that IDs for givenDFResultSet.VertexState
should be (re)loaded from database. This method does not have reversible complementary method ~ no way to unset.- Parameters:
vertexState
- to load IDs for- Since:
- 19.11.0
- See Also:
isLoadIds(com.im.df.api.dml.DFResultSet.VertexState)
-
isLoadIds
boolean isLoadIds(DFResultSet.VertexState vertexState)
Retrieves whethersetLoadIds(com.im.df.api.dml.DFResultSet.VertexState)
has been called for givenDFResultSet.VertexState
.- Parameters:
vertexState
-- Returns:
true
if IDs for givenvertexState
should be loaded from database.- Since:
- 19.11.0
- See Also:
setLoadIds(com.im.df.api.dml.DFResultSet.VertexState)
-
-