[MGNLDAM-563] DublinCore metadata cannot be retrieved from an asset Created: 18/Mar/15  Updated: 19/Mar/18  Resolved: 23/Mar/17

Status: Closed
Project: Magnolia DAM Module
Component/s: None
Affects Version/s: 2.1
Fix Version/s: 2.2.3

Type: Bug Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Hieu Nguyen Duc
Resolution: Fixed Votes: 0
Labels: metadata
Remaining Estimate: 0d
Time Spent: 4d 0.5h
Original Estimate: 2d

Attachments: PNG File asset.png    
Issue Links:
Relates
relates to JCRTOOLS-40 JCR Tools does not support property h... Closed
dependency
is depended upon by MTE-4 New Product Demo - Alpha Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: Saigon 87, Saigon 88
Story Points: 5

 Description   

DamTemplatingFunctions.getAssetMap(asset) returns keys for the DC metadata but all of the values which should come from the asset are blank.

To Reproduce - try the following Freemarker in a template:

[#assign assetMap = damfn.getAssetMap(asset).metadata.dc]
[#list assetMap?keys as prop]
    ${prop} = ${assetMap[prop]}<br>
[/#list]

This is because the asset app editor stores all the dc values in properties with no dc prefix, for example
publisher
source

But in the JcrDublinCore class, the property names are named differently, they have a "dc_" prefix, for example:
dc_publisher
dc_source

This is a bug introduced in DAM 2 in the JcrDublinCore class.

In DAM 1.2.x the constants do not have the dc_ prefix.
See: https://git.magnolia-cms.com/gitweb/?p=modules/dam.git;a=blob;f=src/main/java/info/magnolia/dam/providers/jcr/JcrDublinCoreAssetMetadata.java;h=102c44367d43a9192fc27ca2d20af00586c59f16;hb=refs/heads/magnolia-module-dam-1.2.x

And tests also demonstrate that the properties should not have the prefix:
https://git.magnolia-cms.com/gitweb/?p=modules/dam.git;a=blob;f=src/test/resources/damAssetAndMetadataNodeTree.properties;h=33bacad85424e8e43550052b341f9778af8ba21d;hb=refs/heads/magnolia-module-dam-1.2.x



 Comments   
Comment by Magnolia International [ 19/Mar/15 ]

A test should verify the functionality works in the first place (and thus demonstrate how it doesn't work before your fix) - you're saying it doesn't, which is likely, but at the same time, nothing tells us it does work now.

Comment by Hieu Nguyen Duc [ 14/Mar/17 ]

I've tested this issue on https://demo.magnolia-cms.com/ and 5.5.3-SNAPSHOT and confirm that it's a bug.

Steps to reproduce:

1) Enter all properties for /travel-demo/social-icons/google-plus.png in Assets app

2) In Resources app, add the below script to /travel-demo/templates/macros/imageResponsive.ftl after [ #if asset?exists ]

[#assign assetMap = damfn.getAssetMap(asset).metadata.dc]
[#list assetMap?keys as prop]
    [#if assetMap[prop]?is_string]
        ${prop} = ${assetMap[prop]}<br>
    [/#if]
[/#list]

3) Add a "Text and Image" component to /travel/about

=> The text shown on that page:

coverage = 
identifier = jcr:52469758-3875-4ac1-b2bb-8deac5c8419b
format = image/png
description = test6
language = 
source = 
title = test3
type = 
relation = 
rights = test9
publisher = 

=> All DC properties are empty.

Comment by Hieu Nguyen Duc [ 23/Mar/17 ]

A hint for the release note.
"Fixed retrieval of DublinCore asset metadata from templating functions."

Generated at Mon Feb 12 05:01:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.