Class SqlRepoContext
java.lang.Object
com.evolveum.midpoint.repo.sqlbase.SqlRepoContext
- Direct Known Subclasses:
- SqaleRepoContext
Encapsulates Querydsl 
Configuration, our QueryModelMappingRegistry
 and other parts of SQL repository config and implements methods that need these.
 Preferably, it should hide (hence "encapsulate") the fields and offer behavior instead.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final com.querydsl.sql.Configurationprotected final SchemaService
- 
Constructor SummaryConstructorsConstructorDescriptionSqlRepoContext(JdbcRepositoryConfiguration jdbcRepositoryConfiguration, DataSource dataSource, SchemaService schemaService, QueryModelMappingRegistry mappingRegistry) 
- 
Method SummaryModifier and TypeMethodDescription@NotNull PrismParserNoIOcreateStringParser(String serializedResult) @NotNull PrismSerializer<String><TS,TQ extends FlexibleRelationalPathBase<TR>, TR> 
 QueryTableMapping<TS,TQ, TR> getMappingByQueryType(Class<TQ> queryType) <S,Q extends FlexibleRelationalPathBase<R>, R, QM extends QueryTableMapping<S, Q, R>> 
 QMgetMappingBySchemaType(Class<S> schemaType) com.querydsl.sql.Configurationcom.querydsl.sql.SQLTemplatescom.querydsl.sql.dml.SQLDeleteClausenewDelete(Connection connection, com.querydsl.sql.RelationalPath<?> entity) com.querydsl.sql.dml.SQLInsertClausenewInsert(Connection connection, com.querydsl.sql.RelationalPath<?> entity) CreatesJdbcSessionthat typically represents transactional work on JDBC connection.com.querydsl.sql.SQLQuery<?>newQuery()com.querydsl.sql.SQLQuery<?>newQuery(Connection conn) com.querydsl.sql.dml.SQLUpdateClausenewUpdate(Connection connection, com.querydsl.sql.RelationalPath<?> entity) void@NotNull QNamenormalizeRelation(QName qName) <T> RepositoryObjectParseResult<T>parsePrismObject(String serializedForm, Class<T> schemaType) Sometimes delegation is not enough - we need Prism context for schema type construction with definitions (parameter to constructor).<T> Class<? extends T>qNameToSchemaClass(QName qName) schemaClassToQName(Class<?> schemaClass) voidsetQuerydslSqlListener(com.querydsl.sql.SQLBaseListener listener) Sets Querydsl SQL listener for this repository, replacing any previously one.
- 
Field Details- 
querydslConfigprotected final com.querydsl.sql.Configuration querydslConfig
- 
schemaService
 
- 
- 
Constructor Details- 
SqlRepoContextpublic SqlRepoContext(JdbcRepositoryConfiguration jdbcRepositoryConfiguration, DataSource dataSource, SchemaService schemaService, QueryModelMappingRegistry mappingRegistry) 
 
- 
- 
Method Details- 
setQuerydslSqlListenerpublic void setQuerydslSqlListener(com.querydsl.sql.SQLBaseListener listener) Sets Querydsl SQL listener for this repository, replacing any previously one.
- 
newQuerypublic com.querydsl.sql.SQLQuery<?> newQuery()
- 
newQuery
- 
getMappingByQueryTypepublic <TS,TQ extends FlexibleRelationalPathBase<TR>, QueryTableMapping<TS,TR> TQ, getMappingByQueryTypeTR> (Class<TQ> queryType) - Type Parameters:
- TQ- query type for the target table
- TR- row type related to the- SqlRepoContext
 
- 
getMappingBySchemaTypepublic <S,Q extends FlexibleRelationalPathBase<R>, QM getMappingBySchemaTypeR, QM extends QueryTableMapping<S, Q, R>> (Class<S> schemaType) 
- 
getQuerydslTemplatespublic com.querydsl.sql.SQLTemplates getQuerydslTemplates()
- 
getQuerydslConfigurationpublic com.querydsl.sql.Configuration getQuerydslConfiguration()
- 
newInsertpublic com.querydsl.sql.dml.SQLInsertClause newInsert(Connection connection, com.querydsl.sql.RelationalPath<?> entity) 
- 
newUpdatepublic com.querydsl.sql.dml.SQLUpdateClause newUpdate(Connection connection, com.querydsl.sql.RelationalPath<?> entity) 
- 
newDeletepublic com.querydsl.sql.dml.SQLDeleteClause newDelete(Connection connection, com.querydsl.sql.RelationalPath<?> entity) 
- 
getJdbcRepositoryConfiguration
- 
newJdbcSessionCreatesJdbcSessionthat typically represents transactional work on JDBC connection. All other lifecycle methods are to be called on the returned object. Object isAutoCloseableand can be used in try-with-resource blocks. This call be followed byJdbcSession.startTransaction()(or one of its variants). If the transaction is not started the connection will likely be in auto-commit mode. *We want to start transaction for any work in production code* but for tests it's ok not to.
- 
qNameToSchemaClass
- 
schemaClassToQName
- 
normalizeRelation
- 
createStringSerializer
- 
parsePrismObjectpublic <T> RepositoryObjectParseResult<T> parsePrismObject(String serializedForm, Class<T> schemaType) throws SchemaException - Throws:
- SchemaException
 
- 
createStringParser
- 
prismContextSometimes delegation is not enough - we need Prism context for schema type construction with definitions (parameter to constructor).
- 
matchingRuleRegistry
- 
relationRegistry
- 
normalizeAllRelations
 
-