Remove Rollout(Group) builders (#2603)

* Fix entityManager.merge for ds and sm

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Remove Rollout(Group) builders

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Remove EntityFactory

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-08-11 14:01:03 +03:00
committed by GitHub
parent 861483f0d6
commit 124fef189e
66 changed files with 776 additions and 1753 deletions

View File

@@ -1,75 +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.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.Getter;
import org.eclipse.hawkbit.repository.ValidString;
import org.eclipse.hawkbit.repository.model.Action.Status;
/**
* Create and update builder DTO.
*
* @param <T> update or create builder interface
*/
public abstract class AbstractActionStatusCreate<T> {
protected Status status;
protected Long occurredAt;
protected Integer code;
protected List<@ValidString String> messages;
@Getter
protected Long actionId;
public T status(final Status status) {
this.status = status;
return (T) this;
}
public T occurredAt(final long occurredAt) {
this.occurredAt = occurredAt;
return (T) this;
}
public T code(final int code) {
this.code = code;
return (T) this;
}
public T messages(final Collection<String> messages) {
if (this.messages == null) {
// create modifiable list
this.messages = messages.stream().filter(Objects::nonNull).map(String::strip).collect(Collectors.toCollection(ArrayList::new));
} else {
this.messages.addAll(messages.stream().filter(Objects::nonNull).map(String::strip).toList());
}
return (T) this;
}
public T message(final String message) {
if (message != null) {
if (this.messages == null) {
this.messages = new ArrayList<>();
}
this.messages.add(message.strip());
}
return (T) this;
}
public Optional<Long> getOccurredAt() {
return Optional.ofNullable(occurredAt);
}
}

View File

@@ -1,26 +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 org.eclipse.hawkbit.repository.Identifiable;
public abstract class AbstractBaseEntityBuilder implements Identifiable<Long> {
protected Long id;
@Override
public Long getId() {
return id;
}
static String strip(final String value) {
return value == null ? null : value.strip();
}
}

View File

@@ -1,40 +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;
public abstract class AbstractNamedEntityBuilder<T> extends AbstractBaseEntityBuilder {
@ValidString
protected String name;
@ValidString
protected String description;
public T name(final String name) {
this.name = AbstractBaseEntityBuilder.strip(name);
return (T) this;
}
public T description(final String description) {
this.description = AbstractBaseEntityBuilder.strip(description);
return (T) this;
}
public Optional<String> getName() {
return Optional.ofNullable(name);
}
public Optional<String> getDescription() {
return Optional.ofNullable(description);
}
}

View File

@@ -1,47 +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 org.eclipse.hawkbit.repository.ValidString;
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
/**
* Create builder DTO.
*
* @param <T> update or create builder interface
*/
public abstract class AbstractRolloutGroupCreate<T> extends AbstractNamedEntityBuilder<T> {
@ValidString
protected String targetFilterQuery;
protected Float targetPercentage;
protected RolloutGroupConditions conditions;
protected boolean confirmationRequired;
public T targetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = AbstractBaseEntityBuilder.strip(targetFilterQuery);
return (T) this;
}
public T targetPercentage(final Float targetPercentage) {
this.targetPercentage = targetPercentage;
return (T) this;
}
public T conditions(final RolloutGroupConditions conditions) {
this.conditions = conditions;
return (T) this;
}
public T confirmationRequired(final boolean confirmationRequired) {
this.confirmationRequired = confirmationRequired;
return (T) this;
}
}

View File

@@ -1,20 +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;
/**
* Update implementation.
*/
public class GenericRolloutUpdate extends AbstractNamedEntityBuilder<RolloutUpdate> implements RolloutUpdate {
public GenericRolloutUpdate(final Long id) {
super.id = id;
}
}