Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037329Openbravo ERPA. Platformpublic2017-11-20 14:382018-01-03 12:39
alostale 
alostale 
normaltrivialhave not tried
closedfixed 
5
 
3.0PR18Q1 
caristu
Core
No
0037329: make a more generic Utility.arrayListToString
Currently, there is a Utility.arrayListToString which generates a String representing all the elements in an ArrayList separated by commas and optionally quoted. This is useful to generate SQL queries with IN clauses. The API is unnecessarily limited to ArrayList.

It would be useful, in for some cases, to be more generic allowing any Collection instance instead of just ArrayList.
See, for example, UpdateActuals [1] where a new ArrayList needs to be created from a Set to perform this operation.

---
[1] https://code.openbravo.com/erp/devel/pi/file/e9a105538e89/src/org/openbravo/erpCommon/ad_process/UpdateActuals.java#l100 [^]
Create a more generic API that allows to create this String for Collections instead of just ArrayList. Additionally implement it in a more performant manner.

See metrics taken for new method compared with old one:

elements 1
  commaSeparated: 0 ms
  arrayListToString: 0 ms
elements 10
  commaSeparated: 0 ms
  arrayListToString: 1 ms
elements 100
  commaSeparated: 0 ms
  arrayListToString: 0 ms
elements 1000
  commaSeparated: 2 ms
  arrayListToString: 76 ms
elements 10000
  commaSeparated: 2 ms
  arrayListToString: 2936 ms
elements 100000
  commaSeparated: 31 ms
  arrayListToString: 135858 ms
No tags attached.
related to defect 0037324 closed alostale slow login having many preferences 
Issue History
2017-11-20 14:38alostaleNew Issue
2017-11-20 14:38alostaleAssigned To => platform
2017-11-20 14:38alostaleModules => Core
2017-11-20 14:38alostaleTriggers an Emergency Pack => No
2017-11-20 14:42alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=16321#r16321
2017-11-20 14:42alostaleProposed Solution updated
2017-11-20 14:42alostaleRelationship addedrelated to 0037324
2017-11-20 14:42alostaleAssigned Toplatform => alostale
2017-11-20 14:42alostaleReview Assigned To => caristu
2017-11-21 09:58hgbotCheckin
2017-11-21 09:58hgbotNote Added: 0100639
2017-11-21 09:58hgbotStatusnew => resolved
2017-11-21 09:58hgbotResolutionopen => fixed
2017-11-21 09:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4399ee25ce29f9bfae0280dfedda54e875abeee9 [^]
2017-11-21 10:06alostaleNote Added: 0100640
2017-11-21 10:12hgbotCheckin
2017-11-21 10:12hgbotNote Added: 0100642
2017-11-21 10:14hgbotCheckin
2017-11-21 10:14hgbotNote Added: 0100643
2017-11-24 12:52caristuNote Added: 0100702
2017-11-24 12:52caristuStatusresolved => closed
2017-11-24 12:52caristuFixed in Version => 3.0PR18Q1
2017-12-04 10:20hgbotCheckin
2017-12-04 10:20hgbotNote Added: 0100911
2017-12-04 10:20hgbotStatusclosed => resolved
2017-12-04 10:20hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/4399ee25ce29f9bfae0280dfedda54e875abeee9 [^] => http://code.openbravo.com/erp/devel/pi/rev/1930cd6e575642a6e47ca9d8e5552615cae41821 [^]
2017-12-04 10:21hgbotCheckin
2017-12-04 10:21hgbotNote Added: 0100912
2017-12-15 11:04caristuNote Added: 0101054
2017-12-15 11:04caristuStatusresolved => closed
2017-12-29 14:38hgbotCheckin
2017-12-29 14:38hgbotNote Added: 0101294
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101446
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101447

Notes
(0100639)
hgbot   
2017-11-21 09:58   
Repository: erp/devel/pi
Changeset: 4399ee25ce29f9bfae0280dfedda54e875abeee9
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Nov 20 14:48:56 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4399ee25ce29f9bfae0280dfedda54e875abeee9 [^]

fixes 37329: implemented a more generic Utility.arrayListToString

  Implemented a more generic alternative to Utility.arrayListToString:

    * Receives as parameter a generic Collections instead of limiting it to
      ArrayList instances
    * Implemented it in a more performant manner based on OpenJDK
      AbstractCollection.toString

---
M src/org/openbravo/erpCommon/utility/Utility.java
---
(0100640)
alostale   
2017-11-21 10:06   
Changesets related to this issue that were not automatically detected:

changeset: 33027:f2e2f4826906
user: Asier Lostalé <asier.lostale@openbravo.com>
date: Mon Nov 20 14:49:56 2017 +0100
summary: related to 37329: implemented a more generic Utility.arrayListToString

changeset: 33028:d7b72a4dec05
user: Asier Lostalé <asier.lostale@openbravo.com>
date: Mon Nov 20 14:58:19 2017 +0100
summary: related to 37329: use new method where old was used
(0100642)
hgbot   
2017-11-21 10:12   
Repository: erp/devel/pi
Changeset: 7da257d966c7e114da2f2880833ed0e12272d8ef
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Nov 21 10:11:54 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/7da257d966c7e114da2f2880833ed0e12272d8ef [^]

related to issue 37329: fixes javadoc

---
M src/org/openbravo/erpCommon/utility/Utility.java
---
(0100643)
hgbot   
2017-11-21 10:14   
Repository: erp/devel/pi
Changeset: fb3d55cb33309c69c7fc944289f3ef0df2e80222
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Nov 21 10:14:28 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/fb3d55cb33309c69c7fc944289f3ef0df2e80222 [^]

related to issue 37329: fixes typos

---
M src/org/openbravo/erpCommon/utility/Utility.java
---
(0100702)
caristu   
2017-11-24 12:52   
Code reviewed + tested OK.
(0100911)
hgbot   
2017-12-04 10:20   
Repository: erp/devel/pi
Changeset: 1930cd6e575642a6e47ca9d8e5552615cae41821
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Dec 04 10:11:14 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1930cd6e575642a6e47ca9d8e5552615cae41821 [^]

fixes 37329: implemented a more generic Utility.arrayListToString

  Moved new commaSeparated API from generic Utility to a more specific new class
  StringCollectionUtils. This also removes Utility class dependencies allowing to
  use new API from central components with limited compilation dependencies.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ADAlertDatasourceService.java
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
M src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
M src/org/openbravo/erpCommon/ad_process/UpdateActuals.java
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
M src/org/openbravo/erpCommon/obps/ActivationKey.java
M src/org/openbravo/erpCommon/utility/Utility.java
A src/org/openbravo/erpCommon/utility/StringCollectionUtils.java
---
(0100912)
hgbot   
2017-12-04 10:21   
Repository: erp/devel/api-checks
Changeset: d0c3d7dc51cfbc68dcc23720833c3718f43c2697
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Dec 04 10:20:24 2017 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/d0c3d7dc51cfbc68dcc23720833c3718f43c2697 [^]

related to issue 37329: API change false positive

  Utiliy.commaSeparated was already included in Java API although it was not yet
  published. This method has been now moved to another class, just accepting this
  change as false positive.

---
M java/reference/java.japi.gz
---
(0101054)
caristu   
2017-12-15 11:04   
Reviewed
(0101294)
hgbot   
2017-12-29 14:38   
Repository: erp/devel/api-checks
Changeset: 275dc8d2a7ed41a9ed1527e297da07f704f6ccdc
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Dec 04 10:20:24 2017 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/275dc8d2a7ed41a9ed1527e297da07f704f6ccdc [^]

related to issue 37329: API change false positive

  Utiliy.commaSeparated was already included in Java API although it was not yet
  published. This method has been now moved to another class, just accepting this
  change as false positive.

---
M java/reference/java.japi.gz
---
(0101446)
hudsonbot   
2018-01-03 12:39   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test
(0101447)
hudsonbot   
2018-01-03 12:39   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/c81e0d3cbab5 [^]
Maturity status: Test