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 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.common.value.ValueSet<is.codion.framework.domain.entity.Entity>entities()is.codion.common.value.Value<is.codion.framework.domain.entity.Entity>entity()is.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.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.is.codion.common.value.Value<Character>wildcard()
-
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
-
entity
is.codion.common.value.Value<is.codion.framework.domain.entity.Entity> entity()- Returns:
- a Value controlling the selected entity
-
entities
is.codion.common.value.ValueSet<is.codion.framework.domain.entity.Entity> entities()- Returns:
- a Value controlling the selected entities
-
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 -
wildcard
is.codion.common.value.Value<Character> wildcard()- Returns:
- the Value controlling the wildcard character
-
limit
is.codion.common.value.Value<Integer> limit()- Returns:
- the value controlling 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 Value controlling 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 Value controlling the function providing the
toString()implementation for the entities displayed by this model - See Also:
-
searchStringModified
is.codion.common.state.StateObserver searchStringModified()- Returns:
- a StateObserver indicating whether the search string represents the selected entities
-
selectionEmpty
is.codion.common.state.StateObserver selectionEmpty()- Returns:
- a StateObserver indicating whether the selection is empty
-
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()
-