Hi All,
Need your help with this one. Has anyone tried downloading a file in activiti BPM?
I'm new with activity BPM and original developer of the code created a customised button to retrieve csv files in activiti BPM as below.
public void buttonClick(ClickEvent event) {
logger.info("preparing download resource");
String csvdata = formProperty.getValue();
// the first line is the filename
filename = csvdata.substring(0, csvdata.indexOf('\r'));
csvdata = csvdata.substring(csvdata.indexOf('\r') + 2, csvdata.length());
logger.info("downloading file " + filename);
StreamResource resource = new StreamResource(new StringStreamSource(csvdata), filename, ExplorerApp.get());
resource.setMIMEType("text/plain");
ExplorerApp.get().getMainWindow().open(resource,"downloadWindow");
//downloadWindow.setVisible(true);
}
The code currently opens a new window. I'm looking for a way to download the file/open as a download dialog instead.
I tried to use FileDownloader but I think it clashed with the UI of activiti and I had the error below.
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
com/vaadin/server/FileDownloader.extend(Lcom/vaadin/ui/AbstractComponent
V @2: invokespecial
Reason:
Type 'com/vaadin/ui/AbstractComponent' (current frame, stack[1]) is not assignable to 'com/vaadin/server/AbstractClientConnector'
Current Frame:
bci: @2
flags: { }
locals: { 'com/vaadin/server/FileDownloader', 'com/vaadin/ui/AbstractComponent' }
stack: { 'com/vaadin/server/FileDownloader', 'com/vaadin/ui/AbstractComponent' }
Bytecode:
Does anyone have any idea on how to incorporate the vaadin FileDownloader with the activity BPM UI?