Class SqlTransformer<S,Q extends FlexibleRelationalPathBase<R>,R>
- java.lang.Object
-
- com.evolveum.midpoint.repo.sql.pure.SqlTransformer<S,Q,R>
-
- Type Parameters:
S
- schema typeR
- type of the transformed data, a row bean
- Direct Known Subclasses:
AuditDeltaSqlTransformer
,AuditEventRecordSqlTransformer
public abstract class SqlTransformer<S,Q extends FlexibleRelationalPathBase<R>,R> extends Object
Base class for SQL transformers translating from query beans or tuples to model types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SqlTransformer.SqlTransformationException
-
Field Summary
Fields Modifier and Type Field Description protected QueryModelMapping<S,Q,R>
mapping
protected PrismContext
prismContext
protected com.querydsl.sql.Configuration
querydslConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protected
SqlTransformer(PrismContext prismContext, QueryModelMapping<S,Q,R> mapping, com.querydsl.sql.Configuration querydslConfiguration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected @Nullable ObjectReferenceType
objectReferenceType(@Nullable String oid, RObjectType repoObjectType, String description)
ReturnsObjectReferenceType
with specified oid, proper type based onRObjectType
and, optionally, description.protected void
processExtensionColumns(S schemaObject, com.querydsl.core.Tuple tuple, Q entityPath)
protected @Nullable RObjectType
repoObjectType(@Nullable Integer repoObjectTypeId)
Returns nullableRObjectType
from ordinal Integer.protected @NotNull RObjectType
repoObjectType(@Nullable Integer repoObjectTypeId, @NotNull RObjectType defaultValue)
ReturnsRObjectType
from ordinal Integer or specified default value.S
toSchemaObject(com.querydsl.core.Tuple tuple, Q entityPath)
Transforms row Tuple containingSqlTransformer
under entity path and extension columns.abstract S
toSchemaObject(R row)
Transforms row of R to M type - typically a model/schema object.S
toSchemaObjectSafe(com.querydsl.core.Tuple row, Q entityPath)
S
toSchemaObjectSafe(R row)
Version oftoSchemaObject(Object)
rethrowing checked exceptions as uncheckedSqlTransformer.SqlTransformationException
- this is useful for lambda/method references usages.protected @Nullable String
trim(@Nullable String value, @NotNull com.querydsl.sql.ColumnMetadata columnMetadata)
Trimming the value to the column size from column metadata (must be specified).
-
-
-
Field Detail
-
prismContext
protected final PrismContext prismContext
-
mapping
protected final QueryModelMapping<S,Q extends FlexibleRelationalPathBase<R>,R> mapping
-
querydslConfiguration
protected final com.querydsl.sql.Configuration querydslConfiguration
-
-
Constructor Detail
-
SqlTransformer
protected SqlTransformer(PrismContext prismContext, QueryModelMapping<S,Q,R> mapping, com.querydsl.sql.Configuration querydslConfiguration)
-
-
Method Detail
-
toSchemaObject
public abstract S toSchemaObject(R row) throws SchemaException
Transforms row of R to M type - typically a model/schema object. 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 would be dynamically generated list of select expressions and transforming row to M object directly from
Tuple
.- Throws:
SchemaException
-
toSchemaObject
public S toSchemaObject(com.querydsl.core.Tuple tuple, Q entityPath) throws SchemaException
Transforms row Tuple containingSqlTransformer
under entity path and extension columns.- Throws:
SchemaException
-
processExtensionColumns
protected void processExtensionColumns(S schemaObject, com.querydsl.core.Tuple tuple, Q entityPath)
-
toSchemaObjectSafe
public S toSchemaObjectSafe(R row)
Version oftoSchemaObject(Object)
rethrowing checked exceptions as uncheckedSqlTransformer.SqlTransformationException
- this is useful for lambda/method references usages.
-
objectReferenceType
@Nullable protected @Nullable ObjectReferenceType objectReferenceType(@Nullable @Nullable String oid, RObjectType repoObjectType, String description)
ReturnsObjectReferenceType
with specified oid, proper type based onRObjectType
and, optionally, description. Returnsnull
if OID is null. Fails if OID is not null andrepoObjectType
is null.
-
repoObjectType
@NotNull protected @NotNull RObjectType repoObjectType(@Nullable @Nullable Integer repoObjectTypeId, @NotNull @NotNull RObjectType defaultValue)
ReturnsRObjectType
from ordinal Integer or specified default value.
-
repoObjectType
@Nullable protected @Nullable RObjectType repoObjectType(@Nullable @Nullable Integer repoObjectTypeId)
Returns nullableRObjectType
from ordinal Integer. If null is returned it will not fail immediately unlikeRObjectType.fromOrdinal(int)
. This is practical for eager argument resolution forobjectReferenceType(String, RObjectType, String)
. Null may still be OK if OID is null as well - which means no reference.
-
-