Java 通过Adobe Experience Manager中的UI删除数据库中未使用的DAM图像列表
我是Adobe Experience Manager的新手。我的任务是从数据库中检索未使用图像的列表,并需要通过UI将其删除Java 通过Adobe Experience Manager中的UI删除数据库中未使用的DAM图像列表,java,jsp,aem,crx,Java,Jsp,Aem,Crx,我是Adobe Experience Manager的新手。我的任务是从数据库中检索未使用图像的列表,并需要通过UI将其删除 I found some code an adobe help blog that is how to delete a node or folder from jsp. 我给出了一个Select查询,其中显示了未使用图像的列表。在谷歌搜索之后,我对如何在adobe experience manager中使用QueryBuilder有了一些想法,但我不知道在下面的代码中
I found some code an adobe help blog that is how to delete a node or folder from jsp.
我给出了一个Select查询,其中显示了未使用图像的列表。在谷歌搜索之后,我对如何在adobe experience manager中使用QueryBuilder有了一些想法,但我不知道在下面的代码中将这个select查询放在哪里
SQLQuery = "Select * from [nt:file]
where isdesplay([/home/cam/Bwits/master/images/top_images])
and NAME() LIKE 'cq5dam.thumbnail.140.100.png'";
I found some code an adobe help blog that is how to delete a node or folder from jsp.
下面的代码也是我从adobe支持网站获得的。对于普通Jsp,我知道如何检索文件列表,但现在对于使用adobe(AEM)api的Jsp中的相同文件,我不知道
I found some code an adobe help blog that is how to delete a node or folder from jsp.
如何在CQ创作环境中从JSP中删除内容节点
I found some code an adobe help blog that is how to delete a node or folder from jsp.
通过AJAX调用删除
I found some code an adobe help blog that is how to delete a node or folder from jsp.
要删除的节点路径:
(例如,/content/testdelete/deletePage1')字符集:
命令:
强制删除: (对/错)
I found some code an adobe help blog that is how to delete a node or folder from jsp.
I found some code an adobe help blog that is how to delete a node or folder from jsp.
函数performDelete(){
var响应=null;
var url=“/bin/wcmcommand”;
var pathbj=document.getElementById('pathAJ');
if(pathbj)
{
var params=“path=”+encodeURIComponent(pathbj.value)+“&&u charset=utf-8&cmd=deletePage&force=false”;
var request=document.all?新的ActiveXObject(“Microsoft.XMLHTTP”):新的XMLHttpRequest();
//警报(参数);
打开(“post”、url、false);
setRequestHeader(“内容类型”、“应用程序/x-www-form-urlencoded”);
请求发送(params);
var resp=request.responseText;
document.getElementById('respText')。innerHTML=resp;
}
}
现在,我必须借助SQL查询获取节点列表,并且需要从这个JSP中一次删除这些节点
I found some code an adobe help blog that is how to delete a node or folder from jsp.
请告诉我从数据库检索图像列表的sql查询的位置。
提前感谢您的合作正如其他人所指出的,有几个论坛(主要是Adobe)发布了各种方法来解决这个问题。然而,本着多样性和丰富性的精神,我认为这个问题需要一个新的答案
I found some code an adobe help blog that is how to delete a node or folder from jsp.
下面的解决方案是基于JS的,但没有理由不能在任何其他语言(如Java、Ruby、bash(使用CURL)或PowerShell)中实现此逻辑。此外,这种方法不适用于从CSS和JS文件引用的DAM资产
I found some code an adobe help blog that is how to delete a node or folder from jsp.
以GooTrimxOOTB大坝库为例,考虑大部分资产在
I found some code an adobe help blog that is how to delete a node or folder from jsp.
您需要构建一个递归迭代循环,该循环以线性方式一次一级遍历DAM库。这可以使用以下逻辑完成:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
步骤1:枚举
I found some code an adobe help blog that is how to delete a node or folder from jsp.
通过以下HTTP调用获取内容的根级别文件夹结构:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
http://localhost:4502/content/dam/geometrixx.1.json
I found some code an adobe help blog that is how to delete a node or folder from jsp.
这将返回如下结果:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:mixinTypes":[
"rep:AccessControllable"
],
"jcr:createdBy":"admin",
"jcr:title":"Geometrixx",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000",
"portraits":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Portraits",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"drm":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banners":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Banners",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
}
}
{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Banners",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000",
"banner-mono.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banner-retro.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banner-web20.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
}
}
步骤2:迭代
I found some code an adobe help blog that is how to delete a node or folder from jsp.
递归地遍历此结构,直到到达项目的DAM资源。例如,您在迭代时:http://localhost:4502/content/dam/geometrixx/banners.1.json
您将得到如下结果:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:mixinTypes":[
"rep:AccessControllable"
],
"jcr:createdBy":"admin",
"jcr:title":"Geometrixx",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000",
"portraits":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Portraits",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"drm":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banners":{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Banners",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
}
}
{
"jcr:primaryType":"sling:OrderedFolder",
"jcr:createdBy":"admin",
"jcr:title":"Banners",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000",
"banner-mono.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banner-retro.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
},
"banner-web20.png":{
"jcr:primaryType":"dam:Asset",
"jcr:createdBy":"admin",
"jcr:created":"Mon Feb 27 2017 13:54:20 GMT+0000"
}
}
因此,关键逻辑是获取文件夹节点的子节点并处理所有dam:Asset
节点
I found some code an adobe help blog that is how to delete a node or folder from jsp.
步骤3:查找参考资料
I found some code an adobe help blog that is how to delete a node or folder from jsp.
一旦您点击了DAM资源,您就可以从中使用内置的引用查找器
http://localhost:4502/bin/wcm/references.json?path=
查找参考资料
I found some code an adobe help blog that is how to delete a node or folder from jsp.
例如,使用以下引用实用程序:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
http://localhost:4502/bin/wcm/references.json?path=/content/dam/geometrixx/banners/techsummit.jpg
I found some code an adobe help blog that is how to delete a node or folder from jsp.
将为您提供以下所有参考资料:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
{
"pages":[
{
"srcPath":"/content/dam/geometrixx/banners/techsummit.jpg",
"srcTitle":"Tech Summit",
"path":"/content/geometrixx/en/events/techsummit",
"title":"TechSummit",
"references":[
"/content/geometrixx/en/events/techsummit/jcr:content/image/fileReference",
"/content/geometrixx/en/events/techsummit/jcr:content/par/image/fileReference"
],
"published":false,
"isPage":"true"
}
]
}
包含空页面
数组的任何资产都是未使用的资产
I found some code an adobe help blog that is how to delete a node or folder from jsp.
步骤4:删除
I found some code an adobe help blog that is how to delete a node or folder from jsp.
删除只是节点路径上的HTTP删除请求。例如,如果要删除/content/dam/geometrixx/banners/techsummit.jpg
dam资产,只需在以下位置发送HTTP删除请求:
I found some code an adobe help blog that is how to delete a node or folder from jsp.
I found some code an adobe help blog that is how to delete a node or folder from jsp.
就这样,您的内容将被删除。看一看,这将让您了解从OSGI运行查询的想法。您检查了吗?这是一篇很好的文章,提供了不同的方法和一个方便的CURL脚本供感兴趣的人使用:
I found some code an adobe help blog that is how to delete a node or folder from jsp.