[#1580] Software Module & Distribution Set lock: apply (#1648)

forbid software modules / artifacts modification for locked distribution
sets / software modules respectively

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-15 15:56:01 +02:00
committed by GitHub
parent 5c38af2772
commit 94576bd6fe
7 changed files with 135 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import java.util.Collection;
import java.util.stream.Collectors;
@@ -23,7 +24,9 @@ import org.eclipse.hawkbit.repository.model.MetaData;
*/
public class EntityNotFoundException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_NOT_EXISTS;
/**

View File

@@ -0,0 +1,36 @@
/**
* 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 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 +
" is forbidden!",
THIS_ERROR);
}
}