Class QReferenceMapping<Q extends QReference<R,OR>,R extends MReference,OQ extends FlexibleRelationalPathBase<OR>,OR>
- java.lang.Object
-
- com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping<S,Q,R>
-
- com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping<S,Q,R>
-
- com.evolveum.midpoint.repo.sqale.mapping.SqaleTableMapping<ObjectReferenceType,Q,R>
-
- com.evolveum.midpoint.repo.sqale.qmodel.ref.QReferenceMapping<Q,R,OQ,OR>
-
- Type Parameters:
Q
- type of entity path for the reference tableR
- row type related to theQReferenceMapping
OQ
- query type of the reference ownerOR
- row type of the reference owner (related toQReferenceMapping
)
- All Implemented Interfaces:
QOwnedByMapping<ObjectReferenceType,R,OR>
,SqaleMappingMixin<ObjectReferenceType,Q,R>
- Direct Known Subclasses:
QAccessCertificationWorkItemReferenceMapping
,QAssignmentReferenceMapping
,QCaseWorkItemReferenceMapping
,QObjectReferenceMapping
,QProcessedObjectEventMarkReferenceMapping
public class QReferenceMapping<Q extends QReference<R,OR>,R extends MReference,OQ extends FlexibleRelationalPathBase<OR>,OR> extends SqaleTableMapping<ObjectReferenceType,Q,R> implements QOwnedByMapping<ObjectReferenceType,R,OR>
Base mapping betweenQReference
subclasses andObjectReferenceType
. See subtypes for mapping instances for specific tables and seeMReferenceType
as well.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ALIAS_NAME
static Map<Class<?>,Map<ItemPath,QReferenceMapping<?,?,?,?>>>
MAPPING_BY_OWNER_TYPE_AND_PATH
protected ItemPath
referencePath
-
Fields inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping
logger
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QReferenceMapping(String tableName, String defaultAliasName, Class<Q> queryType, @NotNull SqaleRepoContext repositoryContext, @NotNull Supplier<QueryTableMapping<?,TQ,TR>> targetMappingSupplier)
protected
QReferenceMapping(String tableName, String defaultAliasName, Class<Q> queryType, @NotNull SqaleRepoContext repositoryContext, @NotNull Supplier<QueryTableMapping<?,TQ,TR>> targetMappingSupplier, @Nullable Supplier<QueryTableMapping<OS,OQ,OR>> ownerMappingSupplier, @Nullable BiFunction<Q,OQ,com.querydsl.core.types.Predicate> ownerJoin, @Nullable Class<?> ownerType, @Nullable ItemPath referencePath)
Constructor with owner related parameters to support reference search.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BiFunction<OQ,Q,com.querydsl.core.types.Predicate>
correlationPredicate()
Returns a bi-function that constructs correlation query predicate for owner and reference.static QReferenceMapping<?,?,?,?>
getByOwnerTypeAndPath(Class<?> ownerType, ItemPath itemPath)
static QReferenceMapping<?,?,?,?>
init(@NotNull SqaleRepoContext repositoryContext)
R
insert(ObjectReferenceType reference, OR ownerRow, JdbcSession jdbcSession)
There is no need to override this, only reference creation is different and that is covered bynewRowObject(Object)
including setting FK columns.protected Q
newAliasInstance(String alias)
Method returning new instance ofEntityPath
- to be implemented by sub-mapping.R
newRowObject(OR ownerRow)
Defines a contract for creating the reference for the provided owner row.static void
registerByOwnerTypeAndPath(Class<?> ownerType, ItemPath itemPath, QReferenceMapping<?,?,?,?> mapping)
-
Methods inherited from class com.evolveum.midpoint.repo.sqale.mapping.SqaleTableMapping
addExtensionMapping, binaryMapper, booleanMapper, createFullObject, createRowTransformer, enumMapper, fullObjectItemsToSkip, insert, integerMapper, multiPolyStringMapper, multiStringMapper, multiUriMapper, multiValueMapper, needsInitialization, objectReference, objectReference, objectTypeToQName, parseSchemaObject, parseSchemaObject, polyStringMapper, processCacheableRelation, processCacheableUri, processCacheableUri, processCacheableUris, processExtensionColumns, processExtensions, repositoryContext, resolveIdToUri, resolveReferenceNames, resolveUriIdToQName, schemaTypeToObjectType, setPolyString, setReference, storeRefs, stringMapper, stringsToArray, timestampMapper, toSchemaObject, toSchemaObject, toSchemaObjectComplete, toSchemaObjectCompleteSafe, toSchemaObjectInternal, uriMapper, uuidMapper
-
Methods inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping
addDetailFetchMapper, addExtensionColumn, defaultAlias, defaultAliasName, detailFetchMappers, getExtensionColumns, joinOn, longMapper, newAlias, newRowObject, prismContext, selectExpressions, selectExpressionsWithCustomColumns, tableName, toString, updateGetOptions
-
Methods inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping
addItemMapping, addRelationResolver, getItemMapper, getItemMappings, getRelationResolver, itemDefinition, itemMapper, queryType, relationResolver, schemaType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.repo.sqale.mapping.SqaleMappingMixin
addAuditRefMapping, addContainerTableMapping, addExtensionMapping, addItemMapping, addNestedMapping, addRefMapping, addRefMapping, addRelationResolver, afterModify, queryType
-
-
-
-
Field Detail
-
DEFAULT_ALIAS_NAME
public static final String DEFAULT_ALIAS_NAME
- See Also:
- Constant Field Values
-
MAPPING_BY_OWNER_TYPE_AND_PATH
public static final Map<Class<?>,Map<ItemPath,QReferenceMapping<?,?,?,?>>> MAPPING_BY_OWNER_TYPE_AND_PATH
-
referencePath
protected final ItemPath referencePath
-
-
Constructor Detail
-
QReferenceMapping
protected QReferenceMapping(String tableName, String defaultAliasName, Class<Q> queryType, @NotNull @NotNull SqaleRepoContext repositoryContext, @NotNull @NotNull Supplier<QueryTableMapping<?,TQ,TR>> targetMappingSupplier)
-
QReferenceMapping
protected QReferenceMapping(String tableName, String defaultAliasName, Class<Q> queryType, @NotNull @NotNull SqaleRepoContext repositoryContext, @NotNull @NotNull Supplier<QueryTableMapping<?,TQ,TR>> targetMappingSupplier, @Nullable @Nullable Supplier<QueryTableMapping<OS,OQ,OR>> ownerMappingSupplier, @Nullable @Nullable BiFunction<Q,OQ,com.querydsl.core.types.Predicate> ownerJoin, @Nullable @Nullable Class<?> ownerType, @Nullable @Nullable ItemPath referencePath)
Constructor with owner related parameters to support reference search.- Type Parameters:
OS
- reference owner schema type, needed only for safer typing in the constructorTQ
- type of target entity pathTR
- row type related to theQReferenceMapping
- Parameters:
queryType
- Querydsl query type related to this mappingtargetMappingSupplier
- supplier of the query mapping for the reference targetownerMappingSupplier
- optional supplier for reference owner, needed for .. (parent) resolution and support of reference searchownerJoin
- JOIN function for parent resolutionownerType
- needed for registration for reference search later; this cannot be taken from the ownerMappingSupplier yet, because the supplier may still return null at this momentreferencePath
- item path to the reference in the owner
-
-
Method Detail
-
init
public static QReferenceMapping<?,?,?,?> init(@NotNull @NotNull SqaleRepoContext repositoryContext)
-
registerByOwnerTypeAndPath
public static void registerByOwnerTypeAndPath(Class<?> ownerType, ItemPath itemPath, QReferenceMapping<?,?,?,?> mapping)
-
getByOwnerTypeAndPath
public static QReferenceMapping<?,?,?,?> getByOwnerTypeAndPath(Class<?> ownerType, ItemPath itemPath)
-
newAliasInstance
protected Q newAliasInstance(String alias)
Description copied from class:QueryTableMapping
Method returning new instance ofEntityPath
- to be implemented by sub-mapping. This will create entity path without any extension columns, seeQueryTableMapping.newAlias(java.lang.String)
for that.- Specified by:
newAliasInstance
in classQueryTableMapping<ObjectReferenceType,Q extends QReference<R,OR>,R extends MReference>
-
newRowObject
public R newRowObject(OR ownerRow)
Defines a contract for creating the reference for the provided owner row.- Specified by:
newRowObject
in interfaceQOwnedByMapping<Q extends QReference<R,OR>,R extends MReference,OQ extends FlexibleRelationalPathBase<OR>>
-
correlationPredicate
public BiFunction<OQ,Q,com.querydsl.core.types.Predicate> correlationPredicate()
Returns a bi-function that constructs correlation query predicate for owner and reference.
-
insert
public R insert(ObjectReferenceType reference, OR ownerRow, JdbcSession jdbcSession)
There is no need to override this, only reference creation is different and that is covered bynewRowObject(Object)
including setting FK columns. All the other columns are based on a single schema type, so there is no variation.- Specified by:
insert
in interfaceQOwnedByMapping<Q extends QReference<R,OR>,R extends MReference,OQ extends FlexibleRelationalPathBase<OR>>
-
-