for (Folder folder : folders) {
folderAPI.delete(folder, user, respectFrontendRoles);
}
// Remove Templates
TemplateAPI templateAPI = APILocator.getTemplateAPI();
List<Template> templates = templateAPI.findTemplates(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
for (Template template : templates) {
dc.setSQL("delete from template_containers where template_id = ?");
dc.addParam(template.getIdentifier());
dc.loadResult();
dc.setSQL("select inode, identifier from htmlpage where template_id = ?");
dc.addParam(template.getIdentifier());
List<HashMap<String, Object>> htmlpages = dc.loadResults();
for (HashMap<String, Object> folderMap : htmlpages) {
String identifier = (String) folderMap.get("identifier");
HTMLPage page = htmlPageAPI.loadWorkingPageById(identifier, user, respectFrontendRoles);
htmlPageAPI.delete(page, user, respectFrontendRoles);
}
templateAPI.delete(template, user, respectFrontendRoles);
}
// Remove Containers
ContainerAPI containerAPI = APILocator.getContainerAPI();
List<Container> containers = containerAPI.findContainers(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);