shitanshu
shitanshu

Reputation: 222

ValidateInterceptor is not getting invoked when importing data from Impex

I have created one Interceptor to validate the data, when I am creating new object from HMC I can see the data is getting validated and throwing exception for wrong data but when I am trying to import wrong data from Imp-ex its not getting validated and Imported successfully. Legacy mode is turned off.

impex.legacy.mode=false

$canadasalesArea=salesArea(salesOrg(uid),distributionChannel(uid[default=00]),division(uid[default=00]))
$canadastoreConfig=CanadaStoreConfiguration
insert_update BooleanConfigType;configuration(name);salesDistrict(name,uid)[unique=true];soldTo(uid)[unique=true];name(code,itemtype(code))[unique=true,allownull=true];value;$canadasalesArea[unique=true,allownull=true]
;$canadastoreConfig;;11001859;enableEndecaBasedAPI:ConfigTypeName;true

Upvotes: 1

Views: 937

Answers (1)

dj_frunza
dj_frunza

Reputation: 1593

If the impex contains certain things ( e.g [forceWrite = true], [allownull=true]) , even though legacy mode is set on false, Legacy mode will be used for import and Interceptor will not intervene.

The whole logic which decides whether legacy mode will be used or not can be found in DefaultImportProcessor#getHandlerForLine which calls this.enableLegacyFlagWhenLineIsUsingJaloOnlyFeatures which calls ValueLine#isUsingJaloOnlyFeatures which can return true even though impex.legacy.mode=false

I solved a simillar issue by excluding from impex [forceWrite = true] for one of my columns in Hybris 5.5.1.0

Also make sure that the legacy mode is not checked(settings) if the import is being performed from hac(hybris administration console)

Upvotes: 2

Related Questions