use of org.wso2.carbon.identity.secret.mgt.core.constant.SQLConstants.GET_SECRET_NAME_BY_ID in project carbon-identity-framework by wso2.
the class SecretDAOImpl method isExistingSecret.
@Override
public boolean isExistingSecret(String secretId, int tenantId) throws SecretManagementException {
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
String secretName;
try {
secretName = jdbcTemplate.fetchSingleRecord(GET_SECRET_NAME_BY_ID, (resultSet, rowNumber) -> resultSet.getString(DB_SCHEMA_COLUMN_NAME_SECRET_NAME), preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secretId);
preparedStatement.setInt(DB_SCHEMA_COLUMN_NAME_TENANT_ID, tenantId);
});
return StringUtils.isNotEmpty(secretName);
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_GET_SECRET, "id = " + secretId, e);
}
}
Aggregations