Browse Source

Improve after review

pull/12998/head
Andrii Landiak 1 year ago
parent
commit
27352b7b7e
  1. 35
      common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java

35
common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java

@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.thingsboard.server.common.data.BaseData;
@ -36,10 +37,10 @@ import org.thingsboard.server.common.data.validation.Length;
import org.thingsboard.server.common.data.validation.NoXss;
import java.io.Serial;
import java.util.Objects;
@Schema
@Data
@EqualsAndHashCode(callSuper = true)
public class CalculatedField extends BaseData<CalculatedFieldId> implements HasName, HasTenantId, HasVersion, HasDebugSettings {
@Serial
@ -63,7 +64,7 @@ public class CalculatedField extends BaseData<CalculatedFieldId> implements HasN
@Schema(description = "Version of calculated field configuration.", example = "0")
private int configurationVersion;
@Schema(implementation = SimpleCalculatedFieldConfiguration.class)
private transient CalculatedFieldConfiguration configuration;
private CalculatedFieldConfiguration configuration;
@Getter
@Setter
private Long version;
@ -123,36 +124,6 @@ public class CalculatedField extends BaseData<CalculatedFieldId> implements HasN
this.debugMode = debugMode;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof CalculatedField that)) return false;
if (!super.equals(o)) return false;
return Objects.equals(tenantId, that.tenantId) &&
Objects.equals(entityId, that.entityId) &&
Objects.equals(name, that.name) &&
Objects.equals(debugSettings, that.debugSettings) &&
Objects.equals(configuration, that.configuration) &&
type == that.type && debugMode == that.debugMode &&
configurationVersion == that.configurationVersion &&
Objects.equals(version, that.version);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(tenantId);
result = 31 * result + Objects.hashCode(entityId);
result = 31 * result + Objects.hashCode(type);
result = 31 * result + Objects.hashCode(name);
result = 31 * result + Boolean.hashCode(debugMode);
result = 31 * result + Objects.hashCode(debugSettings);
result = 31 * result + Integer.hashCode(configurationVersion);
result = 31 * result + Objects.hashCode(configuration);
result = 31 * result + Objects.hashCode(version);
return result;
}
@Override
public String toString() {
return new StringBuilder()

Loading…
Cancel
Save