Skip to content

Commit

Permalink
created new Constant for __modificationTimeStamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpatnaik-atlan committed Feb 3, 2025
1 parent 1887b01 commit 7259b4f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ public final class Constants {
public static final String UD_RELATIONSHIP_END_NAME_FROM = "userDefRelationshipFrom";
public static final String UD_RELATIONSHIP_END_NAME_TO = "userDefRelationshipTo";

public static final String MODIFICATION_TIMESTAMP = "__modificationTimestamp";

/**
* SQL property keys.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static org.apache.atlas.model.instance.AtlasEntity.Status.ACTIVE;
import static org.apache.atlas.model.instance.AtlasEntity.Status.DELETED;
import static org.apache.atlas.repository.Constants.MODIFICATION_TIMESTAMP;
import static org.apache.atlas.repository.graph.GraphHelper.getStatus;

public class SoftDeletionProductMigrationService {
Expand Down Expand Up @@ -120,7 +121,7 @@ public boolean deleteEdgeForActiveProduct(AtlasVertex productVertex) {
private boolean deleteEdgeForArchivedProduct(AtlasVertex productVertex) {
boolean isCommitRequired = false;
try {
Long updatedTime = productVertex.getProperty("__modificationTimestamp", Long.class);
Long updatedTime = productVertex.getProperty(MODIFICATION_TIMESTAMP, Long.class);
Iterator<AtlasEdge> existingEdges = productVertex.getEdges(AtlasEdgeDirection.BOTH).iterator();

if (existingEdges == null || !existingEdges.hasNext()) {
Expand All @@ -130,7 +131,7 @@ private boolean deleteEdgeForArchivedProduct(AtlasVertex productVertex) {

while (existingEdges.hasNext()) {
AtlasEdge edge = existingEdges.next();
Long modifiedEdgeTimestamp = edge.getProperty("__modificationTimestamp", Long.class);
Long modifiedEdgeTimestamp = edge.getProperty(MODIFICATION_TIMESTAMP, Long.class);

if (!updatedTime.equals(modifiedEdgeTimestamp)) {
LOG.info("Removing edge with different timestamp: {}", edge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static org.apache.atlas.model.instance.AtlasEntity.Status.ACTIVE;
import static org.apache.atlas.model.instance.AtlasEntity.Status.DELETED;
import static org.apache.atlas.repository.Constants.MODIFICATION_TIMESTAMP;
import static org.apache.atlas.repository.graph.GraphHelper.getStatus;

public class ValidateProductEdgesMigrationService {
Expand Down Expand Up @@ -117,7 +118,7 @@ public boolean validateEdgeForActiveProduct (AtlasVertex productVertex) {
public boolean validateEdgeForArchivedProduct (AtlasVertex productVertex) {
boolean edgeWithDifferentTimeStampFound = false;
try {
Long updatedTime = productVertex.getProperty("__modificationTimestamp", Long.class);
Long updatedTime = productVertex.getProperty(MODIFICATION_TIMESTAMP, Long.class);
Iterator<AtlasEdge> existingEdges = productVertex.getEdges(AtlasEdgeDirection.BOTH).iterator();

if (existingEdges == null || !existingEdges.hasNext()) {
Expand All @@ -127,7 +128,7 @@ public boolean validateEdgeForArchivedProduct (AtlasVertex productVertex) {

while (existingEdges.hasNext()) {
AtlasEdge edge = existingEdges.next();
Long modifiedEdgeTimestamp = edge.getProperty("__modificationTimestamp", Long.class);
Long modifiedEdgeTimestamp = edge.getProperty(MODIFICATION_TIMESTAMP, Long.class);

if (!updatedTime.equals(modifiedEdgeTimestamp)) {
LOG.info("Found edge with different timestamp: {}", edge);
Expand Down

0 comments on commit 7259b4f

Please sign in to comment.