public interface EntitySearchModel
Searches for entities based on a search text and set of String based condition columns.
Factory for
EntitySearchModel.Builder instances via builder(EntityType, EntityConnectionProvider).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for aEntitySearchModel.static interfaceControls the selectionstatic interfaceColumn search settings -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final is.codion.common.property.PropertyValue<Integer>Specifies the default search result limit, that is, the maximum number of results, null meaning no limit Value type: Integer Default value: null -
Method Summary
Modifier and TypeMethodDescriptionstatic EntitySearchModel.Builderbuilder(is.codion.framework.domain.entity.EntityType entityType, is.codion.framework.db.EntityConnectionProvider connectionProvider) Instantiates a newEntitySearchModel.Builder, initialized with the search columns for the given entity typeCollection<is.codion.framework.domain.entity.attribute.Column<String>>columns()is.codion.common.value.Value<Supplier<is.codion.framework.domain.entity.condition.Condition>>Sets the additional search condition supplier to use when performing the next search.is.codion.framework.db.EntityConnectionProvideris.codion.framework.domain.entity.EntityTypeis.codion.common.value.Value<Integer>limit()voidreset()Resets the search string so that is represents the selected entitiesList<is.codion.framework.domain.entity.Entity>search()Performs a query based on the current search configuration and returns the result.is.codion.common.value.Value<String>is.codion.common.state.StateObserveris.codion.common.value.Value<String>Map<is.codion.framework.domain.entity.attribute.Column<String>,EntitySearchModel.Settings> settings()booleanNote that changing this value does not change the search string accordingly.
-
Field Details
-
DEFAULT_LIMIT
Specifies the default search result limit, that is, the maximum number of results, null meaning no limit- Value type: Integer
- Default value: null
-
-
Method Details
-
entityType
is.codion.framework.domain.entity.EntityType entityType()- Returns:
- the type of the entity this search model is based on
-
connectionProvider
is.codion.framework.db.EntityConnectionProvider connectionProvider()- Returns:
- the connection provider used by this search model
-
selection
EntitySearchModel.Selection selection()- Returns:
- the selection
-
description
String description()- Returns:
- a string describing this search model, by default a comma separated list of search column names
-
columns
Collection<is.codion.framework.domain.entity.attribute.Column<String>> columns()- Returns:
- the columns used when performing a search
-
reset
void reset()Resets the search string so that is represents the selected entities -
limit
is.codion.common.value.Value<Integer> limit()- Returns:
- the
Valuecontrolling the search result limit
-
search
List<is.codion.framework.domain.entity.Entity> search()Performs a query based on the current search configuration and returns the result. Note that the number of search results may be limited vialimit().- Returns:
- a list containing the entities fulfilling the current condition
- Throws:
IllegalStateException- in case no search columns are specified- See Also:
-
condition
is.codion.common.value.Value<Supplier<is.codion.framework.domain.entity.condition.Condition>> condition()Sets the additional search condition supplier to use when performing the next search. This condition is AND'ed to the actual search condition. NOTE, this does not affect the currently selected value(s), if any.- Returns:
- the
Valuecontrolling the additional condition supplier
-
stringFunction
is.codion.common.value.Value<Function<is.codion.framework.domain.entity.Entity,String>> stringFunction()Note that changing this value does not change the search string accordingly.- Returns:
- the
Valuecontrolling the function providing thetoString()implementation for the entities displayed by this model - See Also:
-
searchStringModified
is.codion.common.state.StateObserver searchStringModified()- Returns:
- a
StateObserverindicating whether the search string represents the selected entities
-
settings
Map<is.codion.framework.domain.entity.attribute.Column<String>,EntitySearchModel.Settings> settings()- Returns:
- the settings associated with each search column
-
searchString
is.codion.common.value.Value<String> searchString()- Returns:
- the Value representing the search string
-
separator
is.codion.common.value.Value<String> separator()- Returns:
- the Value representing the text used to separate multiple entities
-
singleSelection
boolean singleSelection()- Returns:
- true if single selection is enabled
-
builder
static EntitySearchModel.Builder builder(is.codion.framework.domain.entity.EntityType entityType, is.codion.framework.db.EntityConnectionProvider connectionProvider) Instantiates a newEntitySearchModel.Builder, initialized with the search columns for the given entity type- Parameters:
entityType- the type of the entity to searchconnectionProvider- the EntityConnectionProvider to use when performing the search- Returns:
- a new
EntitySearchModel.Builderinstance - See Also:
-
EntityDefinition.Columns.searchable()
-