[ 
https://issues.apache.org/jira/browse/DIRGROOVY-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904656#action_12904656
 ] 

Grégory Joseph commented on DIRGROOVY-7:
----------------------------------------

Any feedback on this ?

> Support for "returning attributes" in searches
> ----------------------------------------------
>
>                 Key: DIRGROOVY-7
>                 URL: https://issues.apache.org/jira/browse/DIRGROOVY-7
>             Project: Directory Groovy LDAP
>          Issue Type: Improvement
>            Reporter: Grégory Joseph
>            Assignee: Stefan Zoerner
>         Attachments: DIRGROOVY-7.patch, DIRGROOVY-7.patch
>
>
> While the {{o.a.d.groovyldap.Search}} currently holds an {{attrs}} array for 
> these, and they are set accordingly on the SearchControls instance, 2 things 
> are missing to make it useful:
> * support for this in the Map-based constructor
> * {{o.a.d.groovyldap.jndi.DirContextToMapObjectFactory}} should use these 
> attributes (they're passed as {{attrs}} to the {{getObjectInstance}} 
> instance) instead of getting all attributes from the current record.
> This would have two benefits:
> * a presumed performance gain ? (I've always assumed that's one of the 
> reasons for passing "returning attributes" to searches)
> * the ability to retrieve operational attributes such as 'createTimestamp' 
> and 'modifyTimestamp' which are not retrieved when not specified explicitly.
> I'll attach a patch that makes the following code work:
> {code}
> def LDAP ldap = LDAP.newInstance('ldap://localhost/dc=example,dc=com')
> ldap.search(
>         'base': 'ou=users',
>         'filter': '(objectClass=posixAccount)',
>         'attrs': ['uid','cn',
>                 'createTimestamp', 'creatorsName',
>                 'modifyTimestamp', 'modifiersName'
>         ]
> ).each {
>     println """${it.uid}: ${it.cn}
>     mod: ${it.modifyTimestamp} (${it.creatorsName})
>     cre: ${it.createTimestamp} (${it.modifiersName})"""
> }{code}
> (with the current groovyldap, the "mod" and "cre" lines print nulls)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to