Le 08/07/15 12:43, Kiran Ayyagari a écrit :
> On Wed, Jul 8, 2015 at 6:35 PM, Emmanuel Lécharny <[email protected]>
> wrote:
>
>> Le 08/07/15 11:54, Kiran Ayyagari a écrit :
>>> On Wed, Jul 8, 2015 at 5:36 PM, Emmanuel Lécharny <[email protected]>
>>> wrote:
>>>
>>>         if ( dn.isDescendantOf( that.dn ) )
>>>         {
>>>             return 1;
>>>         }
>>>         else if ( that.dn.isDescendantOf( dn ) )
>>>         {
>>>             return -1;
>>>         }
>>>
>>> can we change the return types here to -1 and 1, so that the DNs are
>>> ordered in perfect hierarchy
>>> this is useful for exporting/importing LDIF
>> If the this.dn is a descendant of that.dn, then the method should return
>> 1 (which means this.dn > that.dn), no ?
>>
> cause this.dn is a descendant it should be placed below that.dn (to
> guarantee the proper order during import)

Which is what is going to happen if we return 1 when dn.isDescendant(
that.dn ). Descendant != inferior.

dn1 : ou=example,dc=com
dn2 : cn=test,ou=example,dc=com

dn2.compareTo( dn1 ) returns 1, because dn2 is a descendant of dn1.
 

Reply via email to