[
https://issues.apache.org/jira/browse/DIRSTUDIO-801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261618#comment-13261618
]
Jim Willeke commented on DIRSTUDIO-801:
---------------------------------------
The http://www.unboundid.com/products/ldap-sdk/ makes this operation easy:
public static void sortedSearch(String baseDN, String filter,
LDAPConnection connection, String[] attributes) throws LDAPException
{
SearchRequest searchRequest = new SearchRequest(baseDN,
SearchScope.SUB, filter, attributes);
SearchResult searchResult = connection.search(searchRequest);
EntrySorter entrySorter = new EntrySorter();
SortedSet<Entry> sortedEntries =
entrySorter.sort(searchResult.getSearchEntries());
for (Iterator<Entry> iterator = sortedEntries.iterator();
iterator.hasNext();)
{
Entry entry = iterator.next();
System.out.println(entry.toLDIFString());
}
}
> Allow sorting of LDIF files when Exporting and/or Importing
> -----------------------------------------------------------
>
> Key: DIRSTUDIO-801
> URL: https://issues.apache.org/jira/browse/DIRSTUDIO-801
> Project: Directory Studio
> Issue Type: Improvement
> Components: studio-ldapbrowser
> Affects Versions: 2.0.0-M3
> Reporter: Jim Willeke
> Priority: Minor
>
> When exporting to LDIF the entries may or may not be in the proper order for
> importing.
> A nice feature would be to sort the entries in a "parent-first" fashion so
> when importing the Parents would always be in the file before any of the
> children.
> This could be done on an export or perhaps an import also.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira