Centralizing hardcoded ID ?

Automated Testing Tools are used to assure modifications are always backward compatible and safe for production
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are moved to the same sub-forum. Language will be corrected for readability.

Centralizing hardcoded ID ?

Postby nmicoud » Tue Apr 10, 2012 4:45 pm

Hi,

A lot of Adempiere classes contain hardcoded ID (eg : AMenu with request window ID, AcctViewerData with PostingType reference, ...)
I'm wondering if it would be better to put them in only one place (a top level class or a textfile) so it would be easier to maintain.

WDYT ?

Regards,

Nicolas
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Centralizing hardcoded ID ?

Postby globalqss » Tue Apr 10, 2012 11:47 pm

Excellent idea, I like it, my choice would be a top level class containing the hardcoded IDs as constant.

In case we want to make it parameterizable, I would prefer creating SysConfig variables than a text file.

Regards,

Carlos Ruiz
globalqss
Senior
 
Posts: 599
Joined: Thu Dec 29, 2005 4:15 am
Location: Bogotá, Colombia

Re: Centralizing hardcoded ID ?

Postby nmicoud » Wed Apr 11, 2012 1:54 pm

So maybe, the first thing to do is to create a HardcodedID.java and fill it ?

Then after, we could make it parameterizable.

But i 'm not sure that Sysconfig variables are good thing for this.
Maybe we could create a 'AD_HardcodedID' table (not sure that a tablename which finish with 'ID' is a good thing) which contains mandatory columns and AD_Element_ID, AD_Table_ID, ... so that we could store a direct link.

We could have :
Name = PostingType Reference
Type = Reference
AD_Reference_ID = 125 (but we see "_Posting Type_L")

I think it is easier to maintain than just have some "'Constant_Reference_PostingType' = 125" in SysConfig.

WDYT ?

Should i create a jira ticket for this ?

Regards,

Nico
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm


Return to Quality Assurance

Who is online

Users browsing this forum: No registered users and 11 guests