|
15 | 15 | import lombok.NoArgsConstructor; |
16 | 16 | import lombok.NonNull; |
17 | 17 | import lombok.Setter; |
18 | | -import lombok.SneakyThrows; |
19 | | -import org.json.simple.JSONObject; |
20 | | -import org.json.simple.parser.JSONParser; |
21 | 18 |
|
22 | 19 |
|
23 | 20 | /** |
@@ -88,39 +85,6 @@ public static class PrimaryKey { |
88 | 85 | @Column(name = CREATED_FOR_COLUMN, nullable = true) |
89 | 86 | private String createdFor; |
90 | 87 |
|
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 | | - |
124 | 88 | @Override |
125 | 89 | public String toString() { |
126 | 90 | final String str = "EbeanMetadataAspect: {key: <urn:%s, aspect:%s, version:%s>, createdOn: %s, createdBy: %s, createdFor: %s, metadata: %s}"; |
|
0 commit comments