[exo-jcr-commits] exo-jcr SVN: r1311 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 6 05:44:51 EST 2010


Author: tolusha
Date: 2010-01-06 05:44:51 -0500 (Wed, 06 Jan 2010)
New Revision: 1311

Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
Log:
EXOJCR-362: Do not create ItemImpl on add of auto-created items

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2010-01-06 10:00:11 UTC (rev 1310)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java	2010-01-06 10:44:51 UTC (rev 1311)
@@ -2880,7 +2880,7 @@
          itemAutocreator.makeAutoCreatedItems(node.nodeData(), primaryTypeName, dataManager, session.getUserID());
       for (ItemState autoCreatedState : changes.getAllStates())
       {
-         dataManager.update(autoCreatedState, false); // TODO creates ItemImpl (EXOJCR-362)
+         dataManager.updateItemState(autoCreatedState);
       }
       // addAutoCreatedItems(node.nodeData(), primaryTypeName);
 

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java	2010-01-06 10:00:11 UTC (rev 1310)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java	2010-01-06 10:44:51 UTC (rev 1311)
@@ -517,7 +517,7 @@
 
       return false;
    }
-   
+
    /**
     * Returns true if the item with <code>itemPath</code> was deleted in this session. Within a transaction,
     * isDelete on an Item may return false (because the item has been saved) even if that Item is not in
@@ -1116,7 +1116,7 @@
                   // We can't remove this VH now.
                   return;
                } // else -- if we has a references in workspace where the VH is being
-                 // deleted we can remove VH now.
+               // deleted we can remove VH now.
             }
          }
          finally
@@ -1192,7 +1192,7 @@
    }
 
    /**
-    * Updates (adds or modifies) item state in the session transient storage
+    * Updates (adds or modifies) item state in the session transient storage.
     * 
     * @param itemState
     *          - the state
@@ -1206,7 +1206,6 @@
     */
    public ItemImpl update(ItemState itemState, boolean pool) throws RepositoryException
    {
-
       if (itemState.isDeleted())
          throw new RepositoryException("Illegal state DELETED. Use delete(...) method");
 
@@ -1216,6 +1215,27 @@
    }
 
    /**
+    * Updates (adds or modifies) item state in the session transient storage without creation ItemImpl.
+    * 
+    * @param itemState
+    *          - the state
+    * @param pool
+    *          - if true Manager force pooling this State so next calling will returna the same
+    *          object Common rule: use pool = true if the Item supposed to be returned by JCR API
+    *          (Node.addNode(), Node.setProperty() for ex) (NOTE: independently of pooling the
+    *          Manager always return actual Item state)
+    * @return
+    * @throws RepositoryException
+    */
+   public void updateItemState(ItemState itemState) throws RepositoryException
+   {
+      if (itemState.isDeleted())
+         throw new RepositoryException("Illegal state DELETED. Use delete(...) method");
+
+      changesLog.add(itemState);
+   }
+
+   /**
     * Commit changes
     * 
     * @param path



More information about the exo-jcr-commits mailing list