- if (payload.getSource() != null) {
- Matcher sourceMatcher = urlPattern.matcher(payload.getSource());
-
- if (!sourceMatcher.matches()) {
- throw new CrudException("Invalid Target Urls", Status.BAD_REQUEST);
- }
- String sourceNodeId = sourceMatcher.group(3);
- if (!sourceNodeId.equals(edge.getSource().getId().get())) {
- throw new CrudException("Source can't be updated", Status.BAD_REQUEST);
- }
- }
-
- if (payload.getTarget() != null) {
- Matcher targetMatcher = urlPattern.matcher(payload.getTarget());
-
- if (!targetMatcher.matches()) {
- throw new CrudException("Invalid Target Urls", Status.BAD_REQUEST);
- }
- String sourceNodeId = targetMatcher.group(3);
- if (!sourceNodeId.equals(edge.getTarget().getId().get())) {
- throw new CrudException("Target can't be updated", Status.BAD_REQUEST);
- }
- }