Skip to content

Commit ef9b9ae

Browse files
ATLAS-5026: Remove getProperty call when calling setProperty (#340)
* ATLAS-5026: Remove getProperty call when calling setProperty * Update AtlasGraphUtilsV2.java --------- Co-authored-by: Madhan Neethiraj <madhan@apache.org>
1 parent bdae4e9 commit ef9b9ae

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -233,30 +233,14 @@ public static <T extends AtlasElement> void setProperty(T element, String proper
233233
propertyName = encodePropertyKey(propertyName);
234234
}
235235

236-
Object existingValue = element.getProperty(propertyName, Object.class);
237-
238236
if (value == null) {
239-
if (existingValue != null) {
240-
if (LOG.isDebugEnabled()) {
241-
LOG.debug("Removing property {} from {}", propertyName, toString(element));
242-
}
243-
244-
element.removeProperty(propertyName);
245-
}
237+
element.removeProperty(propertyName);
246238
} else {
247-
if (!value.equals(existingValue)) {
248-
if (LOG.isDebugEnabled()) {
249-
LOG.debug("Setting property {} in {}", propertyName, toString(element));
250-
}
251-
252-
if (value instanceof Date) {
253-
Long encodedValue = ((Date) value).getTime();
254-
255-
element.setProperty(propertyName, encodedValue);
256-
} else {
257-
element.setProperty(propertyName, value);
258-
}
239+
if (value instanceof Date) {
240+
value = ((Date) value).getTime();
259241
}
242+
243+
element.setProperty(propertyName, value);
260244
}
261245
}
262246

0 commit comments

Comments
 (0)