|
|
|
@ -48,11 +48,8 @@ public class ScormExtractor implements WorkflowProcess {
|
|
|
|
|
String[] params = mdm.get("PROCESS_ARGS", "string").toString().split(","); |
|
|
|
|
//String attachmentsPath = params[0];
|
|
|
|
|
String saveToLocation = params[1]; |
|
|
|
|
|
|
|
|
|
log.warn("SCORM WORKFLOW: payload path: " + wi.getContentPath()); |
|
|
|
|
String payloadPath = wi.getWorkflowData().getPayload().toString(); |
|
|
|
|
String payloadPath = wi.getContentPath().replace("/jcr:content/renditions/original",""); |
|
|
|
|
unzipFile(payloadPath, saveToLocation); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void unzipFile(String filePath, String outputFolder) { |
|
|
|
@ -61,15 +58,16 @@ public class ScormExtractor implements WorkflowProcess {
|
|
|
|
|
|
|
|
|
|
Resource zipfile = resourceResolver.getResource(filePath); |
|
|
|
|
AssetManager am = resourceResolver.adaptTo(AssetManager.class); |
|
|
|
|
log.warn("SCORM WORKFLOW: Resource - " + zipfile.getResourceType()); |
|
|
|
|
Asset a = zipfile.adaptTo(Asset.class); |
|
|
|
|
log.warn("SCORM WORKFLOW: Asset - " + a); |
|
|
|
|
InputStream is = a.getOriginal().getStream(); |
|
|
|
|
//NOTE: for some reason 'a' is returning NULL
|
|
|
|
|
//NOTE: now working in initial directory level, need to extract to new folders
|
|
|
|
|
|
|
|
|
|
try (ZipInputStream zipIn = new ZipInputStream(is)) { |
|
|
|
|
ZipEntry entry = zipIn.getNextEntry(); |
|
|
|
|
while (entry != null) { |
|
|
|
|
String zipFilePath = outputFolder + File.separator + entry.getName(); |
|
|
|
|
log.warn("SCORM WORKFLOW: zipFilePath - " + zipFilePath); |
|
|
|
|
// Extract file
|
|
|
|
|
if (!entry.isDirectory()) { |
|
|
|
|
File f = new File(entry.getName()); |
|
|
|
|