Commit 2c8e2d71 authored by Robin Collier's avatar Robin Collier Committed by rcollier

OF-205 Added property to determine chronological order of items.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13307 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7c464bde
...@@ -1455,9 +1455,11 @@ public class PubSubPersistenceManager { ...@@ -1455,9 +1455,11 @@ public class PubSubPersistenceManager {
max = Math.min(MAX_ROWS_FETCH, maxPublished); max = Math.min(MAX_ROWS_FETCH, maxPublished);
// We don't know how many items are in the db, so we will start with an allocation of 500 // We don't know how many items are in the db, so we will start with an allocation of 500
List<PublishedItem> results = new ArrayList<PublishedItem>(max); java.util.LinkedList<PublishedItem> results = new java.util.LinkedList<PublishedItem>();
boolean descending = JiveGlobals.getBooleanProperty("xmpp.pubsub.order.descending", false);
try { try
{
con = DbConnectionManager.getConnection(); con = DbConnectionManager.getConnection();
// Get published items of the specified node // Get published items of the specified node
pstmt = con.prepareStatement(LOAD_ITEMS); pstmt = con.prepareStatement(LOAD_ITEMS);
...@@ -1479,7 +1481,10 @@ public class PubSubPersistenceManager { ...@@ -1479,7 +1481,10 @@ public class PubSubPersistenceManager {
item.setPayloadXML(rs.getString(4)); item.setPayloadXML(rs.getString(4));
} }
// Add the published item to the node // Add the published item to the node
results.add(item); if (descending)
results.add(item);
else
results.addFirst(item);
counter++; counter++;
} }
} }
...@@ -1491,7 +1496,7 @@ public class PubSubPersistenceManager { ...@@ -1491,7 +1496,7 @@ public class PubSubPersistenceManager {
} }
if (results.size() == 0) if (results.size() == 0)
results = Collections.emptyList(); return Collections.emptyList();
return results; return results;
} }
......
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