Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user