[MGNLDAM-604] Name of Asset is not available via DAM API Created: 22/Jul/15  Updated: 23/Aug/22

Status: Open
Project: Magnolia DAM Module
Component/s: DAM API
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Christopher Zimmermann Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
duplicate
duplicates MGNLDAM-621 Property "name" on JcrAsset is very h... 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
Date of First Response:
Team: AuthorX

 Description   

The Edit dialog in the Assets detail subapp allows editing the "name" property of an Asset, but not the name of the Node. This is saved on the node as the "name" property.
(A "Rename Asset" action in the browser subapp does allow you to edit the name of the node.)

But its not possible to retrieve the "name" property via the Asset API's.

From the Asset object:
Asset extends Item which has a getName() method.
From JcrAssetProvider we see that getName returns Node.getName().

From the AssetMap:
Niether dublincore nor magnolia Metadata does not contain the name value.
AssetMap directly contains "name" - but its just the same one the Asset object has.

Workaround: Currently a templater would have to do something like extract the JCR id from the identifier and grab the actual node directly from the workspace. ( ie cmsfn.contentById(String id, String workspace)



 Comments   
Comment by Jonathan Ayala [ 10/Jun/21 ]

As a workaround you can use asJCRNode method to get the actual node and thus, its name property.

The following sample script would iterate over assets under a given folder and would create links with asset name property:

[#assign folder = cmsfn.contentByPath("/destinations", "dam")]
<ul>
[#list cmsfn.children(folder, "mgnl:asset") as child ]
[#assign currentNode = cmsfn.asJCRNode(child)]
   <li><a href="${cmsfn.link(child)}">${currentNode.getProperty('name').getString()!}</a></li>
[/#list]
</ul> 
Generated at Mon Feb 12 05:01:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.