我有Impex通过HAC中的ImpexExport导出来自海布里的数据。(运行良好)我希望通过Groovy脚本执行相同的操作,通过groovy脚本读取相同的Impex,并将导出的zip文件保存在特定的位置。
Impex INSERT_UPDATE区域;等码isocode;等码;国家(等码)
发布于 2021-06-18 13:44:11
您可以使用exportService来实现您的目标:
import de.hybris.platform.servicelayer.impex.ExportConfig
import de.hybris.platform.servicelayer.impex.ExportResult
import de.hybris.platform.servicelayer.impex.ExportService
import de.hybris.platform.servicelayer.impex.impl.StreamBasedImpExResource
ExportService exportService = spring.getBean("exportService")
final ByteArrayInputStream baos = new ByteArrayInputStream("INSERT_UPDATE Region;isocode[unique=true];isocodeShort;country(isocode)".getBytes("UTF-8"));
final ExportConfig config = new ExportConfig();
config.setScript(new StreamBasedImpExResource(baos, "UTF-8"));
config.setValidationMode(ExportConfig.ValidationMode.STRICT);
config.setEncoding("UTF-8");
exportedData = exportService.exportData(config).getExportedData()这将创建一个ExportedModel媒体,以获取可以使用的该媒体的下载URL:exportedData.getDownloadURL()
https://stackoverflow.com/questions/68009240
复制相似问题