Author: nfilotto
Date: 2011-02-15 08:39:35 -0500 (Tue, 15 Feb 2011)
New Revision: 3977
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/GenericConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/indexing/JdbcNodeDataIndexingIterator.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DefaultOracleConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
Log:
EXOJCR-1104: Fix bug that prevents the paging to work properly when no node id is
required. In case of Oracle, MSSQL and DB2, we expect an offset not a limit.
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/GenericConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/GenericConnectionFactory.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/GenericConnectionFactory.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -271,4 +271,13 @@
{
return false;
}
+
+ /**
+ * Indicates whether the id of the last item is needed for paging
+ * @return <code>true</code> if the id is needed,
<code>false</code> otherwise.
+ */
+ public boolean isIDNeededForPaging()
+ {
+ return true;
+ }
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/indexing/JdbcNodeDataIndexingIterator.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/indexing/JdbcNodeDataIndexingIterator.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/indexing/JdbcNodeDataIndexingIterator.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -113,7 +113,7 @@
{
currentOffset = offset.getAndAdd(pageSize);
currentLastNodeId = lastNodeId.get();
- currentPage = page.incrementAndGet();
+ currentPage = page.incrementAndGet();
}
long time = System.currentTimeMillis();
List<NodeDataIndexing> result =
conn.getNodesAndProperties(currentLastNodeId, currentOffset, pageSize);
@@ -125,7 +125,7 @@
+ (result.isEmpty() ? "unknown" : result.get(result.size() -
1).getIdentifier()) + "'");
}
hasNext.compareAndSet(true, result.size() == pageSize);
- if (hasNext())
+ if (hasNext() && connFactory.isIDNeededForPaging())
{
synchronized (this)
{
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -122,4 +122,13 @@
throw new RepositoryException(e);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isIDNeededForPaging()
+ {
+ return false;
+ }
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -93,7 +93,7 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setInt(1, limit);
+ findNodesAndProperties.setInt(1, offset + limit);
findNodesAndProperties.setInt(2, offset);
return findNodesAndProperties.executeQuery();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -95,7 +95,7 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setInt(2, limit);
+ findNodesAndProperties.setInt(2, offset + limit);
findNodesAndProperties.setInt(3, offset);
findNodesAndProperties.setString(4, containerName);
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DefaultOracleConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DefaultOracleConnectionFactory.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DefaultOracleConnectionFactory.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -136,4 +136,13 @@
throw new RepositoryException(e);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isIDNeededForPaging()
+ {
+ return false;
+ }
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLConnectionFactory.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLConnectionFactory.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -122,4 +122,13 @@
throw new RepositoryException(e);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isIDNeededForPaging()
+ {
+ return false;
+ }
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -91,7 +91,7 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setInt(1, limit);
+ findNodesAndProperties.setInt(1, offset + limit);
findNodesAndProperties.setInt(2, offset);
return findNodesAndProperties.executeQuery();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -95,7 +95,7 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setInt(2, limit);
+ findNodesAndProperties.setInt(2, offset + limit);
findNodesAndProperties.setInt(3, offset);
findNodesAndProperties.setString(4, containerName);
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -104,7 +104,7 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setInt(1, limit);
+ findNodesAndProperties.setInt(1, offset + limit);
findNodesAndProperties.setInt(2, offset);
return findNodesAndProperties.executeQuery();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-02-15
10:04:43 UTC (rev 3976)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-02-15
13:39:35 UTC (rev 3977)
@@ -107,7 +107,7 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setInt(2, limit);
+ findNodesAndProperties.setInt(2, offset + limit);
findNodesAndProperties.setInt(3, offset);
findNodesAndProperties.setString(4, containerName);