-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete multiple elements #76
Changes from 5 commits
1f87c1b
90281a4
aa76042
cdee99c
1e4926f
0d44b89
283b748
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,6 +242,16 @@ public ResponseEntity<Void> deleteElement(@PathVariable("elementUuid") UUID elem | |
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@DeleteMapping(value = "/explore/elements/{directoryUuid}/delete-stashed") | ||
@Operation(summary = "Remove directories/elements") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Filter creation request delegated to filter server")}) | ||
public ResponseEntity<Void> deleteElements(@RequestParam("ids") List<UUID> elementsUuid, | ||
@RequestHeader("userId") String userId, | ||
@PathVariable String directoryUuid) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable is not used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but we must have an uuid at this position or the gateway will reject our fetch with 403 status |
||
exploreService.deleteElements(elementsUuid, userId); | ||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@GetMapping(value = "/explore/elements/metadata", produces = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "get element infos from ids given as parameters") | ||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The elements information")}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,6 +204,17 @@ public void deleteElement(UUID id, String userId) { | |
} | ||
} | ||
|
||
public void deleteElements(List<UUID> uuids, String userId) { | ||
try { | ||
uuids.forEach(id -> directoryService.deleteElement(id, userId)); | ||
directoryService.deleteDirectoryElements(uuids, userId); | ||
// FIXME dirty fix to ignore errors and still delete the elements in the directory-server. To delete when handled properly. | ||
Meklo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} catch (Exception e) { | ||
LOGGER.error(e.toString(), e); | ||
directoryService.deleteDirectoryElements(uuids, userId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this method is called in both try and catch !? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the same logic of this PR: #27. we ignore the exception and do the deletion anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider this suggestion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
} | ||
} | ||
|
||
public void updateFilter(UUID id, String filter, String userId, String name) { | ||
filterService.updateFilter(id, filter, userId); | ||
updateElementName(id, name, userId); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not the right description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it