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***
Keep up to date on this post and subscribe to comments