use of org.craftercms.studio.api.v1.to.DeleteDependencyConfigTO in project studio by craftercms.
the class ContentTypesConfigImpl method loadDeleteDependencies.
/**
* load delete dependencies mapping
*
* @param contentTypeConfig
* @param nodes
*/
protected void loadDeleteDependencies(ContentTypeConfigTO contentTypeConfig, List<Node> nodes) {
List<DeleteDependencyConfigTO> deleteConfigs = new ArrayList<>();
if (nodes != null) {
for (Node node : nodes) {
Node patternNode = node.selectSingleNode("pattern");
Node removeFolderNode = node.selectSingleNode("remove-empty-folder");
if (patternNode != null) {
String pattern = patternNode.getText();
String removeEmptyFolder = removeFolderNode.getText();
boolean isRemoveEmptyFolder = false;
if (removeEmptyFolder != null) {
isRemoveEmptyFolder = Boolean.valueOf(removeEmptyFolder);
}
if (StringUtils.isNotEmpty(pattern)) {
DeleteDependencyConfigTO deleteConfigTO = new DeleteDependencyConfigTO(pattern, isRemoveEmptyFolder);
deleteConfigs.add(deleteConfigTO);
}
}
}
contentTypeConfig.setDeleteDependencies(deleteConfigs);
}
}
use of org.craftercms.studio.api.v1.to.DeleteDependencyConfigTO in project studio by craftercms.
the class DependencyServiceImpl method getContentTypeFilteredDeleteDependencies.
private Set<String> getContentTypeFilteredDeleteDependencies(String site, Set<String> paths) {
Set<String> toRet = new HashSet<String>();
List<String> deps = getItemDependenciesFromDB(site, paths);
for (String dep : deps) {
ContentItemTO item = contentService.getContentItem(site, dep, 0);
List<DeleteDependencyConfigTO> deleteDependencyConfigList = servicesConfig.getDeleteDependencyPatterns(site, item.getContentType());
if (CollectionUtils.isNotEmpty(deleteDependencyConfigList)) {
for (DeleteDependencyConfigTO deleteDependencyConfig : deleteDependencyConfigList) {
if (dep.matches(deleteDependencyConfig.getPattern())) {
toRet.add(dep);
break;
}
}
}
}
return toRet;
}
use of org.craftercms.studio.api.v1.to.DeleteDependencyConfigTO in project studio by craftercms.
the class ContentServiceImpl method getDeletePatternConfig.
protected List<DeleteDependencyConfigTO> getDeletePatternConfig(String site, String relativePath, boolean isInLiveRepo) throws ServiceLayerException {
List<DeleteDependencyConfigTO> deleteAssociations = new ArrayList<DeleteDependencyConfigTO>();
ContentItemTO dependencyItem = getContentItem(site, relativePath, 0);
String contentType = dependencyItem.getContentType();
deleteAssociations = servicesConfig.getDeleteDependencyPatterns(site, contentType);
return deleteAssociations;
}
Aggregations