Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
Nível 1
Nível 2
Faça login na Comunidade
Faça logon para exibir todas as medalhas
Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.
context.load().json("/my/folder/co/aem/core/workflow/dam/xyz.json", "/content/dam/test/abc.zip");
Resource resource = context.resourceResolver().getResource("/content/dam/test/abc.zip");
Asset asset = resource.adaptTo(Asset.class); //here asset is null
Solucionado! Ir para a Solução.
Visualizações
respostas
Total de curtidas
Please check example
https://github.com/arunpatidar02/com.aemlab.junitapp/tree/master/core/src/test
jsons are inside resources folder
Visualizações
respostas
Total de curtidas
Hi Arun,
Thanks for your reply. i didnot get any reference.
i'm trying to adapt "resource.adaptTo(Asset.class)" resource as Asset but i'm getting null not sure why this is happening.
Here i'm getting resource.
Visualizações
respostas
Total de curtidas
Visualizações
respostas
Total de curtidas
Hi Arun,
Resource is not null and node type is dam:Asset. still i'm not getting the Asset asset = resource.adaptTo(Asset.class);
Visualizações
respostas
Total de curtidas
Visualizações
respostas
Total de curtidas
Hi Arun, here its
{
"jcr:primaryType":"sling:Folder",
"jcr:createdBy":"admin",
"jcr:created":"Tue Nov 15 2022 12:24:07 GMT+0530",
"abc.zip":{
"jcr:primaryType":"dam:Asset",
"jcr:mixinTypes":[
"mix:referenceable"
],
"jcr:createdBy":"admin",
"jcr:created":"Tue Nov 15 2022 13:17:18 GMT+0530",
"jcr:uuid":"5335343gfdsfgafdaafdf",
"jcr:content":{
"jcr:primaryType":"dam:AssetContent",
"dam:assetState":"processing",
"renditions":{
"jcr:primaryType":"nt:folder",
"jcr:createdBy":"admin",
"jcr:created":"Tue Nov 15 2022 13:17:18 GMT+0530",
"original":{
"jcr:primaryType":"nt:file",
"jcr:createdBy":"admin",
"jcr:created":"Tue Nov 15 2022 13:17:18 GMT+0530",
"jcr:content":{
"jcr:primaryType":"oak:Resource",
"jcr:lastModifiedBy":"admin",
"jcr:mimeType":"application/zip",
"jcr:lastModified":"Tue Nov 15 2022 13:17:18 GMT+0530",
":jcr:data":13721771
}
}
},
"related":{
"jcr:primaryType":"nt:unstructured"
},
"metadata":{
"jcr:primaryType":"nt:unstructured",
"jcr:mixinTypes":[
"cq:Taggable"
]
}
}
},
"jcr:content":{
"jcr:primaryType":"nt:unstructured",
"jcr:title":"testing",
"dam:noThumbnail":true,
"sourcing":"false",
"folderThumbnail":{
"jcr:primaryType":"nt:file",
"jcr:createdBy":"abc-service",
"jcr:created":"Tue Nov 15 2022 13:01:03 GMT+0530",
"jcr:content":{
"jcr:primaryType":"nt:unstructured",
"dam:folderThumbnailPaths":[
],
"height":140,
"bgcolor":-1,
"width":240,
"jcr:lastModified":"Tue Nov 15 2022 13:17:10 GMT+0530",
"jcr:data":631
}
}
}
}
Visualizações
respostas
Total de curtidas
Your json is incorrect?
Try to check the primary type of Resource, it should be dam:Asset ?
you can remove the first nesting e.g. your json should look like below
{ "jcr:primaryType": "dam:Asset", "jcr:mixinTypes": [ "mix:referenceable" ], "jcr:content": { "jcr:primaryType": "dam:AssetContent", "dam:assetState": "processing", "renditions": { "jcr:primaryType": "nt:folder", "original": { "jcr:primaryType": "nt:file", "jcr:content": { "jcr:primaryType": "oak:Resource", "jcr:mimeType": "application/zip", ":jcr:data": 13721771 } } }, "related": { "jcr:primaryType": "nt:unstructured" }, "metadata": { "jcr:primaryType": "nt:unstructured", "jcr:mixinTypes": [ "cq:Taggable" ] } } }
Visualizações
respostas
Total de curtidas
Hi Arun,
primary type of Resource is dam:Asset but still i'm not able to adopt it as asset.
Visualizações
respostas
Total de curtidas
Hi Arun,
it works for me. Thank you so much for helping on this. I really appreciate your effort on this!!
Visualizações
respostas
Total de curtidas
Visualizações
Curtida
respostas