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/AbstractComponentV @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?
Hi Greg
Thanks for your reply. That doesn't seem to work though. In my case, a new window is opened instead.
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");
resource.setMIMEType("application/octet-stream");
ExplorerApp.get().getMainWindow().open(resource,"downloadWindow");
//downloadWindow.setVisible(true);
}
Regards,
Mark
Hmm, ok. Havent spent much time with the explorer app.
Probably need to play around with it. I don't suppose you can attach your project?
Hi,
I don't think I can.
Although, would you think the one you advised me with won't work in vaadin 6.8.8? That's the current version I have now.
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.