Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0037329
TypeCategorySeverityReproducibilityDate SubmittedLast Update
feature request[Openbravo ERP] A. Platformtrivialhave not tried2017-11-20 14:382017-12-04 10:21
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in Version3.0PR18Q1
StatusresolvedFix in branchFixed in SCM revision1930cd6e5756
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0037329: make a more generic Utility.arrayListToString

DescriptionCurrently, 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.
Steps To ReproduceSee, 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 [^]
Proposed SolutionCreate 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
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0037324 closedalostale slow login having many preferences 

-  Notes
(0100639)
hgbot (developer)
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 (developer)
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 (developer)
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 (developer)
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 (developer)
2017-11-24 12:52

Code reviewed + tested OK.
(0100911)
hgbot (developer)
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 (developer)
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
---

- Issue History
Date Modified Username Field Change
2017-11-20 14:38 alostale New Issue
2017-11-20 14:38 alostale Assigned To => platform
2017-11-20 14:38 alostale Modules => Core
2017-11-20 14:38 alostale Triggers an Emergency Pack => No
2017-11-20 14:42 alostale Steps to Reproduce Updated View Revisions
2017-11-20 14:42 alostale Proposed Solution updated
2017-11-20 14:42 alostale Relationship added related to 0037324
2017-11-20 14:42 alostale Assigned To platform => alostale
2017-11-20 14:42 alostale Review Assigned To => caristu
2017-11-21 09:58 hgbot Checkin
2017-11-21 09:58 hgbot Note Added: 0100639
2017-11-21 09:58 hgbot Status new => resolved
2017-11-21 09:58 hgbot Resolution open => fixed
2017-11-21 09:58 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4399ee25ce29f9bfae0280dfedda54e875abeee9 [^]
2017-11-21 10:06 alostale Note Added: 0100640
2017-11-21 10:12 hgbot Checkin
2017-11-21 10:12 hgbot Note Added: 0100642
2017-11-21 10:14 hgbot Checkin
2017-11-21 10:14 hgbot Note Added: 0100643
2017-11-24 12:52 caristu Note Added: 0100702
2017-11-24 12:52 caristu Status resolved => closed
2017-11-24 12:52 caristu Fixed in Version => 3.0PR18Q1
2017-12-04 10:20 hgbot Checkin
2017-12-04 10:20 hgbot Note Added: 0100911
2017-12-04 10:20 hgbot Status closed => resolved
2017-12-04 10:20 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/4399ee25ce29f9bfae0280dfedda54e875abeee9 [^] => http://code.openbravo.com/erp/devel/pi/rev/1930cd6e575642a6e47ca9d8e5552615cae41821 [^]
2017-12-04 10:21 hgbot Checkin
2017-12-04 10:21 hgbot Note Added: 0100912


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker