[exo-jcr-commits] exo-jcr SVN: r4672 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow: serialization and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 21 11:02:36 EDT 2011


Author: tolusha
Date: 2011-07-21 11:02:35 -0400 (Thu, 21 Jul 2011)
New Revision: 4672

Added:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedNodeDataReader.java
Removed:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PresistedNodeDataReader.java
Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java
Log:
EXOJCR-1239: improve ACL permissions

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2011-07-21 12:52:33 UTC (rev 4671)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2011-07-21 15:02:35 UTC (rev 4672)
@@ -617,7 +617,8 @@
          {
             public ItemData run() throws RepositoryException
             {
-               return CacheableWorkspaceDataManager.super.getItemData(parentData, name, itemType);
+               ItemData item = CacheableWorkspaceDataManager.super.getItemData(parentData, name, itemType);
+               return item != null && item.isNode() ? initACL(parentData, (NodeData)item) : item;
             }
          });
       }
@@ -680,7 +681,8 @@
          {
             public ItemData run() throws RepositoryException
             {
-               return CacheableWorkspaceDataManager.super.getItemData(identifier);
+               ItemData item = CacheableWorkspaceDataManager.super.getItemData(identifier);
+               return item != null && item.isNode() ? initACL(null, (NodeData)item) : item;
             }
          });
       }
@@ -1008,6 +1010,15 @@
                      cache.addChildNodes(parentData, childNodes);
                   }
                }
+               else
+               {
+                  // ini ACL
+                  for (int i = 0; i < childNodes.size(); i++)
+                  {
+                     childNodes.set(i, (NodeData)initACL(nodeData, childNodes.get(i)));
+                  }
+               }
+
                return childNodes;
             }
          });
@@ -1027,7 +1038,16 @@
          {
             public List<NodeData> run() throws RepositoryException
             {
-               return CacheableWorkspaceDataManager.super.getChildNodesData(parentData, patternFilters);
+               List<NodeData> childNodes =
+                  CacheableWorkspaceDataManager.super.getChildNodesData(parentData, patternFilters);
+
+               // ini ACL
+               for (int i = 0; i < childNodes.size(); i++)
+               {
+                  childNodes.set(i, (NodeData)initACL(parentData, childNodes.get(i)));
+               }
+
+               return childNodes;
             }
          });
       }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java	2011-07-21 12:52:33 UTC (rev 4671)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/ItemStateReader.java	2011-07-21 15:02:35 UTC (rev 4672)
@@ -110,7 +110,7 @@
 
          if (isNodeData)
          {
-            PresistedNodeDataReader rdr = new PresistedNodeDataReader();
+            PersistedNodeDataReader rdr = new PersistedNodeDataReader();
             is = new ItemState(rdr.read(in), state, eventFire, null, false, isPersisted, oldPath);
          }
          else

Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedNodeDataReader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedNodeDataReader.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedNodeDataReader.java	2011-07-21 15:02:35 UTC (rev 4672)
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.dataflow.serialization;
+
+import org.exoplatform.services.jcr.access.AccessControlList;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
+import org.exoplatform.services.jcr.dataflow.serialization.ObjectReader;
+import org.exoplatform.services.jcr.dataflow.serialization.SerializationConstants;
+import org.exoplatform.services.jcr.dataflow.serialization.UnknownClassIdException;
+import org.exoplatform.services.jcr.datamodel.IllegalNameException;
+import org.exoplatform.services.jcr.datamodel.IllegalPathException;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.QPath;
+
+import java.io.IOException;
+
+/**
+ * Created by The eXo Platform SAS. <br/>Date:
+ * 
+ * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a>
+ * @version $Id: PresistedNodeDataReader.java 1518 2010-01-20 23:33:30Z sergiykarpenko $
+ */
+public class PersistedNodeDataReader
+{
+
+   /**
+    * Read and set PersistedNodeData data.
+    * 
+    * @param in ObjectReader.
+    * @return PersistedNodeData object.
+    * @throws UnknownClassIdException If read Class ID is not expected or do not
+    *           exist.
+    * @throws IOException If an I/O error has occurred.
+    */
+   public PersistedNodeData read(ObjectReader in) throws UnknownClassIdException, IOException
+   {
+      // read id
+      int key;
+      if ((key = in.readInt()) != SerializationConstants.PERSISTED_NODE_DATA)
+      {
+         throw new UnknownClassIdException("There is unexpected class [" + key + "]");
+      }
+
+      QPath qpath;
+      try
+      {
+         String sQPath = in.readString();
+         qpath = QPath.parse(sQPath);
+      }
+      catch (final IllegalPathException e)
+      {
+         throw new IOException("Deserialization error. " + e)
+         {
+
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public Throwable getCause()
+            {
+               return e;
+            }
+         };
+      }
+
+      String identifier = in.readString();
+
+      String parentIdentifier = null;
+      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
+      {
+         parentIdentifier = in.readString();
+      }
+
+      int persistedVersion = in.readInt();
+      // --------------
+
+      int orderNum = in.readInt();
+
+      // primary type
+      InternalQName primaryTypeName;
+      try
+      {
+         primaryTypeName = InternalQName.parse(in.readString());
+      }
+      catch (final IllegalNameException e)
+      {
+         throw new IOException(e.getMessage())
+         {
+            private static final long serialVersionUID = 3489809179234435267L;
+
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public Throwable getCause()
+            {
+               return e;
+            }
+         };
+      }
+
+      // mixins
+      InternalQName[] mixinTypeNames = null;
+      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
+      {
+         int count = in.readInt();
+         mixinTypeNames = new InternalQName[count];
+         for (int i = 0; i < count; i++)
+         {
+            try
+            {
+               mixinTypeNames[i] = InternalQName.parse(in.readString());
+            }
+            catch (final IllegalNameException e)
+            {
+               throw new IOException(e.getMessage())
+               {
+                  private static final long serialVersionUID = 3489809179234435268L; // eclipse
+
+                  // gen
+
+                  /**
+                   * {@inheritDoc}
+                   */
+                  @Override
+                  public Throwable getCause()
+                  {
+                     return e;
+                  }
+               };
+            }
+         }
+      }
+
+      // acl
+      AccessControlList acl = null;
+      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
+      {
+         ACLReader rdr = new ACLReader();
+         acl = rdr.read(in);
+      }
+
+      return new PersistedNodeData(identifier, qpath, parentIdentifier, persistedVersion, orderNum, primaryTypeName,
+         mixinTypeNames, acl);
+   }
+
+}

Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PresistedNodeDataReader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PresistedNodeDataReader.java	2011-07-21 12:52:33 UTC (rev 4671)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PresistedNodeDataReader.java	2011-07-21 15:02:35 UTC (rev 4672)
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.serialization;
-
-import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
-import org.exoplatform.services.jcr.dataflow.serialization.ObjectReader;
-import org.exoplatform.services.jcr.dataflow.serialization.SerializationConstants;
-import org.exoplatform.services.jcr.dataflow.serialization.UnknownClassIdException;
-import org.exoplatform.services.jcr.datamodel.IllegalNameException;
-import org.exoplatform.services.jcr.datamodel.IllegalPathException;
-import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.datamodel.QPath;
-
-import java.io.IOException;
-
-/**
- * Created by The eXo Platform SAS. <br/>Date:
- * 
- * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a>
- * @version $Id$
- */
-public class PresistedNodeDataReader
-{
-
-   /**
-    * Read and set PersistedNodeData data.
-    * 
-    * @param in ObjectReader.
-    * @return PersistedNodeData object.
-    * @throws UnknownClassIdException If read Class ID is not expected or do not
-    *           exist.
-    * @throws IOException If an I/O error has occurred.
-    */
-   public PersistedNodeData read(ObjectReader in) throws UnknownClassIdException, IOException
-   {
-      // read id
-      int key;
-      if ((key = in.readInt()) != SerializationConstants.PERSISTED_NODE_DATA)
-      {
-         throw new UnknownClassIdException("There is unexpected class [" + key + "]");
-      }
-
-      QPath qpath;
-      try
-      {
-         String sQPath = in.readString();
-         qpath = QPath.parse(sQPath);
-      }
-      catch (final IllegalPathException e)
-      {
-         throw new IOException("Deserialization error. " + e)
-         {
-
-            /**
-             * {@inheritDoc}
-             */
-            @Override
-            public Throwable getCause()
-            {
-               return e;
-            }
-         };
-      }
-
-      String identifier = in.readString();
-
-      String parentIdentifier = null;
-      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
-      {
-         parentIdentifier = in.readString();
-      }
-
-      int persistedVersion = in.readInt();
-      // --------------
-
-      int orderNum = in.readInt();
-
-      // primary type
-      InternalQName primaryTypeName;
-      try
-      {
-         primaryTypeName = InternalQName.parse(in.readString());
-      }
-      catch (final IllegalNameException e)
-      {
-         throw new IOException(e.getMessage())
-         {
-            private static final long serialVersionUID = 3489809179234435267L;
-
-            /**
-             * {@inheritDoc}
-             */
-            @Override
-            public Throwable getCause()
-            {
-               return e;
-            }
-         };
-      }
-
-      // mixins
-      InternalQName[] mixinTypeNames = null;
-      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
-      {
-         int count = in.readInt();
-         mixinTypeNames = new InternalQName[count];
-         for (int i = 0; i < count; i++)
-         {
-            try
-            {
-               mixinTypeNames[i] = InternalQName.parse(in.readString());
-            }
-            catch (final IllegalNameException e)
-            {
-               throw new IOException(e.getMessage())
-               {
-                  private static final long serialVersionUID = 3489809179234435268L; // eclipse
-
-                  // gen
-
-                  /**
-                   * {@inheritDoc}
-                   */
-                  @Override
-                  public Throwable getCause()
-                  {
-                     return e;
-                  }
-               };
-            }
-         }
-      }
-
-      // acl
-      AccessControlList acl = null;
-      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
-      {
-         ACLReader rdr = new ACLReader();
-         acl = rdr.read(in);
-      }
-
-      return new PersistedNodeData(identifier, qpath, parentIdentifier, persistedVersion, orderNum, primaryTypeName,
-         mixinTypeNames, acl);
-   }
-
-}



More information about the exo-jcr-commits mailing list