details:   /erp/devel/pi/rev/8fc8d404f947
changeset: 8736:8fc8d404f947
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Mon Oct 25 13:29:54 2010 +0200
summary:   [instancePurpose] Insert a dummy heartbeat log when setting the 
purpose on a cloned community instance.

diffstat:

 src/org/openbravo/erpCommon/ad_forms/InstancePurpose.java |  20 ++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r 2b32c7c08974 -r 8fc8d404f947 
src/org/openbravo/erpCommon/ad_forms/InstancePurpose.java
--- a/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.java Mon Oct 25 
13:14:17 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/InstancePurpose.java Mon Oct 25 
13:29:54 2010 +0200
@@ -29,14 +29,19 @@
 
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.base.filter.ValueListFilter;
+import org.openbravo.base.provider.OBProvider;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.ad_process.HeartbeatProcess;
 import org.openbravo.erpCommon.obps.ActivationKey;
 import org.openbravo.erpCommon.utility.ComboTableData;
+import org.openbravo.erpCommon.utility.SystemInfo;
 import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.system.Client;
+import org.openbravo.model.ad.system.HeartbeatLog;
 import org.openbravo.model.ad.system.SystemInformation;
+import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.xmlEngine.XmlDocument;
 
 public class InstancePurpose extends HttpSecureAppServlet {
@@ -131,10 +136,23 @@
     out.close();
   }
 
-  private void savePurpose(String strPurpose) {
+  private void savePurpose(String strPurpose) throws ServletException {
     SystemInformation systemInfo = 
OBDal.getInstance().get(SystemInformation.class, "0");
     systemInfo.setInstancePurpose(strPurpose);
     OBDal.getInstance().save(systemInfo);
+    if (HeartbeatProcess.isClonedInstance()) {
+      insertDummyHBLog();
+    }
+  }
+
+  private void insertDummyHBLog() throws ServletException {
+    HeartbeatLog hbLog = OBProvider.getInstance().get(HeartbeatLog.class);
+    hbLog.setClient(OBDal.getInstance().get(Client.class, "0"));
+    hbLog.setOrganization(OBDal.getInstance().get(Organization.class, "0"));
+    hbLog.setSystemIdentifier(SystemInfo.getSystemIdentifier());
+    hbLog.setDatabaseIdentifier(SystemInfo.getDBIdentifier());
+    hbLog.setMacIdentifier(SystemInfo.getMacAddress());
+    OBDal.getInstance().save(hbLog);
   }
 
   @Override

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to