mirror of
https://github.com/DependencyTrack/dependency-track.git
synced 2025-10-19 16:03:19 +00:00
Commit search index after project deletion
Fixes #1605 Signed-off-by: nscuro <nscuro@protonmail.com>
This commit is contained in:
parent
768b2443ef
commit
47d81ed574
3 changed files with 8 additions and 6 deletions
|
@ -579,16 +579,18 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
|
|||
/**
|
||||
* Deletes a Project and all objects dependant on the project.
|
||||
* @param project the Project to delete
|
||||
* @param commitIndex specifies if the search index should be committed (an expensive operation)
|
||||
*/
|
||||
public void recursivelyDelete(Project project) {
|
||||
public void recursivelyDelete(final Project project, final boolean commitIndex) {
|
||||
if (project.getChildren() != null) {
|
||||
for (final Project child: project.getChildren()) {
|
||||
recursivelyDelete(child);
|
||||
recursivelyDelete(child, false);
|
||||
}
|
||||
}
|
||||
pm.getFetchPlan().setDetachmentOptions(FetchPlan.DETACH_LOAD_FIELDS);
|
||||
final Project result = pm.getObjectById(Project.class, project.getId());
|
||||
Event.dispatch(new IndexEvent(IndexEvent.Action.DELETE, pm.detachCopy(result)));
|
||||
commitSearchIndex(commitIndex, Project.class);
|
||||
|
||||
deleteAnalysisTrail(project);
|
||||
deleteViolationAnalysisTrail(project);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue