This question was posted today at 5:18 am EST -- however - it appears to be gone. We have re-entered as it AEM ENG has an answer that will benefit the AEM community:
Hi!
I've a workflow with (basically) two steps. The first step puts the userId in the workflow MetaDataMap. The second step, retrieves the userId from workflow MetaDataMap:
• Step 1:
workflowData.getMetaDataMap().put("initiator", workItem.getWorkflow().getInitiator()); //getInitiator() returns String
• Step 2:
String initiator = (String) workItem.getWorkflowData().getMetaDataMap().get("initiator");
When the workflow initiator is 'Administrator', I've no problems (initiator is populated with "admin"). This works fine!
But when the workflow initiator is another user, I get this error message:
...
Caused by: java.lang.ClassCastException: org.apache.jackrabbit.spi.commons.value.QValueValue cannot be cast to java.lang.String
...
Any advice? Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
HI,
When retrieving values from the workflow metadata map always provide the type you wish you retrieve from the map. ie:
String initiator = workItem.getWorkflowData().getMetaDataMap().get("initiator", String.class);
Notice you also don't need the cast.
Hope this helps,
Will
Views
Replies
Total Likes
HI,
When retrieving values from the workflow metadata map always provide the type you wish you retrieve from the map. ie:
String initiator = workItem.getWorkflowData().getMetaDataMap().get("initiator", String.class);
Notice you also don't need the cast.
Hope this helps,
Will
Views
Replies
Total Likes
Will,
I don't know if i am the only one facing the issue, but i see that in participant step(after transition from a process step that does a workflowData.getMetaDataMap().put) if i have the statement before returning the groupname
workflowData.getMetaDataMap().put("principalName",principalName); // doesn't work
It just doesn't store the value infact none of values, any clue? This happens in participant step
workflowData.getMetaDataMap().get("groupPath")) - As i see the line returns the metadata under /etc/workflow/instances/2013-10-11/model_928290622341729/data/metaData
Regards,
Views
Replies
Total Likes
Hi,
Are you on CQ 5.6.0? It's possible this was an issue introduced in 5.6.0 which has been resolved in 5.6.1.
Will
Views
Replies
Total Likes
Will McGauley wrote...
Hi,
Are you on CQ 5.6.0? It's possible this was an issue introduced in 5.6.0 which has been resolved in 5.6.1.
Will
Yes Will, am working on 5.6.0, i will let you know after checking it in 5.6.1.
Views
Replies
Total Likes
Will McGauley wrote...
Hi,
Are you on CQ 5.6.0? It's possible this was an issue introduced in 5.6.0 which has been resolved in 5.6.1.
Will
Hello Will,
Now here's what I've tried on 5.6.1 and my observations are as follows.
In 5.6 i see in participant step when i set item.getMetaDataMap().put("langCode", langCode); it just does not set the value however in 5.6.1, i see it as part of workitem for the node in transition. (path :: /etc/workflow/instances/2013-10-15/model_335189573792558/history/1381866456363/workItem/metaData)
Also in 5.6.1, when i run workflowData.getMetaDataMap().put("groupPath","test") and try to replace existing groupPath (set by a prior process step) value it does not overwrite the existing value, in process step.
In case of Participant step
Now when i set workflowData.getMetaDataMap().put("groupPath","test"); in participant step , it just does not replace the old existing metadata value for "groupPath", in /etc/workflow/instances/2013-10-15/model_335189573792558/data/metaData, same occurs with process step if groupPath property already exists.
when i try to create a new variable group1Path instead of groupPath in participant step, using workflowData.getMetaDataMap().put("group1Path","test"), I don't see the property group1Path under /etc/workflow/instances/2013-10-15/model_335189573792558/data/metaData. while in process step (in my case process step follows the custom participant step) when i have workflowData.getMetaDataMap().put("group1Path","test"), it creates a property under /etc/workflow/instances/2013-10-15/model_335189573792558/data/metaData
In general my observations are in participant step i call workflowData.getMetaDataMap().put("abc","test") and it just does not work in case of creating new metadata property or replacing the value of existing property, In case of process step overwriting exisiting property value does not work, while creating new property works.
Please let me know if you happen to see the issue.
Regards,
Nicole
Views
Replies
Total Likes
Any help Will?
Views
Replies
Total Likes
Hi Nicole - Sorry I didn't see your previous reply.
I canot reproduce your inability to overwrite metadata values from a process step. I wonder if you could share more code?
Also, I think I need some additional info on how you are building your own participant step - can you let me know how you accomplished this and why you wanted to?
Much appreciated,
Will
Views
Replies
Total Likes
Views
Like
Replies