Introduce soft deleted list option for soft deletable entities (#3093)

* Introduce soft deleted list option for soft deletable entities

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fix verify build

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* fix typo in license

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Add sorting option on deleted field

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* add missing import in tests

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Rename SoftDeletedFilter to SoftDeletedMode and its values

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Introduce MgmtSoftDeletedMode on api layer

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* remove unused imports

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Integrate the enum on API layer

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Fix OpenApi spec

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* address some comments

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* Get rid of count(SoftDeletedMode) at all

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

* remove formatter for enum - stop supporting lowercase values in API

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>

---------

Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
Stanislav Trailov
2026-06-08 16:37:05 +03:00
committed by GitHub
parent 95680962cc
commit f44b6268b0
45 changed files with 1230 additions and 101 deletions

View File

@@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_ORDER;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
@@ -103,7 +105,10 @@ public interface MgmtDistributionSetRestApi {
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
String sortParam);
String sortParam,
@RequestParam(value = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE, defaultValue = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT, required = false)
@Schema(description = "Controls whether soft-deleted distribution sets are included in the result.")
MgmtSoftDeletedMode softDeletedMode);
/**
* Handles the GET request of retrieving a single DistributionSet .

View File

@@ -10,6 +10,8 @@
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TYPE_ORDER;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
@@ -91,7 +93,10 @@ public interface MgmtDistributionSetTypeRestApi {
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
String sortParam);
String sortParam,
@RequestParam(value = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE, defaultValue = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT, required = false)
@Schema(description = "Controls whether soft-deleted distribution set types are included in the result.")
MgmtSoftDeletedMode softDeletedMode);
/**
* Handles the GET request of retrieving a single DistributionSetType within.

View File

@@ -39,6 +39,17 @@ public final class MgmtRestConstants {
* The request parameter for specifying the representation mode. The value of this parameter can either be "full" or "compact".
*/
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE = "representation";
/**
* The request parameter for specifying the soft deletion listing of entities. The value of this parameter
* can be ONLY_SOFT_DELETED, EXCLUDE_SOFT_DELETED or INCLUDE_SOFT_DELETED
*/
public static final String REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE = "soft_deleted_mode";
/**
* Default value of the soft deleted mode parameter.
*/
public static final String REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT = "EXCLUDE_SOFT_DELETED";
/**
* The default representation mode.
*/

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
@@ -93,7 +95,10 @@ public interface MgmtRolloutRestApi {
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
String sortParam,
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
String representationModeParam);
String representationModeParam,
@RequestParam(value = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE, defaultValue = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT, required = false)
@Schema(description = "Controls whether soft-deleted rollouts are included in the result.")
MgmtSoftDeletedMode softDeletedMode);
/**
* Handles the GET request of retrieving a single rollout.

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import java.util.Optional;
public enum MgmtSoftDeletedMode {
ONLY_SOFT_DELETED,
EXCLUDE_SOFT_DELETED,
INCLUDE_SOFT_DELETED;
public static Optional<MgmtSoftDeletedMode> fromValue(final String value) {
if (value == null) {
return Optional.empty();
}
try {
return Optional.of(MgmtSoftDeletedMode.valueOf(value.toUpperCase()));
} catch (final IllegalArgumentException e) {
return Optional.empty();
}
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
@@ -186,7 +188,10 @@ public interface MgmtSoftwareModuleRestApi {
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
String sortParam);
String sortParam,
@RequestParam(value = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE, defaultValue = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT, required = false)
@Schema(description = "Controls whether soft-deleted software modules are included in the result.")
MgmtSoftDeletedMode softDeletedMode);
/**
* Handles the GET request of retrieving a single software module.

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.mgmt.rest.api;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
@@ -86,7 +88,10 @@ public interface MgmtSoftwareModuleTypeRestApi {
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
String sortParam);
String sortParam,
@RequestParam(value = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE, defaultValue = REQUEST_PARAMETER_LIST_SOFT_DELETED_MODE_DEFAULT, required = false)
@Schema(description = "Controls whether soft-deleted software module types are included in the result.")
MgmtSoftDeletedMode softDeletedMode);
/**
* Handles the GET request of retrieving a single software module type .