SORMAS-Project
SORMAS-Project copied to clipboard
Automatic deletion for S2S share info, origin and requests [2]
Feature Description
Big picture is permanent deletion of core entities as listed in epic https://github.com/hzi-braunschweig/SORMAS-Project/issues/7736. The deletion of the individual entities currently only removes the references from S2S share info, origin and requests, but does not delete those.
Proposed Change
Similar to what we are doing for persons (#7857), we need to identify all S2S info data that is no longer referenced and thus can be deleted.
SormasToSormasShareRequest
- [x] Add an executePermanentDeletion method to the SormasToSormasShareRequestService. It should query all share requests of origin infos that are no longer referenced by a Case, Contact, Event, EventParticipant, Sample or Immunization and call the deletePermanet method for those. Make sure to unit test this.
- [x] Add this call to the end of the executePermanentDeletion method in the CoreEntityDeletionService
- [x] SormasToSormasOriginInfo should not do orphanRemoval for related cases, etc.
SormasToSormasShareInfo
Deletion of SormasToSormasShareInfo is already taken care of by the individual entity permanent deletion issues.
- [x] Add an executePermanentDeletion method to the SormasToSormasShareInfoService. Delete all ShareRequestInfo that are no longer referenced by a SormasToSormasShareInfo. Alternatively this could go into ShareRequestInfoService
- [x] Add this call to the end of the executePermanentDeletion method in the CoreEntityDeletionService
General
- [x] Add null check to AbstractSormasToSormasInterface.getDataForShareRequest which may receive a request with a uuid that no longer exists in the system and needs to handle this.
- [x] Check the other methods that are directly called by the Sormas2SormasResource for this
Acceptance Criteria
Implementation Details
Additional Information
@leventegal-she For the permanent deletion of cases you brought up that we can delete the SormasToSormasShareInfo right away. Do you think this also goes for other entities listed above? Does it make sense the delete them when deleting the individual core entity (e.g. case) or should we delete the unreferences ones in bulk?
@MartinWahnschaffe
The share request is the main entry for the user, we show the request and users should accept or reject it so I consider it to be a higher order object than origin info.
SormasToSormasOriginInfo is part of SormasToSormasShareRequest and it also used to link share requests with core entities so instead of SormasToSormasOriginInfo I would permanent delete SormasToSormasShareRequest that are no longer referenced by any entity through origin info. That will cascade delete the origin info.
There is the same kind of relation between SormasToSormasShareInfo and ShareRequestInfo so empty share request infos needs to be deleted separately.
Thanks. I have updated the issue accordingly.
I am reopening the ticket due to the fact that pending share requests (that have not yet been accepted) get deleted when the deletion job runs.
Verified ticket in peer to peer testing session on the local S2S machine of @JonasCir using the SORMAS version from the development branch - 1.76.0-SNAPSHOT(e37915d907dbb6fd18a243ce6d056635ea2f8cd2).