Package com.im.df.api.dml
Interface DFResultSet.VertexState
-
- Enclosing interface:
- DFResultSet
public static interface DFResultSet.VertexState
This object represent state of data of oneDFDataTree.Vertex
. Each VertexState has these properties: all ids, sort directive, row selection.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_IDS
Fired when the IDs of the vertex state have changed.static java.lang.String
PROP_SELECTION
Fired when the selection of the vertex state has change.static java.lang.String
PROP_SORT
Fired when thesort directive
of the vertex state has changed.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Registers PropertyChangeListener to this VertexState to be notified about ids, sort and selection changes.java.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>>
getData(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRO env)
Deprecated.getData(List, Set, DFEnvironmentRO)
is replacement for this methodjava.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>>
getData(java.util.List<? extends java.lang.Comparable<?>> ids, java.util.Set<? extends DFField> fields, com.im.commons.progress.DFEnvironmentRO env)
Fetches data for the specified IDs.java.lang.Comparable<?>
getIdAt(int index)
Gets ID (primary key) at the specific position.java.util.List<? extends java.lang.Comparable<?>>
getIds()
Get list of all IDs (primary keys values) of all rows in this VertexState.java.util.List<? extends java.lang.Comparable<?>>
getIdsForParentId(java.lang.Comparable<?> parentRowId, com.im.commons.progress.DFEnvironmentRO env)
Gets list of all IDs (primary key values) of rows in this VertexState for specific parent row ID.DFResultSet
getResultSet()
Gets the DFResultSet this VertexState belongs to.java.util.List<? extends java.lang.Comparable<?>>
getSelectedRowsIds()
Gets the list of row IDs for selected rows.SelectionDescription
getSelection()
Gets the current selection descriptor.int
getSize()
Gets number of rows at this level ofresult set
at this moment.SortDirective
getSort()
Gets the current sort directive.DFDataTree.Vertex
getVertex()
Gets the vertex (static DDL object) for this VertexState (dynamic data DML object).java.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>>
getWrappedData(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRO env)
int
indexOfId(java.lang.Comparable<?> id)
Returns the index of the given id, if it's part of current vertex state.void
insertId(java.lang.Comparable<?> id, boolean selectIt, com.im.commons.progress.DFEnvironmentRW env)
Inserts a new row (with the specified id = primary key) to this VertexState.void
reload(com.im.commons.progress.DFEnvironmentRO env)
Reloads row ids (primary keys) and data just for this VertexState.void
removeIds(java.util.List<? extends java.lang.Comparable<?>> idsToRemove, com.im.commons.progress.DFEnvironmentRW env)
Removes the rows (with the specified ids = primary key) from this VertexState.void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Unregisters PropertyChangeListener from this VertexState.void
setSelection(SelectionDescription selection, com.im.commons.progress.DFEnvironmentRO env)
Set selection on this level of result set.void
setSort(SortDirective sort, com.im.commons.progress.DFEnvironmentRW env)
Sets sort on this level of result set.
-
-
-
Field Detail
-
PROP_IDS
static final java.lang.String PROP_IDS
Fired when the IDs of the vertex state have changed. For example, after a query, list or a new sort directive is applied.- See Also:
- Constant Field Values
-
PROP_SORT
static final java.lang.String PROP_SORT
Fired when thesort directive
of the vertex state has changed. Old and new values of the property change correspond to old and new sort directive respectively.- See Also:
- Constant Field Values
-
PROP_SELECTION
static final java.lang.String PROP_SELECTION
Fired when the selection of the vertex state has change.- See Also:
- Constant Field Values
-
-
Method Detail
-
getResultSet
DFResultSet getResultSet()
Gets the DFResultSet this VertexState belongs to.- Returns:
- The DFResultSet
-
getVertex
DFDataTree.Vertex getVertex()
Gets the vertex (static DDL object) for this VertexState (dynamic data DML object).- Returns:
- The vertex for this VertexState
-
getSize
int getSize()
Gets number of rows at this level ofresult set
at this moment. This can change, for example, whenvertex state
of an ancestor's entity changes selection.- Returns:
- The number of rows
-
getIds
java.util.List<? extends java.lang.Comparable<?>> getIds()
Get list of all IDs (primary keys values) of all rows in this VertexState. Note that it is ensured that resulting list never contains duplicates. I.e. it rather corresponds toLinkedHashSet
.- Returns:
- The unique list of all IDs
-
getIdsForParentId
java.util.List<? extends java.lang.Comparable<?>> getIdsForParentId(java.lang.Comparable<?> parentRowId, com.im.commons.progress.DFEnvironmentRO env)
Gets list of all IDs (primary key values) of rows in this VertexState for specific parent row ID. This method allows you to read relational data from a detail table without changing selection in master.- Parameters:
parentRowId
- Parent row ID (primary key value)env
- The environment- Returns:
- List of IDs for given parent's (master) row id.
- Throws:
java.lang.IllegalStateException
- when it's called for the root VertexState (for which it has no meaning). It only works for detail VertexStates.java.lang.IllegalArgumentException
- when parentRowId is of wrong type or isnull
-
getSelectedRowsIds
java.util.List<? extends java.lang.Comparable<?>> getSelectedRowsIds()
Gets the list of row IDs for selected rows. Note that it is ensured that resulting list never contains duplicates. I.e. it rather corresponds toLinkedHashSet
.- Returns:
- The unique list of primary keys for currently selected rows. Never returns
null
.
-
getIdAt
java.lang.Comparable<?> getIdAt(int index)
Gets ID (primary key) at the specific position.- Parameters:
index
- VertexState index- Returns:
- the ID at the given index or
null
(e.g. if the index is out of VertexState's IDs range)
-
indexOfId
int indexOfId(java.lang.Comparable<?> id)
Returns the index of the given id, if it's part of current vertex state. If it's not there (or id is not in DB), then return -1.- Parameters:
id
- The row id which you are looking for- Returns:
- The index or -1
-
insertId
void insertId(java.lang.Comparable<?> id, boolean selectIt, com.im.commons.progress.DFEnvironmentRW env)
Inserts a new row (with the specified id = primary key) to this VertexState. This method is not supposed to be called for adding new rows to data source (DFEntityDataProvider
should be used instead), but it should just add existing id. The new id (row) is added and will be in vertex state just till whole ids list is set again. For root vertex it means when applyList or applyQuery is called, for any child vertex it means when parent vertex changes the selection.- Parameters:
id
- The primary key of the row to be added to VertexStateselectIt
- If true, the newly added row will be selected (PROP_SELECTION)env
- The environment
-
removeIds
void removeIds(java.util.List<? extends java.lang.Comparable<?>> idsToRemove, com.im.commons.progress.DFEnvironmentRW env)
Removes the rows (with the specified ids = primary key) from this VertexState. This method doesn't delete rows from database, but just delete them from result set. To delete rows from database use (DFEntityDataProvider.deleteIds(List, DFEnvironmentRW)
method instead.This change is not permanent. If you remove row using this method from root vertex then it's added again when query is executed again. For detail vertex (detail entity) row is added again only if you change selection in parent vertex (e.g. you go one row down and back up in master table).
- Parameters:
idsToRemove
- The primary key values of the rows to be removed from VertexStateenv
- The environment
-
reload
void reload(com.im.commons.progress.DFEnvironmentRO env)
Reloads row ids (primary keys) and data just for this VertexState. This method works similar toDFResultSet.reload(DFEnvironmentRW)
but reloads just this VertexState. This method also callsDFEntityDataProvider.reloadData()
- Parameters:
env
- The environment- Since:
- 16.2.8
-
setSort
void setSort(SortDirective sort, com.im.commons.progress.DFEnvironmentRW env)
Sets sort on this level of result set.- Parameters:
sort
- The sort directiveenv
- The environment
-
getSort
SortDirective getSort()
Gets the current sort directive.- Returns:
- The current sort directive
-
setSelection
void setSelection(SelectionDescription selection, com.im.commons.progress.DFEnvironmentRO env)
Set selection on this level of result set. Selection change has impact on detail tables related to this vertex - it means detail VertexStates (from this VertexStates point of view) will update their list of ids and typically also selection.- Parameters:
selection
- The selection descriptorenv
- The environment
-
getSelection
SelectionDescription getSelection()
Gets the current selection descriptor. Note thatSelectionDescription
uses indexes so should be used carefully. Selection[min=0, max=1] change the meaning whenDFResultSet
rows are updated, e.g. after a query is executed.- Returns:
- The current selection descriptor
-
getData
@Deprecated java.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>> getData(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRO env)
Deprecated.getData(List, Set, DFEnvironmentRO)
is replacement for this methodFetches data for these IDs.- Parameters:
ids
- the IDsenv
- environment for reading data- Returns:
- A map of the data, keyed by the row ID. The values of the first level of
Map
are instances ofMap
again. In these nestedMap
s key is id ofDFField
and value is the read data value. NestedMap
s contain only data for eachDFField
specified infields
parameter.
-
getData
java.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>> getData(java.util.List<? extends java.lang.Comparable<?>> ids, java.util.Set<? extends DFField> fields, com.im.commons.progress.DFEnvironmentRO env)
Fetches data for the specified IDs.- Parameters:
ids
- the IDsfields
- set of fields to retrieve the values from. Ifnull
or empty all fields of the entity are retrievedenv
- environment for reading data- Returns:
- A map of the data, keyed by the row ID. The values of the first level of
Map
are instances ofMap
again. In these nestedMap
s key is id ofDFField
and value is the read data value. NestedMap
s contain only data for eachDFField
specified infields
parameter. - Since:
- 6.2
-
getWrappedData
java.util.Map<java.lang.Comparable<?>,java.util.Map<java.lang.String,java.lang.Object>> getWrappedData(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRO env)
-
addPropertyChangeListener
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Registers PropertyChangeListener to this VertexState to be notified about ids, sort and selection changes.- Parameters:
l
- The PropertyChangeListener
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Unregisters PropertyChangeListener from this VertexState.- Parameters:
l
- The PropertyChangeListener
-
-