TargetManagement over RepositoryManagement (#2599)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations 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 java.util.Optional;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractMetadataUpdateCreate<T> {
|
||||
|
||||
@ValidString
|
||||
@Getter
|
||||
protected String key;
|
||||
@ValidString
|
||||
protected String value;
|
||||
|
||||
public T key(final String key) {
|
||||
this.key = AbstractBaseEntityBuilder.strip(key);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T value(final String value) {
|
||||
this.value = AbstractBaseEntityBuilder.strip(value);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getValue() {
|
||||
return Optional.ofNullable(value);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations 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 java.util.Optional;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractSoftwareModuleMetadataUpdateCreate<T> extends AbstractMetadataUpdateCreate<T> {
|
||||
|
||||
protected Boolean targetVisible;
|
||||
protected long softwareModuleId;
|
||||
|
||||
public T softwareModuleId(final long softwareModuleId) {
|
||||
this.softwareModuleId = softwareModuleId;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public long getSoftwareModuleId() {
|
||||
return softwareModuleId;
|
||||
}
|
||||
|
||||
public Optional<Boolean> isTargetVisible() {
|
||||
return Optional.ofNullable(targetVisible);
|
||||
}
|
||||
|
||||
public T targetVisible(final Boolean targetVisible) {
|
||||
this.targetVisible = targetVisible;
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations 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 java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public class AbstractTagUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
|
||||
@ValidString
|
||||
protected String colour;
|
||||
|
||||
public T colour(final String colour) {
|
||||
this.colour = AbstractBaseEntityBuilder.strip(colour);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getColour() {
|
||||
return Optional.ofNullable(colour);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 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 java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractTargetTypeUpdateCreate<T> extends AbstractTypeUpdateCreate<T> {
|
||||
|
||||
protected Collection<Long> compatible;
|
||||
|
||||
/**
|
||||
* @param compatible list of ID
|
||||
* @return generic type
|
||||
*/
|
||||
public T compatible(final Collection<Long> compatible) {
|
||||
this.compatible = compatible;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of ID
|
||||
*/
|
||||
public Optional<Collection<Long>> getCompatible() {
|
||||
return Optional.ofNullable(compatible);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations 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 java.net.URI;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.ToString;
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidTargetAddressException;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
* @param <T> update or create builder interface
|
||||
*/
|
||||
public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
|
||||
@ValidString
|
||||
protected String controllerId;
|
||||
protected String address;
|
||||
@ToString.Exclude
|
||||
@ValidString
|
||||
protected String securityToken;
|
||||
protected Long lastTargetQuery;
|
||||
protected TargetUpdateStatus status;
|
||||
protected Boolean requestAttributes;
|
||||
protected Long targetTypeId;
|
||||
protected String group;
|
||||
|
||||
protected AbstractTargetUpdateCreate(final String controllerId) {
|
||||
this.controllerId = AbstractBaseEntityBuilder.strip(controllerId);
|
||||
}
|
||||
|
||||
public T status(final TargetUpdateStatus status) {
|
||||
this.status = status;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T address(final String address) {
|
||||
// check if this is a real URI
|
||||
if (address != null) {
|
||||
try {
|
||||
URI.create(AbstractBaseEntityBuilder.strip(address));
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw new InvalidTargetAddressException(
|
||||
"The given address " + address + " violates the RFC-2396 specification", e);
|
||||
}
|
||||
}
|
||||
this.address = address;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T securityToken(final String securityToken) {
|
||||
this.securityToken = AbstractBaseEntityBuilder.strip(securityToken);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T requestAttributes(final Boolean requestAttributes) {
|
||||
this.requestAttributes = requestAttributes;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T lastTargetQuery(final Long lastTargetQuery) {
|
||||
this.lastTargetQuery = lastTargetQuery;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public TargetCreate controllerId(final String controllerId) {
|
||||
this.controllerId = AbstractBaseEntityBuilder.strip(controllerId);
|
||||
return (TargetCreate) this;
|
||||
}
|
||||
|
||||
public T targetType(final Long targetTypeId) {
|
||||
this.targetTypeId = targetTypeId;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T group(final String group) {
|
||||
this.group = group;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public String getControllerId() {
|
||||
return controllerId;
|
||||
}
|
||||
|
||||
public Optional<String> getAddress() {
|
||||
return Optional.ofNullable(address);
|
||||
}
|
||||
|
||||
public Optional<String> getSecurityToken() {
|
||||
return Optional.ofNullable(securityToken);
|
||||
}
|
||||
|
||||
public Optional<Long> getLastTargetQuery() {
|
||||
return Optional.ofNullable(lastTargetQuery);
|
||||
}
|
||||
|
||||
public Optional<TargetUpdateStatus> getStatus() {
|
||||
return Optional.ofNullable(status);
|
||||
}
|
||||
|
||||
public Long getTargetTypeId() {
|
||||
return targetTypeId;
|
||||
}
|
||||
|
||||
public Optional<String> getGroup() { return Optional.ofNullable(group); }
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 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 java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
|
||||
/**
|
||||
* 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 = AbstractBaseEntityBuilder.strip(colour);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getColour() {
|
||||
return Optional.ofNullable(colour);
|
||||
}
|
||||
|
||||
public T key(final String key) {
|
||||
this.key = AbstractBaseEntityBuilder.strip(key);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Optional<String> getKey() {
|
||||
return Optional.ofNullable(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user