Class QObjectMapping<S extends ObjectType,Q extends QObject<R>,R extends MObject>
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<S,Q,R>
com.evolveum.midpoint.repo.sqale.qmodel.object.QObjectMapping<S,Q,R>
- Type Parameters:
S
- schema type of the objectQ
- type of entity pathR
- row type related to theQObjectMapping
- All Implemented Interfaces:
SqaleMappingMixin<S,
Q, R>
- Direct Known Subclasses:
QAssignmentHolderMapping
,QSchemaMapping
,QShadowMapping
public class QObjectMapping<S extends ObjectType,Q extends QObject<R>,R extends MObject>
extends SqaleTableMapping<S,Q,R>
Mapping between
QObject
and ObjectType
.-
Field Summary
Fields inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryModelMapping
logger
-
Constructor Summary
ModifierConstructorDescriptionprotected
QObjectMapping
(@NotNull String tableName, @NotNull String defaultAliasName, @NotNull Class<S> schemaType, @NotNull Class<Q> queryType, @NotNull SqaleRepoContext repositoryContext) -
Method Summary
Modifier and TypeMethodDescription<C extends Containerable,
TQ extends QContainer<TR, R>, TR extends MContainer>
SqaleMappingMixin<S,Q, R> addContainerTableMapping
(@NotNull ItemName itemName, @NotNull QContainerMapping<C, TQ, TR, R> containerMapping, @NotNull BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinPredicate) Defines table mapping for multi-value container owned by an object or another container.<C extends Containerable,
TQ extends QContainerWithFullObject<TR, R>, TR extends MContainerWithFullObject>
SqaleMappingMixin<S,Q, R> addFullObjectContainerTableMapping
(@NotNull ItemName itemName, @NotNull QContainerWithFullObjectMapping<C, TQ, TR, R> containerMapping, boolean includeByDefault, @NotNull BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinPredicate) int
<TQ extends QReference<TR,
R>, TR extends MReference>
SqaleMappingMixin<S,Q, R> addRefMapping
(@NotNull QName itemName, @NotNull QReferenceMapping<TQ, TR, Q, R> referenceMapping) Defines multi-value reference mapping (refs in table) for both query and modifications.createRowTransformer
(SqlQueryContext<S, Q, R> sqlQueryContext, JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) Returns result transformer that by default callsQueryTableMapping.toSchemaObject(Tuple, FlexibleRelationalPathBase, JdbcSession, Collection)
for each result row.protected void
customizeFullObjectItemsToSkip
(PathSet mutableSet) protected CheckedFunction<SchemaRegistryState,
ItemDefinition<?>, SystemException> protected SchemaRegistryState.DerivationKey<ItemDefinition<?>>
protected final PathSet
static QObjectMapping<?,
?, ?> static QObjectMapping<?,
?, ?> initObjectMapping
(@NotNull SqaleRepoContext repositoryContext) protected boolean
isExcludeAll
(@Nullable Collection<SelectorOptions<GetOperationOptions>> options) boolean
If mapping supports force reindexprotected Q
newAliasInstance
(String alias) Method returning new instance ofEntityPath
- to be implemented by sub-mapping.@NotNull com.querydsl.core.types.Path<?>[]
selectExpressions
(Q entity, Collection<SelectorOptions<GetOperationOptions>> options) By default, usesQueryTableMapping.selectExpressionsWithCustomColumns(Q)
and does not use options.void
setFullObject
(R row, S schemaObject) Serializes schema object and setsMObject.fullObject
.void
setStoreSplitted
(boolean storeSplitted) void
storeRelatedEntities
(R row, S schemaObject, @NotNull JdbcSession jdbcSession) Stores other entities related to the main object row like containers, references, etc.toRowObjectWithoutFullObject
(S schemaObject, JdbcSession jdbcSession) Override this to fill additional row attributes after calling this super version.toSchemaObject
(@NotNull com.querydsl.core.Tuple row, Q entityPath, @NotNull JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) Transforms row Tuple containingSqaleTableMapping
under entity path and extension columns.toSchemaObjectCompleteSafe
(com.querydsl.core.Tuple tuple, Q entityPath, Collection<SelectorOptions<GetOperationOptions>> options, @NotNull JdbcSession jdbcSession, boolean forceFull) The same function as in overridden method, but softer exception handling.Methods inherited from class com.evolveum.midpoint.repo.sqale.mapping.SqaleTableMapping
addExtensionMapping, binaryMapper, booleanMapper, createFullObject, doubleMapper, enumMapper, getDefinition, getPartitionManager, 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, toSchemaObjectComplete, toSchemaObjectInternal, uriMapper, uuidMapper
Methods inherited from class com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping
addDetailFetchMapper, addExtensionColumn, defaultAlias, defaultAliasName, detailFetchMappers, getExtensionColumns, joinOn, longMapper, newAlias, paths, prismContext, 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, addExtensionMapping, addItemMapping, addNestedMapping, addRefMapping, addRelationResolver, afterModify, queryType
-
Field Details
-
DEFAULT_ALIAS_NAME
- See Also:
-
-
Constructor Details
-
QObjectMapping
-
-
Method Details
-
initObjectMapping
public static QObjectMapping<?,?, initObjectMapping?> (@NotNull @NotNull SqaleRepoContext repositoryContext) -
getObjectMapping
-
selectExpressions
@NotNull public @NotNull com.querydsl.core.types.Path<?>[] selectExpressions(Q entity, Collection<SelectorOptions<GetOperationOptions>> options) Description copied from class:QueryTableMapping
By default, usesQueryTableMapping.selectExpressionsWithCustomColumns(Q)
and does not use options. Can be overridden to fulfil other needs, e.g. to select just full object.- Overrides:
selectExpressions
in classQueryTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
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<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
newRowObject
- Overrides:
newRowObject
in classQueryTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
toSchemaObject
public S toSchemaObject(@NotNull @NotNull com.querydsl.core.Tuple row, @NotNull Q entityPath, @NotNull @NotNull JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException Description copied from class:SqaleTableMapping
Transforms row Tuple containingSqaleTableMapping
under entity path and extension columns. While public, for Sqale repo it should only be called for internal mapping purposes. *Do not call this in result list transformers* because the results would not have resolved reference names (if requested). Notice that the default implementation ofQueryTableMapping.createRowTransformer(com.evolveum.midpoint.repo.sqlbase.SqlQueryContext<S, Q, R>, com.evolveum.midpoint.repo.sqlbase.JdbcSession, java.util.Collection<com.evolveum.midpoint.schema.SelectorOptions<com.evolveum.midpoint.schema.GetOperationOptions>>)
in this class callsSqaleTableMapping.toSchemaObjectCompleteSafe(com.querydsl.core.Tuple, Q, java.util.Collection<com.evolveum.midpoint.schema.SelectorOptions<com.evolveum.midpoint.schema.GetOperationOptions>>, com.evolveum.midpoint.repo.sqlbase.JdbcSession, boolean)
which is the right thing to call in result list transformers.- Overrides:
toSchemaObject
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject> - Throws:
SchemaException
-
isExcludeAll
protected boolean isExcludeAll(@Nullable @Nullable Collection<SelectorOptions<GetOperationOptions>> options) -
toSchemaObjectCompleteSafe
public S toSchemaObjectCompleteSafe(com.querydsl.core.Tuple tuple, Q entityPath, Collection<SelectorOptions<GetOperationOptions>> options, @NotNull @NotNull JdbcSession jdbcSession, boolean forceFull) The same function as in overridden method, but softer exception handling. This targets cases likeRepositoryService.searchObjects(java.lang.Class<T>, com.evolveum.midpoint.prism.query.ObjectQuery, java.util.Collection<com.evolveum.midpoint.schema.SelectorOptions<com.evolveum.midpoint.schema.GetOperationOptions>>, com.evolveum.midpoint.schema.result.OperationResult)
where single wrong object should not spoil the whole result list.- Overrides:
toSchemaObjectCompleteSafe
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
toRowObjectWithoutFullObject
Override this to fill additional row attributes after calling this super version. *This must be called with active JDBC session* so it can create newQUri
rows. As this is intended for inserts *DO NOT* setMObject.objectType
to any value, it must be NULL otherwise the DB will complain about the value for the generated column. OID may be null, hence the method does NOT create any sub-entities, seestoreRelatedEntities(MObject, ObjectType, JdbcSession)
. Try to keep order of fields here, in M-class (MObject for this one) and in SQL the same. -
storeRelatedEntities
public void storeRelatedEntities(@NotNull R row, @NotNull S schemaObject, @NotNull @NotNull JdbcSession jdbcSession) throws SchemaException Stores other entities related to the main object row like containers, references, etc. This is not part oftoRowObjectWithoutFullObject(S, com.evolveum.midpoint.repo.sqlbase.JdbcSession)
because it requires known OID which is not assured before calling that method. *Always call this super method first in overriding methods.*- Parameters:
row
- master row for the added object("aggregate root")schemaObject
- schema objects for which the details are storedjdbcSession
- JDBC session used to insert related rows- Throws:
SchemaException
-
setFullObject
Serializes schema object and setsMObject.fullObject
.- Throws:
SchemaException
-
addContainerTableMapping
public <C extends Containerable,TQ extends QContainer<TR, SqaleMappingMixin<S,R>, TR extends MContainer> Q, addContainerTableMappingR> (@NotNull @NotNull ItemName itemName, @NotNull @NotNull QContainerMapping<C, TQ, TR, R> containerMapping, @NotNull @NotNull BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinPredicate) Description copied from interface:SqaleMappingMixin
Defines table mapping for multi-value container owned by an object or another container. This includes path resolver for queries and delta processor for modifications.- Type Parameters:
C
- schema type of the container mapped to the target tableTQ
- entity query type of the container tableTR
- row type of the container table, related toSqaleMappingMixin
-
addRefMapping
public <TQ extends QReference<TR,R>, SqaleMappingMixin<S,TR extends MReference> Q, addRefMappingR> (@NotNull @NotNull QName itemName, @NotNull @NotNull QReferenceMapping<TQ, TR, Q, R> referenceMapping) Description copied from interface:SqaleMappingMixin
Defines multi-value reference mapping (refs in table) for both query and modifications. -
addFullObjectContainerTableMapping
public <C extends Containerable,TQ extends QContainerWithFullObject<TR, SqaleMappingMixin<S,R>, TR extends MContainerWithFullObject> Q, addFullObjectContainerTableMappingR> (@NotNull @NotNull ItemName itemName, @NotNull @NotNull QContainerWithFullObjectMapping<C, TQ, TR, R> containerMapping, boolean includeByDefault, @NotNull @NotNull BiFunction<Q, TQ, com.querydsl.core.types.Predicate> joinPredicate) -
fullObjectItemsToSkip
- Overrides:
fullObjectItemsToSkip
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
customizeFullObjectItemsToSkip
-
createRowTransformer
public ResultListRowTransformer<S,Q, createRowTransformerR> (SqlQueryContext<S, Q, R> sqlQueryContext, JdbcSession jdbcSession, Collection<SelectorOptions<GetOperationOptions>> options) Description copied from class:QueryTableMapping
Returns result transformer that by default callsQueryTableMapping.toSchemaObject(Tuple, FlexibleRelationalPathBase, JdbcSession, Collection)
for each result row. This can be overridden, seeResultListRowTransformer
javadoc for details. This is useful for stateful transformers where the whole result can be pre-/post-processed as well.- Overrides:
createRowTransformer
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
additionalSelectsByDefault
@VisibleForTesting public int additionalSelectsByDefault() -
setStoreSplitted
@VisibleForTesting public void setStoreSplitted(boolean storeSplitted) -
isReindexSupported
public boolean isReindexSupported()If mapping supports force reindex- Returns:
- True if reindex is supported for specified objects.
-
definitionDerivationKey
- Overrides:
definitionDerivationKey
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-
definitionDerivation
protected CheckedFunction<SchemaRegistryState,ItemDefinition<?>, definitionDerivation()SystemException> - Overrides:
definitionDerivation
in classSqaleTableMapping<S extends ObjectType,
Q extends QObject<R>, R extends MObject>
-