REQ-3540: 惹名scope的子节点名可以重复
This commit is contained in:
parent
1d3ae64869
commit
245968b282
@ -17,6 +17,17 @@ public interface IndexNodeScope {
|
||||
return DatabaseScope.ANONYMOUS;
|
||||
}
|
||||
|
||||
default boolean isChildrenNameDuplicatable() {
|
||||
switch (context()) {
|
||||
case FILE_TEMPLATE:
|
||||
case TEMPLATE_DATABASE:
|
||||
case FILE_DATABASE:
|
||||
return false;
|
||||
default:
|
||||
return scope().isChildrenNameDuplicatable();
|
||||
}
|
||||
}
|
||||
|
||||
default String scopeCode() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class IndexManager {
|
||||
}
|
||||
|
||||
private void maybeEnsureChildNameNotUsed(NodeCreate create, IndexNodeType nodeType, boolean withLock) {
|
||||
if (create.nodeScope().scope().isChildrenNameDuplicatable())
|
||||
if (create.nodeScope().isChildrenNameDuplicatable())
|
||||
return;
|
||||
if (withLock)
|
||||
indexSupport.lockParentAndReleaseOnCommit(create);
|
||||
@ -129,7 +129,7 @@ public class IndexManager {
|
||||
if (indexNode.getName().equals(newName))
|
||||
return;
|
||||
docLogDao.log("indexNode:rename", code, "newName", newName);
|
||||
if (!indexNode.scope().isChildrenNameDuplicatable()) {
|
||||
if (!indexNode.isChildrenNameDuplicatable()) {
|
||||
indexSupport.lockParentAndReleaseOnCommit(indexNode);
|
||||
indexSupport.ensureChildNameNotUsed(indexNode, indexNode.getNodeType(), newName);
|
||||
}
|
||||
@ -214,7 +214,7 @@ public class IndexManager {
|
||||
indexNodeDao.connectNodes(TreeUtils.collectValues(connectRoot));
|
||||
IndexNode rootNode = connectRoot.getChildren().get(0).<IndexNode> asValueNode().getValue();
|
||||
// resolve the name issue
|
||||
if (!rootNode.scope().isChildrenNameDuplicatable())
|
||||
if (!rootNode.isChildrenNameDuplicatable())
|
||||
indexSupport.incrNameIfDuplicate(rootNode);
|
||||
// get the coped root with full props
|
||||
return indexNodeDao.findOrNull(rootNode.getCode());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user