use of org.wso2.carbon.identity.configuration.mgt.core.constant.ConfigurationConstants.ErrorMessages.ERROR_CODE_GET_ATTRIBUTE in project carbon-identity-framework by wso2.
the class ConfigurationDAOImpl method getAttributeByKey.
/**
* {@inheritDoc}
*/
@Override
public Attribute getAttributeByKey(String resourceId, String attributeKey) throws ConfigurationManagementException {
JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();
try {
return jdbcTemplate.fetchSingleRecord(SQLConstants.GET_ATTRIBUTE_SQL, (resultSet, rowNumber) -> new Attribute(resultSet.getString(DB_SCHEMA_COLUMN_NAME_ATTRIBUTE_KEY), resultSet.getString(DB_SCHEMA_COLUMN_NAME_ATTRIBUTE_VALUE), resultSet.getString(DB_SCHEMA_COLUMN_NAME_ID)), preparedStatement -> {
int initialParameterIndex = 1;
preparedStatement.setString(initialParameterIndex, attributeKey);
preparedStatement.setString(++initialParameterIndex, resourceId);
});
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_GET_ATTRIBUTE, attributeKey, e);
}
}
Aggregations