Unable to get custom metadata
Hello,
I just began working on AEM 6.0 (SP2). I simply wanted to create a new metadata for all images in the DAM and get the value of that meta through code.
I used the new metadata schema interface to add my custom field and was able to then edit the value of that new field with no problem.
My issues start when I try to get the values in my code.
First I wasn't sure which class to use between com.day.cq.dam.api.Asset and com.adobe.granite.asset.api.Asset. Of course I tried both before coming here.
When using the first (day) I can get my meta using getMetadataValue but it returns a string which is not very convenient in my case. If I use getMetadata, my custom meta is not in the map for some reason so I'm unable to get it.
When using the second (adobe) initially I had an error because my meta didn't have a namespace so I added one in the namespace editor and modified the mapping in the metadata schema. Still doesn't work because the new namespace doesn't exist in the prefix map returned by XMPMetaFactory.getSchemaRegistry().getPrefixes(). Maybe I'm missing a step to correctly register the new namespace ?
Also regarding the map from XMPMetaFactory.getSchemaRegistry().getPrefixes() it seems wrong to me because the keys contains colons (e.g key:=http://value/eg/1.0) but the XMPPathParser.parse() method says it cannot find the key in the map. If I create a custom map with key=http://value/eg/1.0 it works.
Of course I could just go though the node properties but I wanted to try to do it right before resorting to that.
Thanks for your help !