Question

How to create a .zip file from attachments in the Document Revisions screen in Aurena

  • 30 March 2021
  • 5 replies
  • 185 views

Userlevel 3
Badge +7

Hi,

I want to create a .zip file from some of the attachments in Document Revisions screen using a JAVA code and opening an Outlook mail by adding that .zip file as an attachment.

Since Aurena agent only allows one file at a time, how to implement this functionality for multiple files using a JAVA code in a projection in Aurena?
Any suggestions?


Thanks

Regards,
Tharindu


This topic has been closed for comments

5 replies

Userlevel 7
Badge +30

Hi,

I think you want to zip multiple files together. That then becomes one file. So, how is it a problem that the Aurena Agent only supports downloading one file?

Or do you really want to download multiple files using the agent, and the zip option is the workaround?

If the number of files is not that large I think I have a bit ugly idea where you can do multiple calls to the agent, one after the other. You could have, say, 10 or 20 If-sections, checking some counter or variable and you have to keep a list of files to be downloaded. You need this since we have no way to do loops in the Aurena client today.

So, do you want to zip or do you want to use the agent to download many files?

/Mathias

 

Userlevel 3
Badge +7

Hi Mathias,

Actually this post is linked to this post 
 


Regards,
Tharindu

Userlevel 7
Badge +30

It felt similar, yes :) But here you mention Document Revision instead. And, you have a question to answer above, and some suggestions to comment on…

 

 

Userlevel 3
Badge +7

Hi Mathias,

As per the previous post I looked into code in the FileOperationCommands.fragment ( "agentcall DownloadAndSend" ). This is working per one file at a time.

How to do the Download and Send for multiple files?
I want to open up an Outlook mail with multiple attachments.

So yes I want to zip all the files and then open up an Outlook screen with that zip file.

Or is there any other way where we can download all the files first then opening up the Outlook mail with those attachments?

As I saw in DownloadAndSend it’s downloading to a temp folder then opening up the Outlook mail, if I got it correct :)

Thanks 

Regards,
Tharindu

Userlevel 7
Badge +30

You need to write Java code, possibly behind a function in the projection (the return type should be Stream I think, you can see how we have done it in other places). Given some input parameters (not sure what that would be here), the Java code would download each file to a temporary area on the server, then zip each file, then return an InputStream. You would need to construct a URL to get data from that function and pass that URL to the agent. It will download the zip and open an e-mail with it.