cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BackOffice Excel Export

0 Likes
702

Hi Experts, I want to export Order with excel export. By default excel export is only defined in Product area in backoffice. I have extended this behaviour to enable the export in all the items in backoffice. The final list will be having two extra columns : Users and Currency.

Then, to Overcome this I created the translator but still this problem continues and after calling translator. It's throwing class cast exception. Can I have to override export Service.

 java.lang.ClassCastException: de.hybris.platform.core.model.c2l.CurrencyModel cannot be cast to de.hybris.platform.core.model.order.OrderModel
         at com.lulu.backoffice.excel.export.translator.LuluExcelExportTranslator.exportData(LuluExcelExportTranslator.java:1) ~[classes/:?]
         at com.hybris.backoffice.excel.exporting.DefaultExcelExportService.lambda$6(DefaultExcelExportService.java:188) ~[backofficeserver.jar:?]
         at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_172]
         at com.hybris.backoffice.excel.exporting.DefaultExcelExportService.lambda$5(DefaultExcelExportService.java:187) ~[backofficeserver.jar:?]
         at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_172]
         at com.hybris.backoffice.excel.exporting.DefaultExcelExportService.addValues(DefaultExcelExportService.java:181) ~[backofficeserver.jar:?]
         at com.hybris.backoffice.excel.exporting.DefaultExcelExportService.lambda$2(DefaultExcelExportService.java:120) ~[backofficeserver.jar:?]
         at java.util.HashMap.forEach(HashMap.java:1289) ~[?:1.8.0_172]



Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

The exception is thrown in your custom translator so it's difficult to debug. To export OrderModel you should create your own translators for CurrencyModel and UsersModel attributes of it, because they are complex types. As far I know the translator of CurrencyModel should just export value of 'isocode' and translator of UsersModel should export 'uid' as simple Strings. Moreover, you should remember about proper implementation of 'canHandle' methods to avoid class cast exceptions. You can refer to 'ExcelCatalogVersionTypeTranslator' translator and its implementation of 'canHandle', because you should implement it in similar way in this case.