Class DefaultItemSqlMapper<S,Q extends FlexibleRelationalPathBase<R>,R>
- java.lang.Object
-
- com.evolveum.midpoint.repo.sqlbase.mapping.DefaultItemSqlMapper<S,Q,R>
-
- Type Parameters:
S
- schema type owning the mapped itemQ
- entity path owning the mapped itemR
- row type with the mapped item
- All Implemented Interfaces:
ItemSqlMapper<Q,R>
public class DefaultItemSqlMapper<S,Q extends FlexibleRelationalPathBase<R>,R> extends Object implements ItemSqlMapper<Q,R>
Declarative information how an item (from schema/prism world) is to be processed when interpreting query. As this is declarative it does not point to any Q-class attributes - instead it knows how to get to the attributes when the Q-class instance (entity path) is provided; this is provided as a function (or functions for multiple paths), typically as lambdas. Based on this information the mapper can later createFilterProcessor
when needed, again providing the right type ofFilterProcessor
, based on the type of the item and/or how the item is mapped to the database.
-
-
Constructor Summary
Constructors Constructor Description DefaultItemSqlMapper(@NotNull Function<SqlQueryContext<S,Q,R>,ItemValueFilterProcessor<?>> filterProcessorFactory)
DefaultItemSqlMapper(@NotNull Function<SqlQueryContext<S,Q,R>,ItemValueFilterProcessor<?>> filterProcessorFactory, @Nullable Function<Q,P> primaryItemMapping)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ValueFilter<?,?>>
@Nullable ItemValueFilterProcessor<T>createFilterProcessor(SqlQueryContext<?,?,?> sqlQueryContext)
CreatesItemValueFilterProcessor
based on this mapping.@Nullable RightHandProcessor
createRightHandProcessor(SqlQueryContext<?,?,?> sqlQueryContext)
@Nullable com.querydsl.core.types.Path<?>
primaryPath(Q root, ItemDefinition<?> unused)
Returns primary path for provided entity path - usable for ordering.
-
-
-
Constructor Detail
-
DefaultItemSqlMapper
public DefaultItemSqlMapper(@NotNull @NotNull Function<SqlQueryContext<S,Q,R>,ItemValueFilterProcessor<?>> filterProcessorFactory, @Nullable @Nullable Function<Q,P> primaryItemMapping)
-
DefaultItemSqlMapper
public DefaultItemSqlMapper(@NotNull @NotNull Function<SqlQueryContext<S,Q,R>,ItemValueFilterProcessor<?>> filterProcessorFactory)
-
-
Method Detail
-
primaryPath
@Nullable public @Nullable com.querydsl.core.types.Path<?> primaryPath(Q root, ItemDefinition<?> unused)
Description copied from interface:ItemSqlMapper
Returns primary path for provided entity path - usable for ordering.- Specified by:
primaryPath
in interfaceItemSqlMapper<S,Q extends FlexibleRelationalPathBase<R>>
-
createFilterProcessor
@Nullable public <T extends ValueFilter<?,?>> @Nullable ItemValueFilterProcessor<T> createFilterProcessor(SqlQueryContext<?,?,?> sqlQueryContext)
CreatesItemValueFilterProcessor
based on this mapping. ProvidedSqlQueryContext
is used to figure out the query paths when this is executed (as the entity path instance is not yet available when the mapping is configured in a declarative manner). The type of the returned processor is adapted to the client code needs for convenience. Also the type of the provided context is flexible, but with proper mapping it's all safe. [NOTE] This may return null if the subclass supports other type of mapping for this item, but not filtering for queries.- Specified by:
createFilterProcessor
in interfaceItemSqlMapper<S,Q extends FlexibleRelationalPathBase<R>>
-
createRightHandProcessor
@Nullable public @Nullable RightHandProcessor createRightHandProcessor(SqlQueryContext<?,?,?> sqlQueryContext)
- Specified by:
createRightHandProcessor
in interfaceItemSqlMapper<S,Q extends FlexibleRelationalPathBase<R>>
-
-