Issue Details (XML | Word | Printable)

Key: NUCLDAP-51
Type: Bug Bug
Status: Open Open
Priority: Testcase Required Testcase Required
Assignee: Unassigned
Reporter: Stefaan Van Cauwenberge
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store LDAP

unable to specify the searchscope on a relation attribute

Created: 11/May/12 02:11 PM   Updated: 22/Oct/12 09:05 PM
Component/s: None
Affects Version/s: 3.1.0.m3
Fix Version/s: None

File Attachments: 1. Java Source File DNFieldFetcher.java (2 kB)
2. File ldap.diff (13 kB)
3. Zip Archive patch.zip (42 kB)

Environment: all

Datastore: LDAP
Severity: Proof of Concept


 Description  « Hide
When you specify a relation (eg parent-child container), you are unable to specify the searchscope (subtree, one level). Subtree is always taken.
In other words: the attribute recursion-depth="1" in the below configuration does not work.

            <field
                  name="parentContainer"
                  persistence-modifier="persistent"
                  default-fetch-group="true"/>
            <field
                  name="childContainers"
                  persistence-modifier="persistent"
                  mapped-by="parentContainer"
                  recursion-depth="1">
                  </field>


Stefaan Van Cauwenberge added a comment - 11/May/12 02:54 PM
Files for issues
NUCLDAP-49
NUCLDAP-50
NUCLDAP-51

Tested on eDirectory and openLDAP.

After I fixed the issue localy, I merged it with the latest version (3.1.0.m3). I hope it still works.

This patch supports the following:
1. A field definition of "dn" will always contain the dn of the object.
Example:
            <field
                  name="dn"
                  persistence-modifier="persistent"
                  primary-key="true"
                  column="dn"/>

2. Extention on the class to add the search scope:
Example:
<extension vendor-name="opns" key="scope" value="SUBTREE_SCOPE"/>

Possible values are the SearchControl.xxx constants.

3. Support for the attribute recursion-depth on the field definition.
Supported values: 0, 1 and 2 (the actual values of the SearchControl.xxx constants).
Example:
            <field
                  name="parentContainer"
                  persistence-modifier="persistent"
                  default-fetch-group="true"/>
            <field
                  name="childContainers"
                  persistence-modifier="persistent"
                  mapped-by="parentContainer"
                  recursion-depth="1">
                  </field>


Stefaan

Stefaan Van Cauwenberge made changes - 11/May/12 02:54 PM
Field Original Value New Value
Attachment patch.zip [ 11654 ]
Andy Jefferson added a comment - 17/May/12 02:55 PM
Hi, thx for the diffs, but sadly they don't apply to SVN trunk. Could you please regenerate it, using SVN trunk as the basis and attach a single "patch" file ("diff -u" format).

Andy Jefferson made changes - 09/Aug/12 09:54 AM
Priority Major [ 3 ] Incomplete [ 6 ]
Stefaan Van Cauwenberge added a comment - 22/Oct/12 08:53 PM
New diff file.
Diff with version 3.1

I hope this one does the trick for you.

This fix includes support for:
- The dn attribute in the object, both in PersistenceManager.newQuery(...) and PersistenceManager.getObjectById, allowing primary-key="true" on the dn attribute (enabling caching of objects with the same naming value but a different context).
- A lot less query towards the ldap (no need to require the ldap to get the DN every 5 seconds...). The dn is associated with the object itself.
- Support for extention 'opns' for search controlling scope (method LDAPUtils.getSearchControls). If included it the release, the extention name should be

Stefaan

Stefaan Van Cauwenberge made changes - 22/Oct/12 08:53 PM
Attachment ldap.diff [ 11791 ]
Stefaan Van Cauwenberge added a comment - 22/Oct/12 09:05 PM
It seems that the diif does not include new class files. Attached the new class file I added: DNFieldFetcher.

Stefaan Van Cauwenberge made changes - 22/Oct/12 09:05 PM
Attachment DNFieldFetcher.java [ 11796 ]