この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
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
解決済! 解決策の投稿を見る。
表示
返信
いいね!の合計
Please check example
https://github.com/arunpatidar02/com.aemlab.junitapp/tree/master/core/src/test
jsons are inside resources folder
表示
返信
いいね!の合計
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.
表示
返信
いいね!の合計
Hi Arun,
Resource is not null and node type is dam:Asset. still i'm not getting the Asset asset = resource.adaptTo(Asset.class);
表示
返信
いいね!の合計
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
}
}
}
}
表示
返信
いいね!の合計
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" ] } } }
表示
返信
いいね!の合計
Hi Arun,
primary type of Resource is dam:Asset but still i'm not able to adopt it as asset.
表示
返信
いいね!の合計
Hi Arun,
it works for me. Thank you so much for helping on this. I really appreciate your effort on this!!
表示
返信
いいね!の合計