Search in sources :

Example 1 with ColumnFunctionCipher

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

the class AbstractConditionQuery method doRegIQ.

protected void doRegIQ(ConditionKey key, Object value, ConditionValue cvalue, String columnDbName, ConditionOption option) {
    if (!prepareQueryChecked(key, value, cvalue, columnDbName).newClause()) {
        return;
    }
    final DBMeta dbmeta = xgetDBMetaProvider().provideDBMetaChecked(asTableDbName());
    final ColumnInfo columnInfo = dbmeta.findColumnInfo(columnDbName);
    final String propertyName = columnInfo.getPropertyName();
    final String uncapPropName = initUncap(propertyName);
    // If Java, it is necessary to use uncapPropName!
    final String location = xgetLocation(uncapPropName);
    key.setupConditionValue(xcreateQueryModeProvider(), cvalue, value, location, option);
    final ColumnSqlName columnSqlName = columnInfo.getColumnSqlName();
    final ColumnFunctionCipher cipher = xgetSqlClause().findColumnFunctionCipher(columnInfo);
    if (isBaseQuery()) {
        xgetSqlClause().registerBaseTableInlineWhereClause(columnSqlName, key, cvalue, cipher, option);
    } else {
        final String aliasName = xgetAliasName();
        xgetSqlClause().registerOuterJoinInlineWhereClause(aliasName, columnSqlName, key, cvalue, cipher, option, _onClause);
    }
}
Also used : ColumnSqlName(org.dbflute.dbmeta.name.ColumnSqlName) DBMeta(org.dbflute.dbmeta.DBMeta) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher)

Example 2 with ColumnFunctionCipher

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

the class ConditionKey method doResolveCompoundColumnCipher.

protected ColumnRealName doResolveCompoundColumnCipher(ConditionOption option, SpecifiedColumn specifiedColumn) {
    final GearedCipherManager cipherManager = option.getGearedCipherManager();
    final ColumnRealName specifiedName = specifiedColumn.toColumnRealName();
    if (cipherManager != null && !specifiedColumn.isDerived()) {
        final ColumnInfo columnInfo = specifiedColumn.getColumnInfo();
        final ColumnFunctionCipher cipher = cipherManager.findColumnFunctionCipher(columnInfo);
        if (cipher != null) {
            return toColumnRealName(cipher.decrypt(specifiedName.toString()));
        } else {
            return specifiedName;
        }
    } else {
        return specifiedName;
    }
}
Also used : ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) GearedCipherManager(org.dbflute.cbean.cipher.GearedCipherManager) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName)

Example 3 with ColumnFunctionCipher

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

the class AbstractConditionQuery method setupConditionValueAndRegisterWhereClause.

protected void setupConditionValueAndRegisterWhereClause(ConditionKey key, Object value, ConditionValue cvalue, String columnDbName, ConditionOption option) {
    final DBMeta dbmeta = xgetLocalDBMeta();
    final ColumnInfo columnInfo = dbmeta.findColumnInfo(columnDbName);
    final QueryModeProvider queryModeProvider = xcreateQueryModeProvider();
    final Object filtered = filterConditionValueIfNeeds(key, value, cvalue, columnDbName, option, columnInfo);
    final String propertyName = columnInfo.getPropertyName();
    final String uncapPropName = initUncap(propertyName);
    // if Java, it is necessary to use uncapPropName
    final String location = xgetLocation(uncapPropName);
    key.setupConditionValue(queryModeProvider, cvalue, filtered, location, option);
    final ColumnRealName columnRealName = toColumnRealName(columnDbName);
    final ColumnFunctionCipher cipher = xgetSqlClause().findColumnFunctionCipher(columnInfo);
    final String usedAliasName = xgetAliasName();
    xgetSqlClause().registerWhereClause(columnRealName, key, cvalue, cipher, option, usedAliasName);
}
Also used : DBMeta(org.dbflute.dbmeta.DBMeta) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo) ColumnFunctionCipher(org.dbflute.cbean.cipher.ColumnFunctionCipher) ColumnRealName(org.dbflute.dbmeta.name.ColumnRealName) QueryModeProvider(org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider)

Aggregations

ColumnFunctionCipher (org.dbflute.cbean.cipher.ColumnFunctionCipher)3 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)3 DBMeta (org.dbflute.dbmeta.DBMeta)2 ColumnRealName (org.dbflute.dbmeta.name.ColumnRealName)2 GearedCipherManager (org.dbflute.cbean.cipher.GearedCipherManager)1 QueryModeProvider (org.dbflute.cbean.cvalue.ConditionValue.QueryModeProvider)1 ColumnSqlName (org.dbflute.dbmeta.name.ColumnSqlName)1