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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033601
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2016-08-02 15:182016-09-02 13:25
ReportershuehnerView Statuspublic 
Assigned ToNaroaIriarte 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revision938e3500425d
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033601: Preferences.getPreferenceValue is doing useless extra db-reads (missing getProxy)

DescriptionOn first look this function is missing some getProxy usage to avoid db reads.

proxy is fine as only pk value is used.

  public static String getPreferenceValue(String property, boolean isListProperty,
      String strClient, String strOrg, String strUser, String strRole, String strWindow)
      throws PropertyException {

However checking that function it only calls next function having Client,Organization etc as objects as parameter just to extract the id again to use it.

So maybe swap around those functions do put real content inside the functions having id's and use the other one as the wrapper
Steps To Reproduce      Client client = OBDal.getInstance().get(Client.class, strClient == null ? "" : strClient);
      Organization org = OBDal.getInstance().get(Organization.class, strOrg == null ? "" : strOrg);
      User user = OBDal.getInstance().get(User.class, strUser == null ? "" : strUser);
      Role role = OBDal.getInstance().get(Role.class, strRole == null ? "" : strRole);
      Window window = OBDal.getInstance().get(Window.class, strWindow == null ? "" : strWindow);

are all missing getProxy
NOTE: take care about that strange '== null' checks in there

just to then:
      String clientId = client == null ? null : (String) DalUtil.getId(client);
      String orgId = org == null ? null : (String) DalUtil.getId(org);
      String userId = user == null ? null : (String) DalUtil.getId(user);
      String roleId = role == null ? null : (String) DalUtil.getId(role);
      String windowId = window == null ? null : (String) DalUtil.getId(window);

Note: Those DalUtil.getId are already simplified to be use .getId() in tip of pi.

TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0089589)
hgbot (developer)
2016-08-31 11:12

Repository: erp/devel/pi
Changeset: 938e3500425d8128135e96ea4bf0e97ac0aea493
Author: Naroa Iriarte <naroa.iriarte <at> openbravo.com>
Date: Mon Aug 29 15:25:51 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/938e3500425d8128135e96ea4bf0e97ac0aea493 [^]

Fixed issue 33601: Preferences.getPreferenceValue's performance improved

There are two methods called Preferences.getPrferenceValue. Before, one of them was getting the Client, org... objects and passing them as arguments to the other function. The other function was getting the Id from those objects to execute all the logic. This was not a good code, because one function was making queries to the database to get the objects just to pass them as arguments of the other function and in that funtion, those objects were only used to get the Id... so it has been modifyied. Now the function which before was called in the other is the one which calls the other function. Thanks to this change it is not needed to query the database to get the client, organization, user, role and window objects.

---
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
---
(0089647)
hudsonbot (developer)
2016-09-01 12:12

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/a321ec570edd [^]
Maturity status: Test
(0089701)
alostale (manager)
2016-09-02 13:25

code reviewed + tested

- Issue History
Date Modified Username Field Change
2016-08-02 15:18 shuehner New Issue
2016-08-02 15:18 shuehner Assigned To => platform
2016-08-02 15:18 shuehner Modules => Core
2016-08-02 15:18 shuehner Triggers an Emergency Pack => No
2016-08-02 15:18 shuehner Tag Attached: Performance
2016-08-29 09:19 alostale Status new => scheduled
2016-08-29 09:19 alostale Assigned To platform => NaroaIriarte
2016-08-31 11:12 hgbot Checkin
2016-08-31 11:12 hgbot Note Added: 0089589
2016-08-31 11:12 hgbot Status scheduled => resolved
2016-08-31 11:12 hgbot Resolution open => fixed
2016-08-31 11:12 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/938e3500425d8128135e96ea4bf0e97ac0aea493 [^]
2016-09-01 12:12 hudsonbot Checkin
2016-09-01 12:12 hudsonbot Note Added: 0089647
2016-09-02 13:25 alostale Review Assigned To => alostale
2016-09-02 13:25 alostale Note Added: 0089701
2016-09-02 13:25 alostale Status resolved => closed
2016-09-02 13:25 alostale Fixed in Version => 3.0PR16Q4


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker