From 7bfc30305b9341999e74f19f747bb7d3c77f6414 Mon Sep 17 00:00:00 2001 From: "Kajur, Harish (vk250x)" Date: Thu, 1 Nov 2018 17:50:54 -0400 Subject: Fix bug on create created ts and modified ts where on create the values should be the same but it ends up being different sometimes Issue-ID: AAI-1832 Change-Id: Ia8cfb75a5812e6b59f8000a820cf3605ab17eb2b Signed-off-by: Kajur, Harish (vk250x) --- .../src/main/java/org/onap/aai/serialization/db/DBSerializer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'aai-core/src/main/java') diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java index e8c03bdd..7a2c447e 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java @@ -96,6 +96,7 @@ public class DBSerializer { private final Loader loader; private final String baseURL; private double dbTimeMsecs = 0; + private long currentTimeMillis; private SchemaVersions schemaVersions; /** @@ -117,6 +118,7 @@ public class DBSerializer { this.version = version; this.loader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version); this.baseURL = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE); + this.currentTimeMillis = System.currentTimeMillis(); initBeans(); } @@ -156,14 +158,14 @@ public class DBSerializer { * @param isNewVertex the is new vertex */ public void touchStandardVertexProperties(Vertex v, boolean isNewVertex) { - - String timeNowInSec = Long.toString(System.currentTimeMillis()); + String timeNowInSec = Long.toString(currentTimeMillis); + if (isNewVertex) { v.property(AAIProperties.SOURCE_OF_TRUTH, this.sourceOfTruth); v.property(AAIProperties.CREATED_TS, timeNowInSec); v.property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()); } - v.property(AAIProperties.RESOURCE_VERSION, timeNowInSec ); + v.property(AAIProperties.RESOURCE_VERSION, timeNowInSec); v.property(AAIProperties.LAST_MOD_TS, timeNowInSec); v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, this.sourceOfTruth); -- cgit