この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
I am trying the keep the inputstream of a file in to the map while instantialting the workflow
but the same inputstream I am not able to get from the process step - it showing null.
please help me !!
Code in Servlet under below--
InputStream isStream = new BufferedInputStream(pArr[0].getInputStream()); // this is stream object getting from the request parameter (pArr[0] is RequestParameter object)
Map<String, Object> map = new HashMap<String, Object>();
map.put("filetoUpdateStream", isStream);
ResourceResolver resourceResolver = this.resolverFactory.getAdministrativeResourceResolver(null);
WorkflowSession workflowSession = resourceResolver.adaptTo(WorkflowSession.class);
if(workflowSession !=null) {
WorkflowModel workflowModel = workflowSession.getModel("/etc/workflow/models/document_revision_tool_moderate/jcr:content/model");
WorkflowData workflowData = workflowSession.newWorkflowData("JCR_PATH", contentType);
log.debug("workflow payload = "+workflowData.getPayloadType());
Workflow workflow = workflowSession.startWorkflow(workflowModel, workflowData, map);
log.debug("workflow is started.."+workflow.getId());
}else{
log.error("workflow session is null");
}
///////////////
code in Process Step under below,
InputStream isStream = null;
MetaDataMap dataMap = workItem.getWorkflow().getMetaDataMap();
isStream = (InputStream)dataMap.get("filetoUpdateStream");
isStream value is null ..
Thanks,
Saleem.
解決済! 解決策の投稿を見る。
表示
返信
いいね!の合計
You cannot place an inputStream into a Map - which confirms what i saw in testing. This is what Will has to say:
They shouldn’t store binary content inside the workflow metadata, at least not as an inputstream. They should either store it as a byte[] or just add a real file to the repo. If the inputstream content is large they would not want to store it as a byte[]
表示
返信
いいね!の合計
Will, an AEM workflow eng member talks about how to get data in this ASK the AEM community experts. See this link. https://helpx.adobe.com/experience-manager/using/Workflows.html. The link to the session is in the table at the start of article.
表示
返信
いいね!の合計
What is your usecase ??
why do you need InputStream in a map ?
表示
返信
いいね!の合計
My use case is,
file will be uploaded and that has to be activated based on the approval through workflow
I am capturing the file content in to InputStream and putting in to Map avialable in workflowSession.startWorkflow(workflowModel, workflowData, map); method
the map values can be retrieved in the workflow process step there I am getting null value for the InputStream.
表示
返信
いいね!の合計
I am testing this as well
表示
返信
いいね!の合計
I am making progress on this use case - here is the model I am using for testing:
I have successfully passed a string value - in step 2 - we set a string:
String keyValue ="Walk" ;
item.getWorkflowData().getMetaDataMap().put("MyInputStreamKey", keyValue);
In Step 3 - we read the map and write to log:
String value = item.getWorkflowData().getMetaDataMap().get("MyInputStreamKey", java.lang.String.class);
log.info("*** In Step 3 - the Retreieved value is " + value);
The log is:
14.04.2016 08:11:50.318 *INFO* [JobHandler: /etc/workflow/instances/server0/2016-04-13/model_255570656180357:/content/restfulAEMClient] com.aem.worflow.service.CustomGetDataStep *** In Step 3 - the Retreieved value is Walk
I am askign our Eng Members if we can pass an InputStream or only primitive types work.
表示
返信
いいね!の合計
Hi Saleem,
For your usecase, follow the below steps
1. Upload the file using 'AssetManager' API. Get the link where the file would be uploaded
2. Use the path as the 'Payload' and start the workflow,
This would be enough for to initiate the workflow for the uploaded asset. The approach you are following will not work for your usecase.
Regards,
Lokesh
表示
返信
いいね!の合計
You cannot place an inputStream into a Map - which confirms what i saw in testing. This is what Will has to say:
They shouldn’t store binary content inside the workflow metadata, at least not as an inputstream. They should either store it as a byte[] or just add a real file to the repo. If the inputstream content is large they would not want to store it as a byte[]
表示
返信
いいね!の合計