Related to 32899: Provide an base class which implements default offline and online behavior in multi-server environments
authorMartin Taal <martin.taal@openbravo.com>
Sun, 08 May 2016 00:53:32 +0200
changeset 4 52f356c919ef
parent 3 b1dafc97de17
child 5 68ba8744640d
Related to 32899: Provide an base class which implements default offline and online behavior in multi-server environments
Sample code for multi-server process calls
src-db/database/sourcedata/OBMOBC_SERVICES.xml
src/org/openbravo/retail/storeserver/howto/StoreServerHowToComponentProvider.java
src/org/openbravo/retail/storeserver/howto/store/CheckProductStore.java
web/org.openbravo.retail.storeserver.howto/js/ob-storeserver-howto-add-button.js
--- a/src-db/database/sourcedata/OBMOBC_SERVICES.xml	Sat Nov 21 22:39:10 2015 +0100
+++ b/src-db/database/sourcedata/OBMOBC_SERVICES.xml	Sun May 08 00:53:32 2016 +0200
@@ -11,6 +11,17 @@
 <!--13E3955B83F348F7B60AAACEE6A7BE86-->  <ROUTINGTYPE><![CDATA[Failover]]></ROUTINGTYPE>
 <!--13E3955B83F348F7B60AAACEE6A7BE86--></OBMOBC_SERVICES>
 
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17--><OBMOBC_SERVICES>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <OBMOBC_SERVICES_ID><![CDATA[2EA8D5CF171A48F1A8EDABDC17E22E17]]></OBMOBC_SERVICES_ID>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <AD_MODULE_ID><![CDATA[ED6F408F7E85415A961E06275EDE3028]]></AD_MODULE_ID>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <SERVICE><![CDATA[org.openbravo.retail.storeserver.howto.CheckMultiServer]]></SERVICE>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <DESCRIPTION><![CDATA[Check Multi Server Example]]></DESCRIPTION>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17-->  <ROUTINGTYPE><![CDATA[Failover]]></ROUTINGTYPE>
+<!--2EA8D5CF171A48F1A8EDABDC17E22E17--></OBMOBC_SERVICES>
+
 <!--3EA7B669022F4F1EA7DFCCE70EA4A173--><OBMOBC_SERVICES>
 <!--3EA7B669022F4F1EA7DFCCE70EA4A173-->  <OBMOBC_SERVICES_ID><![CDATA[3EA7B669022F4F1EA7DFCCE70EA4A173]]></OBMOBC_SERVICES_ID>
 <!--3EA7B669022F4F1EA7DFCCE70EA4A173-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/retail/storeserver/howto/StoreServerHowToComponentProvider.java	Sat Nov 21 22:39:10 2015 +0100
+++ b/src/org/openbravo/retail/storeserver/howto/StoreServerHowToComponentProvider.java	Sun May 08 00:53:32 2016 +0200
@@ -43,7 +43,8 @@
 
     final String prefix = "web/org.openbravo.retail.storeserver.howto/js/";
 
-    final String[] resourceDependency = { "ob-storeserver-howto-add-button" };
+    final String[] resourceDependency = { "ob-storeserver-howto-add-button",
+        "ob-storeserver-howto-multi-server-call" };
 
     for (final String resource : resourceDependency) {
       globalResources.add(createComponentResource(ComponentResourceType.Static, prefix + resource
--- a/src/org/openbravo/retail/storeserver/howto/store/CheckProductStore.java	Sat Nov 21 22:39:10 2015 +0100
+++ b/src/org/openbravo/retail/storeserver/howto/store/CheckProductStore.java	Sun May 08 00:53:32 2016 +0200
@@ -42,7 +42,7 @@
       JSONObject result = new JSONObject();
 
       String productId = json.getString("productId");
-      String hqlCheckProduct = "select count(p.id) from Product as p " + "where p.id='" + productId
+      String hqlCheckProduct = "select count(p.id) from Product as p where p.id='" + productId
           + "' ";
       Query checkProductQuery = OBDal.getInstance().getSession().createQuery(hqlCheckProduct);
 
--- a/web/org.openbravo.retail.storeserver.howto/js/ob-storeserver-howto-add-button.js	Sat Nov 21 22:39:10 2015 +0100
+++ b/web/org.openbravo.retail.storeserver.howto/js/ob-storeserver-howto-add-button.js	Sun May 08 00:53:32 2016 +0200
@@ -27,7 +27,7 @@
   });
 
   //Register the button...
-  OB.OBPOSPointOfSale.UI.EditLine.prototype.actionButtons.push({
+  OB.OBPOSPointOfSale.UI.EditLine.prototype.actionButtons.unshift({
     kind: 'OB.OBPOSPointOfSale.UI.EditLine.StoreServerProductCheck',
     name: 'storeServerProductCheck'
   });