Class TableRelationResolver<Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR>
- java.lang.Object
-
- com.evolveum.midpoint.repo.sqlbase.mapping.TableRelationResolver<Q,R,TS,TQ,TR>
-
- Type Parameters:
Q
- type of source entity path (where the mapping is)R
- row type forTableRelationResolver
TS
- schema type for the target entity, can be owning container or objectTQ
- type of target entity pathTR
- row type related to the target entity pathTableRelationResolver
- All Implemented Interfaces:
ItemRelationResolver<Q,R,TQ,TR>
public class TableRelationResolver<Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR> extends Object implements ItemRelationResolver<Q,R,TQ,TR>
Resolver that knows how to traverse to the specified target query type. By default EXISTS subquery is used which is better for multi-value table stored items to avoid result multiplication. The resolver supports mapping supplier to avoid call cycles during mapping initialization.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.evolveum.midpoint.repo.sqlbase.mapping.ItemRelationResolver
ItemRelationResolver.ResolutionResult<TQ extends FlexibleRelationalPathBase<TR>,TR>
-
-
Field Summary
Fields Modifier and Type Field Description protected BiFunction<Q,TQ,com.querydsl.core.types.Predicate>
correlationPredicate
protected Supplier<QueryTableMapping<TS,TQ,TR>>
targetMappingSupplier
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableRelationResolver(@NotNull QueryTableMapping<TS,TQ,TR> targetMapping, @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
Constructor for relation resolver using `EXISTS` subquery to the table.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemRelationResolver.ResolutionResult<TQ,TR>
resolve(SqlQueryContext<?,Q,R> context)
Creates the EXISTS subquery using provided query context.static <Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR>
TableRelationResolver<Q,R,TS,TQ,TR>usingJoin(@NotNull Supplier<QueryTableMapping<TS,TQ,TR>> targetMappingSupplier, @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
Currently the decision to use `JOIN` is static in the mapping, but it can be more flexible.static <Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR>
TableRelationResolver<Q,R,TS,TQ,TR>usingSubquery(@NotNull QueryTableMapping<TS,TQ,TR> targetMapping, @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
-
-
-
Field Detail
-
targetMappingSupplier
protected final Supplier<QueryTableMapping<TS,TQ extends FlexibleRelationalPathBase<TR>,TR>> targetMappingSupplier
-
correlationPredicate
protected final BiFunction<Q extends FlexibleRelationalPathBase<R>,TQ extends FlexibleRelationalPathBase<TR>,com.querydsl.core.types.Predicate> correlationPredicate
-
-
Constructor Detail
-
TableRelationResolver
protected TableRelationResolver(@NotNull @NotNull QueryTableMapping<TS,TQ,TR> targetMapping, @NotNull @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
Constructor for relation resolver using `EXISTS` subquery to the table. This is good for multi-value containers.
-
-
Method Detail
-
usingSubquery
public static <Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR> TableRelationResolver<Q,R,TS,TQ,TR> usingSubquery(@NotNull @NotNull QueryTableMapping<TS,TQ,TR> targetMapping, @NotNull @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
-
usingJoin
public static <Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>,TR> TableRelationResolver<Q,R,TS,TQ,TR> usingJoin(@NotNull @NotNull Supplier<QueryTableMapping<TS,TQ,TR>> targetMappingSupplier, @NotNull @NotNull BiFunction<Q,TQ,com.querydsl.core.types.Predicate> correlationPredicate)
Currently the decision to use `JOIN` is static in the mapping, but it can be more flexible. If the query does not order by such a path, `EXISTS` is more efficient and should be used. This would require order examination first and then using this info inresolve(SqlQueryContext)
, perhaps accessible via the context parameter.
-
resolve
public ItemRelationResolver.ResolutionResult<TQ,TR> resolve(SqlQueryContext<?,Q,R> context)
Creates the EXISTS subquery using provided query context.- Specified by:
resolve
in interfaceItemRelationResolver<Q extends FlexibleRelationalPathBase<R>,R,TS,TQ extends FlexibleRelationalPathBase<TR>>
- Parameters:
context
- query context used for subquery creation- Returns:
- result with context for subquery entity path and its mapping
-
-