[#1509] Sync Target type with SW and DS types (Mgmt Layer) (#1513)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2023-12-13 11:48:51 +02:00
committed by GitHub
parent 71a5319019
commit 4b5a7d6e7d
10 changed files with 105 additions and 82 deletions

View File

@@ -13,6 +13,7 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TargetType;
import org.eclipse.hawkbit.repository.model.Type;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@@ -42,12 +43,19 @@ public interface TargetTypeCreate {
*/
TargetTypeCreate description(@Size(max = NamedEntity.DESCRIPTION_MAX_SIZE) String description);
/**
* @param key
* for {@link TargetType#getName()}
* @return updated builder instance
*/
TargetTypeCreate key(@Size(min = 1, max = Type.KEY_MAX_SIZE) @NotEmpty String key);
/**
* @param colour
* for {@link TargetType#getColour()}
* @return updated builder instance
*/
TargetTypeCreate colour(@Size(max = TargetType.COLOUR_MAX_SIZE) String colour);
TargetTypeCreate colour(@Size(max = Type.COLOUR_MAX_SIZE) String colour);
/**
* @param compatible

View File

@@ -0,0 +1,33 @@
/**
* Copyright (c) 2023 Bosch.IO GmbH and others
*
* 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 java.io.Serial;
/**
* Thrown if tried creation of type with no key nor name.
*/
public class TargetTypeKeyOrNameRequiredException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
private static final SpServerError THIS_ERROR = SpServerError.SP_TARGET_TYPE_KEY_OR_NAME_REQUIRED;
/**
* Default constructor.
*/
public TargetTypeKeyOrNameRequiredException(final String message) {
super(message, THIS_ERROR);
}
}