Skip to content

Commit

Permalink
CHORE: fix unique value validator finally
Browse files Browse the repository at this point in the history
  • Loading branch information
serialcool committed Mar 25, 2024
1 parent 311b587 commit 8052a24
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private boolean isValidValue(String value) {
LOGGER.debug("Validate for unique value {} by query [{},{},{}].", value, workspace, nodeType, propertyName);
final List<Node> foundNodes = new NodesByQuery(workspace, nodeType, propertyName).apply(value);
final String currentNodeId = NodeUtils.getIdentifier((Node) _itemContext.getSingle().orElse(null));
valid = foundNodes.stream().anyMatch(node -> !NodeUtils.getIdentifier(node).equals(currentNodeId));
valid = foundNodes.isEmpty() || foundNodes.size() == 1 && currentNodeId.equals(NodeUtils.getIdentifier(foundNodes.get(0)));
}
return valid;
}
Expand Down

0 comments on commit 8052a24

Please sign in to comment.