Proposal: Common interface for PO and GridTab

48 views
Skip to first unread message

reua...@gmail.com

unread,
Sep 9, 2021, 5:43:49 AM9/9/21
to iDempiere
Hello Community,

I often find myself duplicating the business logic from a callout when it is also used in a Generate or Create Lines process. 
I believe the implementation effort could be drastically reduced if both PO and GridTab implemented a common interface that just included some basic value setters and getters.
This would allow to implement much of the business logic just once and then use it from both a callout and a process.

WDYT?

Heng Sin Low

unread,
Sep 9, 2021, 9:51:15 AM9/9/21
to idem...@googlegroups.com
Yeah, a common interface should be a nice one to have.

As it is, the common approach to share code is to use the GridTabWrapper.create(...) method.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/3a780b0f-01e5-4421-9753-dfda6e2b9b33n%40googlegroups.com.

reua...@gmail.com

unread,
Sep 9, 2021, 1:48:02 PM9/9/21
to iDempiere
Thanks Hengsin for the encouraging comment.

I have started to play around with the idea and it looks very promising. 
It's too bad that corresponding PO and GridTab functions use different method names. 
e.g. getValue vs. get_Value, getTableName vs. get_TableName etc.
I solved that by adding wrapper methods to the GridTab class. 
This adds some amount of bloat still I think the benefits outweigh that by far.

Thanks for pointing me to  the  GridTabWrapper.create(...) method. That's nifty indeed.
I don't think the proposed common interface could replace that mechanism since the interface only provides the least common denominator while the GridTabWrapper produces a full fledged table model class instance from a GridTab object. 

I'll post a pull request when I'm done refactoring a couple of my callouts and the thing has taken some shape.

Andreas
Reply all
Reply to author
Forward
0 new messages