I am new to Adobe Experience Manager. My task is to retrieve the list of unused images from database and needs to delete that through an UI.
I have given a Select query which displays list of unused images. After google search I got some idea that is how to use QueryBuilder in adobe experience manager but I not aware of where to place this select query in the below code.
SQLQuery = "Select * from [nt:file]
where isdesplay([/home/cam/Bwits/master/images/top_images])
and NAME() LIKE 'cq5dam.thumbnail.140.100.png'";
The below code also I got it from adobe support website. For normal Jsp I know how to retrieve the list of files but now for the same in JSP with adobe (AEM) api no idea
I found some code an adobe help blog that is how to delete a node or folder from jsp.
How to delete a content node from a JSP in CQ authoring environments
Delete via AJAX Call
Node Path to Delete:
(e.g. ‘/content/testdelete/deletePage1’)
Char-set:
Command:
Force Delete:
(true/false)
<div id=”respText”></div>
function performDelete() {
var response = null;
var url = “/bin/wcmcommand”;
var pathObj= document.getElementById(‘pathAJ’);
if(pathObj)
{
var params = “path=”+encodeURIComponent(pathObj.value)+”&_charset_=utf-8&cmd=deletePage&force=false”;
var request = document.all ? new ActiveXObject(“Microsoft.XMLHTTP”) : new XMLHttpRequest();
//alert(params);
request.open(“post”, url, false);
request.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
request.send(params);
var resp= request.responseText;
document.getElementById(‘respText’).innerHTML=resp;
}
}
</script>
</HTML>
Now I have to get the list of nodes with help of SQL Query and needs to delete that nodes at a time from this JSP.
Kindly suggest me where to place the sql query for retrieving the list of images from database. Thanks for your cooperation in advance