Introduce soft deleted list option for soft deletable entities#3093
Introduce soft deleted list option for soft deletable entities#3093strailov wants to merge 12 commits into
Conversation
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
| * @return number of {@link BaseEntity}s matching the given soft-deleted filter | ||
| */ | ||
| @PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY) | ||
| long count(@NotNull SoftDeletedMode softDeletedMode); |
There was a problem hiding this comment.
If you extract soft deletable interface SoftDeletableRepositoryManagement - this count method shall go there
| */ | ||
| @PreAuthorize(SpringEvalExpressions.HAS_READ_REPOSITORY) | ||
| Page<Rollout> findByRsql(@NotNull String rsql, SoftDeletedMode softDeletedMode, @NotNull Pageable pageable); | ||
|
|
There was a problem hiding this comment.
don't we want here count with soft deleted mode?
There was a problem hiding this comment.
I even started to think - why we need count at all ? Previously Slice it was used - that's why count was invoked, but It seems everything is page now - meaning why do we need count at all since we have it into the page ?
There was a problem hiding this comment.
This probably would eliminate the need of count(SoftDeletedMode) at all.
| } | ||
|
|
||
| @Override | ||
| public long count(SoftDeletedMode softDeletedMode) { |
There was a problem hiding this comment.
currently there is softe deleted support here, see supportSoftDelete0, isNotDeleted0 that automatically resolve if there is soft deleted support or not.
So there are two options:
A) stick to this support, and implement using that mechanism, eventually AbstractJpaSoftDeletableRepostioryManagement (or this class to extend and implement SoftDeletableRepostioryManagement)
B) remove soft deletable mechanism from here and move the support entirely into AbstractJpaSoftDeletableRepostioryManagement
Anyway I think a dedicated abstract class with impl of SoftDeletableRepostioryManagement will help to minimise boilerplate code
There was a problem hiding this comment.
It's not that simple I think - DS & SM extend AbstractJpaRepositoryWithMetadataManagement but other entities don't - they lay on AbstractJpaRepositoryManagement . So it again leads to not so clean separation ...
We would have to add also AbstractJpaSoftDeletableRepositoryWithMetadataManagement for DS & SM eventually ?
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
Add
soft_deleted_modequery parameter to listing REST endpointsSummary
Introduces a
soft_deleted_modefilter parameter to all soft-deletable entity listing endpoints, allowing API consumers to query soft-deleted entities that were previously hidden from listing results.Motivation
Soft-deleted entities (Distribution Sets, Software Modules, their Types, and Rollouts) were previously only accessible by direct ID lookup. There was no way to list or search them via the REST API, making it difficult for UI and integrations to display or manage deleted resources.
Changes
New API contract:
SoftDeletedModeenum (only_soft_deleted,exclude_not_soft_deleted,include_soft_deleted) with safefromValue()parsingSoftDeletableRepositoryManagementinterface extendingRepositoryManagementwithfindAll(SoftDeletedMode, Pageable)andfindByRsql(String, SoftDeletedMode, Pageable)count(SoftDeletedMode)added toRepositoryManagementwith fallback for non-soft-deletable entitiesAffected REST endpoints:
GET /rest/v1/distributionsetsGET /rest/v1/distributionsettypesGET /rest/v1/softwaremodulesGET /rest/v1/softwaremoduletypesGET /rest/v1/rollouts(compact mode only; full mode intentionally excluded)Mutation guards:
update,lock,unlock,invalidate,assignTag,unassignTagnow reject operations on soft-deleted entities withDeletedExceptionImplementations:
JpaDistributionSetManagement— refactoredfindByRsqlto support deleted filter while preserving legacycompletefield handlingJpaSoftwareModuleManagement,JpaSoftwareModuleTypeManagement,JpaDistributionSetTypeManagement— addedfindAll/findByRsqlwith soft-delete filtering and update guardsJpaRolloutManagement— addedfindAll/findByRsqlwithSoftDeletedFilterAbstractJpaRepositoryManagementdue to that some entities are not soft-deletable by definition. So the current approach may have some duplications withfindAllorfindByRsqlimplementations but seems with more clear architecture approach and distinguish those entities.AbstractJpaRepositoryManagement→AbstractJpaRepositoryWithMetadataManagement- Would need two variants (with/without metadata) or force unrelated coupling. Not worth the complexity. Decided to override the updates for each entity which is easy to review, no risk for other entities and straightforward .