Search in sources :

Example 1 with GET_TENANT_RESOURCES_SELECT_COLUMNS_MSSQL_OR_ORACLE

use of org.wso2.carbon.identity.configuration.mgt.core.constant.SQLConstants.GET_TENANT_RESOURCES_SELECT_COLUMNS_MSSQL_OR_ORACLE in project carbon-identity-framework by wso2.

the class ConfigurationDAOImpl method buildPlaceholderSQL.

private PlaceholderSQL buildPlaceholderSQL(Condition condition, boolean useCreatedTime) throws ConfigurationManagementException {
    String queryWithCreatedTime = GET_TENANT_RESOURCES_SELECT_COLUMNS_MYSQL;
    String queryWithOutCreatedTime = GET_TENANT_RESOURCES_SELECT_COLUMNS_MYSQL_WITHOUT_CREATED_TIME;
    try {
        if (isOracleDB() || isMSSqlDB()) {
            queryWithCreatedTime = GET_TENANT_RESOURCES_SELECT_COLUMNS_MSSQL_OR_ORACLE;
        }
    } catch (DataAccessException e) {
        throw handleServerException(ERROR_CODE_CHECK_DB_METADATA, e.getMessage(), e);
    }
    StringBuilder sb = new StringBuilder();
    sb.append(useCreatedTime ? queryWithCreatedTime : queryWithOutCreatedTime);
    sb.append("WHERE\n");
    try {
        PlaceholderSQL placeholderSQL = condition.buildQuery(new PrimitiveConditionValidator(new ResourceSearchBean()));
        placeholderSQL.setQuery(sb.append(placeholderSQL.getQuery()).toString());
        return placeholderSQL;
    } catch (PrimitiveConditionValidationException e) {
        throw handleClientException(ERROR_CODE_SEARCH_QUERY_SQL_PROPERTY_PARSE_ERROR, e.getMessage(), e);
    }
}
Also used : PlaceholderSQL(org.wso2.carbon.identity.configuration.mgt.core.search.PlaceholderSQL) PrimitiveConditionValidator(org.wso2.carbon.identity.configuration.mgt.core.search.PrimitiveConditionValidator) ResourceSearchBean(org.wso2.carbon.identity.configuration.mgt.core.model.ResourceSearchBean) PrimitiveConditionValidationException(org.wso2.carbon.identity.configuration.mgt.core.search.exception.PrimitiveConditionValidationException) DataAccessException(org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)

Aggregations

DataAccessException (org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)1 ResourceSearchBean (org.wso2.carbon.identity.configuration.mgt.core.model.ResourceSearchBean)1 PlaceholderSQL (org.wso2.carbon.identity.configuration.mgt.core.search.PlaceholderSQL)1 PrimitiveConditionValidator (org.wso2.carbon.identity.configuration.mgt.core.search.PrimitiveConditionValidator)1 PrimitiveConditionValidationException (org.wso2.carbon.identity.configuration.mgt.core.search.exception.PrimitiveConditionValidationException)1