[OpenbravoERP-commits] devel/pi: related to issue 40747: added comment to variable

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/03190a39ef36
changeset: 35718:03190a39ef36
user:  Asier Lostalé  openbravo.com>
date:  Tue May 07 08:37:36 2019 +0200
summary:   related to issue 40747: added comment to variable

diffstat:

 src/org/openbravo/service/importprocess/ImportEntryManager.java |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 3ad31745f63e -r 03190a39ef36 
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java   Fri May 
03 14:06:11 2019 +0200
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java   Tue May 
07 08:37:36 2019 +0200
@@ -153,6 +153,8 @@
   // default to number of processors plus some additionals for the main threads
   private int numberOfThreads = Runtime.getRuntime().availableProcessors() + 3;
 
+  // used to determine the time to wait after each cycle before querying for 
new entries to be
+  // processed
   private int processingCapacityPerSecond;
 
   // defines the batch size of reading and processing import entries by the
@@ -179,9 +181,7 @@
 numberOfThreads, 4);
 maxTaskQueueSize = ImportProcessUtils.getCheckIntProperty(log, 
"import.max.task.queue.size",
 maxTaskQueueSize, 50);
-
 managerWaitTime = ImportProcessUtils.getCheckIntProperty(log, 
"import.wait.time", 600, 1);
-
 processingCapacityPerSecond = ImportProcessUtils.getCheckIntProperty(log,
 "import.processing.capacity.per.second", numberOfThreads * 30, 10);
 


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: 2 new changesets

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/e0759ec376b4
changeset: 35719:e0759ec376b4
user:  Augusto Mauch  openbravo.com>
date:  Mon May 06 16:47:56 2019 +0200
summary:   Fixes issue 40763: Standard properties are taken from underlying 
window in P

When a P window contains a grid and a request to the datasource of the P 
window is done, it is
not clear whether the P grid or the underlying grid standard properties 
(tabId, tableId, windowId, etc)
should be included in the contextInfo.

Before this changeset [1] was pushed, the standard properties were taken from 
the underlying grid. The
changeset modified the behaviour, so that the P grid standard properties were 
included instead.
This was necessary because the SelectorConstants.includeOrgFilter method needed 
the table ID of the
P grid.

But the change caused another problem: Some OBBindings were relying on the 
underlying grid standard
properties being included in the contextInfo.

To fix both problems, now a new property called inpPickAndExecuteTableId is 
included when doing a
request from a P grid, and that property is referenced by 
SelectorConstants.includeOrgFilter.

The contextInfo now will include the standard properties of the underlying 
grid, as it was done
before [1].

[1] 
https://code.openbravo.com/erp/devel/pi/rev/1ed089db27e7036cf53026ca873dbcf104d79bb9

details:   https://code.openbravo.com/erp/devel/pi/rev/15cdfeb7c6ac
changeset: 35720:15cdfeb7c6ac
user:  Augusto Mauch  openbravo.com>
date:  Tue May 07 09:47:49 2019 +0200
summary:   Fixes issue 40472: New filtering logic takes into account lazy 
filtering

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
 |  11 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
|   4 ++-
 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorConstants.java
|   9 +--
 3 files changed, 19 insertions(+), 5 deletions(-)

diffs (74 lines):

diff -r 03190a39ef36 -r 15cdfeb7c6ac 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
   Tue May 07 08:37:36 2019 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
   Tue May 07 09:47:49 2019 +0200
@@ -175,13 +175,22 @@
 },
 _original_recordClick: isc.PickListMenu.getPrototype().recordClick,
 recordClick: function (viewer, record, recordNum, field, fieldNum, 
value, rawValue) {
+  var filterEditor = this.formItem && this.formItem.grid,
+  grid = filterEditor && filterEditor.parentElement;
   if (field && field.name === '_checkboxField') {
 // when clicking on the checkbox, execute default behaviour
 return this._original_recordClick(viewer, record, recordNum, 
field, fieldNum, value, rawValue);
   } else {
 // when clicking a row outside the checkbox, select that specific 
row and close the popup
 this.formItem.setValue('==' + record._identifier);
-this.formItem.grid.performFilter(true, true);
+if (grid) {
+  if (grid.lazyFiltering) {
+grid.filterHasChanged = true;
+grid.sorter.enable();
+  } else {
+filterEditor.performFilter(true, true);
+  }
+}
 this.hide();
   }
 }
diff -r 03190a39ef36 -r 15cdfeb7c6ac 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
  Tue May 07 08:37:36 2019 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
  Tue May 07 09:47:49 2019 +0200
@@ -925,7 +925,9 @@
   return;
 }
 contextInfo = isc.addProperties({}, 
this.view.parentWindow.activeView.getContextInfo(false, true, true, true));
-isc.addProperties(contextInfo, this.viewProperties.standardProperties);
+if (this.viewProperties.standardProperties && 
this.viewProperties.standardProperties.inpTableId) {
+  contextInfo.inpPickAndExecuteTableId = 
this.viewProperties.standardProperties.inpTableId;
+}
 record = isc.addProperties({}, this.getRecord(rowNum), 
this.getEditValues(rowNum));
 fields = this.viewProperties.fields;
 len = fields.length;
diff -r 03190a39ef36 -r 15cdfeb7c6ac 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorConstants.java
--- 

[OpenbravoERP-commits] devel/pi: 2 new changesets

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/01589a6ee69a
changeset: 35716:01589a6ee69a
user:  Asier Lostalé  openbravo.com>
date:  Fri May 03 07:48:00 2019 +0200
summary:   fixes 40747: unnecessary wait in Import Entry Manager

  After handling import entries to be processed, ImportEntryManager thread 
sleeps
  in order to give time those entries to be processed before starting a new 
loop.

  The time was calculated based on the amount of import entries handled in last
  cycle (giving 300ms to each one) with a minimum of 2 secs. In cases with a 
high
  activity this time can be very high resulting in no new entries being 
processed
  because the import entry manager thread is sleeping.

  When doing this calculation, the number of threads processing import entries 
was
  not taken into account.

  Now this time is divided by this number of threads. Still this is just an 
inaccurate
  approximation. If this time is very small, the entries took in previous loop 
will
  be taken again in the next one(s) as they couldn't be processed yet so their 
status
  didn't change in database, causing unnecessary roundtrips to database. In any 
case,
  the consecuence of this would be limited to non required work being done as
  ImportEntryProcessor.ImportEntryProcessRunnable.addEntry method checks 
whether new
  import entries retrieved from DB are already being processed before adding 
them to
  the queue preventing in this way double processing.

details:   https://code.openbravo.com/erp/devel/pi/rev/3ad31745f63e
changeset: 35717:3ad31745f63e
user:  Asier Lostalé  openbravo.com>
date:  Fri May 03 14:06:11 2019 +0200
summary:   fixes 37853: improved ImportEntryManager logs

  - Log partial timing statistics for the last 100 entries processed keeping 
also
total statisitcs since last restart
  - Include process time for each processed entry
  - ImportEntryProcessor.addEntry
 * Set key to runnable before adding entry so it gets properly logged
 * In all logs include type of data and key to know if problems occur in a
   single processor
 * Increase from debug to warn log level message when processor's quee is
   completelly full. This should really exceptional and worth to make it
   visible in log as it might indicate sever problems

diffstat:

 src/org/openbravo/service/importprocess/ImportEntryManager.java   |  53 
++---
 src/org/openbravo/service/importprocess/ImportEntryProcessor.java |  18 +-
 2 files changed, 47 insertions(+), 24 deletions(-)

diffs (160 lines):

diff -r b638e581f3c3 -r 3ad31745f63e 
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java   Mon May 
06 15:49:37 2019 +0200
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java   Fri May 
03 14:06:11 2019 +0200
@@ -153,6 +153,8 @@
   // default to number of processors plus some additionals for the main threads
   private int numberOfThreads = Runtime.getRuntime().availableProcessors() + 3;
 
+  private int processingCapacityPerSecond;
+
   // defines the batch size of reading and processing import entries by the
   // main thread, for each type of data the batch size is being read
   private int importBatchSize = 5000;
@@ -177,10 +179,21 @@
 numberOfThreads, 4);
 maxTaskQueueSize = ImportProcessUtils.getCheckIntProperty(log, 
"import.max.task.queue.size",
 maxTaskQueueSize, 50);
+
 managerWaitTime = ImportProcessUtils.getCheckIntProperty(log, 
"import.wait.time", 600, 1);
 
+processingCapacityPerSecond = ImportProcessUtils.getCheckIntProperty(log,
+"import.processing.capacity.per.second", numberOfThreads * 30, 10);
+
 // property defined in secs, convert to ms
 managerWaitTime = managerWaitTime * 1000;
+
+log.info("Import entry manager settings");
+log.info("  batch size: {}", importBatchSize);
+log.info("  number of threads: {}", numberOfThreads);
+log.info("  task queue size: {}", maxTaskQueueSize);
+log.info("  wait time: {} sec", managerWaitTime);
+log.info("  processing capacity per second: {} entries", 
processingCapacityPerSecond);
   }
 
   public synchronized void start() {
@@ -613,23 +626,24 @@
 if (entryCount > 0) {
   // if there was data then just wait some time
   // give the threads time to process it all before trying
-  // a next batch of entries
+  // a next batch of entries to prevent retrieving from DB the 
same records we have just
+  // handled in this cycle
   try {
-// wait one second per 30 records, somewhat arbitrary
-// but high enough for most cases, also always wait 300 millis 
additional to
-// start up threads etc.
+// wait processingCapacityPerSecond which is the expected 
entries number of entries
+// that can be processed per second, it 

[OpenbravoERP-commits] devel/pi: related to issue 40735: add test case

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/8c40baeab17c
changeset: 35721:8c40baeab17c
user:  Carlos Aristu  openbravo.com>
date:  Tue May 07 11:14:50 2019 +0200
summary:   related to issue 40735: add test case

  Added test case to cover the export of a grid filtered by a date column

diffstat:

 src-test/src/org/openbravo/test/AllAntTaskTests.java   |2 +
 src-test/src/org/openbravo/test/base/TestConstants.java|4 +
 src-test/src/org/openbravo/test/datasource/GridExport.java |  154 +
 3 files changed, 160 insertions(+), 0 deletions(-)

diffs (191 lines):

diff -r 15cdfeb7c6ac -r 8c40baeab17c 
src-test/src/org/openbravo/test/AllAntTaskTests.java
--- a/src-test/src/org/openbravo/test/AllAntTaskTests.java  Tue May 07 
09:47:49 2019 +0200
+++ b/src-test/src/org/openbravo/test/AllAntTaskTests.java  Tue May 07 
11:14:50 2019 +0200
@@ -67,6 +67,7 @@
 import org.openbravo.test.dal.ReadByNameTest;
 import org.openbravo.test.dal.ValidationTest;
 import org.openbravo.test.dal.ViewTest;
+import org.openbravo.test.datasource.GridExport;
 import org.openbravo.test.db.model.functions.ADOrgTreeTest;
 import org.openbravo.test.db.model.functions.Ad_isorgincludedTest;
 import org.openbravo.test.db.model.functions.SqlCallableStatement;
@@ -309,6 +310,7 @@
 
 // others
 DocumentNumberGeneration.class, //
+GridExport.class, //
 ViewGeneration.class,
 
 // Cancel and Replace Tests
diff -r 15cdfeb7c6ac -r 8c40baeab17c 
src-test/src/org/openbravo/test/base/TestConstants.java
--- a/src-test/src/org/openbravo/test/base/TestConstants.java   Tue May 07 
09:47:49 2019 +0200
+++ b/src-test/src/org/openbravo/test/base/TestConstants.java   Tue May 07 
11:14:50 2019 +0200
@@ -52,6 +52,10 @@
 public static final String DISCOUNTS_AND_PROMOTIONS = "800028";
   }
 
+  public static class Entities {
+public static final String COUNTRY = "Country";
+  }
+
   private TestConstants() {
   }
 }
diff -r 15cdfeb7c6ac -r 8c40baeab17c 
src-test/src/org/openbravo/test/datasource/GridExport.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/src-test/src/org/openbravo/test/datasource/GridExport.javaTue May 
07 11:14:50 2019 +0200
@@ -0,0 +1,154 @@
+/*
+ *
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2019 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  __.
+ 
+ */
+package org.openbravo.test.datasource;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.openbravo.test.base.TestConstants.Entities.COUNTRY;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.junit.Test;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.weld.test.WeldBaseTest;
+import org.openbravo.erpCommon.utility.StringCollectionUtils;
+import org.openbravo.service.datasource.DataSourceServiceProvider;
+import org.openbravo.service.datasource.DefaultDataSourceService;
+import org.openbravo.service.json.DefaultJsonDataService.QueryResultWriter;
+import org.openbravo.service.json.JsonConstants;
+
+/**
+ * Test cases to verify the correct behavior when exporting an standard grid. 
Note that the tests in
+ * this class does not need to execute any request as they are making direct 
use of the DataSource
+ * API.
+ */
+public class GridExport extends WeldBaseTest {
+
+  @Inject
+  private DataSourceServiceProvider dataSourceServiceProvider;
+
+  /** exports a grid filtered by a date column */
+  @Test
+  public void exportRecordsFilteredByDate() throws Exception {
+TestQueryResultWriter writer = new TestQueryResultWriter(COUNTRY,
+Arrays.asList("iSOCountryCode", "name", "addressPrintFormat", 
"currency", "hasRegions"));
+exportGrid(writer);
+assertThat(writer.getResults(), equalTo(getExpectedResult()));
+  }
+
+  private void exportGrid(TestQueryResultWriter 

[OpenbravoERP-commits] devel/pi: fixed issue 40754: OOM on export.database in validatio...

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/804489012532
changeset: 35723:804489012532
user:  Asier Lostalé  openbravo.com>
date:  Tue May 07 12:58:29 2019 +0200
summary:   fixed issue 40754: OOM on export.database in validation part with 
many modules

  Validate model part of export database throws OOM error when there are many
  modules to check.

  This patch:
- Clears DAL session after validating each module as this process never does
  any modification and there is no reutilization all loaded objects can be
  safely evited from 1st level cache.
- Removes unused map retainig all AD tables.
- Filters tables by datatype in query instead of in JVM.

diffstat:

 src/org/openbravo/service/system/DatabaseValidator.java |  21 +---
 1 files changed, 7 insertions(+), 14 deletions(-)

diffs (47 lines):

diff -r 9d6a4a7aa38c -r 804489012532 
src/org/openbravo/service/system/DatabaseValidator.java
--- a/src/org/openbravo/service/system/DatabaseValidator.java   Tue May 07 
12:29:08 2019 +0200
+++ b/src/org/openbravo/service/system/DatabaseValidator.java   Tue May 07 
12:58:29 2019 +0200
@@ -159,14 +159,6 @@
   }
 }
 
-final OBCriteria tcs = 
OBDal.getInstance().createCriteria(Table.class);
-tcs.add(Restrictions.eq(Table.PROPERTY_VIEW, false));
-final List adTables = tcs.list();
-final Map adTablesByName = new HashMap();
-for (Table adTable : adTables) {
-  adTablesByName.put(adTable.getDBTableName(), adTable);
-}
-
 // the following cases are checked:
 // 1) table present in ad, but not in db
 // 2) table present in db, not in ad
@@ -192,14 +184,14 @@
   dbViews.put(view.getName().toUpperCase(), view);
 }
 
+final List adTables = OBDal.getInstance()
+.createCriteria(Table.class)
+.add(Restrictions.eq(Table.PROPERTY_VIEW, false))
+.add(Restrictions.eq(Table.PROPERTY_DATAORIGINTYPE, 
ApplicationConstants.TABLEBASEDTABLE))
+.list();
+
 final String moduleId = (getValidateModule() == null ? null : 
getValidateModule().getId());
 for (Table adTable : adTables) {
-
-  // Do not validate the table if it is based on a datasource
-  if 
(!ApplicationConstants.TABLEBASEDTABLE.equals(adTable.getDataOriginType())) {
-continue;
-  }
-
   final org.apache.ddlutils.model.Table dbTable = dbTablesByName
   .get(adTable.getDBTableName().toUpperCase());
   final View view = dbViews.get(adTable.getDBTableName().toUpperCase());
@@ -264,6 +256,7 @@
 
 checkKillableImplementation(result);
 
+OBDal.getInstance().getSession().clear();
 return result;
   }
 


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: Fixes issue 40796 Updates the list of supported and re...

2019-05-07 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/9d6a4a7aa38c
changeset: 35722:9d6a4a7aa38c
user:  Pablo Lujan  openbravo.com
date:  Tue May 07 12:29:08 2019 +0200
summary:   Fixes issue 40796 Updates the list of supported and recommended 
browsers

diffstat:

 src/org/openbravo/erpCommon/security/Login.html |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 8c40baeab17c -r 9d6a4a7aa38c 
src/org/openbravo/erpCommon/security/Login.html
--- a/src/org/openbravo/erpCommon/security/Login.html   Tue May 07 11:14:50 
2019 +0200
+++ b/src/org/openbravo/erpCommon/security/Login.html   Tue May 07 12:29:08 
2019 +0200
@@ -43,13 +43,13 @@