Improve Security Core with lombok (#1592)

Add lombok to repository modules

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-03 02:47:28 +02:00
committed by GitHub
parent ea885d6f61
commit d2a740823d
27 changed files with 168 additions and 874 deletions

View File

@@ -15,9 +15,7 @@ import java.util.List;
/**
* Generic assignment result bean.
*
* @param <T>
* type of the assigned and unassigned {@link BaseEntity}s.
*
* @param <T> type of the assigned and unassigned {@link BaseEntity}s.
*/
public abstract class AbstractAssignmentResult<T extends BaseEntity> {
@@ -90,5 +88,4 @@ public abstract class AbstractAssignmentResult<T extends BaseEntity> {
return Collections.unmodifiableList(unassignedEntity);
}
}
}

View File

@@ -10,12 +10,14 @@
package org.eclipse.hawkbit.repository.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* Holds properties for {@link Action}
*/
@Data
public class ActionProperties implements Serializable {
private static final long serialVersionUID = 1L;
@@ -43,42 +45,6 @@ public class ActionProperties implements Serializable {
this.status = action.getStatus();
}
public void setId(final Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTenant(final String tenant) {
this.tenant = tenant;
}
public String getTenant() {
return tenant;
}
public void setMaintenanceWindowAvailable(final boolean maintenanceWindowAvailable) {
this.maintenanceWindowAvailable = maintenanceWindowAvailable;
}
public boolean isMaintenanceWindowAvailable() {
return maintenanceWindowAvailable;
}
public Action.ActionType getActionType() {
return actionType;
}
public void setActionType(final Action.ActionType actionType) {
this.actionType = actionType;
}
public Action.Status getStatus() {
return status;
}
@JsonIgnore
public boolean isWaitingConfirmation() {
return status == Action.Status.WAIT_FOR_CONFIRMATION;

View File

@@ -14,12 +14,14 @@ import java.io.InputStream;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.eclipse.hawkbit.repository.ValidString;
/**
* Use to create a new artifact.
*
*/
@Data
public class ArtifactUpload {
@NotNull
@@ -97,40 +99,4 @@ public class ArtifactUpload {
this.contentType = contentType;
this.filesize = filesize;
}
public InputStream getInputStream() {
return inputStream;
}
public long getModuleId() {
return moduleId;
}
public String getFilename() {
return filename;
}
public String getProvidedMd5Sum() {
return providedMd5Sum;
}
public String getProvidedSha1Sum() {
return providedSha1Sum;
}
public String getProvidedSha256Sum() {
return providedSha256Sum;
}
public boolean overrideExisting() {
return overrideExisting;
}
public String getContentType() {
return contentType;
}
public long getFilesize() {
return filesize;
}
}

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import org.eclipse.hawkbit.repository.Identifiable;
import java.io.Serializable;
@@ -18,6 +19,7 @@ import java.io.Serializable;
* Use to display software modules for the selected distribution.
*
*/
@Data
public class AssignedSoftwareModule implements Serializable, Identifiable<Long> {
private static final long serialVersionUID = 1L;
@@ -40,62 +42,8 @@ public class AssignedSoftwareModule implements Serializable, Identifiable<Long>
this.assigned = assigned;
}
/**
* @return {@link SoftwareModule}
*/
public SoftwareModule getSoftwareModule() {
return softwareModule;
}
/**
* @return <code>true</code> if assigned
*/
public boolean isAssigned() {
return assigned;
}
@Override
public String toString() {
return "AssignedSoftwareModule [softwareModule=" + softwareModule + ", assigned=" + assigned + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (assigned ? 1231 : 1237);
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final AssignedSoftwareModule other = (AssignedSoftwareModule) obj;
if (assigned != other.assigned) {
return false;
}
if (softwareModule == null) {
if (other.softwareModule != null) {
return false;
}
} else if (!softwareModule.equals(other.softwareModule)) {
return false;
}
return true;
}
@Override
public Long getId() {
return softwareModule.getId();
}
}

View File

@@ -13,14 +13,16 @@ import java.util.Objects;
import jakarta.validation.Valid;
import lombok.Data;
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
/**
* A custom view on assigning a {@link DistributionSet} to a {@link Target}.
*
*/
@Data
public class DeploymentRequest {
private final Long distributionSetId;
@Valid
private final TargetWithActionType targetWithActionType;
@@ -76,46 +78,7 @@ public class DeploymentRequest {
this.distributionSetId = distributionSetId;
}
public Long getDistributionSetId() {
return distributionSetId;
}
public String getControllerId() {
return targetWithActionType.getControllerId();
}
public TargetWithActionType getTargetWithActionType() {
return targetWithActionType;
}
@Override
public String toString() {
return String.format(
"DeploymentRequest [controllerId=%s, distributionSetId=%d, actionType=%s, forceTime=%d, weight=%d, maintenanceSchedule=%s, maintenanceWindowDuration=%s, maintenanceWindowTimeZone=%s, confirmationRequired=%s]",
targetWithActionType.getControllerId(), getDistributionSetId(), targetWithActionType.getActionType(),
targetWithActionType.getForceTime(), targetWithActionType.getWeight(),
targetWithActionType.getMaintenanceSchedule(), targetWithActionType.getMaintenanceWindowDuration(),
targetWithActionType.getMaintenanceWindowTimeZone(), targetWithActionType.isConfirmationRequired());
}
@Override
public int hashCode() {
return Objects.hash(distributionSetId, targetWithActionType);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DeploymentRequest other = (DeploymentRequest) obj;
return Objects.equals(distributionSetId, other.distributionSetId)
&& Objects.equals(targetWithActionType, other.targetWithActionType);
}
}

View File

@@ -123,5 +123,4 @@ public class DeploymentRequestBuilder {
return new DeploymentRequest(controllerId, distributionSetId, actionType, forceTime, weight,
maintenanceSchedule, maintenanceWindowDuration, maintenanceWindowTimeZone, confirmationRequired);
}
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.util.Collections;
import java.util.List;
@@ -18,6 +20,7 @@ import java.util.List;
* how much of the assignments had already been existed.
*
*/
@Data
public class DistributionSetAssignmentResult extends AbstractAssignmentResult<Action> {
private final DistributionSet distributionSet;
@@ -37,12 +40,4 @@ public class DistributionSetAssignmentResult extends AbstractAssignmentResult<Ac
super(alreadyAssigned, assigned, Collections.emptyList());
this.distributionSet = distributionSet;
}
/**
* @return The distribution set that has been assigned
*/
public DistributionSet getDistributionSet() {
return distributionSet;
}
}
}

View File

@@ -9,81 +9,17 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Builder;
import lombok.Data;
import java.util.Collection;
/**
* Holds distribution set filter parameters.
*/
@Data
@Builder
public final class DistributionSetFilter {
/**
* Distribution set filter builder.
*/
public static class DistributionSetFilterBuilder {
private Boolean isDeleted;
private Boolean isComplete;
private Boolean isValid;
private Long typeId;
private String searchText;
private Boolean selectDSWithNoTag;
private Collection<String> tagNames;
private String assignedTargetId;
private String installedTargetId;
/**
* Build filter.
*
* @return DistributionSetFilter
*/
public DistributionSetFilter build() {
return new DistributionSetFilter(this);
}
public DistributionSetFilterBuilder setAssignedTargetId(final String assignedTargetId) {
this.assignedTargetId = assignedTargetId;
return this;
}
public DistributionSetFilterBuilder setInstalledTargetId(final String installedTargetId) {
this.installedTargetId = installedTargetId;
return this;
}
public DistributionSetFilterBuilder setIsComplete(final Boolean isComplete) {
this.isComplete = isComplete;
return this;
}
public DistributionSetFilterBuilder setIsDeleted(final Boolean isDeleted) {
this.isDeleted = isDeleted;
return this;
}
public DistributionSetFilterBuilder setIsValid(final Boolean isValid) {
this.isValid = isValid;
return this;
}
public DistributionSetFilterBuilder setSearchText(final String searchText) {
this.searchText = searchText;
return this;
}
public DistributionSetFilterBuilder setSelectDSWithNoTag(final Boolean selectDSWithNoTag) {
this.selectDSWithNoTag = selectDSWithNoTag;
return this;
}
public DistributionSetFilterBuilder setTagNames(final Collection<String> tagNames) {
this.tagNames = tagNames;
return this;
}
public DistributionSetFilterBuilder setTypeId(final Long typeId) {
this.typeId = typeId;
return this;
}
}
private final Boolean isDeleted;
private final Boolean isComplete;
@@ -93,61 +29,5 @@ public final class DistributionSetFilter {
private final Boolean selectDSWithNoTag;
private final Collection<String> tagNames;
private final String assignedTargetId;
private final String installedTargetId;
/**
* Parametric constructor.
*
* @param builder
* DistributionSetFilterBuilder
*/
public DistributionSetFilter(final DistributionSetFilterBuilder builder) {
this.isDeleted = builder.isDeleted;
this.isComplete = builder.isComplete;
this.isValid = builder.isValid;
this.typeId = builder.typeId;
this.searchText = builder.searchText;
this.selectDSWithNoTag = builder.selectDSWithNoTag;
this.tagNames = builder.tagNames;
this.assignedTargetId = builder.assignedTargetId;
this.installedTargetId = builder.installedTargetId;
}
public String getAssignedTargetId() {
return assignedTargetId;
}
public String getInstalledTargetId() {
return installedTargetId;
}
public Boolean getIsComplete() {
return isComplete;
}
public Boolean getIsDeleted() {
return isDeleted;
}
public Boolean getIsValid() {
return isValid;
}
public String getSearchText() {
return searchText;
}
public Boolean getSelectDSWithNoTag() {
return selectDSWithNoTag;
}
public Collection<String> getTagNames() {
return tagNames;
}
public Long getTypeId() {
return typeId;
}
}
}

View File

@@ -9,13 +9,24 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.util.Collection;
/**
* Holds the information about the invalidation of a distribution set
*/
@Data
public class DistributionSetInvalidation {
/**
* Defines if and how actions should be canceled when invalidating a
* distribution set
*/
public enum CancelationType {
FORCE, SOFT, NONE
}
private Collection<Long> distributionSetIds;
private CancelationType cancelationType;
private boolean cancelRollouts;
@@ -36,37 +47,4 @@ public class DistributionSetInvalidation {
this.cancelationType = cancelationType;
this.cancelRollouts = cancelRollouts;
}
public Collection<Long> getDistributionSetIds() {
return distributionSetIds;
}
public void setDistributionSetIds(final Collection<Long> distributionSetIds) {
this.distributionSetIds = distributionSetIds;
}
public CancelationType getCancelationType() {
return cancelationType;
}
public void setCancelationType(final CancelationType cancelationType) {
this.cancelationType = cancelationType;
}
public boolean isCancelRollouts() {
return cancelRollouts;
}
public void setCancelRollouts(final boolean cancelRollouts) {
this.cancelRollouts = cancelRollouts;
}
/**
* Defines if and how actions should be canceled when invalidating a
* distribution set
*/
public enum CancelationType {
FORCE, SOFT, NONE
}
}
}

View File

@@ -9,11 +9,14 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
/**
* object that holds information about the count of affected rollouts,
* auto-assignments and actions, when a list of distribution sets gets
* invalidated
*/
@Data
public class DistributionSetInvalidationCount {
private final long rolloutsCount;
@@ -26,17 +29,4 @@ public class DistributionSetInvalidationCount {
this.autoAssignmentCount = autoAssignmentCount;
this.actionCount = actionCount;
}
public long getRolloutsCount() {
return rolloutsCount;
}
public long getAutoAssignmentCount() {
return autoAssignmentCount;
}
public long getActionCount() {
return actionCount;
}
}
}

View File

@@ -24,5 +24,4 @@ public interface DistributionSetMetadata extends MetaData {
default Long getEntityId() {
return getDistributionSet().getId();
}
}

View File

@@ -9,12 +9,15 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.util.List;
/**
* Result object for {@link DistributionSetTag} assignments.
*
*/
@Data
public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult<DistributionSet> {
private final DistributionSetTag distributionSetTag;
@@ -37,9 +40,4 @@ public class DistributionSetTagAssignmentResult extends AbstractAssignmentResult
super(alreadyAssigned, assigned, unassigned);
this.distributionSetTag = distributionSetTag;
}
public DistributionSetTag getDistributionSetTag() {
return distributionSetTag;
}
}

View File

@@ -9,6 +9,8 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.time.LocalDateTime;
/**
@@ -17,7 +19,9 @@ import java.time.LocalDateTime;
* poll time.
*
*/
@Data
public class PollStatus {
private final LocalDateTime lastPollDate;
private final LocalDateTime nextPollDate;
private final LocalDateTime overdueDate;
@@ -41,29 +45,4 @@ public class PollStatus {
public boolean isOverdue() {
return currentDate.isAfter(overdueDate);
}
/**
* @return the lastPollDate
*/
public LocalDateTime getLastPollDate() {
return lastPollDate;
}
public LocalDateTime getNextPollDate() {
return nextPollDate;
}
public LocalDateTime getOverdueDate() {
return overdueDate;
}
public LocalDateTime getCurrentDate() {
return currentDate;
}
@Override
public String toString() {
return "PollTime [lastPollDate=" + lastPollDate + ", nextPollDate=" + nextPollDate + ", overdueDate="
+ overdueDate + ", currentDate=" + currentDate + "]";
}
}
}

View File

@@ -24,5 +24,4 @@ public final class RepositoryModelConstants {
private RepositoryModelConstants() {
// Utility class.
}
}
}

View File

@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
*
*/
public class RolloutGroupConditionBuilder {
private final RolloutGroupConditions conditions = new RolloutGroupConditions();
/**

View File

@@ -9,6 +9,7 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
@@ -18,7 +19,9 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
* Object which holds all {@link RolloutGroup} conditions together which can
* easily built.
*/
@Data
public class RolloutGroupConditions {
private RolloutGroupSuccessCondition successCondition;
private String successConditionExp;
private RolloutGroupSuccessAction successAction;
@@ -27,68 +30,4 @@ public class RolloutGroupConditions {
private String errorConditionExp;
private RolloutGroupErrorAction errorAction;
private String errorActionExp;
public RolloutGroupSuccessCondition getSuccessCondition() {
return successCondition;
}
public void setSuccessCondition(final RolloutGroupSuccessCondition finishCondition) {
successCondition = finishCondition;
}
public String getSuccessConditionExp() {
return successConditionExp;
}
public void setSuccessConditionExp(final String finishConditionExp) {
successConditionExp = finishConditionExp;
}
public RolloutGroupSuccessAction getSuccessAction() {
return successAction;
}
public void setSuccessAction(final RolloutGroupSuccessAction successAction) {
this.successAction = successAction;
}
public String getSuccessActionExp() {
return successActionExp;
}
public void setSuccessActionExp(final String successActionExp) {
this.successActionExp = successActionExp;
}
public RolloutGroupErrorCondition getErrorCondition() {
return errorCondition;
}
public void setErrorCondition(final RolloutGroupErrorCondition errorCondition) {
this.errorCondition = errorCondition;
}
public String getErrorConditionExp() {
return errorConditionExp;
}
public void setErrorConditionExp(final String errorConditionExp) {
this.errorConditionExp = errorConditionExp;
}
public RolloutGroupErrorAction getErrorAction() {
return errorAction;
}
public void setErrorAction(final RolloutGroupErrorAction errorAction) {
this.errorAction = errorAction;
}
public String getErrorActionExp() {
return errorActionExp;
}
public void setErrorActionExp(final String errorActionExp) {
this.errorActionExp = errorActionExp;
}
}
}

View File

@@ -12,11 +12,13 @@ package org.eclipse.hawkbit.repository.model;
import java.util.List;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* Represents information to validate the correct distribution of targets to
* rollout groups.
*/
@Data
public class RolloutGroupsValidation {
/**
@@ -43,14 +45,6 @@ public class RolloutGroupsValidation {
this.targetsPerGroup = targetsPerGroup;
}
public long getTotalTargets() {
return totalTargets;
}
public List<Long> getTargetsPerGroup() {
return targetsPerGroup;
}
/**
* @return the count of targets that are in groups
*/
@@ -64,4 +58,4 @@ public class RolloutGroupsValidation {
public boolean isValid() {
return totalTargets == getTargetsInGroups();
}
}
}

View File

@@ -9,12 +9,15 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.util.List;
/**
* Result object for {@link TargetTag} assignments.
*
*/
@Data
public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target> {
private final TargetTag targetTag;
@@ -36,8 +39,4 @@ public class TargetTagAssignmentResult extends AbstractAssignmentResult<Target>
super(alreadyAssigned, assigned, unassigned);
this.targetTag = targetTag;
}
public TargetTag getTargetTag() {
return targetTag;
}
}

View File

@@ -9,12 +9,15 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import java.util.List;
/**
* Result object for {@link TargetType} assignments.
*
*/
@Data
public class TargetTypeAssignmentResult extends AbstractAssignmentResult<Target> {
private final TargetType targetType;
@@ -36,8 +39,4 @@ public class TargetTypeAssignmentResult extends AbstractAssignmentResult<Target>
super(alreadyAssigned, assigned, unassigned);
this.targetType = targetType;
}
public TargetType getTargetType() {
return targetType;
}
}
}

View File

@@ -9,14 +9,14 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
import org.eclipse.hawkbit.repository.Identifiable;
import org.eclipse.hawkbit.repository.model.Action.Status;
/**
*
* Target with action status.
*
*/
@Data
public class TargetWithActionStatus implements Identifiable<Long> {
private Target target;
@@ -40,32 +40,8 @@ public class TargetWithActionStatus implements Identifiable<Long> {
this.lastActionStatusCode = lastActionStatusCode;
}
public Target getTarget() {
return target;
}
public Status getStatus() {
return status;
}
public void setTarget(final Target target) {
this.target = target;
}
public void setStatus(final Status status) {
this.status = status;
}
@Override
public Long getId() {
return target.getId();
}
public Integer getLastActionStatusCode() {
return lastActionStatusCode;
}
public void setLastActionStatusCode(final Integer lastActionStatusCode) {
this.lastActionStatusCode = lastActionStatusCode;
}
}

View File

@@ -9,29 +9,28 @@
*/
package org.eclipse.hawkbit.repository.model;
import java.util.Objects;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;
import org.eclipse.hawkbit.repository.exception.InvalidMaintenanceScheduleException;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
/**
* A custom view on {@link Target} with {@link ActionType}.
*
*/
@Data
public class TargetWithActionType {
private final String controllerId;
private final ActionType actionType;
private final long forceTime;
@Min(Action.WEIGHT_MIN)
@Max(Action.WEIGHT_MAX)
@Min(Action.WEIGHT_MIN) @Max(Action.WEIGHT_MAX)
private final Integer weight;
private String maintenanceSchedule;
private String maintenanceWindowDuration;
private String maintenanceWindowTimeZone;
private final boolean confirmationRequired;
private final String maintenanceSchedule;
private final String maintenanceWindowDuration;
private final String maintenanceWindowTimeZone;
/**
* Constructor that uses {@link ActionType#FORCED}
@@ -62,11 +61,7 @@ public class TargetWithActionType {
public TargetWithActionType(
final String controllerId, final ActionType actionType, final long forceTime,
final Integer weight, final boolean confirmationRequired) {
this.controllerId = controllerId;
this.actionType = actionType != null ? actionType : ActionType.FORCED;
this.forceTime = forceTime;
this.weight = weight;
this.confirmationRequired = confirmationRequired;
this(controllerId, actionType, forceTime, weight, null, null, null, confirmationRequired);
}
/**
@@ -98,109 +93,19 @@ public class TargetWithActionType {
* @throws InvalidMaintenanceScheduleException
* if the parameters do not define a valid maintenance schedule.
*/
public TargetWithActionType(final String controllerId, final ActionType actionType, final long forceTime,
final Integer weight, final String maintenanceSchedule, final String maintenanceWindowDuration,
final String maintenanceWindowTimeZone, final boolean confirmationRequired) {
this(controllerId, actionType, forceTime, weight, confirmationRequired);
public TargetWithActionType(
final String controllerId, final ActionType actionType, final long forceTime, final Integer weight,
final String maintenanceSchedule, final String maintenanceWindowDuration, final String maintenanceWindowTimeZone,
final boolean confirmationRequired) {
this.controllerId = controllerId;
this.actionType = actionType != null ? actionType : ActionType.FORCED;
this.forceTime = actionType == ActionType.TIMEFORCED ?
forceTime : RepositoryModelConstants.NO_FORCE_TIME;
this.weight = weight;
this.confirmationRequired = confirmationRequired;
this.maintenanceSchedule = maintenanceSchedule;
this.maintenanceWindowDuration = maintenanceWindowDuration;
this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
}
public ActionType getActionType() {
if (actionType != null) {
return actionType;
}
// default value
return ActionType.FORCED;
}
public long getForceTime() {
if (actionType == ActionType.TIMEFORCED) {
return forceTime;
}
return RepositoryModelConstants.NO_FORCE_TIME;
}
public Integer getWeight() {
return weight;
}
public String getControllerId() {
return controllerId;
}
/**
* Returns the maintenance schedule for the {@link Action}.
*
* @return cron expression as {@link String}.
*/
public String getMaintenanceSchedule() {
return this.maintenanceSchedule;
}
/**
* Returns the duration of maintenance window for the {@link Action}.
*
* @return duration in HH:mm:ss format as {@link String}.
*/
public String getMaintenanceWindowDuration() {
return maintenanceWindowDuration;
}
/**
* Returns the timezone of maintenance window for the {@link Action}.
*
* @return the timezone offset from UTC in +/-hh:mm as {@link String}.
*/
public String getMaintenanceWindowTimeZone() {
return maintenanceWindowTimeZone;
}
/**
* Return if a confirmation is required for this assignment (depends on confirmation flow active)
*
* @return the flag
*/
public boolean isConfirmationRequired() {
return confirmationRequired;
}
@Override
public String toString() {
return "TargetWithActionType [controllerId=" + controllerId + ", actionType=" + getActionType() + ", forceTime="
+ getForceTime() + ", weight=" + getWeight() + ", maintenanceSchedule=" + getMaintenanceSchedule()
+ ", maintenanceWindowDuration=" + getMaintenanceWindowDuration() + ", maintenanceWindowTimeZone="
+ getMaintenanceWindowTimeZone() + ", confirmationRequired=" + isConfirmationRequired() + "]";
}
@Override
public int hashCode() {
return Objects.hash(actionType, controllerId, forceTime, weight, confirmationRequired, maintenanceSchedule,
maintenanceWindowDuration, maintenanceWindowTimeZone);
}
@SuppressWarnings("squid:S1067")
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TargetWithActionType other = (TargetWithActionType) obj;
return Objects.equals(actionType, other.actionType) && Objects.equals(controllerId, other.controllerId)
&& Objects.equals(forceTime, other.forceTime) && Objects.equals(weight, other.weight)
&& Objects.equals(confirmationRequired, other.confirmationRequired)
&& Objects.equals(maintenanceSchedule, other.maintenanceSchedule)
&& Objects.equals(maintenanceWindowDuration, other.maintenanceWindowDuration)
&& Objects.equals(maintenanceWindowTimeZone, other.maintenanceWindowTimeZone);
}
}
}

View File

@@ -9,6 +9,9 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
@@ -17,175 +20,16 @@ import java.io.Serializable;
* @param <T>
* type of the configuration value
*/
@Data
@Builder
public final class TenantConfigurationValue<T extends Serializable> implements Serializable {
private static final long serialVersionUID = 1L;
private T value;
private Long lastModifiedAt;
private String lastModifiedBy;
private Long createdAt;
private String createdBy;
private boolean global = true;
private TenantConfigurationValue() {
}
/**
* Gets the value.
*
* @return the value
*/
public T getValue() {
return value;
}
/**
* Checks if is global.
*
* @return true, if is global
*/
public boolean isGlobal() {
return global;
}
/**
* Gets the last modified at.
*
* @return the last modified at
*/
public Long getLastModifiedAt() {
return lastModifiedAt;
}
/**
* Gets the last modified by.
*
* @return the last modified by
*/
public String getLastModifiedBy() {
return lastModifiedBy;
}
/**
* Gets the created at.
*
* @return the created at
*/
public Long getCreatedAt() {
return createdAt;
}
/**
* Gets the created by.
*
* @return the created by
*/
public String getCreatedBy() {
return createdBy;
}
/**
* Builder.
*
* @param <K>
* the key type
* @return the tenant configuration value builder
*/
public static <K extends Serializable> TenantConfigurationValueBuilder<K> builder() {
return new TenantConfigurationValueBuilder<>();
}
/**
* builds the tenant configuration value including some meta data
*
* @param <T>
* type of the configuration value
*/
public static class TenantConfigurationValueBuilder<T extends Serializable> {
private final TenantConfigurationValue<T> configuration = new TenantConfigurationValue<>();
/**
* Builds the.
*
* @return the tenant configuration value
*/
public TenantConfigurationValue<T> build() {
return configuration;
}
/**
* sets the configuration value itself
*
* @param value
* the value
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> value(final T value) {
this.configuration.value = value;
return this;
}
/**
* set the is global attribute.
*
* @param global
* true when there is no tenant specific value, false
* otherwise
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> global(final boolean global) {
this.configuration.global = global;
return this;
}
/**
* Sets the last modified at attribute
*
* @param lastModifiedAt
* timestamp of last modification
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> lastModifiedAt(final Long lastModifiedAt) {
this.configuration.lastModifiedAt = lastModifiedAt;
return this;
}
/**
* sets the last modified by attribute
*
* @param lastModifiedBy
* the last modified by
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> lastModifiedBy(final String lastModifiedBy) {
this.configuration.lastModifiedBy = lastModifiedBy;
return this;
}
/**
* sets the created at attribute
*
* @param createdAt
* defined when the configuration has been created
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> createdAt(final Long createdAt) {
this.configuration.createdAt = createdAt;
return this;
}
/**
* sets the created by attribute
*
* @param createdBy
* defines by whom the configuration has been created
* @return the tenant configuration value builder
*/
public TenantConfigurationValueBuilder<T> createdBy(final String createdBy) {
this.configuration.createdBy = createdBy;
return this;
}
}
}
}

View File

@@ -9,16 +9,19 @@
*/
package org.eclipse.hawkbit.repository.model;
import lombok.Data;
/**
* Represents rollout or rollout group statuses and count of targets in each
* status.
*
*/
@Data
public class TotalTargetCountActionStatus {
private final Action.Status status;
private final Long count;
private Long id;
private final Long id;
public TotalTargetCountActionStatus(final Long id, final Action.Status status, final Long count) {
this.status = status;
@@ -27,28 +30,6 @@ public class TotalTargetCountActionStatus {
}
public TotalTargetCountActionStatus(final Action.Status status, final Long count) {
this.status = status;
this.count = count;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @return the status
*/
public Action.Status getStatus() {
return status;
}
/**
* @return the count
*/
public Long getCount() {
return count;
this(null, status, count);
}
}