Relationship between JCR and DAM - Is the DAM part of the JCR
Hi, I am uncertain as to what the relationship between the DAM and the JCR is. I had always assumed that the DAM was stored inside the JCR, but now I am uncertain.
Regards
Clive Stewart
Hi, I am uncertain as to what the relationship between the DAM and the JCR is. I had always assumed that the DAM was stored inside the JCR, but now I am uncertain.
Regards
Clive Stewart
The DAM is certainly part of the AEM JCR and the structure of the DAM is nodes in the JCR:
[img]DAM.png[/img]
Like other JCR nodes - you can use various APIs - like QueryBuilder API to search for nodes.
// create query description as hash map (simplest way, same as form post)
Map<String, String> map = new HashMap<String, String>();
//set QueryBuilder search criteria
map.put("type", "dam:Asset");
map.put("path", "/content/dam/car");
map.put("property.value", "image/png");
builder= resourceResolver.adaptTo(QueryBuilder.class);
//Invoke the Search query
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult sr= query.getResult();
You can use AssetManager to create new nodes. For example:
ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(null);
//Use AssetManager to place the file into the AEM DAM
com.day.cq.dam.api.AssetManager assetMgr = resourceResolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
String newFile = "/content/dam/travel/"+fileName ;
assetMgr.createAsset(newFile, is,"image/jpeg", true);
All content in AEM - including content in the DAM - are resources and part of the AEM JCR.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.