Skip to Content
author's profile photo Former Member
Former Member

how%20to%20create%20IMPEX%20MEDIA

I want to create ImpExMedia instance. Could you help me out the API to create the same. I found the below code but do not know of which class createImpExMedia() method is?

ImpExMedia jobMedia = createImpExMedia( "myImportScript", "UTF-8" ); jobMedia.setFieldSeparator( ';' ); jobMedia.setQuoteCharacter( "\"" );

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2015 at 10:07 AM

    Detail code is here: try { // Creating import media ImpExMedia jobMedia = createImpExMedia( "myImportScript", "UTF-8" ); jobMedia.setFieldSeparator( ';' ); jobMedia.setQuoteCharacter( "\"" ); jobMedia.setData( new DataInputStream( ImpExManager.class.getResourceAsStream("myScript.impex")), jobMedia.getCode() + "." + ImpExConstants.File.EXTENSION_CSV, ImpExConstants.File.MIME_TYPE_CSV );

    // create cronjob ImpExImportCronJob cronJob = ImpExManager.getInstance().createDefaultImpExImportCronJob(); cronJob.setEnableCodeExecution( codeexecution ); cronJob.setJobMedia( media );

    // process import cronJob.getJob().perform( cronJob, true ); } catch( UnsupportedEncodingException e ) { log.error( "Given encoding is not supported", e ); }

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.