use of org.wso2.carbon.identity.secret.mgt.core.constant.SQLConstants.GET_SECRETS in project carbon-identity-framework by wso2.
the class SecretDAOImpl method getSecrets.
@Override
public List getSecrets(SecretType secretType, int tenantId) throws SecretManagementException {
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
try {
return jdbcTemplate.executeQuery(GET_SECRETS, (LambdaExceptionUtils.rethrowRowMapper((resultSet, rowNumber) -> {
String secretId = resultSet.getString(DB_SCHEMA_COLUMN_NAME_ID);
String secretName = resultSet.getString(DB_SCHEMA_COLUMN_NAME_SECRET_NAME);
String secretLastModified = resultSet.getString(DB_SCHEMA_COLUMN_NAME_LAST_MODIFIED);
String secretCreatedTime = resultSet.getString(DB_SCHEMA_COLUMN_NAME_CREATED_TIME);
String description = resultSet.getString(DB_SCHEMA_COLUMN_NAME_DESCRIPTION);
Secret secret = new Secret();
secret.setCreatedTime(secretCreatedTime);
secret.setSecretId(secretId);
secret.setSecretName(secretName);
secret.setLastModified(secretLastModified);
secret.setTenantDomain(IdentityTenantUtil.getTenantDomain(tenantId));
secret.setSecretType(secretType.getName());
secret.setDescription(description);
return secret;
})), preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_TYPE, secretType.getId());
preparedStatement.setInt(DB_SCHEMA_COLUMN_NAME_TENANT_ID, tenantId);
});
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_SECRETS_DOES_NOT_EXISTS, e);
}
}
Aggregations