REQ-3540: misc

This commit is contained in:
yanglin 2025-03-21 18:07:33 +08:00
parent a13a4bb45a
commit d075ff8443
3 changed files with 15 additions and 27 deletions

View File

@ -8,26 +8,6 @@ public interface IndexNodeParentScope {
IndexNodeScope nodeScope();
default boolean isChildrenNameDuplicatable() {
switch (nodeScope().context()) {
case FILE_TEMPLATE:
case TEMPLATE_DATABASE:
return false;
default:
return nodeScope().scope().getChildNameDuplicatable();
}
}
default boolean isLimitChildrenCount() {
switch (nodeScope().context()) {
case FILE_TEMPLATE:
case TEMPLATE_DATABASE:
return true;
default:
return nodeScope().scope().getLimitChildrenCount();
}
}
default String parentCode() {
return IndexNodeScope.TREE_ROOT_NODE_CODE;
}

View File

@ -102,15 +102,23 @@ public class IndexSupport {
}
boolean isChildrenNameDuplicatable(IndexNodeParentScope parentScope) {
if (StringUtils.isNotBlank(parentScope.parentCode()))
return indexNodeDao.getOrThrow(parentScope.parentCode()).isChildrenNameDuplicatable();
return parentScope.isChildrenNameDuplicatable();
switch (parentScope.nodeScope().context()) {
case FILE_TEMPLATE:
case TEMPLATE_DATABASE:
return false;
default:
return parentScope.nodeScope().scope().getChildNameDuplicatable();
}
}
boolean isLimitChildrenCount(IndexNodeParentScope parentScope) {
if (StringUtils.isNotBlank(parentScope.parentCode()))
return indexNodeDao.getOrThrow(parentScope.parentCode()).isLimitChildrenCount();
return parentScope.isLimitChildrenCount();
switch (parentScope.nodeScope().context()) {
case FILE_TEMPLATE:
case TEMPLATE_DATABASE:
return true;
default:
return parentScope.nodeScope().scope().getLimitChildrenCount();
}
}
List<IndexNode> collectValidSubtreeAsValueRoot(IndexNode srcNode) {