3 changed files with 64 additions and 0 deletions
@ -0,0 +1,59 @@ |
|||||||
|
package com.mcaps.core.workflows; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import javax.jcr.Node; |
||||||
|
import javax.jcr.Session; |
||||||
|
|
||||||
|
import org.osgi.framework.Constants; |
||||||
|
import org.osgi.service.component.annotations.Component; |
||||||
|
import org.osgi.service.component.annotations.Reference; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
import com.adobe.granite.workflow.WorkflowException; |
||||||
|
import com.adobe.granite.workflow.WorkflowSession; |
||||||
|
import com.adobe.granite.workflow.exec.WorkItem; |
||||||
|
import com.adobe.granite.workflow.exec.WorkflowProcess; |
||||||
|
import com.adobe.granite.workflow.metadata.MetaDataMap; |
||||||
|
|
||||||
|
import com.day.cq.search.PredicateGroup; |
||||||
|
import com.day.cq.search.Query; |
||||||
|
import com.day.cq.search.QueryBuilder; |
||||||
|
import com.day.cq.search.result.Hit; |
||||||
|
import com.day.cq.search.result.SearchResult; |
||||||
|
|
||||||
|
@Component(property = { |
||||||
|
Constants.SERVICE_DESCRIPTION + "=Extracts a SCORM content package and puts it somewhere", |
||||||
|
Constants.SERVICE_VENDOR + "=Slalom LLC", |
||||||
|
"process.label" + "=Extracts a SCORM content package" |
||||||
|
}) |
||||||
|
public class ScormExtractor implements WorkflowProcess { |
||||||
|
private static final Logger log = LoggerFactory.getLogger(ScormExtractor.class); |
||||||
|
|
||||||
|
@Reference |
||||||
|
QueryBuilder queryBuilder; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2) throws WorkflowException { |
||||||
|
|
||||||
|
log.warn("The string I got was ..." + arg2.get("PROCESS_ARGS", "string").toString()); |
||||||
|
String[] params = arg2.get("PROCESS_ARGS", "string").toString().split(","); |
||||||
|
String attachmentsPath = params[0]; |
||||||
|
String saveToLocation = params[1]; |
||||||
|
log.warn("The payload path is " + arg0.getContentPath()); |
||||||
|
String payloadPath = arg0.getWorkflowData().getPayload().toString(); |
||||||
|
Map<String, String> map = new HashMap<String, String> (); |
||||||
|
map.put("path", payloadPath + "/" + attachmentsPath); |
||||||
|
//File saveLocationFolder = new File(saveToLocation);
|
||||||
|
//if (!saveLocationFolder.exists()) {
|
||||||
|
// saveLocationFolder.mkdirs();
|
||||||
|
//}
|
||||||
|
|
||||||
|
map.put("type", "nt:file"); |
||||||
|
//throw new UnsupportedOperationException("Unimplemented method 'execute'");
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
@Version("1.0") |
||||||
|
package com.mcaps.core.workflows; |
||||||
|
|
||||||
|
import org.osgi.annotation.versioning.Version; |
Loading…
Reference in new issue