ofbiz-framework icon indicating copy to clipboard operation
ofbiz-framework copied to clipboard

Improved: EntityUtil getProperty Methods dont use entity (OFBIZ-12815)

Open thahn27 opened this issue 1 year ago • 5 comments

The getProperty methods in EntityUtilProperties don't use entity at all. All of the getProperty methods simply lead to UtilProperties and therefore no configure during runtime is possible.

Improved: New methods have been written so the entity usage is now functional.

thahn27 avatar May 08 '23 08:05 thahn27

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar May 08 '23 08:05 sonarqubecloud[bot]

This sounds good to me.

Should we not deprecate the previous getPropertyNumber(String resource, String name, double defaultValue) until getPropertyAsBigDecimal(String resource, String name, BigDecimal defaultNumber) ?

JacquesLeRoux avatar May 08 '23 12:05 JacquesLeRoux

Hey Jacques,

I will provide another commit in which i adjust the switch statement mentioned by Gil and also deprecate the previous ones.

thahn27 avatar May 08 '23 12:05 thahn27

Hi @thahn27,

I checked the usage in Java and Groovy code of the previous methods I talked about above. Most of them are not used at all OOTB. getPropertyAsBoolean and getPropertyAsBigDecimal are both used twice in Java, getPropertyAsInteger is used 21 times in Java and 6 in Groovy.

It could be that OFBiz users are using them more. But it's really easy to replace them by UtilProperties ones or the new EntityUtilProperties ones. So maybe we could remove them all together OOTB. And replace those used by calls to the new ones you introduce. I'll start a discussion on dev ML about that.

JacquesLeRoux avatar May 09 '23 05:05 JacquesLeRoux

I send an email to dev ML 1 hour ago but it does not appear yet. I wonder why, but let's wait

JacquesLeRoux avatar May 09 '23 07:05 JacquesLeRoux