Question

3
Replies
459
Views
KathyD79 Member since 2019 11 posts
Booz Allen Hamilton
Posted: 11 months ago
Last activity: 10 months 3 weeks ago

Unzip a Zip File Attachment

I have a requirement to have the user attach a zip file to a case, unzip the file, and continue processing the unzipped files. I have created a Java function in Pega to unzip a file. It has 2 parameters, destDir (destination directory to store the unzip files, and zipFile. First I had zipFile as a String representing the path to the zip file, but I could not figure out how to get the file path from the attachment. We are using Alfresco for out CMIS document management. Then I tried passing the .pyAttachStream of the attachment file, which is a String. In my Java function, I then tried to create a Java File or FileOutputStream from this String. I keep getting an Exception of "File or Directory does not exist". I don't know if I am using a wrong directory path or if something else is wrong. I have attached my Java function, the Activity that calls it, and the error message.

I also have to read the unzipped files back in to another activity for further processing.

Another other approaches? I was hoping that .pyAttachStream would give me a java.io.FileInputStream or something that I could just pass to the Java function.

***Moderator Edit-Vidyaranjan: Updated Platform Capability***

Data Integration Java and Activities Case Management
Share this page LinkedIn