I am using Bonita Studio - Community Edition version 5.8 and have been trying to use the Bonita Connector - "Get document".
These are the steps that I have made:
1. I set the DocumentUUID that is required (stored in a database)
2. I set the Destination Variable to a global variable named "myDocument" which is an attachment data type
I have been getting the error:
"Caused by: org.ow2.bonita.facade.exception.HookInvocationException: Bonita Error: bsi_HEI_3
Exception caught while executing Hook: org.bonitasoft.connectors.bonita.GetDocument because Unexpected Exception arrived in Bonita: Only an array of bytes or an AttachmentInstance can be used to set an Attachment using setVariable method"
Here is a snippet from one of my process.
Variable fichierDestinationExport is a file created with Jasperreport.
documentExport is the document created from this file and associated with a field of type attachment in the form.
In this form, user click on a PDF button.
Then, a PDF file is created and converted in a document (the snippet).
The form is refreshed with a link associated with this document as the user can download it.
Hope this helps.
Fred
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.io.File;
import java.io.InputStream;
File file = new File(fichierDestinationExport);
FileInputStream fileStream = new FileInputStream(file);
byte[] fileContent = new byte[(int)file.length()];
fileStream.read(fileContent);
fileStream.close();
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.