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
,QAffectedObjectReferenceMapping
,QAssignmentMarkReferenceMapping
,QAssignmentMetadataReferenceMapping
,QAssignmentReferenceMapping
,QCaseWorkItemReferenceMapping
,QObjectReferenceMapping
,QProcessedObjectEventMarkReferenceMapping
,QShadowReferenceAttributeMapping
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 between
QReference
subclasses and ObjectReferenceType
.
See subtypes for mapping instances for specific tables and see MReferenceType
as well.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final Map<Class<?>,
Map<ItemPath, QReferenceMapping<?, ?, ?, ?>>> protected final ItemPath
Fields inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping
logger
-
Constructor Summary
ModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionBiFunction<OQ,
Q, com.querydsl.core.types.Predicate> 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) protected void
initRowObject
(R row, ObjectReferenceType reference) 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.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, definitionDerivation, definitionDerivationKey, doubleMapper, enumMapper, fullObjectItemsToSkip, getDefinition, getPartitionManager, insert, integerMapper, multiPolyStringMapper, multiStringMapper, multiUriMapper, multiValueMapper, needsInitialization, objectReference, objectReference, objectTypeToQName, parseSchemaObject, parseSchemaObject, polyStringMapper, preprocessCacheableUris, 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, appendPaths, defaultAlias, defaultAliasName, detailFetchMappers, getExtensionColumns, joinOn, longMapper, newAlias, newRowObject, paths, 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 Details
-
DEFAULT_ALIAS_NAME
- See Also:
-
MAPPING_BY_OWNER_TYPE_AND_PATH
public static final Map<Class<?>,Map<ItemPath, MAPPING_BY_OWNER_TYPE_AND_PATHQReferenceMapping<?, ?, ?, ?>>> -
referencePath
-
-
Constructor Details
-
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 Details
-
init
-
registerByOwnerTypeAndPath
public static void registerByOwnerTypeAndPath(Class<?> ownerType, ItemPath itemPath, QReferenceMapping<?, ?, ?, ?> mapping) -
getByOwnerTypeAndPath
public static QReferenceMapping<?,?, getByOwnerTypeAndPath?, ?> (Class<?> ownerType, ItemPath itemPath) -
newAliasInstance
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
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
Returns a bi-function that constructs correlation query predicate for owner and reference. -
insert
public R insert(ObjectReferenceType reference, OR ownerRow, JdbcSession jdbcSession) throws SchemaException 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>> - Throws:
SchemaException
-
initRowObject
- Throws:
SchemaException
-