on 11-25-2016 12:27 PM
Hi all,
in the Help provided by Hybris there is a code where you can export using API
ExportConfiguration config = new ExportConfiguration( impexscript, ImpExManager.getExportOnlyMode() );
I do know that impexscript is an ImpExMedia but how to create it..
Can any one help to write the statement with which this impexscript is created..
Best
Hi,
InputStream stream =new FileInputStream("abc.impex"); // read your impex
ImpexMediaModel mediaModel = new StreamBasedImpExResource(stream, "UTF-8").getMedia();
ImpexMedia media=modelservice.getSource(mediaModel );
Hope this is what you are looking for.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have used the following code to Export items and its finished success but its giving a NullPointerException at setTargetFile method, can you help .. @Override public PerformResult perform(final CronJobModel cronJob) { FileInputStream stream = null;
try
{
stream = new FileInputStream("C:/export.impex");
int content;
while ((content = stream.read()) != -1)
{
// convert to char and display it
System.out.println((char) content);
}
}
catch (final FileNotFoundException e2)
{
// YTODO Auto-generated catch block
e2.getMessage();
} // read your impex
catch (final IOException e)
{
// YTODO Auto-generated catch block
e.printStackTrace();
}
try
{
final ImpExMediaModel mediaModel = new StreamBasedImpExResource(stream, "UTF-8").getMedia();
final ImpExMedia media = modelService.getSource(mediaModel);
final ExportConfiguration config = new ExportConfiguration(media, ImpExManager.getExportOnlyMode());
final Exporter exporter = new Exporter(config);
exporter.setTargetFile("C:/result.csv", true);
exporter.exportItems("Buch", true);
}
catch (final Exception e1)
{ // YTODO Auto-generated catch block System.out.println("Exception is here::::::::" + stream);
System.out.println("heeeeeeeeeeeeeeeeeHere man::::::::");
e1.printStackTrace();
}
return new PerformResult(CronJobResult.SUCCESS, CronJobStatus.FINISHED);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.