Browse Source

add more log messaging

master
Larry L 1 year ago
parent
commit
dd1e41fcf7
  1. 3
      .vscode/settings.json
  2. 9
      core/src/main/java/com/mcaps/core/workflows/ScormExtractor.java

3
.vscode/settings.json vendored

@ -1,3 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic"
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic"
}

9
core/src/main/java/com/mcaps/core/workflows/ScormExtractor.java

@ -62,8 +62,9 @@ public class ScormExtractor implements WorkflowProcess {
/* Created for manually triggered workflows */
String payloadPath = wi.getContentPath().replace("/jcr:content/renditions/original","");
String[] fileExtensions = params;
String[] fileExtensions = params; // Valid extensions com from the 'Arguments' field in the workflows 'Process' tab
unzipFile(payloadPath, fileExtensions);
cleanup(payloadPath, resourceResolver);
}
private void cleanup(String path, ResourceResolver resourceResolver) {
@ -90,10 +91,11 @@ 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);
InputStream is = a.getOriginal().getStream();
//NOTE: now working in initial directory level, need to extract to new folders
//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) {
@ -117,6 +119,7 @@ public class ScormExtractor implements WorkflowProcess {
while ((length = zipIn.read(buffer)) >= 0) {
fos.write(buffer, 0, length);
}
log.warn("SCORM WORKFLOW: saving to AEM: " + zipFilePath);
InputStream fis = new FileInputStream(f);
am.createAsset(zipFilePath, fis, null, true);
log.warn("SCORM WORKFLOW: file extracted: " + zipFilePath);
@ -128,7 +131,7 @@ public class ScormExtractor implements WorkflowProcess {
}
} catch (FileNotFoundException e) {
log.error(e.getMessage());
e.printStackTrace();
log.error(e.getStackTrace().toString());
} catch (IOException e) {
log.error(e.getMessage());
e.printStackTrace();

Loading…
Cancel
Save