[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#4034) LdapResultSet fails with multi-value attributes
Full_Name: Teddy Wang
Version: JDBC-LDAP 2.0
OS: Windows 2000 Professional
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (128.221.4.201)
I've been testing the JDBC-LDAP bridge and found a pretty big omission in
functionality. It appears that any multi-value attributes are hidden behind a
"name_n", where n is a numeric value starting at 0 incrementing with the number
of attribute values - 1 using the "name", convention. This is easily remedied
through the implementation of a getList() method:
public List getList(java.lang.String str) throws java.sql.SQLException
{
final String columnName = str;
List list = new ArrayList();
Predicate startsWithPredicate = new Predicate()
{
public boolean evaluate(Object o)
{
return (o instanceof String) && (((String)
o).startsWith(columnName));
}
};
Collection keys = row.keySet();
Collection names = CollectionUtils.select(keys, startsWithPredicate);
Iterator iter = names.iterator();
while(iter.hasNext())
{
list.add(getObject((String)iter.next()));
}
return list;
}
As this code is contributed by octetstring, I'm not quite sure what is the best
way to contribute this code.
Thanks!