directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Retrieving over multi-valued attributes
Date Tue, 12 Feb 2013 22:15:34 GMT
Le 2/12/13 8:47 PM, Emilio Recio a écrit :
> I am kind of stuck on how to get ALL of the attribute's values.
> Currently, I am Binding as the user (using LdapNetworkConnection). I
> am getting an EntryCursor via search method of that. I am retrieving
> an Entry from the cursor.get() method. I get a collection<attribute>
> list of attributes. I can cycle through each of the entry's attributes
> but whatever I do, I cannot find in the API where I can get more than
> just the first value.
>
> I have tried:
>
> Collection<Attribute> attrs = entry.getAttributes();
> for (Attribute attr : attrs) {
>     _log.debug("ATTR: " + attr.getId());
>     _log.debug("VALX: " + attr.size());
>
>     Value<?> vals = attr.get();
>     for (int i = 0;i < vals.length(); i++ ) {
>         ????
>     }
>
>
> For example, I am taking the objectClass attribute.
>From the top of my head :


for (Attribute attr : entry) {
    _log.debug("ATTR: " + attr.getId());
    _log.debug("VALX: " + attr.size());

    for ( Value<?> value : attr) {
        // You have all the values one by one
    }
}


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Mime
View raw message