[dna-commits] DNA SVN: r827 - in trunk: dna-graph/src/main/java/org/jboss/dna/graph/request and 1 other directories.
dna-commits at lists.jboss.org
dna-commits at lists.jboss.org
Wed Apr 15 10:14:34 EDT 2009
Author: rhauch
Date: 2009-04-15 10:14:33 -0400 (Wed, 15 Apr 2009)
New Revision: 827
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java
Log:
DNA-354 JcrSession.hasPendingChanges Is Not Implemented
Previous changes that were made in addition to the patch did not properly implement the hasPendingChanges method. When doing this, it was discovered that SessionCache was incorrectly creating it's Graph.Batch instance to not use the SessionCache's request builder (which used the cache's list of requests, allowing SessionCache.save(UUID) to play with the pending requests to save only those that affect the branch below the supplied UUID).
This commit corrects the implementation, and all tests now pass.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-04-15 12:50:45 UTC (rev 826)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-04-15 14:14:33 UTC (rev 827)
@@ -1899,7 +1899,7 @@
* @see Results
*/
public Batch batch() {
- return new Batch(null);
+ return new Batch(new BatchRequestBuilder());
}
/**
@@ -1933,7 +1933,8 @@
protected boolean executed = false;
/*package*/Batch( BatchRequestBuilder builder ) {
- this.requestQueue = builder != null ? builder : new BatchRequestBuilder();
+ assert builder != null;
+ this.requestQueue = builder;
this.workspaceName = Graph.this.getCurrentWorkspaceName();
this.nextRequests = new BatchConjunction() {
public Batch and() {
@@ -1961,7 +1962,7 @@
* @return true if there are some requests in this batch that need to be executed, or false execution is not required
*/
public boolean isExecuteRequired() {
- return !executed || requestQueue.hasRequests();
+ return !executed && requestQueue.hasRequests();
}
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-04-15 12:50:45 UTC (rev 826)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-04-15 14:14:33 UTC (rev 827)
@@ -72,6 +72,7 @@
if (pendingRequest != null) {
// There's a pending request, we need to build it ...
add(pendingRequest.toRequest());
+ pendingRequest = null;
}
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java 2009-04-15 12:50:45 UTC (rev 826)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java 2009-04-15 14:14:33 UTC (rev 827)
@@ -186,7 +186,7 @@
// Create the batch operations ...
this.requests = new LinkedList<Request>();
this.requestBuilder = new BatchRequestBuilder(this.requests);
- this.operations = this.store.batch();
+ this.operations = this.store.batch(this.requestBuilder);
}
JcrSession session() {
More information about the dna-commits
mailing list