[#1580] Software Module & Distribution Set lock: implicit (#1649)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-18 23:01:55 +02:00
committed by GitHub
parent 94576bd6fe
commit 9e76223a91
34 changed files with 630 additions and 293 deletions

View File

@@ -0,0 +1,33 @@
/**
* Copyright (c) 2024 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.repository.exception;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import java.io.Serial;
/**
* Thrown if assignment quota is exceeded
*/
public class DeletedException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_DELETED;
public DeletedException(
final Class<? extends BaseEntity> type, final Object entityId) {
super(type.getSimpleName() + " with given identifier {" + entityId + "} is soft-deleted!",
THIS_ERROR);
}
}

View File

@@ -16,20 +16,18 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
import java.io.Serial;
/**
* Thrown if assignment quota is exceeded
* Thrown if there is attempt to functionally modify a locked entity
*/
public class LockedException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final String ASSIGNMENT_QUOTA_EXCEEDED_MESSAGE = "Quota exceeded: Cannot assign %s more %s entities to %s '%s'. The maximum is %s.";
private static final SpServerError THIS_ERROR = SpServerError.SP_LOCKED;
public LockedException(
final Class<? extends BaseEntity> type, final Object entityId, final String operation) {
super(
type.getSimpleName() + " with given identifier {" + entityId + "} is locked and " + operation +
super(type.getSimpleName() + " with given identifier {" + entityId + "} is locked and " + operation +
" is forbidden!",
THIS_ERROR);
}