[#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,7 +13,6 @@ import java.util.Collection;
import java.util.Optional;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
@@ -22,11 +21,7 @@ import org.springframework.util.StringUtils;
* @param <T>
* update or create builder interface
*/
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String colour;
@ValidString
protected String key;
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
protected Collection<Long> mandatory;
protected Collection<Long> optional;
@@ -48,23 +43,4 @@ public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends Abstrac
public Optional<Collection<Long>> getOptional() {
return Optional.ofNullable(optional);
}
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);
}
}

View File

@@ -9,22 +9,13 @@
*/
package org.eclipse.hawkbit.repository.builder;
import java.util.Optional;
import org.eclipse.hawkbit.repository.ValidString;
import org.springframework.util.StringUtils;
/**
* Create and update builder DTO.
*
* @param <T>
* update or create builder interface
*/
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String colour;
@ValidString
protected String key;
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
protected int maxAssignments = 1;
@@ -36,23 +27,4 @@ public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends Abstract
public int getMaxAssignments() {
return maxAssignments;
}
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);
}
}

View File

@@ -21,9 +21,7 @@ import java.util.Optional;
* @param <T>
* update or create builder interface
*/
public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String colour;
public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
protected Collection<Long> compatible;
@@ -43,22 +41,4 @@ public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractNamedEnt
public Optional<Collection<Long>> getCompatible() {
return Optional.ofNullable(compatible);
}
/**
* @param colour
* Colour value
* @return generic type
*/
public T colour(final String colour) {
this.colour = StringUtils.trimWhitespace(colour);
return (T) this;
}
/**
* @return colour
*/
public Optional<String> getColour() {
return Optional.ofNullable(colour);
}
}

View File

@@ -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);
}
}