use of org.wso2.carbon.identity.configuration.mgt.core.constant.SQLConstants.GET_RESOURCE_ID_BY_NAME_SQL in project carbon-identity-framework by wso2.
the class ConfigurationDAOImpl method isResourceExists.
private boolean isResourceExists(Resource resource, String resourceTypeId) throws TransactionException {
JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();
String resourceId = jdbcTemplate.withTransaction(template -> template.fetchSingleRecord(GET_RESOURCE_ID_BY_NAME_SQL, (resultSet, rowNumber) -> resultSet.getString(DB_SCHEMA_COLUMN_NAME_ID), preparedStatement -> {
int initialParameterIndex = 1;
preparedStatement.setString(initialParameterIndex, resource.getResourceName());
preparedStatement.setInt(++initialParameterIndex, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
preparedStatement.setString(++initialParameterIndex, resourceTypeId);
}));
return resourceId != null;
}
Aggregations