Update of /var/cvs/applications/richtext/src/org/mmbase/versioning
In directory james.mmbase.org:/tmp/cvs-serv32466
Modified Files:
VersioningCommitProcessor.java
Log Message:
only create new version if node actually changed
See also:
http://cvs.mmbase.org/viewcvs/applications/richtext/src/org/mmbase/versioning
Index: VersioningCommitProcessor.java
===================================================================
RCS file:
/var/cvs/applications/richtext/src/org/mmbase/versioning/VersioningCommitProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- VersioningCommitProcessor.java 12 Mar 2008 10:24:52 -0000 1.3
+++ VersioningCommitProcessor.java 13 Mar 2008 10:51:50 -0000 1.4
@@ -9,7 +9,7 @@
* This commitprocessor copies on every commit the complete node to a
'versioning' table.
* @author Sander de Boer
* @author Michiel Meeuwissen
- * @version $Id: VersioningCommitProcessor.java,v 1.3 2008/03/12 10:24:52
michiel Exp $
+ * @version $Id: VersioningCommitProcessor.java,v 1.4 2008/03/13 10:51:50
michiel Exp $
* @since
*/
@@ -21,9 +21,10 @@
public static final String VERSION_FIELD = "version";
public static final String OBJECT_FIELD = "object";
- public static final String TIMESTAMP_FIELD = "timestamp";
public void commit(Node node, Field field) {
+ if (node.isChanged()) {
+ log.debug("Commiting " + node + "setting version in " + field);
NodeManager wo = node.getNodeManager();
String versionBuilder = wo.getProperty("versionbuilder");
@@ -35,17 +36,14 @@
//clone this version to the versions builder
Cloud cloud = node.getCloud();
- Node version = wv.createNode();
+ Node version = wv.createNode();
//increase the version of the current node
int newVersionNo = node.getIntValue(field.getName()) + 1;
node.setIntValue(field.getName(), newVersionNo);
cloneNode(node, version);
- if (node.getNodeManager().hasField("lastmodified")) {
- version.setDateValue(TIMESTAMP_FIELD,
node.getDateValue("lastmodified"));
- }
version.setNodeValue(OBJECT_FIELD, node);
version.setIntValue(VERSION_FIELD, newVersionNo);
if (! node.isNew()) {
@@ -56,6 +54,9 @@
// http://www.mmbase.org/jira/browse/MMB-1522.
// http://www.mmbase.org/jira/browse/MMB-1621 // This would also
give a way to get the 'old values'.
}
+ } else {
+ log.service("Node not changed");
+ }
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs