Getting metadata doesn't work for a custom property | Community
Skip to main content
Level 2
October 16, 2015
Solved

Getting metadata doesn't work for a custom property

  • October 16, 2015
  • 3 replies
  • 2019 views

I'm trying to get the metadata for an asset in the DAM. However, it seems that the metadata comes back as empty for properties that don't have "dc:" in front of them. 

For example:

Resource rs = getResourceResolver().getResource(fileReference); Asset asset = rs.adaptTo(Asset.class); //this works title = asset.getMetadataValue("dc:title").toString(); //this does not work. I have ensured that mine.title is a property and has string value assigned to it. customTitle = asset.getMetadataValue("mine.title").toString(): //this does not work either customTitle = asset.getMetadata("mine.title").toString():

Is there a way to get the value from a custom metadata property?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by prajesh

You cannot store properties with other prefixes like "mine" on the metadata node.  You may want to recheck your DAM node structure and check whether your custom properties like "mine:title" are on some other node like jcr:content.

The metadata node is specifically used to store the metadata extracted from the binary assets. There are set of metadata standards which AEM implements. Here for example in "dc:title" the "dc" means "Dublin Core" which is a metadata standard. There are other metadata standards too like XMP and Exif which AEM implements. Therefore the metadata node allows only those predefined prefixes. 

Also, if you want to set any of your application related custom properties then I would advise you NOT to store it on the metadata node because any changes to the metadata of an asset are written back to the original binary by CQ-metadata writeback workflow. 

For more information on metadata, please check the following documentation link : https://docs.adobe.com/docs/en/aem/6-1/administer/content/assets/metadata.html

3 replies

prajesh
prajeshAccepted solution
Level 2
October 16, 2015

You cannot store properties with other prefixes like "mine" on the metadata node.  You may want to recheck your DAM node structure and check whether your custom properties like "mine:title" are on some other node like jcr:content.

The metadata node is specifically used to store the metadata extracted from the binary assets. There are set of metadata standards which AEM implements. Here for example in "dc:title" the "dc" means "Dublin Core" which is a metadata standard. There are other metadata standards too like XMP and Exif which AEM implements. Therefore the metadata node allows only those predefined prefixes. 

Also, if you want to set any of your application related custom properties then I would advise you NOT to store it on the metadata node because any changes to the metadata of an asset are written back to the original binary by CQ-metadata writeback workflow. 

For more information on metadata, please check the following documentation link : https://docs.adobe.com/docs/en/aem/6-1/administer/content/assets/metadata.html

Level 2
October 16, 2015
Adobe Employee
September 28, 2016

You need to register your namespace in AEM in order for metadata to sync from the metadata node to the XMP record in the asset binary.

http://blogs.adobe.com/contentmanagement/tag/namespace/

Once you register the namespace, then you can add metadata with your registered prefix onto the metadata node. You can also build form fields in a metadata schema page that can read and write data to metadata, using the prefix:property nomenclature.