Skip to content

Commit 935650b

Browse files
committed
remove equal() override on ebean entity model
1 parent 6273d6e commit 935650b

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanMetadataAspect.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
import lombok.NoArgsConstructor;
1616
import lombok.NonNull;
1717
import lombok.Setter;
18-
import lombok.SneakyThrows;
19-
import org.json.simple.JSONObject;
20-
import org.json.simple.parser.JSONParser;
2118

2219

2320
/**
@@ -88,39 +85,6 @@ public static class PrimaryKey {
8885
@Column(name = CREATED_FOR_COLUMN, nullable = true)
8986
private String createdFor;
9087

91-
@SneakyThrows
92-
@Override
93-
public boolean equals(Object o) {
94-
if (o == null) {
95-
return false;
96-
}
97-
if (o.getClass() != this.getClass()) {
98-
return false;
99-
}
100-
EbeanMetadataAspect other = (EbeanMetadataAspect) o;
101-
102-
boolean primitiveEqualityCheck = this.key.equals(other.key)
103-
// either both metadata fields are null or both are equal (will check non-null equality after)
104-
&& ((this.metadata == null && other.metadata == null) || (this.metadata != null && other.metadata != null))
105-
&& Math.abs(this.createdOn.getTime() - other.getCreatedOn().getTime()) < 1000 // timestamps are considered equal if within 1s of each other
106-
&& this.createdBy.equals(other.getCreatedBy())
107-
// either both createdFor fields are null or both are equal (need to check this.createdFor != null to avoid NPE)
108-
&& ((this.createdFor == null && other.getCreatedFor() == null) || (this.createdFor != null && this.createdFor.equals(other.getCreatedFor())));
109-
if (!primitiveEqualityCheck) {
110-
return false;
111-
}
112-
113-
JSONParser parser = new JSONParser();
114-
JSONObject thisMetadata = (JSONObject) parser.parse(this.metadata);
115-
JSONObject otherMetadata = (JSONObject) parser.parse(other.metadata);
116-
return thisMetadata.equals(otherMetadata);
117-
}
118-
119-
@Override
120-
public int hashCode() {
121-
return super.hashCode();
122-
}
123-
12488
@Override
12589
public String toString() {
12690
final String str = "EbeanMetadataAspect: {key: <urn:%s, aspect:%s, version:%s>, createdOn: %s, createdBy: %s, createdFor: %s, metadata: %s}";

0 commit comments

Comments
 (0)