Re-applied base entity based equals hashcode policy

This commit is contained in:
Kai Zimmermann
2016-03-28 09:59:24 +02:00
parent a2a0a5697e
commit 9849205bea
38 changed files with 289 additions and 888 deletions

View File

@@ -127,55 +127,30 @@ public class Action extends TenantAwareBaseEntity implements Comparable<Action>
return status == Status.CANCELING || status == Status.CANCELED;
}
/**
* @param active
* the active to set
*/
public void setActive(final boolean active) {
this.active = active;
}
/**
* @return the status
*/
public Status getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(final Status status) {
this.status = status;
}
/**
* @return the downloadProgressPercent
*/
public int getDownloadProgressPercent() {
return downloadProgressPercent;
}
/**
* @param downloadProgressPercent
* the downloadProgressPercent to set
*/
public void setDownloadProgressPercent(final int downloadProgressPercent) {
this.downloadProgressPercent = downloadProgressPercent;
}
/**
* @return the active
*/
public boolean isActive() {
return active;
}
/**
* @param actionType
* the actionType to set
*/
public void setActionType(final ActionType actionType) {
this.actionType = actionType;
}
@@ -187,69 +162,38 @@ public class Action extends TenantAwareBaseEntity implements Comparable<Action>
return actionType;
}
/**
* @return the actionStatus
*/
public List<ActionStatus> getActionStatus() {
return actionStatus;
}
/**
* @param target
* the target to set
*/
public void setTarget(final Target target) {
this.target = target;
}
/**
* @return the target
*/
public Target getTarget() {
return target;
}
/**
* @return the forcedTime
*/
public long getForcedTime() {
return forcedTime;
}
/**
* @param forcedTime
* the forcedTime to set
*/
public void setForcedTime(final long forcedTime) {
this.forcedTime = forcedTime;
}
/**
* @return the rolloutGroup
*/
public RolloutGroup getRolloutGroup() {
return rolloutGroup;
}
/**
* @param rolloutGroup
* the rolloutGroup to set
*/
public void setRolloutGroup(final RolloutGroup rolloutGroup) {
this.rolloutGroup = rolloutGroup;
}
/**
* @return the rollout
*/
public Rollout getRollout() {
return rollout;
}
/**
* @param rollout
* the rollout to set
*/
public void setRollout(final Rollout rollout) {
this.rollout = rollout;
}
@@ -311,42 +255,25 @@ public class Action extends TenantAwareBaseEntity implements Comparable<Action>
}
@Override
public int hashCode() { // NOSONAR - as this is generated
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());
result = prime * result + (active ? 1231 : 1237);
result = prime * result + (int) (forcedTime ^ (forcedTime >>> 32));
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + (isHitAutoForceTime(System.currentTimeMillis()) ? 1231 : 1237);
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Action other = (Action) obj;
if (actionType != other.actionType) {
return false;
}
if (active != other.active) {
return false;
}
if (forcedTime != other.forcedTime) {
return false;
}
if (status != other.status) {
if (!(obj instanceof Action)) {
return false;
}
return true;
}
@@ -409,9 +336,6 @@ public class Action extends TenantAwareBaseEntity implements Comparable<Action>
/**
* The action type for this action relation.
*
*
*
*
*/
public enum ActionType {
FORCED, SOFT, TIMEFORCED;

View File

@@ -60,7 +60,7 @@ public class ActionStatus extends TenantAwareBaseEntity {
/**
* Creates a new {@link ActionStatus} object.
*
*
* @param action
* the action for this action status
* @param status
@@ -76,7 +76,7 @@ public class ActionStatus extends TenantAwareBaseEntity {
/**
* Creates a new {@link ActionStatus} object.
*
*
* @param action
* the action for this action status
* @param status
@@ -144,10 +144,7 @@ public class ActionStatus extends TenantAwareBaseEntity {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result + ((messages == null) ? 0 : messages.hashCode());
result = prime * result + ((occurredAt == null) ? 0 : occurredAt.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@@ -159,34 +156,10 @@ public class ActionStatus extends TenantAwareBaseEntity {
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ActionStatus other = (ActionStatus) obj;
if (action == null) {
if (other.action != null) {
return false;
}
} else if (!action.equals(other.action)) {
return false;
}
if (messages == null) {
if (other.messages != null) {
return false;
}
} else if (!messages.equals(other.messages)) {
return false;
}
if (occurredAt == null) {
if (other.occurredAt != null) {
return false;
}
} else if (!occurredAt.equals(other.occurredAt)) {
return false;
}
if (status != other.status) {
if (!(obj instanceof ActionStatus)) {
return false;
}
return true;
}

View File

@@ -15,9 +15,6 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
* Custom JPA Model for querying {@link Action} include the count of the
* action's {@link ActionStatus}.
*
*
*
*
*/
public class ActionWithStatusCount {
private final Long actionStatusCount;
@@ -37,7 +34,7 @@ public class ActionWithStatusCount {
/**
* JPA constructor, the parameter are the result set columns of the custom
* query.
*
*
* @param actionId
* the ID of the action
* @param actionType
@@ -70,9 +67,9 @@ public class ActionWithStatusCount {
final String rolloutName) {
this.actionId = actionId;
this.actionType = actionType;
this.actionActive = active;
this.actionForceTime = forcedTime;
this.actionStatus = status;
actionActive = active;
actionForceTime = forcedTime;
actionStatus = status;
this.actionCreatedAt = actionCreatedAt;
this.actionLastModifiedAt = actionLastModifiedAt;
this.dsId = dsId;
@@ -81,12 +78,12 @@ public class ActionWithStatusCount {
this.actionStatusCount = actionStatusCount;
this.rolloutName = rolloutName;
this.action = new Action();
this.action.setActionType(actionType);
this.action.setActive(actionActive);
this.action.setForcedTime(actionForceTime);
this.action.setStatus(actionStatus);
this.action.setId(actionId);
action = new Action();
action.setActionType(actionType);
action.setActive(actionActive);
action.setForcedTime(actionForceTime);
action.setStatus(actionStatus);
action.setId(actionId);
}
/**

View File

@@ -58,9 +58,7 @@ public abstract class Artifact extends TenantAwareBaseEntity {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((md5Hash == null) ? 0 : md5Hash.hashCode());
result = prime * result + ((sha1Hash == null) ? 0 : sha1Hash.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@@ -72,31 +70,10 @@ public abstract class Artifact extends TenantAwareBaseEntity {
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Artifact other = (Artifact) obj;
if (md5Hash == null) {
if (other.md5Hash != null) {
return false;
}
} else if (!md5Hash.equals(other.md5Hash)) {
return false;
}
if (sha1Hash == null) {
if (other.sha1Hash != null) {
return false;
}
} else if (!sha1Hash.equals(other.sha1Hash)) {
return false;
}
if (size == null) {
if (other.size != null) {
return false;
}
} else if (!size.equals(other.size)) {
if (!(obj instanceof Artifact)) {
return false;
}
return true;
}
}

View File

@@ -9,10 +9,7 @@
package org.eclipse.hawkbit.repository.model;
/**
* Generic assigment result bean.
*
*
*
* Generic assignment result bean.
*
*/
public class AssignmentResult {
@@ -36,23 +33,14 @@ public class AssignmentResult {
total = assigned + alreadyAssigned;
}
/**
* @return the assignedTargets
*/
public int getAssigned() {
return assigned;
}
/**
* @return the total
*/
public int getTotal() {
return total;
}
/**
* @return the alreadyAssigned
*/
public int getAlreadyAssigned() {
return alreadyAssigned;
}

View File

@@ -13,9 +13,6 @@ import java.io.Serializable;
/**
* Use to display software modules for the selected distribution.
*
*
*
*
*/
public class CustomSoftwareModule implements Serializable {
@@ -39,16 +36,10 @@ public class CustomSoftwareModule implements Serializable {
this.assigned = assigned;
}
/**
* @return the softwareModule
*/
public SoftwareModule getSoftwareModule() {
return softwareModule;
}
/**
* @return the assigned
*/
public boolean isAssigned() {
return assigned;
}
@@ -63,7 +54,7 @@ public class CustomSoftwareModule implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + (assigned ? 1231 : 1237);
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode());
return result;
}
@@ -75,7 +66,7 @@ public class CustomSoftwareModule implements Serializable {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof CustomSoftwareModule)) {
return false;
}
final CustomSoftwareModule other = (CustomSoftwareModule) obj;

View File

@@ -160,11 +160,6 @@ public class DistributionSet extends NamedVersionedEntity {
return actions;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
@@ -173,11 +168,6 @@ public class DistributionSet extends NamedVersionedEntity {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@@ -234,11 +224,6 @@ public class DistributionSet extends NamedVersionedEntity {
return installedAtTargets;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "DistributionSet [getName()=" + getName() + ", getOptLockRevision()=" + getOptLockRevision()

View File

@@ -39,9 +39,6 @@ public class DistributionSetIdName implements Serializable {
this.version = version;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
@@ -50,40 +47,27 @@ public class DistributionSetIdName implements Serializable {
return version;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (id == null ? 0 : id.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof DistributionSetIdName)) {
return false;
}
final DistributionSetIdName other = (DistributionSetIdName) obj;
@@ -97,11 +81,6 @@ public class DistributionSetIdName implements Serializable {
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
// only return the ID because it's used in vaadin for setting the item

View File

@@ -33,10 +33,6 @@ import javax.persistence.Table;
@Entity
@Table(name = "sp_ds_metadata")
public class DistributionSetMetadata implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@@ -49,11 +45,11 @@ public class DistributionSetMetadata implements Serializable {
@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ds_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_metadata_ds") )
@JoinColumn(name = "ds_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_metadata_ds"))
private DistributionSet distributionSet;
public DistributionSetMetadata() {
// Default constructor for JPA.
}
/**
@@ -73,49 +69,74 @@ public class DistributionSetMetadata implements Serializable {
return new DsMetadataCompositeKey(distributionSet, key);
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @param key
* the key to set
*/
public void setKey(final String key) {
this.key = key;
}
/**
* @param distributionSet
* the distributionSet to set
*/
public void setDistributionSet(final DistributionSet distributionSet) {
this.distributionSet = distributionSet;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value
* the value to set
*/
public void setValue(final String value) {
this.value = value;
}
/**
* @return the distributionSet
*/
public DistributionSet getDistributionSet() {
return distributionSet;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (distributionSet == null ? 0 : distributionSet.hashCode());
result = prime * result + (key == null ? 0 : key.hashCode());
result = prime * result + (value == null ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DistributionSetMetadata)) {
return false;
}
final DistributionSetMetadata other = (DistributionSetMetadata) obj;
if (distributionSet == null) {
if (other.distributionSet != null) {
return false;
}
} else if (!distributionSet.equals(other.distributionSet)) {
return false;
}
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
if (value == null) {
if (other.value != null) {
return false;
}
} else if (!value.equals(other.value)) {
return false;
}
return true;
}
}

View File

@@ -21,16 +21,11 @@ import javax.persistence.UniqueConstraint;
* A {@link DistributionSetTag} is used to describe DistributionSet attributes
* and use them also for filtering the DistributionSet list.
*
*
*
*
*
*
*/
@Entity
@Table(name = "sp_distributionset_tag", indexes = {
@Index(name = "sp_idx_distribution_set_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"name", "tenant" }, name = "uk_ds_tag") )
"name", "tenant" }, name = "uk_ds_tag"))
public class DistributionSetTag extends Tag {
private static final long serialVersionUID = 1L;
@@ -69,11 +64,6 @@ public class DistributionSetTag extends Tag {
return assignedToDistributionSet;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
@@ -82,11 +72,6 @@ public class DistributionSetTag extends Tag {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {

View File

@@ -84,7 +84,7 @@ public class DistributionSetType extends NamedEntity {
public DistributionSetType(final String key, final String name, final String description, final String color) {
super(name, description);
this.key = key;
this.colour = color;
colour = color;
}
/**
@@ -289,10 +289,7 @@ public class DistributionSetType extends NamedEntity {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((colour == null) ? 0 : colour.hashCode());
result = prime * result + (deleted ? 1231 : 1237);
result = prime * result + ((elements == null) ? 0 : elements.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@@ -307,31 +304,7 @@ public class DistributionSetType extends NamedEntity {
if (!(obj instanceof DistributionSetType)) {
return false;
}
final DistributionSetType other = (DistributionSetType) obj;
if (colour == null) {
if (other.colour != null) {
return false;
}
} else if (!colour.equals(other.colour)) {
return false;
}
if (deleted != other.deleted) {
return false;
}
if (elements == null) {
if (other.elements != null) {
return false;
}
} else if (!elements.equals(other.elements)) {
return false;
}
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
return true;
}

View File

@@ -65,7 +65,7 @@ public class DistributionSetTypeElement implements Serializable {
public DistributionSetTypeElement(final DistributionSetType dsType, final SoftwareModuleType smType,
final boolean mandatory) {
super();
this.key = new DistributionSetTypeElementCompositeKey(dsType, smType);
key = new DistributionSetTypeElementCompositeKey(dsType, smType);
this.dsType = dsType;
this.smType = smType;
this.mandatory = mandatory;
@@ -100,37 +100,7 @@ public class DistributionSetTypeElement implements Serializable {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + (mandatory ? 1231 : 1237);
return result;
public String toString() {
return "DistributionSetTypeElement [mandatory=" + mandatory + ", dsType=" + dsType + ", smType=" + smType + "]";
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DistributionSetTypeElement)) {
return false;
}
final DistributionSetTypeElement other = (DistributionSetTypeElement) obj;
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
if (mandatory != other.mandatory) {
return false;
}
return true;
}
}

View File

@@ -61,43 +61,4 @@ public class DistributionSetTypeElementCompositeKey implements Serializable {
public void setSmType(final Long smType) {
this.smType = smType;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((dsType == null) ? 0 : dsType.hashCode());
result = prime * result + ((smType == null) ? 0 : smType.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DistributionSetTypeElementCompositeKey)) {
return false;
}
final DistributionSetTypeElementCompositeKey other = (DistributionSetTypeElementCompositeKey) obj;
if (dsType == null) {
if (other.dsType != null) {
return false;
}
} else if (!dsType.equals(other.dsType)) {
return false;
}
if (smType == null) {
if (other.smType != null) {
return false;
}
} else if (!smType.equals(other.smType)) {
return false;
}
return true;
}
}

View File

@@ -13,24 +13,19 @@ import java.io.Serializable;
/**
* The DistributionSet Metadata composite key which contains the meta data key
* and the ID of the DistributionSet itself.
*
*
*
*
*/
public final class DsMetadataCompositeKey implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String key;
private Long distributionSet;
/**
*
*/
public DsMetadataCompositeKey() {
// Default constructor for JPA.
}
/**
@@ -44,55 +39,31 @@ public final class DsMetadataCompositeKey implements Serializable {
this.key = key;
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @param key
* the key to set
*/
public void setKey(final String key) {
this.key = key;
}
/**
* @return the distributionSet
*/
public Long getDistributionSet() {
return distributionSet;
}
/**
* @param distributionSet
* the distributionSet to set
*/
public void setDistributionSet(final Long distributionSet) {
this.distributionSet = distributionSet;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((distributionSet == null) ? 0 : distributionSet.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + (distributionSet == null ? 0 : distributionSet.hashCode());
result = prime * result + (key == null ? 0 : key.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code

View File

@@ -36,7 +36,7 @@ public class ExternalArtifact extends Artifact {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "provider", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_art_to_ext_provider") )
@JoinColumn(name = "provider", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_art_to_ext_provider"))
private ExternalArtifactProvider externalArtifactProvider;
@Column(name = "url_suffix", length = 512)
@@ -44,7 +44,7 @@ public class ExternalArtifact extends Artifact {
// CascadeType.PERSIST as we register ourself at the BSM
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST })
@JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_external_assigned_sm") )
@JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_external_assigned_sm"))
private SoftwareModule softwareModule;
/**
@@ -127,11 +127,6 @@ public class ExternalArtifact extends Artifact {
this.urlSuffix = urlSuffix;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
final int prime = 31;
@@ -140,11 +135,6 @@ public class ExternalArtifact extends Artifact {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {

View File

@@ -15,11 +15,8 @@ import javax.persistence.Table;
/**
* External repositories for artifact storage. The SP server provides URLs for
* the targets to download rom these external ressources but does not access
* thenm itself.
*
*
*
* the targets to download from these external resources but does not access
* them itself.
*
*/
@Table(name = "sp_external_provider", indexes = {
@@ -60,41 +57,22 @@ public class ExternalArtifactProvider extends NamedEntity {
basePath = "";
}
/**
* @return the basePath
*/
public String getBasePath() {
return basePath;
}
/**
* @return the defaultSuffix
*/
public String getDefaultSuffix() {
return defaultSuffix;
}
/**
* @param basePath
* the basePath to set
*/
public void setBasePath(final String basePath) {
this.basePath = basePath;
}
/**
* @param defaultSuffix
* the defaultSuffix to set
*/
public void setDefaultSuffix(final String defaultSuffix) {
this.defaultSuffix = defaultSuffix;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
final int prime = 31;
@@ -103,11 +81,6 @@ public class ExternalArtifactProvider extends NamedEntity {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {

View File

@@ -46,7 +46,7 @@ public class LocalArtifact extends Artifact {
private String filename;
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST })
@JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_assigned_sm") )
@JoinColumn(name = "software_module", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_assigned_sm"))
private SoftwareModule softwareModule;
/**
@@ -73,11 +73,6 @@ public class LocalArtifact extends Artifact {
this.filename = filename;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
final int prime = 31;
@@ -86,11 +81,6 @@ public class LocalArtifact extends Artifact {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {
@@ -106,33 +96,20 @@ public class LocalArtifact extends Artifact {
return true;
}
/**
* @return the softwareModule
*/
@Override
public SoftwareModule getSoftwareModule() {
return softwareModule;
}
/**
* @param softwareModule
* the softwareModule to set
*/
public final void setSoftwareModule(final SoftwareModule softwareModule) {
this.softwareModule = softwareModule;
this.softwareModule.addArtifact(this);
}
/**
* @return the gridFsFileName
*/
public String getGridFsFileName() {
return gridFsFileName;
}
/**
* @return the filename
*/
public String getFilename() {
return filename;
}

View File

@@ -34,7 +34,7 @@ public abstract class NamedEntity extends TenantAwareBaseEntity {
/**
* Parameterized constructor.
*
*
* @param name
* of the {@link NamedEntity}
* @param description
@@ -60,43 +60,4 @@ public abstract class NamedEntity extends TenantAwareBaseEntity {
public void setName(final String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final NamedEntity other = (NamedEntity) obj;
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
return true;
}
}

View File

@@ -14,11 +14,6 @@ import javax.persistence.MappedSuperclass;
/**
* Extension for {@link NamedEntity} that are versioned.
*
*
*
*
*
*
*/
@MappedSuperclass
public abstract class NamedVersionedEntity extends NamedEntity {
@@ -29,7 +24,7 @@ public abstract class NamedVersionedEntity extends NamedEntity {
/**
* parameterized constructor.
*
*
* @param name
* of the entity
* @param version
@@ -53,4 +48,27 @@ public abstract class NamedVersionedEntity extends NamedEntity {
this.version = version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof NamedVersionedEntity)) {
return false;
}
return true;
}
}

View File

@@ -36,20 +36,20 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
@Entity
@Table(name = "sp_rollout", indexes = {
@Index(name = "sp_idx_rollout_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"name", "tenant" }, name = "uk_rollout") )
"name", "tenant" }, name = "uk_rollout"))
public class Rollout extends NamedEntity {
private static final long serialVersionUID = 1L;
@OneToMany(targetEntity = RolloutGroup.class)
@JoinColumn(name = "rollout", insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollout_rolloutgroup") )
@JoinColumn(name = "rollout", insertable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollout_rolloutgroup"))
private List<RolloutGroup> rolloutGroups;
@Column(name = "target_filter", length = 1024, nullable = false)
private String targetFilterQuery;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolltout_ds") )
@JoinColumn(name = "distribution_set", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolltout_ds"))
private DistributionSet distributionSet;
@Column(name = "status")
@@ -79,159 +79,86 @@ public class Rollout extends NamedEntity {
@Transient
private transient TotalTargetCountStatus totalTargetCountStatus;
/**
* @return the distributionSet
*/
public DistributionSet getDistributionSet() {
return distributionSet;
}
/**
* @param distributionSet
* the distributionSet to set
*/
public void setDistributionSet(final DistributionSet distributionSet) {
this.distributionSet = distributionSet;
}
/**
* @return the rolloutGroups
*/
public List<RolloutGroup> getRolloutGroups() {
return rolloutGroups;
}
/**
* @param rolloutGroups
* the rolloutGroups to set
*/
public void setRolloutGroups(final List<RolloutGroup> rolloutGroups) {
this.rolloutGroups = rolloutGroups;
}
/**
* @return the targetFilterQuery
*/
public String getTargetFilterQuery() {
return targetFilterQuery;
}
/**
* @param targetFilterQuery
* the targetFilterQuery to set
*/
public void setTargetFilterQuery(final String targetFilterQuery) {
this.targetFilterQuery = targetFilterQuery;
}
/**
* @return the status
*/
public RolloutStatus getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(final RolloutStatus status) {
this.status = status;
}
/**
* @return the lastCheck
*/
public long getLastCheck() {
return lastCheck;
}
/**
* @param lastCheck
* the lastCheck to set
*/
public void setLastCheck(final long lastCheck) {
this.lastCheck = lastCheck;
}
/**
* @return the actionType
*/
public ActionType getActionType() {
return actionType;
}
/**
* @param actionType
* the actionType to set
*/
public void setActionType(final ActionType actionType) {
this.actionType = actionType;
}
/**
* @return the forcedTime
*/
public long getForcedTime() {
return forcedTime;
}
/**
* @param forcedTime
* the forcedTime to set
*/
public void setForcedTime(final long forcedTime) {
this.forcedTime = forcedTime;
}
/**
* @return the totalTargets
*/
public long getTotalTargets() {
return totalTargets;
}
/**
* @param totalTargets
* the totalTargets to set
*/
public void setTotalTargets(final long totalTargets) {
this.totalTargets = totalTargets;
}
/**
* @return the rolloutGroupsTotal
*/
public int getRolloutGroupsTotal() {
return rolloutGroupsTotal;
}
/**
* @param rolloutGroupsTotal
* the rolloutGroupsTotal to set
*/
public void setRolloutGroupsTotal(final int rolloutGroupsTotal) {
this.rolloutGroupsTotal = rolloutGroupsTotal;
}
/**
* @return the rolloutGroupsCreated
*/
public int getRolloutGroupsCreated() {
return rolloutGroupsCreated;
}
/**
* @param rolloutGroupsCreated
* the rolloutGroupsCreated to set
*/
public void setRolloutGroupsCreated(final int rolloutGroupsCreated) {
this.rolloutGroupsCreated = rolloutGroupsCreated;
}
/**
* @return the totalTargetCountStatus
*/
public TotalTargetCountStatus getTotalTargetCountStatus() {
if (totalTargetCountStatus == null) {
totalTargetCountStatus = new TotalTargetCountStatus(totalTargets);
@@ -239,10 +166,6 @@ public class Rollout extends NamedEntity {
return totalTargetCountStatus;
}
/**
* @param totalTargetCountStatus
* the totalTargetCountStatus to set
*/
public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) {
this.totalTargetCountStatus = totalTargetCountStatus;
}
@@ -256,7 +179,7 @@ public class Rollout extends NamedEntity {
/**
*
* @author Michael Hirsch
* State machine for rollout.
*
*/
public enum RolloutStatus {
@@ -308,4 +231,27 @@ public class Rollout extends NamedEntity {
*/
ERROR_STARTING;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Rollout)) {
return false;
}
return true;
}
}

View File

@@ -34,13 +34,13 @@ import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "sp_rolloutgroup", indexes = {
@Index(name = "sp_idx_rolloutgroup_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"name", "rollout", "tenant" }, name = "uk_rolloutgroup") )
"name", "rollout", "tenant" }, name = "uk_rolloutgroup"))
public class RolloutGroup extends NamedEntity {
private static final long serialVersionUID = 1L;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "rollout", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolloutgroup_rollout") )
@JoinColumn(name = "rollout", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rolloutgroup_rollout"))
private Rollout rollout;
@Column(name = "status")
@@ -210,8 +210,7 @@ public class RolloutGroup extends NamedEntity {
}
/**
*
* @author Michael Hirsch
* Rollout goup state machine.
*
*/
public enum RolloutGroupStatus {
@@ -478,4 +477,27 @@ public class RolloutGroup extends NamedEntity {
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof RolloutGroup)) {
return false;
}
return true;
}
}

View File

@@ -241,8 +241,8 @@ public class SoftwareModule extends NamedVersionedEntity {
@Override
public String toString() {
return "SoftwareModule [deleted=" + deleted + ", getVersion()=" + getVersion() + ", getOptLockRevision()="
+ getOptLockRevision() + ", getId()=" + getId() + ", getType()=" + getType().getName() + "]";
return "SoftwareModule [deleted=" + deleted + ", name=" + getName() + ", version=" + getVersion()
+ ", revision=" + getOptLockRevision() + ", Id=" + getId() + ", type=" + getType().getName() + "]";
}
@Override

View File

@@ -13,8 +13,6 @@ import java.io.Serializable;
/**
* To hold software module name and Id.
*
*
*
*/
public class SoftwareModuleIdName implements Serializable {
@@ -35,25 +33,14 @@ public class SoftwareModuleIdName implements Serializable {
this.name = name;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {// NOSONAR - as this is generated
final int prime = 31;
@@ -62,11 +49,6 @@ public class SoftwareModuleIdName implements Serializable {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {// NOSONAR - as this is generated
if (this == obj) {

View File

@@ -29,10 +29,6 @@ import javax.persistence.Table;
@Entity
@Table(name = "sp_sw_metadata")
public class SoftwareModuleMetadata implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@@ -106,9 +102,9 @@ public class SoftwareModuleMetadata implements Serializable {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + (key == null ? 0 : key.hashCode());
result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode());
result = prime * result + (value == null ? 0 : value.hashCode());
return result;
}

View File

@@ -17,9 +17,6 @@ import javax.persistence.UniqueConstraint;
/**
* Type of a software modules.
*
*
*
*
*/
@Entity
@Table(name = "sp_software_module_type", indexes = {
@@ -28,9 +25,6 @@ import javax.persistence.UniqueConstraint;
@UniqueConstraint(columnNames = { "type_key", "tenant" }, name = "uk_smt_type_key"),
@UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_smt_name") })
public class SoftwareModuleType extends NamedEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "type_key", nullable = false, length = 64)
@@ -92,48 +86,26 @@ public class SoftwareModuleType extends NamedEntity {
super();
}
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @return the max
*/
public int getMaxAssignments() {
return maxAssignments;
}
/**
* @return the deleted
*/
public boolean isDeleted() {
return deleted;
}
/**
* @param deleted
* the deleted to set
*/
public void setDeleted(final boolean deleted) {
this.deleted = deleted;
}
/**
*
* @return the software type color
*/
public String getColour() {
return colour;
}
/**
*
* @param colour
* the col
*/
public void setColour(final String colour) {
this.colour = colour;
}
@@ -143,4 +115,26 @@ public class SoftwareModuleType extends NamedEntity {
return "SoftwareModuleType [key=" + key + ", getName()=" + getName() + ", getId()=" + getId() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof SoftwareModuleType)) {
return false;
}
return true;
}
}

View File

@@ -69,25 +69,15 @@ public final class SwMetadataCompositeKey implements Serializable {
this.softwareModule = softwareModule;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
result = prime * result + (key == null ? 0 : key.hashCode());
result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code

View File

@@ -14,14 +14,9 @@ import javax.persistence.MappedSuperclass;
import org.springframework.hateoas.Identifiable;
/**
* A Tag can be used as describing and organisational meta information for any
* A Tag can be used as describing and organizational meta information for any
* kind of entity.
*
*
*
*
*
*
*/
@MappedSuperclass
public abstract class Tag extends NamedEntity implements Identifiable<Long> {
@@ -57,14 +52,31 @@ public abstract class Tag extends NamedEntity implements Identifiable<Long> {
this.colour = colour;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Tag [getOptLockRevision()=" + getOptLockRevision() + ", getId()=" + getId() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Tag)) {
return false;
}
return true;
}
}

View File

@@ -56,11 +56,6 @@ import org.springframework.data.domain.Persistable;
* {@link TargetStatus#REGISTERED}, i.e. a target {@link DistributionSet} .
* </p>
*
*
*
*
*
*
*/
@Entity
@Table(name = "sp_target", indexes = {
@@ -117,7 +112,7 @@ public class Target extends NamedEntity implements Persistable<Long> {
/**
* Constructor.
*
*
* @param controllerId
* controller ID of the {@link Target}
*/
@@ -182,25 +177,14 @@ public class Target extends NamedEntity implements Persistable<Long> {
this.assignedDistributionSet = assignedDistributionSet;
}
/**
* @param controllerId
* the controllerId to set
*/
public void setControllerId(final String controllerId) {
this.controllerId = controllerId;
}
/**
* @param tags
* the tags to set
*/
public void setTags(final Set<TargetTag> tags) {
this.tags = tags;
}
/**
* @return the actions
*/
public List<Action> getActions() {
return actions;
}
@@ -209,11 +193,6 @@ public class Target extends NamedEntity implements Persistable<Long> {
return new TargetIdName(getId(), getControllerId(), getName());
}
/*
* (non-Javadoc)
*
* @see org.springframework.data.domain.Persistable#isNew()
*/
@Override
@Transient
public boolean isNew() {
@@ -263,7 +242,7 @@ public class Target extends NamedEntity implements Persistable<Long> {
/*
* (non-Javadoc)
*
*
* @see java.lang.Object#toString()
*/
@Override

View File

@@ -57,32 +57,25 @@ public class TargetFilterQuery extends TenantAwareBaseEntity {
}
@Override
public boolean equals(final Object obj) {// NOSONAR - as this is generated
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TargetFilterQuery other = (TargetFilterQuery) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
return true;
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@Override
public int hashCode() { // NOSONAR - as this is generated
final int prime = 31;
int result = 1;
result = prime * result + (name == null ? 0 : name.hashCode());
return result;
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TargetFilterQuery)) {
return false;
}
return true;
}
}

View File

@@ -39,61 +39,39 @@ public class TargetIdName implements Serializable {
this.name = name;
}
/**
* @return the controller id
*/
public String getControllerId() {
return controllerId;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param id
* the id to set
*/
public void setControllerId(final String id) {
this.controllerId = id;
controllerId = id;
}
/**
* @param name
* the name to set
*/
public void setName(final String name) {
this.name = name;
}
/**
* @return the targetId
*/
public long getTargetId() {
return targetId;
}
/*
* (non-Javadoc)
*
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (targetId ^ (targetId >>> 32));
result = prime * result + (int) (targetId ^ targetId >>> 32);
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@@ -112,11 +90,6 @@ public class TargetIdName implements Serializable {
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
// only return the ID because it's used in vaadin for setting the item

View File

@@ -54,19 +54,11 @@ import org.springframework.data.domain.Persistable;
* modifying the {@link Target} itself when a controller reports it's
* {@link #lastTargetQuery} for example.
*
*
*
*
*/
@Table(name = "sp_target_info", indexes = {
@Index(name = "sp_idx_target_info_02", columnList = "target_id,update_status") })
@Entity
// @DynamicUpdate
public class TargetInfo implements Persistable<Long>, Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(TargetInfo.class);
@@ -81,9 +73,6 @@ public class TargetInfo implements Persistable<Long>, Serializable {
@OneToOne(cascade = { CascadeType.MERGE, CascadeType.REMOVE }, fetch = FetchType.LAZY, targetEntity = Target.class)
@JoinColumn(name = "target_id", nullable = false, updatable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_stat_targ"))
@MapsId
// use deprecated annotation until HHH-8862 is fixed
// @SuppressWarnings( "deprecation" )
// @org.hibernate.annotations.ForeignKey( name = "fk_targ_stat_targ" )
private Target target;
@Column(name = "address", length = 512)
@@ -111,9 +100,7 @@ public class TargetInfo implements Persistable<Long>, Serializable {
@MapKeyColumn(name = "attribute_key", nullable = false, length = 32)
@CollectionTable(name = "sp_target_attributes", joinColumns = {
@JoinColumn(name = "target_id") }, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_targ_attrib_target"))
// use deprecated annotation until HHH-8862 is fixed
// @org.hibernate.annotations.ForeignKey( name = "fk_targ_attrib_target" )
private final Map<String, String> controllerAttributes = Collections.synchronizedMap(new HashMap<String, String>());
// set default request controller attributes to true, because we want to
@@ -124,7 +111,7 @@ public class TargetInfo implements Persistable<Long>, Serializable {
/**
* Constructor for {@link TargetStatus}.
*
*
* @param target
* related to this status.
*/
@@ -138,21 +125,11 @@ public class TargetInfo implements Persistable<Long>, Serializable {
targetId = null;
}
/*
* (non-Javadoc)
*
* @see org.springframework.data.domain.Persistable#getId()
*/
@Override
public Long getId() {
return targetId;
}
/*
* (non-Javadoc)
*
* @see org.springframework.data.domain.Persistable#isNew()
*/
@Override
@Transient
public boolean isNew() {
@@ -198,114 +175,62 @@ public class TargetInfo implements Persistable<Long>, Serializable {
this.address = address;
}
/**
* @return the targetId
*/
public Long getTargetId() {
return targetId;
}
/**
* @param targetId
* the targetId to set
*/
public void setTargetId(final Long targetId) {
this.targetId = targetId;
}
/**
* @return the target
*/
public Target getTarget() {
return target;
}
/**
* @param target
* the target to set
*/
public void setTarget(final Target target) {
this.target = target;
}
/**
* @return the lastTargetQuery
*/
public Long getLastTargetQuery() {
return lastTargetQuery;
}
/**
* @param lastTargetQuery
* the lastTargetQuery to set
*/
public void setLastTargetQuery(final Long lastTargetQuery) {
this.lastTargetQuery = lastTargetQuery;
}
/**
* @param requestControllerAttributes
* the requestControllerAttributes to set
*/
public void setRequestControllerAttributes(final boolean requestControllerAttributes) {
this.requestControllerAttributes = requestControllerAttributes;
}
/**
* @return the controllerAttributes
*/
public Map<String, String> getControllerAttributes() {
return controllerAttributes;
}
/**
* @return the requestControllerAttributes
*/
public boolean isRequestControllerAttributes() {
return requestControllerAttributes;
}
/**
* @return the installationDate
*/
public Long getInstallationDate() {
return installationDate;
}
/**
* @param installationDate
* the installationDate to set
*/
public void setInstallationDate(final Long installationDate) {
this.installationDate = installationDate;
}
/**
* @return the updateStatus
*/
public TargetUpdateStatus getUpdateStatus() {
return updateStatus;
}
/**
* @param updateStatus
* the updateStatus to set
*/
public void setUpdateStatus(final TargetUpdateStatus updateStatus) {
this.updateStatus = updateStatus;
}
/**
* @return the installedDistributionSet
*/
public DistributionSet getInstalledDistributionSet() {
return installedDistributionSet;
}
/**
* @param installedDistributionSet
* the installedDistributionSet to set
*/
public void setInstalledDistributionSet(final DistributionSet installedDistributionSet) {
this.installedDistributionSet = installedDistributionSet;
}
@@ -338,8 +263,6 @@ public class TargetInfo implements Persistable<Long>, Serializable {
* The poll time object which holds all the necessary information around the
* target poll time, e.g. the last poll time, the next poll time and the
* overdue poll time.
*
*
*
*/
public static final class PollStatus {
@@ -359,7 +282,7 @@ public class TargetInfo implements Persistable<Long>, Serializable {
/**
* calculates if the target poll time is overdue and the target has not
* been polled in the configured poll time interval.
*
*
* @return {@code true} if the current time is after the poll time
* overdue date otherwise {@code false}.
*/
@@ -386,15 +309,41 @@ public class TargetInfo implements Persistable<Long>, Serializable {
return currentDate;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "PollTime [lastPollDate=" + lastPollDate + ", nextPollDate=" + nextPollDate + ", overdueDate="
+ overdueDate + ", currentDate=" + currentDate + "]";
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (target == null ? 0 : target.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TargetInfo)) {
return false;
}
final TargetInfo other = (TargetInfo) obj;
if (target == null) {
if (other.target != null) {
return false;
}
} else if (!target.equals(other.target)) {
return false;
}
return true;
}
}

View File

@@ -30,7 +30,7 @@ import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "sp_target_tag", indexes = {
@Index(name = "sp_idx_target_tag_prim", columnList = "tenant,id") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"name", "tenant" }, name = "uk_targ_tag") )
"name", "tenant" }, name = "uk_targ_tag"))
public class TargetTag extends Tag {
private static final long serialVersionUID = 1L;
@@ -65,18 +65,10 @@ public class TargetTag extends Tag {
super();
}
/**
* @return the assignedToTargets
*/
public List<Target> getAssignedToTargets() {
return assignedToTargets;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
@@ -85,11 +77,6 @@ public class TargetTag extends Tag {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj) {

View File

@@ -13,11 +13,6 @@ package org.eclipse.hawkbit.repository.model;
* status. A {@link Target} can have only one status. independent of the number
* of {@link UpdateAction}s that have to be applied.
*
*
*
*
*
*
*/
public enum TargetUpdateStatus {

View File

@@ -76,22 +76,22 @@ public abstract class TenantAwareBaseEntity extends BaseEntity {
}
@Override
public int hashCode() { // NOSONAR - as this is generated
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((tenant == null) ? 0 : tenant.hashCode());
result = prime * result + (tenant == null ? 0 : tenant.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
if (!(obj instanceof TenantAwareBaseEntity)) {
return false;
}
final TenantAwareBaseEntity other = (TenantAwareBaseEntity) obj;

View File

@@ -27,10 +27,6 @@ import javax.persistence.UniqueConstraint;
@Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key",
"tenant" }, name = "uk_tenant_key"))
public class TenantConfiguration extends TenantAwareBaseEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name = "conf_key", length = 128)
@@ -89,24 +85,14 @@ public class TenantConfiguration extends TenantAwareBaseEntity implements Serial
this.value = value;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + (key == null ? 0 : key.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code

View File

@@ -24,7 +24,7 @@ import javax.persistence.UniqueConstraint;
* Tenant entity with meta data that is configured globally for the entire
* tenant. This entity is not tenant aware to allow the system to access it
* through the {@link EntityManager} even before the actual tenant exists.
*
*
* Entities owned by the tenant are based on {@link TenantAwareBaseEntity}.
*
*/
@@ -82,8 +82,7 @@ public class TenantMetaData extends BaseEntity {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((defaultDsType == null) ? 0 : defaultDsType.hashCode());
result = prime * result + ((tenant == null) ? 0 : tenant.hashCode());
result = prime * result + this.getClass().getName().hashCode();
return result;
}
@@ -95,24 +94,10 @@ public class TenantMetaData extends BaseEntity {
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TenantMetaData other = (TenantMetaData) obj;
if (defaultDsType == null) {
if (other.defaultDsType != null) {
return false;
}
} else if (!defaultDsType.equals(other.defaultDsType)) {
return false;
}
if (tenant == null) {
if (other.tenant != null) {
return false;
}
} else if (!tenant.equals(other.tenant)) {
if (!(obj instanceof TenantMetaData)) {
return false;
}
return true;
}
}