I have an asset in AEM that has properties in the metadata. It looks like this:
[img]Screen Shot 2015-06-29 at 12.45.55 PM.png[/img]
I would like to display the note.title
property. However, it isn't working. I am able to get the InputStream
from the original
perfectly fine but can't seem to get the note.title
or other metadata properties.
This is what I'm doing in my Java Class that extends WCMUse
@Override public void activate() throws Exception { fileReference = getProperties().get("fileReference", String.class); if(fileReference != null){ Resource rs = getResourceResolver().getResource(fileReference); Asset asset = rs.adaptTo(Asset.class); Resource original = asset.getOriginal(); InputStream stream = original.adaptTo(InputStream.class); //Put the inputstream into a string to return BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); htmloutput = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { htmloutput.append(line); } title = asset.getMetadata("note.title").toString(); } //getter setter for title and html }
In my HTML page I have the following;
<div data-sly-use.ev="Foo" class="${ev.cssClass || ''}" title="${ev.title || ''}" > This is html: ${ev.html @ context='unsafe'}<br/> This is title: ${ev.title @ context='unsafe'}<br/> </div>
After, I select the asset I can see the html
but I don't see the title
.
Why am I not getting the metadata properties?
Views
Replies
Total Likes
The following post may help you - http://www.albinsblog.com/2015/07/Programatically-Set-Get-metadata-Asset-Adobe-CQ5-Adobe-AEM.html
Views
Replies
Total Likes