Module is.codion.framework.model
Package is.codion.framework.model
Interface ForeignKeyModelLink<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
- Type Parameters:
M
- theEntityModel
typeE
- theEntityEditModel
typeT
- theEntityTableModel
type
- All Superinterfaces:
ModelLink<M,
E, T>
public interface ForeignKeyModelLink<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
extends ModelLink<M,E,T>
Represents a link between two entity models based on a foreign key.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
ForeignKeyModelLink.Builder<M extends EntityModel<M,
E, T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ForeignKeyModelLink.Builder<M, E, T, B>> Builds aForeignKeyModelLink
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue
<Boolean> Specifies whether a linked model clears the foreign key search condition when null or no value is selected in a parent model
Value type: Boolean
Default value: truestatic final PropertyValue
<Boolean> Specifies whether a linked model sets the parent foreign key value to null when null or no value is selected in a parent model
Value type: Boolean
Default value: falsestatic final PropertyValue
<Boolean> Specifies whether a linked model should be automatically refreshed when the selection in the parent model changes.static final PropertyValue
<Boolean> Specifies whether a linked model should automatically search by the entity inserted by the parent model.static final PropertyValue
<Boolean> Specifies whether a linked model should automatically set the foreign key value to the entity inserted by the parent model. -
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends EntityModel<M,
E, T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ForeignKeyModelLink.Builder<M, E, T, B>>
ForeignKeyModelLink.Builder<M, E, T, B> builder
(M model, ForeignKey foreignKey) Returns a newForeignKeyModelLink.Builder
instance.
-
Field Details
-
SET_VALUE_ON_INSERT
Specifies whether a linked model should automatically set the foreign key value to the entity inserted by the parent model.- Value type: Boolean
- Default value: true
-
SET_CONDITION_ON_INSERT
Specifies whether a linked model should automatically search by the entity inserted by the parent model.- Value type: Boolean
- Default value: false
-
REFRESH_ON_SELECTION
Specifies whether a linked model should be automatically refreshed when the selection in the parent model changes.- Value type: Boolean
- Default value: true
-
CLEAR_VALUE_ON_EMPTY_SELECTION
Specifies whether a linked model sets the parent foreign key value to null when null or no value is selected in a parent model
- Value type: Boolean
- Default value: false
- Value type: Boolean
-
CLEAR_CONDITION_ON_EMPTY_SELECTION
Specifies whether a linked model clears the foreign key search condition when null or no value is selected in a parent model
- Value type: Boolean
- Default value: true
- Value type: Boolean
-
-
Method Details
-
foreignKey
ForeignKey foreignKey()- Returns:
- the foreign key this model link is based on
-
builder
static <M extends EntityModel<M,E, ForeignKeyModelLink.Builder<M,T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ForeignKeyModelLink.Builder<M, E, T, B>> E, builderT, B> (M model, ForeignKey foreignKey) Returns a new
ForeignKeyModelLink.Builder
instance.Note that if the linked model contains a table model it is configured so that a query condition is required for it to show any data, via
EntityQueryModel.conditionRequired()
- Type Parameters:
M
- theEntityModel
typeE
- theEntityEditModel
typeT
- theEntityTableModel
typeB
- the builder type- Parameters:
model
- the model to linkforeignKey
- the foreign key- Returns:
- a
ForeignKeyModelLink.Builder
instance
-