Author: areshetnyak
Date: 2009-11-18 11:28:53 -0500 (Wed, 18 Nov 2009)
New Revision: 757
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/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
Log:
EXOJCR-248 : The AbstractCacheLoader was changed.
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-18
16:27:30 UTC (rev 756)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-18
16:28:53 UTC (rev 757)
@@ -114,7 +114,7 @@
break;
case PUT_KEY_VALUE :
- if (m.getOldValue() != null)
+ if (isUpdate(m, conn))
doUpdate(m, conn);
else
doAdd(m, conn);
@@ -141,6 +141,19 @@
}
/**
+ * Check update item or add item.
+ *
+ * @param m
+ * @param conn
+ * @return boolean
+ * return true if update
+ */
+ private boolean isUpdate(Modification m, JDBCStorageConnection conn) throws
RepositoryException
+ {
+ return (conn.getItemName((String)m.getFqn().get(1)) == null ? false : true);
+ }
+
+ /**
* {@inheritDoc}
*/
public void put(List<Modification> modifications) throws Exception
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
===================================================================
---
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-18
16:27:30 UTC (rev 756)
+++
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-18
16:28:53 UTC (rev 757)
@@ -158,7 +158,6 @@
String fqn = "/" + JBossCacheStorage.PROPS + "/" +
data.getIdentifier();
Modification modification =
new Modification(ModificationType.PUT_KEY_VALUE, Fqn.fromString(fqn),
JBossCacheStorage.ITEM_DATA, data);
- modification.setOldValue(data);
list.add(modification);
return list;
}
@@ -186,7 +185,6 @@
fqn = Fqn.fromElements(JBossCacheStorage.NODES, data.getIdentifier());
modification = new Modification(ModificationType.PUT_KEY_VALUE, fqn,
JBossCacheStorage.ITEM_DATA, data);
- modification.setOldValue(data);
list.add(modification);
return list;
Show replies by date