Author: pnedonosko
Date: 2009-11-24 09:49:52 -0500 (Tue, 24 Nov 2009)
New Revision: 830
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: updateMixin in conn and loader
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-24
13:56:05 UTC (rev 829)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-24
14:49:52 UTC (rev 830)
@@ -712,7 +712,7 @@
if (data instanceof TransientNodeData)
{
- ((TransientNodeData)data).setState(TransientNodeData.TRANSITIVE_MIXIN_UPDATED);
+ ((TransientNodeData)data).addState(TransientNodeData.TRANSITIVE_MIXIN_UPDATED);
}
}
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-24
13:56:05 UTC (rev 829)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-24
14:49:52 UTC (rev 830)
@@ -119,29 +119,7 @@
}
break;
case PUT_KEY_VALUE :
- if (m.getFqn().size() == 2)
- {
- // if (m.getValue() instanceof TransientNodeData)
- // {
- // //Check flag it's mixin update for node, if
this flag set we have node need to
- // // update node
- // int skipMask =
TransientNodeData.TRANSITIVE_MIXIN_UPDATED;
- // if
((((TransientNodeData)m.getValue()).getState() & skipMask) > 0)
- // {
- //
- // continue;
- // }
- // }
- if (isUpdate(m, (JDBCStorageConnection)conn))
- {
- doUpdate(m, conn);
- }
- else
- {
- doAdd(m, conn);
- }
- }
-
+ doUpdate(m, (JDBCStorageConnection)conn);
break;
case REMOVE_DATA :
if (LOG.isDebugEnabled())
@@ -180,19 +158,6 @@
}
/**
- * Check update item or add item.
- *
- * @param m Modification
- * @param conn JDBCStorageConnection
- * @return boolean
- * return true if update, false if add
- */
- private boolean isUpdate(Modification m, JDBCStorageConnection conn) throws
RepositoryException
- {
- return conn.itemExists((String)m.getFqn().get(1), m.getValue() instanceof
NodeData);
- }
-
- /**
* {@inheritDoc}
*/
public void put(List<Modification> modifications) throws Exception
@@ -285,44 +250,54 @@
}
/**
- * Performs UPDATE to NodeData and PropertyData.
- * @param modification
- * @param conn
- * @throws IllegalStateException
- * @throws RepositoryException
+ * Performs UPDATE to NodeData or PropertyData.
+ *
+ * @param modification Modification
+ * @param conn WorkspaceStorageConnection
+ * @throws IllegalStateException if connection closed
+ * @throws RepositoryException if error occurs
*/
- private void doUpdate(Modification modification, WorkspaceStorageConnection conn)
throws IllegalStateException,
+ private void doUpdate(Modification m, JDBCStorageConnection conn) throws
IllegalStateException,
RepositoryException
{
- if (modification.getValue() instanceof ItemData)
+ if (m.getFqn().size() == 2 && m.getValue() instanceof TransientItemData)
{
- TransientItemData item = (TransientItemData)modification.getValue();
+ //Check flag it's mixin update for node, if this flag set we have node need
to
+ TransientItemData item = (TransientItemData)m.getValue();
- if ((item.getState() & TransientItemData.TRANSITIVE_PATH_UPDATED) == 0)
+ // TODO try
+ // if ((item.getState() == TransientItemData.TRANSITIVE_NONE)
+
+ if ((item.getState() & TransientItemData.TRANSITIVE_PATH_UPDATED) == 0
+ || (item.getState() & TransientItemData.TRANSITIVE_MIXIN_UPDATED) == 0)
{
- // update if it's non transitive update
- if (item.isNode())
+ if (conn.itemExists((String)m.getFqn().get(1), item.isNode()))
+ //if (isUpdate(m, (JDBCStorageConnection)conn))
{
- // conn.rename() is used to update all the fields in DB.
- // Original conn.update() will be matched as deprecated,
- // and conn.rename() should be renamed to update. This
- // is done to solve the issue, when we need to guess each
- // time whether node is moved or just updated. This
- // solution is used as the fastest among other.
- conn.rename((NodeData)item);
+ // update if it's non transitive update
+ if (item.isNode())
+ {
+ // TODO conn.rename() is used to update all the fields in DB.
+ // Original conn.update() will be matched as deprecated,
+ // and conn.rename() should be renamed to update. This
+ // is done to solve the issue, when we need to guess each
+ // time whether node is moved or just updated. This
+ // solution is used as the fastest among other.
+ conn.rename((NodeData)item);
+ }
+ else
+ {
+ //update property data
+ conn.update((PropertyData)item);
+ }
}
else
{
- //update property data
- conn.update((PropertyData)item);
+ doAdd(m, conn);
}
}
- else
- {
- // TODO for debug
- LOG.info("TRANSITIVE_PATH_UPDATED " +
item.getQPath().getAsString());
- }
}
+
}
/**
Show replies by date