Author: jonesde
Date: Sat Jan 10 22:53:05 2009
New Revision: 733423
URL:
http://svn.apache.org/viewvc?rev=733423&view=revLog:
Improved GenericValue.checkFks method so that is dummy fk value is created then it will inherit the values create/update stamps so it doesn't seem like newer data; should fix issue reported by Sam Hamilton about 2-way entity sync erasing data when dummy fks are needed
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=733423&r1=733422&r2=733423&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Sat Jan 10 22:53:05 2009
@@ -467,6 +467,13 @@
if (allFieldsSet) {
if (Debug.infoOn()) Debug.logInfo("Creating place holder value : " + newValue, module);
+ // inherit create and update times from this value in order to make this not seem like new/fresh data
+ newValue.put(ModelEntity.CREATE_STAMP_FIELD, this.get(ModelEntity.CREATE_STAMP_FIELD));
+ newValue.put(ModelEntity.CREATE_STAMP_TX_FIELD, this.get(ModelEntity.CREATE_STAMP_TX_FIELD));
+ newValue.put(ModelEntity.STAMP_FIELD, this.get(ModelEntity.STAMP_FIELD));
+ newValue.put(ModelEntity.STAMP_TX_FIELD, this.get(ModelEntity.STAMP_TX_FIELD));
+ // set isFromEntitySync so that create/update stamp fields set above will be preserved
+ newValue.setIsFromEntitySync(true);
// check the FKs for the newly created entity
newValue.checkFks(true);
newValue.create();
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java?rev=733423&r1=733422&r2=733423&view=diff==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java Sat Jan 10 22:53:05 2009
@@ -89,7 +89,7 @@
esc.setSplitStartTime(); // just run this the first time, will be updated between each loop automatically
while (esc.hasMoreTimeToSync()) {
- // TODO make sure the following message is commented out before commit:
+ // this will result in lots of log messages, so leaving commented out unless needed/wanted later
// Debug.logInfo("Doing runEntitySync split, currentRunStartTime=" + esc.currentRunStartTime + ", currentRunEndTime=" + esc.currentRunEndTime, module);
esc.totalSplits++;