Class QueryTableMapping<S,Q extends FlexibleRelationalPathBase<R>,R>  
java.lang.Object
com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping<S,Q,R>
  
com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping<S,Q,R>  
- Type Parameters:
- S- schema type
- Q- type of entity path
- R- row type related to the- QueryTableMapping
- Direct Known Subclasses:
- SqaleTableMapping
public abstract class QueryTableMapping<S,Q extends FlexibleRelationalPathBase<R>,R>  
extends QueryModelMapping<S,Q,R>  
Common supertype for mapping items/attributes between schema (prism) classes and tables.
 See 
QueryModelMapping.addItemMapping(QName, ItemSqlMapper) for details about mapping mechanism.
 See createRowTransformer(SqlQueryContext, JdbcSession) for more about mapping
 related to-many detail tables.
 The main goal of this type is to map object query conditions and ORDER BY to SQL.
 Mappings also takes care of transformation between schema/prism objects and repository objects
 (row beans or tuples).
 Any logic specific for the particular type (table) should appear in the related mapping subclass.
 This applies for filtering, fetching (e.g. additional detail tables) and transforming to midPoint
 objets.
 See also Javadoc in SqlQueryContext for additional info.
 Other important functions of mapping:
 * It allows creating "aliases" (entity path instances) newAlias(String).
 * It knows how to traverse to other related entities, defined by QueryModelMapping.addRelationResolver(javax.xml.namespace.QName, com.evolveum.midpoint.repo.sqlbase.mapping.ItemRelationResolver<Q, R, ?, ?>)
 Mapping for tables is initialized once and requires SqlRepoContext.
 The mapping is accessible by static `get()` method; if multiple mapping instances exist
 for the same type the method uses suffix to differentiate them.- 
Field SummaryFields inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMappinglogger
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedQueryTableMapping(@NotNull String tableName, @NotNull String defaultAliasName, @NotNull Class<S> schemaType, @NotNull Class<Q> queryType, @NotNull SqlRepoContext repositoryContext) Creates metamodel for the table described by designated type (Q-class) related to schema type.
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddDetailFetchMapper(ItemName itemName, SqlDetailFetchMapper<R, ?, ?, ?> detailFetchMapper) Deprecated.voidaddExtensionColumn(String propertyName, com.querydsl.sql.ColumnMetadata columnMetadata) Registers extension columns.protected ItemSqlMapper<Q,R> booleanMapper(Function<Q, com.querydsl.core.types.dsl.BooleanPath> rootToQueryItem) Returns the mapper creating the boolean filter processor from context.createRowTransformer(SqlQueryContext<S, Q, R> sqlQueryContext, JdbcSession jdbcSession) Returns result transformer that by default callstoSchemaObject(Tuple, FlexibleRelationalPathBase, JdbcSession, Collection)for each result row.Returns default alias - use only once per query, e.g. not for two different joins.final Collection<SqlDetailFetchMapper<R,?, ?, ?>> Deprecated.integerMapper(Function<Q, com.querydsl.core.types.dsl.NumberPath<Integer>> rootToQueryItem) Returns the mapper creating the integer filter processor from context.protected <TQ extends FlexibleRelationalPathBase<TR>,TR> 
 BiFunction<Q,TQ, com.querydsl.core.types.Predicate> joinOn(BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinOnPredicateFunction) Lambda "wrapper" that helps with the type inference (namely the current Q type).longMapper(Function<Q, com.querydsl.core.types.dsl.NumberPath<Long>> rootToQueryItem) Returns the mapper creating the long filter processor from context.Creates new alias (entity path instance) with a defined name.protected abstract QnewAliasInstance(String alias) Method returning new instance ofEntityPath- to be implemented by sub-mapping.protected ItemSqlMapper<Q,R> polyStringMapper(Function<Q, com.querydsl.core.types.dsl.StringPath> origMapping, Function<Q, com.querydsl.core.types.dsl.StringPath> normMapping) Returns the mapper creating the string filter processor from context.@NotNull com.querydsl.core.types.Path<?>[]selectExpressions(Q entity, Collection<SelectorOptions<GetOperationOptions>> options) By default, usesselectExpressionsWithCustomColumns(Q)and does not use options.@NotNull com.querydsl.core.types.Path<?>[]selectExpressionsWithCustomColumns(Q entity) protected ItemSqlMapper<Q,R> stringMapper(Function<Q, com.querydsl.core.types.dsl.StringPath> rootToQueryItem) Returns the mapper creating the string filter processor from context.protected <T extends Comparable<T>>
 ItemSqlMapper<Q,R> timestampMapper(Function<Q, com.querydsl.core.types.dsl.DateTimePath<T>> rootToQueryItem) Returns the mapper function creating the timestamp filter processor from context.toSchemaObject(@NotNull com.querydsl.core.Tuple tuple, Q entityPath, @NotNull JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) Transforms row Tuple containing attributes ofQueryTableMappingto schema typeQueryTableMapping.abstract StoSchemaObject(R row) Transforms row ofQueryTableMappingtype to schema typeQueryTableMapping.toString()updateGetOptions(Collection<SelectorOptions<GetOperationOptions>> options, @NotNull Collection<? extends ItemDelta<?, ?>> modifications) protected ItemSqlMapper<Q,R> uuidMapper(Function<Q, UuidPath> rootToQueryItem) Returns the mapper creating the OID (UUID) filter processor from context.Methods inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMappingaddItemMapping, addRelationResolver, getItemMapper, getItemMappings, getRelationResolver, itemDefinition, itemMapper, queryType, relationResolver, schemaType
- 
Constructor Details- 
QueryTableMappingprotected QueryTableMapping(@NotNull @NotNull String tableName, @NotNull @NotNull String defaultAliasName, @NotNull @NotNull Class<S> schemaType, @NotNull @NotNull Class<Q> queryType, @NotNull @NotNull SqlRepoContext repositoryContext) Creates metamodel for the table described by designated type (Q-class) related to schema type. Allows registration of any number of columns - typically used for static properties (non-extensions).- Parameters:
- tableName- database table name
- defaultAliasName- default alias name, some short abbreviation, must be unique across mapped types
 
 
- 
- 
Method Details- 
stringMapperprotected ItemSqlMapper<Q,R> stringMapper(Function<Q, com.querydsl.core.types.dsl.StringPath> rootToQueryItem) Returns the mapper creating the string filter processor from context.
- 
integerMapperpublic ItemSqlMapper<Q,R> integerMapper(Function<Q, com.querydsl.core.types.dsl.NumberPath<Integer>> rootToQueryItem) Returns the mapper creating the integer filter processor from context.
- 
longMapperpublic ItemSqlMapper<Q,R> longMapper(Function<Q, com.querydsl.core.types.dsl.NumberPath<Long>> rootToQueryItem) Returns the mapper creating the long filter processor from context.
- 
booleanMapperprotected ItemSqlMapper<Q,R> booleanMapper(Function<Q, com.querydsl.core.types.dsl.BooleanPath> rootToQueryItem) Returns the mapper creating the boolean filter processor from context.
- 
uuidMapperReturns the mapper creating the OID (UUID) filter processor from context.
- 
timestampMapperprotected <T extends Comparable<T>> ItemSqlMapper<Q,R> timestampMapper(Function<Q, com.querydsl.core.types.dsl.DateTimePath<T>> rootToQueryItem) Returns the mapper function creating the timestamp filter processor from context.- Type Parameters:
- T- actual data type of the query path storing the timestamp
 
- 
polyStringMapperprotected ItemSqlMapper<Q,R> polyStringMapper(Function<Q, com.querydsl.core.types.dsl.StringPath> origMapping, Function<Q, com.querydsl.core.types.dsl.StringPath> normMapping) Returns the mapper creating the string filter processor from context.
- 
addDetailFetchMapper@Deprecated public final void addDetailFetchMapper(ItemName itemName, SqlDetailFetchMapper<R, ?, ?, ?> detailFetchMapper) Deprecated.Fetcher/mappers for detail tables take care of loading to-many details related to this mapped entity (master). One fetcher per detail type/table is registered under the related item name. Used only in old-repo audit, we will let it die with that - but don't use in new stuff. UsecreateRowTransformer(SqlQueryContext, JdbcSession)mechanism instead.- Parameters:
- itemName- item name from schema type that is mapped to detail table in the repository
- detailFetchMapper- fetcher-mapper that handles loading of details
- See Also:
 
- 
joinOnprotected <TQ extends FlexibleRelationalPathBase<TR>,TR> BiFunction<Q,TQ, joinOncom.querydsl.core.types.Predicate> (BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinOnPredicateFunction) Lambda "wrapper" that helps with the type inference (namely the current Q type). Returned bi-function returnsONcondition predicate for two entity paths.- Type Parameters:
- TQ- query type for the JOINed (target) table
- TR- row type related to the- QueryTableMapping
 
- 
tableName
- 
defaultAliasName
- 
repositoryContext
- 
prismContext
- 
newAliasCreates new alias (entity path instance) with a defined name. You can also usedefaultAlias()if one alias in a query is enough. Entity path instance returned by this call is already enhanced by extension columns.
- 
newAliasInstanceMethod returning new instance ofEntityPath- to be implemented by sub-mapping. This will create entity path without any extension columns, seenewAlias(java.lang.String)for that.
- 
defaultAliasReturns default alias - use only once per query, e.g. not for two different joins. Also, don't cache it yourself, always use this method which ensures that the alias has all the extension columns configured properly.
- 
detailFetchMappersDeprecated.Returns collection of all registeredSqlDetailFetchMappers. Used only in old-repo audit, we will let it die with that - but don't use in new stuff. UsecreateRowTransformer(SqlQueryContext, JdbcSession)mechanism instead.
- 
addExtensionColumnRegisters extension columns. At this moment all are treated as strings.
- 
getExtensionColumns
- 
selectExpressions@NotNull public @NotNull com.querydsl.core.types.Path<?>[] selectExpressions(Q entity, Collection<SelectorOptions<GetOperationOptions>> options) By default, usesselectExpressionsWithCustomColumns(Q)and does not use options. Can be overridden to fulfil other needs, e.g. to select just full object.
- 
selectExpressionsWithCustomColumns@NotNull public @NotNull com.querydsl.core.types.Path<?>[] selectExpressionsWithCustomColumns(Q entity) 
- 
newRowObject
- 
toSchemaObjectTransforms row ofQueryTableMappingtype to schema typeQueryTableMapping. If pre-generated bean is used as row it does not include extension (dynamic) columns, which is OK if extension columns are used only for query and their information is still contained in the object somehow else (e.g. full object LOB). Alternative is to dynamically generate the list of select expressions reading directly from theTuple- seetoSchemaObject(Tuple, FlexibleRelationalPathBase, JdbcSession, Collection).- Throws:
- SchemaException
 
- 
toSchemaObjectpublic S toSchemaObject(@NotNull @NotNull com.querydsl.core.Tuple tuple, @NotNull Q entityPath, @NotNull @NotNull JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException Transforms row Tuple containing attributes ofQueryTableMappingto schema typeQueryTableMapping. Entity path can be used to access tuple elements. This allows loading also dynamically defined columns (like extensions). This is what is used by default inSqlQueryContext.- Throws:
- SchemaException
 
- 
createRowTransformerpublic ResultListRowTransformer<S,Q, createRowTransformerR> (SqlQueryContext<S, Q, R> sqlQueryContext, JdbcSession jdbcSession) Returns result transformer that by default callstoSchemaObject(Tuple, FlexibleRelationalPathBase, JdbcSession, Collection)for each result row. This can be overridden, seeResultListRowTransformerjavadoc for details. This is useful for stateful transformers where the whole result can be pre-/post-processed as well.
- 
updateGetOptionspublic Collection<SelectorOptions<GetOperationOptions>> updateGetOptions(Collection<SelectorOptions<GetOperationOptions>> options, @NotNull @NotNull Collection<? extends ItemDelta<?, ?>> modifications) 
- 
toString
 
-