Skip to Content
1
Nov 26, 2020 at 10:09 AM

Type Casting in Impex Export

369 Views

Hi All,

Is it possible to do type casting when exporting through impex export?

for example I have CustomProductModel that extends OOTB ProductModel, in that CustomProductModel I have myAttribute field.

From it's variantProductModel, can I get myAttribute field? If I want to get CustomProductModel's code from variantProductModel we could write an impex like this since code is also part of OOTB ProductModel :

INSERT_UPDATE variantProduct;code[unique=true];baseProduct(code);

writing

INSERT_UPDATE variantProduct;code[unique=true];baseProduct(myAttribute) 
won't work because baseProduct of variantProductModel is registered as OOTB ProductModel, which doesn't have myAttribute field.

In java we could get myAttribute by casting baseProduct to CustomProductModel :

String myAttribute = ((CustomProductModel) variantProductModel.getBaseProduct()).getMyAttribute();

So, is it possible to cast type of baseProduct in impex so it could read myAttribute?