|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface DFRelationDataProvider
API Status: This interface is not stable. Do not use it.
Data provider for relational data. As this is still under development
this class is not stable and might be changed/removed in the future.
The DataProvider represents row tuples related by a DFRelationship, in
the direction described by getRelationshipDir().
The manipulation methods, addRelation(java.lang.Object, java.util.Set and removeRelation(java.lang.Object, java.util.Set,
are only used to connect existing rows of Entities. If you need to create data
rows or delete them from the database, you have to use the DFSchemaDataProvider.
Because of different cardinalities, the add and remove methods are specified as
they take a single Row ID from one side of the relation, and a collection of row
IDs from the other side.
The mapping is as follows:
MANY_TO_ONE - the destination field
ONE_TO_MANY - the source field
ONE_TO_ONE - the source field (reason: the relationship is directed)
MANY_TO_MANY - the source field
This is because it is possible to clear a subset or all relations between the
single "master" and its detail rows in the MANY_TO_ONE or ONE_TO_MANY case.
It also allows to prune whole subsets in MANY_TO_MANY case. The ONE_TO_ONE
case is just a singluarity.
| Method Summary | |
|---|---|
void |
addDFRelationDataListener(DFRelationDataListener listener)
|
void |
addRelation(Object idMaster,
Set<Object> idDetail,
DFEnvironmentRW env)
Establishes or changes relations between existing entities. |
DFLockable |
getLockable()
|
List<? extends Comparable<?>> |
getRelatedIds(Comparable<?> masterId,
DFTermExpression filter,
SortDirective sort)
Retrieves a mapping from 'masterIds' of the DFRelationship.Direction.getSrcField() to their counterparts
according to the relation. |
DFRelationship.Direction |
getRelationshipDir()
|
DFSchemaDataProvider |
getSchemaDataProvider()
|
void |
removeDFRelationDataListener(DFRelationDataListener listener)
|
void |
removeRelation(Object idMaster,
Set<Object> removeIDs,
DFEnvironmentRW env)
Breaks relations between 'idMaster' row in the master entity and 'removeIDs' rows of the detail entity. |
| Method Detail |
|---|
DFLockable getLockable()
DFSchemaDataProvider getSchemaDataProvider()
DFRelationship.Direction getRelationshipDir()
List<? extends Comparable<?>> getRelatedIds(Comparable<?> masterId,
DFTermExpression filter,
SortDirective sort)
DFRelationship.Direction.getSrcField() to their counterparts
according to the relation.
The returned IDs will respect the 'sort' SortDirective applied
to the results from the destination field's entity.
The method returns a Map keyed by "source" row IDs. Values are
lists ordered according to the SortDirective that contain
row IDs from the related entity.
void addRelation(Object idMaster,
Set<Object> idDetail,
DFEnvironmentRW env)
throws DFRelationDataException
DFRelationship.Direction.getType()
may restrict the operation. For *_TO_ONE relationship types, the
'idDetail' must contain exactly one item.
You may consider to use the DFRelationship provider for the 'one' side
of the relationship to associate multiple items.
DFRelationDataException
void removeRelation(Object idMaster,
Set<Object> removeIDs,
DFEnvironmentRW env)
throws DFRelationDataException
DFRelationship.Direction.getType()
may restrict the operation. For *_TO_ONE relationship types, the
'idDetail' must contain exactly one item.
You may consider to use the DFRelationship provider for the 'one' side
of the relationship to break association to multiple items at once.
Note that if the field that binds the relationship in the 'detail' entity
is 'required', the method will throw a DFRelationDataException, informing
you which field cannot be reset.
idMaster - The r ow ID in the "source" entityremoveIDs - The r ow IDs in the "destination" entityenv - The DFEnvironment.
DFRelationDataExceptionvoid addDFRelationDataListener(DFRelationDataListener listener)
void removeDFRelationDataListener(DFRelationDataListener listener)
|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||