Hi,
Can anyone please help me with the how to write servlet for deleting the completed project in aem 6.5
Thanks & Regards,
Madhu
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @madhuyadawad,
This is possible. You can use ProjectManager, Project, ProjectFilter java api, for this action:
Sample code, you could put inside servlet:
import com.adobe.cq.projects.api.ProjectManager;
import com.adobe.cq.projects.api.Project;
import java.util.Iterator;
ProjectManager projectManager = resourceResolver.adaptTo(ProjectManager.class);
Iterator<Project> iterator = projectManager.getProjects(null, 0, 100);
while(iterator.hasNext()) {
Project project = iterator.next();
if (project != null && !project.isActive()) {
projectManager.deleteProject(project);
resourceResolver.commit();
}
}
Hi @madhuyadawad,
This is possible. You can use ProjectManager, Project, ProjectFilter java api, for this action:
Sample code, you could put inside servlet:
import com.adobe.cq.projects.api.ProjectManager;
import com.adobe.cq.projects.api.Project;
import java.util.Iterator;
ProjectManager projectManager = resourceResolver.adaptTo(ProjectManager.class);
Iterator<Project> iterator = projectManager.getProjects(null, 0, 100);
while(iterator.hasNext()) {
Project project = iterator.next();
if (project != null && !project.isActive()) {
projectManager.deleteProject(project);
resourceResolver.commit();
}
}
Thank You
Views
Likes
Replies