Skip to Content
0
May 17, 2017 at 09:24 AM

Agentry (Work Manager 6.4): Java Reflection issue - Changing class of a child collection attribute

81 Views

Hi,

I'm working with Vehicle Stock add-on for Work Manager 6.4. In this Add-on there are the objects StockTransportOrderHeader and StockTransportOrderItem.

I enhanced the second one (Item) by adding serial numbers collection to it. For Java, I had to create new class inheriting from the original one and change the parameter in Config Panel as usual. This is working OK for the STO Creation.

But now I tried to also do the relevant enhancements for the STO fetch. So after an enhancement, the SAP BAPI is already returning the serial numbers, and the custom Java BAPI class is adding the serial numbers to each relevant STO item. All works as expected, and when the Steplet execution reaches the end, I do have all the information as I want:

STOHeader (standard class object)->STOItem(custom class object)->SerialNumber(custom attribute array)

But then, when the Java object is mapped to the Agentry object, the custom attribute of the item is lost, because reflection is not working properly here, the "mapping" classes think that the Item attribute of the STO Header is still the standard class and they igonre my new Serial Numbers attribute.

How can I fix this? It's not possible by enhancing the standard STO Header class because Java does not allow to override an attribute class, just adds a new one with the same name and different type, and then the error is still not solved.