-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
- Loading branch information
1 parent
71a5319
commit 4b5a7d6
Showing
10 changed files
with
105 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...n/java/org/eclipse/hawkbit/repository/exception/TargetTypeKeyOrNameRequiredException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...y-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractTypeUpdateCreate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* 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.builder; | ||
|
||
import org.eclipse.hawkbit.repository.ValidString; | ||
import org.springframework.util.StringUtils; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Create and update builder DTO. | ||
* | ||
* @param <T> | ||
* update or create builder interface | ||
*/ | ||
public abstract class AbstractTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> { | ||
|
||
@ValidString | ||
protected String colour; | ||
@ValidString | ||
protected String key; | ||
|
||
public T colour(final String colour) { | ||
this.colour = StringUtils.trimWhitespace(colour); | ||
return (T) this; | ||
} | ||
|
||
public Optional<String> getColour() { | ||
return Optional.ofNullable(colour); | ||
} | ||
|
||
public T key(final String key) { | ||
this.key = StringUtils.trimWhitespace(key); | ||
return (T) this; | ||
} | ||
|
||
public Optional<String> getKey() { | ||
return Optional.ofNullable(key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters