Creamos un proceso de ejemplo y creamos una variable tipo attachment con el nombre adjunto.
Agregamos un conector Bonita tipo Set Variable... y asignamos un nombre para el conector
En la opción nombre seleccionamos la variable tipo attachment y en la opción value seleccionamo editar expresión y copiamos el siguiente codigo
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.ow2.bonita.facade.runtime.impl.InitialAttachmentImpl;
File file = new File("doc.pdf");
long length = file.length();
byte[] bytes = new byte[(int) length];
bytes = FileUtils.readFileToByteArray(file);
return bytes
Ejecutar el proceso
No hay comentarios:
Publicar un comentario