Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
claudio_marzorati
Contributor
Contributor

UPSERT ContentVersion in BULK

Hello Talend community,

i'm trying to upload bulk content version but it happens something strange with my tSalesforceOutputBulkExec. As you can see from my screen, no item were processed from both side "success" or "reject/error".

But there is 1 row in input, how is it possible?

0695b00000nRF4wAAG.png

Below the javarow,

output_row.Parent_ID = input_row.Parent_ID; // Related object's Id

output_row.Name = input_row.Name; // The document's name such as xxxxx.docx or yyyyyy.xlsx or anything else 

output_row.ContentType = input_row.ContentType; // Object's name such as Account, Task and so on

output_row.Body = null; // The place to put the conversion result

// In this case, I iterate over the input directory using a tFileList

File file = new File((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"));

FileInputStream documentInFile = null;

try {      

  // Read file

  documentInFile = new FileInputStream(file);

byte[] documentData = new byte[(int)file.length()];

documentInFile.read(documentData);

output_row.Body = new String(Base64.encodeBase64(documentData));

  System.out.println("+++ File converted "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH"));

} catch (FileNotFoundException e) {

  output_row.conversionCode = "FILE_NOT_FOUND";

  output_row.conversionMessage = "File not found "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH");

  System.out.println("*** File not found "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")+"\n"+e);

} catch (IOException ioe) {

  output_row.conversionCode = "CONVERSION_ERROR";

  output_row.conversionMessage = "Error converting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH");

  System.out.println("*** Error converting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")+"\n"+ioe);

} finally {

  try {

    // Close and delete file after it has been successfully converted

    if (documentInFile != null) {

     documentInFile.close();

      

     //file.delete();

    }

  } catch (IOException e) {

     output_row.conversionCode = "DELETE_ERROR";

     output_row.conversionMessage = "Error deleting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH");

     System.out.println("*** Error deleting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")+"\n"+e);

     e.printStackTrace();

  }

}

Thanks,

Claudio

Labels (2)
0 Replies