Commit f0199c6e authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-1117] Paged result work.


git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10037 b35dd754-fafc-0310-a699-88a17e54d16e
parent 353e262e
...@@ -1521,7 +1521,6 @@ public class LdapManager { ...@@ -1521,7 +1521,6 @@ public class LdapManager {
if (!clientSideSort) { if (!clientSideSort) {
skip = startIndex; skip = startIndex;
lastRes = startIndex + numResults; lastRes = startIndex + numResults;
} }
byte[] cookie = null; byte[] cookie = null;
int count = 0; int count = 0;
...@@ -1540,8 +1539,7 @@ public class LdapManager { ...@@ -1540,8 +1539,7 @@ public class LdapManager {
} }
// Get the next result. // Get the next result.
String result = (String)((SearchResult)answer.next()).getAttributes().get( String result = (String)((SearchResult)answer.next()).getAttributes().get(attribute).get();
attribute).get();
// Remove suffixToTrim if set // Remove suffixToTrim if set
if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) { if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) {
result = result.substring(0,result.length()-suffixToTrim.length()); result = result.substring(0,result.length()-suffixToTrim.length());
...@@ -1554,14 +1552,16 @@ public class LdapManager { ...@@ -1554,14 +1552,16 @@ public class LdapManager {
if (controls != null) { if (controls != null) {
for (Control control : controls) { for (Control control : controls) {
if (control instanceof PagedResultsResponseControl) { if (control instanceof PagedResultsResponseControl) {
PagedResultsResponseControl prrc = PagedResultsResponseControl prrc = (PagedResultsResponseControl) control;
(PagedResultsResponseControl) control;
cookie = prrc.getCookie(); cookie = prrc.getCookie();
int total = prrc.getResultSize();
Log.debug("LdapManager: End of page found, count is "+count+", total results are "+total+", and cookie is "+cookie);
// Re-activate paged results // Re-activate paged results
ctx.setRequestControls(new Control[]{ ctx.setRequestControls(new Control[]{
new PagedResultsControl(pageSize, cookie, Control.CRITICAL) }); new PagedResultsControl(pageSize, cookie, Control.CRITICAL) });
break; // break;
} }
} }
} }
...@@ -1589,8 +1589,7 @@ public class LdapManager { ...@@ -1589,8 +1589,7 @@ public class LdapManager {
} }
// Get the next result. // Get the next result.
String result = (String)((SearchResult)answer.next()).getAttributes().get( String result = (String)((SearchResult)answer.next()).getAttributes().get(attribute).get();
attribute).get();
// Remove suffixToTrim if set // Remove suffixToTrim if set
if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) { if (suffixToTrim != null && suffixToTrim.length() > 0 && result.endsWith(suffixToTrim)) {
result = result.substring(0,result.length()-suffixToTrim.length()); result = result.substring(0,result.length()-suffixToTrim.length());
...@@ -1603,12 +1602,11 @@ public class LdapManager { ...@@ -1603,12 +1602,11 @@ public class LdapManager {
if (controls != null) { if (controls != null) {
for (Control control : controls) { for (Control control : controls) {
if (control instanceof PagedResultsResponseControl) { if (control instanceof PagedResultsResponseControl) {
PagedResultsResponseControl prrc = PagedResultsResponseControl prrc = (PagedResultsResponseControl) control;
(PagedResultsResponseControl) control;
cookie = prrc.getCookie(); cookie = prrc.getCookie();
// Re-activate paged results // Re-activate paged results
ctx.setRequestControls(new Control[]{ ctx2.setRequestControls(new Control[]{
new PagedResultsControl(pageSize, cookie, Control.CRITICAL) }); new PagedResultsControl(pageSize, cookie, Control.CRITICAL) });
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment