Search in sources :

Example 1 with GearedCipherManager

use of org.dbflute.cbean.cipher.GearedCipherManager in project dbflute-core by dbflute.

the class AbstractConditionQuery method doRegisterQueryDerivedReferrer.

protected void doRegisterQueryDerivedReferrer(String function, final ConditionQuery subQuery, String columnDbName, String relatedColumnDbName, String propertyName, String referrerPropertyName, String operand, Object value, String parameterPropertyName, DerivedReferrerOption option) {
    assertFunctionNotNull("QueryDerivedReferrer", columnDbName, function);
    assertSubQueryNotNull("QueryDerivedReferrer", columnDbName, subQuery);
    option.xacceptBaseCB(xgetBaseCB());
    if (isDerivedReferrerSelectAllPossible(subQuery, option)) {
        createCBExThrower().throwQueryDerivedReferrerSelectAllPossibleException(function, subQuery);
    }
    final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
    final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
    final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
    final SqlClause subQueryClause = subQuery.xgetSqlClause();
    final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
    final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
    final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
    final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
    final String mainSubQueryIdentity = propertyName + "[" + subQueryLevel + ":subquerymain]";
    final String parameterPath = xgetLocation(parameterPropertyName);
    final QueryDerivedReferrer derivedReferrer = option.createQueryDerivedReferrer(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, mainSubQueryIdentity, operand, value, parameterPath);
    xregisterParameterOption(option);
    final String correlatedFixedCondition = xbuildReferrerCorrelatedFixedCondition(subQuery, referrerPropertyName);
    final String clause = derivedReferrer.buildDerivedReferrer(function, columnDbName, relatedColumnDbName, correlatedFixedCondition, option);
    // /= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    // is null or null-revived conversion (coalesce) -> no way to be inner
    // 
    // for example, the following SQL is no way to be inner
    // (suppose if PURCHASE refers WITHDRAWAL)
    // 
    // select mb.MEMBER_ID, mb.MEMBER_NAME
    // , mb.MEMBER_STATUS_CODE, wd.MEMBER_ID as WD_MEMBER_ID
    // from MEMBER mb
    // left outer join MEMBER_WITHDRAWAL wd on mb.MEMBER_ID = wd.MEMBER_ID
    // where (select max(pc.PURCHASE_PRICE)
    // from PURCHASE pc
    // where pc.MEMBER_ID = wd.MEMBER_ID -- may null
    // ) is null
    // order by mb.MEMBER_ID
    // 
    // and using coalesce means it may select records that have null value
    // so using coalesce is no way in spite of operand
    // = = = = = = = = = =/
    final boolean noWayInner = HpQDRParameter.isOperandIsNull(operand) || option.mayNullRevived();
    registerWhereClause(clause, noWayInner);
}
Also used : ColumnRealNameProvider(org.dbflute.dbmeta.name.ColumnRealNameProvider) DerivedReferrerOptionFactory(org.dbflute.cbean.coption.DerivedReferrerOptionFactory) UnionClauseProvider(org.dbflute.cbean.sqlclause.union.UnionClauseProvider) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionKeyInScope(org.dbflute.cbean.ckey.ConditionKeyInScope) Date(java.util.Date) ParameterOption(org.dbflute.cbean.coption.ParameterOption) LoggerFactory(org.slf4j.LoggerFactory) OrderByElement(org.dbflute.cbean.sqlclause.orderby.OrderByElement) QueryClause(org.dbflute.cbean.sqlclause.query.QueryClause) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) SimpleMapPmb(org.dbflute.twowaysql.pmbean.SimpleMapPmb) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) PrimaryInfo(org.dbflute.dbmeta.info.PrimaryInfo) OrScopeQueryAndPartUnsupportedOperationException(org.dbflute.exception.OrScopeQueryAndPartUnsupportedOperationException) Map(java.util.Map) HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) DfBeanDescFactory(org.dbflute.helper.beans.factory.DfBeanDescFactory) ManualOrderOption(org.dbflute.cbean.ordering.ManualOrderOption) ConditionOption(org.dbflute.cbean.coption.ConditionOption) FixedConditionLazyChecker(org.dbflute.cbean.sqlclause.join.FixedConditionLazyChecker) Method(java.lang.reflect.Method) RangeOfOption(org.dbflute.cbean.coption.RangeOfOption) DfCollectionUtil(org.dbflute.util.DfCollectionUtil) SubQuery(org.dbflute.cbean.scoping.SubQuery) TimeZone(java.util.TimeZone) IndependentProcessor(org.dbflute.helper.function.IndependentProcessor) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) LikeSearchOption(org.dbflute.cbean.coption.LikeSearchOption) QueryModeProvider(org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider) FixedConditionResolver(org.dbflute.cbean.sqlclause.join.FixedConditionResolver) ScalarConditionOption(org.dbflute.cbean.coption.ScalarConditionOption) DBMeta(org.dbflute.dbmeta.DBMeta) FunCustodial(org.dbflute.FunCustodial) DfBeanDesc(org.dbflute.helper.beans.DfBeanDesc) Classification(org.dbflute.jdbc.Classification) List(java.util.List) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ExistsReferrer(org.dbflute.cbean.sqlclause.subquery.ExistsReferrer) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) SqlClauseMySql(org.dbflute.cbean.sqlclause.SqlClauseMySql) DBMetaProvider(org.dbflute.dbmeta.DBMetaProvider) DBFluteSystem(org.dbflute.system.DBFluteSystem) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) DateConditionAdjuster(org.dbflute.cbean.garnish.datefitting.DateConditionAdjuster) ConditionKeyPrepareResult(org.dbflute.cbean.ckey.ConditionKeyPrepareResult) ScalarCondition(org.dbflute.cbean.sqlclause.subquery.ScalarCondition) HpFixedConditionQueryResolver(org.dbflute.cbean.chelper.HpFixedConditionQueryResolver) LocalDateTime(java.time.LocalDateTime) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) HashMap(java.util.HashMap) ReflectionFailureException(org.dbflute.util.DfReflectionUtil.ReflectionFailureException) DerivedReferrerOption(org.dbflute.cbean.coption.DerivedReferrerOption) ManualOrderOptionCall(org.dbflute.cbean.ordering.ManualOrderOptionCall) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SqlClauseOracle(org.dbflute.cbean.sqlclause.SqlClauseOracle) HpQDRSetupper(org.dbflute.cbean.chelper.HpQDRSetupper) ExtensionOperand(org.dbflute.dbway.ExtensionOperand) HpQDRParameter(org.dbflute.cbean.chelper.HpQDRParameter) PartitionByProvider(org.dbflute.cbean.sqlclause.subquery.ScalarCondition.PartitionByProvider) DfReflectionUtil(org.dbflute.util.DfReflectionUtil) QueryUsedAliasInfo(org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo) ShortCharHandlingMode(org.dbflute.jdbc.ShortCharHandlingMode) Srl(org.dbflute.util.Srl) QueryClauseArranger(org.dbflute.cbean.sqlclause.query.QueryClauseArranger) ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) ConditionValue(org.dbflute.cbean.cvalue.ConditionValue) RelationInfo(org.dbflute.dbmeta.info.RelationInfo) ForeignInfo(org.dbflute.dbmeta.info.ForeignInfo) FromToOption(org.dbflute.cbean.coption.FromToOption) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) HpSLCFunction(org.dbflute.cbean.chelper.HpSLCFunction) SpecifyDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.SpecifyDerivedReferrer) WayOfMySQL(org.dbflute.dbway.WayOfMySQL) QueryDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.QueryDerivedReferrer) ConditionKey(org.dbflute.cbean.ckey.ConditionKey) ConditionOptionCall(org.dbflute.cbean.coption.ConditionOptionCall) HpSLCCustomized(org.dbflute.cbean.chelper.HpSLCCustomized) ConditionBeanExceptionThrower(org.dbflute.cbean.exception.ConditionBeanExceptionThrower) HpDerivingSubQueryInfo(org.dbflute.cbean.chelper.HpDerivingSubQueryInfo) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo) DfTypeUtil(org.dbflute.util.DfTypeUtil) HpQDRFunction(org.dbflute.cbean.chelper.HpQDRFunction) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) InScopeRelation(org.dbflute.cbean.sqlclause.subquery.InScopeRelation) DBMeta(org.dbflute.dbmeta.DBMeta) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) QueryDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.QueryDerivedReferrer) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager)

Example 2 with GearedCipherManager

use of org.dbflute.cbean.cipher.GearedCipherManager in project dbflute-core by dbflute.

the class AbstractConditionQuery method registerInScopeRelation.

// *unsupported ExistsReferrer as in-line because it's (or was) so dangerous
// ===================================================================================
// InScopeRelation
// ===============
// {Modified at DBFlute-0.7.5}
protected void registerInScopeRelation(final ConditionQuery subQuery, String columnDbName, String relatedColumnDbName, String propertyName, String relationPropertyName, boolean notInScope) {
    assertSubQueryNotNull("InScopeRelation", columnDbName, subQuery);
    final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
    final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
    final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
    final SqlClause subQueryClause = subQuery.xgetSqlClause();
    final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
    final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
    final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
    final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
    final boolean suppressLocalAliasName = isInScopeRelationSuppressLocalAliasName();
    final InScopeRelation inScopeRelation = new InScopeRelation(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, suppressLocalAliasName);
    final String correlatedFixedCondition = xbuildForeignCorrelatedFixedCondition(subQuery, relationPropertyName);
    final String inScopeOption = notInScope ? "not" : null;
    final String clause = inScopeRelation.buildInScopeRelation(columnDbName, relatedColumnDbName, correlatedFixedCondition, inScopeOption);
    registerWhereClause(clause);
}
Also used : ColumnRealNameProvider(org.dbflute.dbmeta.name.ColumnRealNameProvider) DerivedReferrerOptionFactory(org.dbflute.cbean.coption.DerivedReferrerOptionFactory) UnionClauseProvider(org.dbflute.cbean.sqlclause.union.UnionClauseProvider) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionKeyInScope(org.dbflute.cbean.ckey.ConditionKeyInScope) Date(java.util.Date) ParameterOption(org.dbflute.cbean.coption.ParameterOption) LoggerFactory(org.slf4j.LoggerFactory) OrderByElement(org.dbflute.cbean.sqlclause.orderby.OrderByElement) QueryClause(org.dbflute.cbean.sqlclause.query.QueryClause) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) SimpleMapPmb(org.dbflute.twowaysql.pmbean.SimpleMapPmb) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) PrimaryInfo(org.dbflute.dbmeta.info.PrimaryInfo) OrScopeQueryAndPartUnsupportedOperationException(org.dbflute.exception.OrScopeQueryAndPartUnsupportedOperationException) Map(java.util.Map) HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) DfBeanDescFactory(org.dbflute.helper.beans.factory.DfBeanDescFactory) ManualOrderOption(org.dbflute.cbean.ordering.ManualOrderOption) ConditionOption(org.dbflute.cbean.coption.ConditionOption) FixedConditionLazyChecker(org.dbflute.cbean.sqlclause.join.FixedConditionLazyChecker) Method(java.lang.reflect.Method) RangeOfOption(org.dbflute.cbean.coption.RangeOfOption) DfCollectionUtil(org.dbflute.util.DfCollectionUtil) SubQuery(org.dbflute.cbean.scoping.SubQuery) TimeZone(java.util.TimeZone) IndependentProcessor(org.dbflute.helper.function.IndependentProcessor) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) LikeSearchOption(org.dbflute.cbean.coption.LikeSearchOption) QueryModeProvider(org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider) FixedConditionResolver(org.dbflute.cbean.sqlclause.join.FixedConditionResolver) ScalarConditionOption(org.dbflute.cbean.coption.ScalarConditionOption) DBMeta(org.dbflute.dbmeta.DBMeta) FunCustodial(org.dbflute.FunCustodial) DfBeanDesc(org.dbflute.helper.beans.DfBeanDesc) Classification(org.dbflute.jdbc.Classification) List(java.util.List) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ExistsReferrer(org.dbflute.cbean.sqlclause.subquery.ExistsReferrer) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) SqlClauseMySql(org.dbflute.cbean.sqlclause.SqlClauseMySql) DBMetaProvider(org.dbflute.dbmeta.DBMetaProvider) DBFluteSystem(org.dbflute.system.DBFluteSystem) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) DateConditionAdjuster(org.dbflute.cbean.garnish.datefitting.DateConditionAdjuster) ConditionKeyPrepareResult(org.dbflute.cbean.ckey.ConditionKeyPrepareResult) ScalarCondition(org.dbflute.cbean.sqlclause.subquery.ScalarCondition) HpFixedConditionQueryResolver(org.dbflute.cbean.chelper.HpFixedConditionQueryResolver) LocalDateTime(java.time.LocalDateTime) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) HashMap(java.util.HashMap) ReflectionFailureException(org.dbflute.util.DfReflectionUtil.ReflectionFailureException) DerivedReferrerOption(org.dbflute.cbean.coption.DerivedReferrerOption) ManualOrderOptionCall(org.dbflute.cbean.ordering.ManualOrderOptionCall) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SqlClauseOracle(org.dbflute.cbean.sqlclause.SqlClauseOracle) HpQDRSetupper(org.dbflute.cbean.chelper.HpQDRSetupper) ExtensionOperand(org.dbflute.dbway.ExtensionOperand) HpQDRParameter(org.dbflute.cbean.chelper.HpQDRParameter) PartitionByProvider(org.dbflute.cbean.sqlclause.subquery.ScalarCondition.PartitionByProvider) DfReflectionUtil(org.dbflute.util.DfReflectionUtil) QueryUsedAliasInfo(org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo) ShortCharHandlingMode(org.dbflute.jdbc.ShortCharHandlingMode) Srl(org.dbflute.util.Srl) QueryClauseArranger(org.dbflute.cbean.sqlclause.query.QueryClauseArranger) ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) ConditionValue(org.dbflute.cbean.cvalue.ConditionValue) RelationInfo(org.dbflute.dbmeta.info.RelationInfo) ForeignInfo(org.dbflute.dbmeta.info.ForeignInfo) FromToOption(org.dbflute.cbean.coption.FromToOption) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) HpSLCFunction(org.dbflute.cbean.chelper.HpSLCFunction) SpecifyDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.SpecifyDerivedReferrer) WayOfMySQL(org.dbflute.dbway.WayOfMySQL) QueryDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.QueryDerivedReferrer) ConditionKey(org.dbflute.cbean.ckey.ConditionKey) ConditionOptionCall(org.dbflute.cbean.coption.ConditionOptionCall) HpSLCCustomized(org.dbflute.cbean.chelper.HpSLCCustomized) ConditionBeanExceptionThrower(org.dbflute.cbean.exception.ConditionBeanExceptionThrower) HpDerivingSubQueryInfo(org.dbflute.cbean.chelper.HpDerivingSubQueryInfo) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo) DfTypeUtil(org.dbflute.util.DfTypeUtil) HpQDRFunction(org.dbflute.cbean.chelper.HpQDRFunction) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) InScopeRelation(org.dbflute.cbean.sqlclause.subquery.InScopeRelation) DBMeta(org.dbflute.dbmeta.DBMeta) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) InScopeRelation(org.dbflute.cbean.sqlclause.subquery.InScopeRelation)

Example 3 with GearedCipherManager

use of org.dbflute.cbean.cipher.GearedCipherManager in project dbflute-core by dbflute.

the class ResourceContext method findColumnFunctionCipher.

public static ColumnFunctionCipher findColumnFunctionCipher(String tableDbName, String columnDbName) {
    assertResourceContextExists();
    final ResourceContext context = getResourceContextOnThread();
    final GearedCipherManager manager = context.getGearedCipherManager();
    return manager != null ? manager.findColumnFunctionCipher(tableDbName, columnDbName) : null;
}
Also used : GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager)

Example 4 with GearedCipherManager

use of org.dbflute.cbean.cipher.GearedCipherManager in project dbflute-core by dbflute.

the class AbstractConditionQuery method doRegisterSpecifyDerivedReferrer.

protected void doRegisterSpecifyDerivedReferrer(String function, final ConditionQuery subQuery, String columnDbName, String relatedColumnDbName, String propertyName, String referrerPropertyName, String aliasName, DerivedReferrerOption option) {
    assertFunctionNotNull("SpecifyDerivedReferrer", columnDbName, function);
    assertSubQueryNotNull("SpecifyDerivedReferrer", columnDbName, subQuery);
    option.xacceptBaseCB(xgetBaseCB());
    if (isDerivedReferrerSelectAllPossible(subQuery, option)) {
        createCBExThrower().throwSpecifyDerivedReferrerSelectAllPossibleException(function, subQuery, aliasName);
    }
    final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
    final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
    final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
    final SqlClause subQueryClause = subQuery.xgetSqlClause();
    final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
    final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
    final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
    final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
    final String mainSubQueryIdentity = propertyName + "[" + subQueryLevel + ":subquerymain]";
    final SpecifyDerivedReferrer derivedReferrer = option.createSpecifyDerivedReferrer(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, mainSubQueryIdentity, aliasName);
    xregisterParameterOption(option);
    final String correlatedFixedCondition = xbuildReferrerCorrelatedFixedCondition(subQuery, referrerPropertyName);
    final String clause = derivedReferrer.buildDerivedReferrer(function, columnDbName, relatedColumnDbName, correlatedFixedCondition, option);
    final HpDerivingSubQueryInfo subQueryInfo = xcreateDerivingSubQueryInfo(function, aliasName, clause, derivedReferrer);
    xgetSqlClause().specifyDerivingSubQuery(subQueryInfo);
}
Also used : ColumnRealNameProvider(org.dbflute.dbmeta.name.ColumnRealNameProvider) DerivedReferrerOptionFactory(org.dbflute.cbean.coption.DerivedReferrerOptionFactory) UnionClauseProvider(org.dbflute.cbean.sqlclause.union.UnionClauseProvider) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionKeyInScope(org.dbflute.cbean.ckey.ConditionKeyInScope) Date(java.util.Date) ParameterOption(org.dbflute.cbean.coption.ParameterOption) LoggerFactory(org.slf4j.LoggerFactory) OrderByElement(org.dbflute.cbean.sqlclause.orderby.OrderByElement) QueryClause(org.dbflute.cbean.sqlclause.query.QueryClause) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) SimpleMapPmb(org.dbflute.twowaysql.pmbean.SimpleMapPmb) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) PrimaryInfo(org.dbflute.dbmeta.info.PrimaryInfo) OrScopeQueryAndPartUnsupportedOperationException(org.dbflute.exception.OrScopeQueryAndPartUnsupportedOperationException) Map(java.util.Map) HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) DfBeanDescFactory(org.dbflute.helper.beans.factory.DfBeanDescFactory) ManualOrderOption(org.dbflute.cbean.ordering.ManualOrderOption) ConditionOption(org.dbflute.cbean.coption.ConditionOption) FixedConditionLazyChecker(org.dbflute.cbean.sqlclause.join.FixedConditionLazyChecker) Method(java.lang.reflect.Method) RangeOfOption(org.dbflute.cbean.coption.RangeOfOption) DfCollectionUtil(org.dbflute.util.DfCollectionUtil) SubQuery(org.dbflute.cbean.scoping.SubQuery) TimeZone(java.util.TimeZone) IndependentProcessor(org.dbflute.helper.function.IndependentProcessor) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) LikeSearchOption(org.dbflute.cbean.coption.LikeSearchOption) QueryModeProvider(org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider) FixedConditionResolver(org.dbflute.cbean.sqlclause.join.FixedConditionResolver) ScalarConditionOption(org.dbflute.cbean.coption.ScalarConditionOption) DBMeta(org.dbflute.dbmeta.DBMeta) FunCustodial(org.dbflute.FunCustodial) DfBeanDesc(org.dbflute.helper.beans.DfBeanDesc) Classification(org.dbflute.jdbc.Classification) List(java.util.List) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ExistsReferrer(org.dbflute.cbean.sqlclause.subquery.ExistsReferrer) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) SqlClauseMySql(org.dbflute.cbean.sqlclause.SqlClauseMySql) DBMetaProvider(org.dbflute.dbmeta.DBMetaProvider) DBFluteSystem(org.dbflute.system.DBFluteSystem) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) DateConditionAdjuster(org.dbflute.cbean.garnish.datefitting.DateConditionAdjuster) ConditionKeyPrepareResult(org.dbflute.cbean.ckey.ConditionKeyPrepareResult) ScalarCondition(org.dbflute.cbean.sqlclause.subquery.ScalarCondition) HpFixedConditionQueryResolver(org.dbflute.cbean.chelper.HpFixedConditionQueryResolver) LocalDateTime(java.time.LocalDateTime) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) HashMap(java.util.HashMap) ReflectionFailureException(org.dbflute.util.DfReflectionUtil.ReflectionFailureException) DerivedReferrerOption(org.dbflute.cbean.coption.DerivedReferrerOption) ManualOrderOptionCall(org.dbflute.cbean.ordering.ManualOrderOptionCall) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SqlClauseOracle(org.dbflute.cbean.sqlclause.SqlClauseOracle) HpQDRSetupper(org.dbflute.cbean.chelper.HpQDRSetupper) ExtensionOperand(org.dbflute.dbway.ExtensionOperand) HpQDRParameter(org.dbflute.cbean.chelper.HpQDRParameter) PartitionByProvider(org.dbflute.cbean.sqlclause.subquery.ScalarCondition.PartitionByProvider) DfReflectionUtil(org.dbflute.util.DfReflectionUtil) QueryUsedAliasInfo(org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo) ShortCharHandlingMode(org.dbflute.jdbc.ShortCharHandlingMode) Srl(org.dbflute.util.Srl) QueryClauseArranger(org.dbflute.cbean.sqlclause.query.QueryClauseArranger) ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) ConditionValue(org.dbflute.cbean.cvalue.ConditionValue) RelationInfo(org.dbflute.dbmeta.info.RelationInfo) ForeignInfo(org.dbflute.dbmeta.info.ForeignInfo) FromToOption(org.dbflute.cbean.coption.FromToOption) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) HpSLCFunction(org.dbflute.cbean.chelper.HpSLCFunction) SpecifyDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.SpecifyDerivedReferrer) WayOfMySQL(org.dbflute.dbway.WayOfMySQL) QueryDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.QueryDerivedReferrer) ConditionKey(org.dbflute.cbean.ckey.ConditionKey) ConditionOptionCall(org.dbflute.cbean.coption.ConditionOptionCall) HpSLCCustomized(org.dbflute.cbean.chelper.HpSLCCustomized) ConditionBeanExceptionThrower(org.dbflute.cbean.exception.ConditionBeanExceptionThrower) HpDerivingSubQueryInfo(org.dbflute.cbean.chelper.HpDerivingSubQueryInfo) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo) DfTypeUtil(org.dbflute.util.DfTypeUtil) HpQDRFunction(org.dbflute.cbean.chelper.HpQDRFunction) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) InScopeRelation(org.dbflute.cbean.sqlclause.subquery.InScopeRelation) DBMeta(org.dbflute.dbmeta.DBMeta) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) HpDerivingSubQueryInfo(org.dbflute.cbean.chelper.HpDerivingSubQueryInfo) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) SpecifyDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.SpecifyDerivedReferrer) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager)

Example 5 with GearedCipherManager

use of org.dbflute.cbean.cipher.GearedCipherManager in project dbflute-core by dbflute.

the class AbstractConditionQuery method doRegisterScalarCondition.

protected <CB extends ConditionBean> void doRegisterScalarCondition(final String function, final ConditionQuery subQuery, String propertyName, String operand, final HpSLCCustomized<CB> after, ScalarConditionOption option) {
    assertSubQueryNotNull("ScalarCondition", propertyName, subQuery);
    final SubQueryPath subQueryPath = new SubQueryPath(xgetLocation(propertyName));
    final GeneralColumnRealNameProvider localRealNameProvider = new GeneralColumnRealNameProvider();
    final int subQueryLevel = subQuery.xgetSqlClause().getSubQueryLevel();
    final SqlClause subQueryClause = subQuery.xgetSqlClause();
    final String subQueryIdentity = propertyName + "[" + subQueryLevel + "]";
    final ColumnSqlNameProvider subQuerySqlNameProvider = dbName -> subQuery.toColumnSqlName(dbName);
    final DBMeta subQueryDBMeta = findDBMeta(subQuery.asTableDbName());
    final GearedCipherManager cipherManager = xgetSqlClause().getGearedCipherManager();
    final String mainSubQueryIdentity = propertyName + "[" + subQueryLevel + ":subquerymain]";
    final PartitionByProvider partitionByProvider = () -> after.preparePartitionBySqlClause();
    final ScalarCondition scalarCondition = new ScalarCondition(subQueryPath, localRealNameProvider, subQuerySqlNameProvider, subQueryLevel, subQueryClause, subQueryIdentity, subQueryDBMeta, cipherManager, mainSubQueryIdentity, operand, partitionByProvider);
    xregisterParameterOption(option);
    final QueryClause clause = new QueryClause() {

        /* lazy registration to use partition-by */
        public String toString() {
            return scalarCondition.buildScalarCondition(function, option);
        }
    };
    // no speak about inner-join because of no possible of null revival
    final QueryUsedAliasInfo usedAliasInfo = new QueryUsedAliasInfo(xgetAliasName(), null);
    registerWhereClause(clause, usedAliasInfo);
}
Also used : ColumnRealNameProvider(org.dbflute.dbmeta.name.ColumnRealNameProvider) DerivedReferrerOptionFactory(org.dbflute.cbean.coption.DerivedReferrerOptionFactory) UnionClauseProvider(org.dbflute.cbean.sqlclause.union.UnionClauseProvider) SpecifiedColumn(org.dbflute.cbean.dream.SpecifiedColumn) ConditionKeyInScope(org.dbflute.cbean.ckey.ConditionKeyInScope) Date(java.util.Date) ParameterOption(org.dbflute.cbean.coption.ParameterOption) LoggerFactory(org.slf4j.LoggerFactory) OrderByElement(org.dbflute.cbean.sqlclause.orderby.OrderByElement) QueryClause(org.dbflute.cbean.sqlclause.query.QueryClause) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) SimpleMapPmb(org.dbflute.twowaysql.pmbean.SimpleMapPmb) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) PrimaryInfo(org.dbflute.dbmeta.info.PrimaryInfo) OrScopeQueryAndPartUnsupportedOperationException(org.dbflute.exception.OrScopeQueryAndPartUnsupportedOperationException) Map(java.util.Map) HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) DfBeanDescFactory(org.dbflute.helper.beans.factory.DfBeanDescFactory) ManualOrderOption(org.dbflute.cbean.ordering.ManualOrderOption) ConditionOption(org.dbflute.cbean.coption.ConditionOption) FixedConditionLazyChecker(org.dbflute.cbean.sqlclause.join.FixedConditionLazyChecker) Method(java.lang.reflect.Method) RangeOfOption(org.dbflute.cbean.coption.RangeOfOption) DfCollectionUtil(org.dbflute.util.DfCollectionUtil) SubQuery(org.dbflute.cbean.scoping.SubQuery) TimeZone(java.util.TimeZone) IndependentProcessor(org.dbflute.helper.function.IndependentProcessor) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) LikeSearchOption(org.dbflute.cbean.coption.LikeSearchOption) QueryModeProvider(org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider) FixedConditionResolver(org.dbflute.cbean.sqlclause.join.FixedConditionResolver) ScalarConditionOption(org.dbflute.cbean.coption.ScalarConditionOption) DBMeta(org.dbflute.dbmeta.DBMeta) FunCustodial(org.dbflute.FunCustodial) DfBeanDesc(org.dbflute.helper.beans.DfBeanDesc) Classification(org.dbflute.jdbc.Classification) List(java.util.List) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ExistsReferrer(org.dbflute.cbean.sqlclause.subquery.ExistsReferrer) LocalDate(java.time.LocalDate) Entry(java.util.Map.Entry) SqlClauseMySql(org.dbflute.cbean.sqlclause.SqlClauseMySql) DBMetaProvider(org.dbflute.dbmeta.DBMetaProvider) DBFluteSystem(org.dbflute.system.DBFluteSystem) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) DateConditionAdjuster(org.dbflute.cbean.garnish.datefitting.DateConditionAdjuster) ConditionKeyPrepareResult(org.dbflute.cbean.ckey.ConditionKeyPrepareResult) ScalarCondition(org.dbflute.cbean.sqlclause.subquery.ScalarCondition) HpFixedConditionQueryResolver(org.dbflute.cbean.chelper.HpFixedConditionQueryResolver) LocalDateTime(java.time.LocalDateTime) IllegalConditionBeanOperationException(org.dbflute.exception.IllegalConditionBeanOperationException) HashMap(java.util.HashMap) ReflectionFailureException(org.dbflute.util.DfReflectionUtil.ReflectionFailureException) DerivedReferrerOption(org.dbflute.cbean.coption.DerivedReferrerOption) ManualOrderOptionCall(org.dbflute.cbean.ordering.ManualOrderOptionCall) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SqlClauseOracle(org.dbflute.cbean.sqlclause.SqlClauseOracle) HpQDRSetupper(org.dbflute.cbean.chelper.HpQDRSetupper) ExtensionOperand(org.dbflute.dbway.ExtensionOperand) HpQDRParameter(org.dbflute.cbean.chelper.HpQDRParameter) PartitionByProvider(org.dbflute.cbean.sqlclause.subquery.ScalarCondition.PartitionByProvider) DfReflectionUtil(org.dbflute.util.DfReflectionUtil) QueryUsedAliasInfo(org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo) ShortCharHandlingMode(org.dbflute.jdbc.ShortCharHandlingMode) Srl(org.dbflute.util.Srl) QueryClauseArranger(org.dbflute.cbean.sqlclause.query.QueryClauseArranger) ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) ConditionValue(org.dbflute.cbean.cvalue.ConditionValue) RelationInfo(org.dbflute.dbmeta.info.RelationInfo) ForeignInfo(org.dbflute.dbmeta.info.ForeignInfo) FromToOption(org.dbflute.cbean.coption.FromToOption) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) HpSLCFunction(org.dbflute.cbean.chelper.HpSLCFunction) SpecifyDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.SpecifyDerivedReferrer) WayOfMySQL(org.dbflute.dbway.WayOfMySQL) QueryDerivedReferrer(org.dbflute.cbean.sqlclause.subquery.QueryDerivedReferrer) ConditionKey(org.dbflute.cbean.ckey.ConditionKey) ConditionOptionCall(org.dbflute.cbean.coption.ConditionOptionCall) HpSLCCustomized(org.dbflute.cbean.chelper.HpSLCCustomized) ConditionBeanExceptionThrower(org.dbflute.cbean.exception.ConditionBeanExceptionThrower) HpDerivingSubQueryInfo(org.dbflute.cbean.chelper.HpDerivingSubQueryInfo) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) ReferrerInfo(org.dbflute.dbmeta.info.ReferrerInfo) DfTypeUtil(org.dbflute.util.DfTypeUtil) HpQDRFunction(org.dbflute.cbean.chelper.HpQDRFunction) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) InScopeRelation(org.dbflute.cbean.sqlclause.subquery.InScopeRelation) ColumnSqlNameProvider(org.dbflute.dbmeta.name.ColumnSqlNameProvider) QueryClause(org.dbflute.cbean.sqlclause.query.QueryClause) DBMeta(org.dbflute.dbmeta.DBMeta) SubQueryPath(org.dbflute.cbean.sqlclause.subquery.SubQueryPath) SqlClause(org.dbflute.cbean.sqlclause.SqlClause) ScalarCondition(org.dbflute.cbean.sqlclause.subquery.ScalarCondition) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) QueryUsedAliasInfo(org.dbflute.cbean.sqlclause.query.QueryUsedAliasInfo) PartitionByProvider(org.dbflute.cbean.sqlclause.subquery.ScalarCondition.PartitionByProvider)

Aggregations

GearedCipherManager (org.dbflute.cbean.cipher.GearedCipherManager)7 ColumnFunctionCipher (org.dbflute.cbean.cipher.ColumnFunctionCipher)6 Method (java.lang.reflect.Method)5 Timestamp (java.sql.Timestamp)5 LocalDate (java.time.LocalDate)5 LocalDateTime (java.time.LocalDateTime)5 ArrayList (java.util.ArrayList)5 Collection (java.util.Collection)5 Date (java.util.Date)5 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 LinkedHashMap (java.util.LinkedHashMap)5 List (java.util.List)5 Map (java.util.Map)5 Entry (java.util.Map.Entry)5 TimeZone (java.util.TimeZone)5 FunCustodial (org.dbflute.FunCustodial)5 HpDerivingSubQueryInfo (org.dbflute.cbean.chelper.HpDerivingSubQueryInfo)5 HpFixedConditionQueryResolver (org.dbflute.cbean.chelper.HpFixedConditionQueryResolver)5 HpInvalidQueryInfo (org.dbflute.cbean.chelper.HpInvalidQueryInfo)5