Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

<dc:title> being set as string [] when updating title of image assets and DAM Update Asset workflow run

Avatar

Level 1

Hi,

When i am trying to update the title of asset [from image1 to image2] in DAM then the title first time its not updated and second time it will shown as a string [] like image1, image2.

when i investigated this further i found that <dc:title> property of metadata node is first time string and if we update this property then it will convert as string[].

Could anyone please suggest how can we get the last updated title as string? Do we need to update the DAM Update Asset Workflow or modify any process in the workflow?

For e.g: image1, image2 where title[0] = image1 and title[1] = image2

Thanks in Advance!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi, there is a suggested method from adobe to handle the metadata values that sometimes can show up as string arays:

 

//Get the title as string and put it into the tmp variable String tmp = ""; Object titleObj = asset.getMetadata().get("dc:title"); if (titleObj instanceof String) { tmp = titleObj.toString(); } else if (titleObj instanceof Object[]) { Object[] titleArray = (Object[]) titleObj; tmp = (titleArray.length > 0) ? titleArray[0].toString() : ""; }

Hope that will help you :D
/Johan

View solution in original post

4 Replies

Avatar

Correct answer by
Level 7

Hi, there is a suggested method from adobe to handle the metadata values that sometimes can show up as string arays:

 

//Get the title as string and put it into the tmp variable String tmp = ""; Object titleObj = asset.getMetadata().get("dc:title"); if (titleObj instanceof String) { tmp = titleObj.toString(); } else if (titleObj instanceof Object[]) { Object[] titleArray = (Object[]) titleObj; tmp = (titleArray.length > 0) ? titleArray[0].toString() : ""; }

Hope that will help you :D
/Johan

Avatar

Level 1

Hi Johan,

Thanks for the reply.

This approach we are using currently but we need to handle it at workflow level may be at some process step. Is there any way to handle it from workflow level?

Regards,

Radhika

Avatar

Level 7

I guess one way of doing that is to handle it in kind of the same way using a custom workflow process.

Have you read this great page about the workflow customizing and extending workflows http://dev.day.com/docs/en/cq/current/workflows/wf-extending.html ? In there there are some good examples of how to write your own processes.

Good Luck

/Johan

Avatar

Level 2

Do you know when the property dc:title is stored as String and when the property dc:title is stored as String[]?? is random this behavior?