Skip to content

Commit

Permalink
DG-1697: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit-at committed Jul 19, 2024
1 parent 5fb0aaf commit 89f0deb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 71 deletions.
1 change: 0 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ on:
- development
- master
- lineageondemand
- policyendpointsmasterss

jobs:
build:
Expand Down
69 changes: 1 addition & 68 deletions server-api/src/main/java/org/apache/atlas/RequestContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class RequestContext {
private String currentTypePatchAction = "";
private AtlasTask currentTask;
private String traceId;
private Map<AtlasObjectId, Object> relationshipEndToVertexIdMap = new HashMap<>();
private final Map<AtlasObjectId, Object> relationshipEndToVertexIdMap = new HashMap<>();
private boolean allowDuplicateDisplayName;
private MetricsRegistry metricsRegistry;
private boolean skipAuthorizationCheck = false;
Expand All @@ -104,77 +104,13 @@ public class RequestContext {
private boolean delayTagNotifications = false;
private Map<AtlasClassification, Collection<Object>> deletedClassificationAndVertices = new HashMap<>();
private Map<AtlasClassification, Collection<Object>> addedClassificationAndVertices = new HashMap<>();

private boolean isCloned = false;
private boolean alternatePath = false;


private RequestContext() {

}

private RequestContext(RequestContext other) {
this.user = other.user;
this.userGroups = other.userGroups != null ? new HashSet<>(other.userGroups) : null;
this.clientIPAddress = other.clientIPAddress;
this.forwardedAddresses = other.forwardedAddresses != null ? new ArrayList<>(other.forwardedAddresses) : null;
this.deleteType = other.deleteType;
this.isPurgeRequested = other.isPurgeRequested;
this.maxAttempts = other.maxAttempts;
this.attemptCount = other.attemptCount;
this.isImportInProgress = other.isImportInProgress;
this.isInNotificationProcessing = other.isInNotificationProcessing;
this.isInTypePatching = other.isInTypePatching;
this.createShellEntityForNonExistingReference = other.createShellEntityForNonExistingReference;
this.skipFailedEntities = other.skipFailedEntities;
this.allowDeletedRelationsIndexsearch = other.allowDeletedRelationsIndexsearch;
this.includeMeanings = other.includeMeanings;
this.includeClassifications = other.includeClassifications;
this.includeClassificationNames = other.includeClassificationNames;
this.currentTypePatchAction = other.currentTypePatchAction;
this.currentTask = other.currentTask;
this.traceId = other.traceId;
this.relationshipEndToVertexIdMap = new HashMap<>(other.relationshipEndToVertexIdMap);
this.allowDuplicateDisplayName = other.allowDuplicateDisplayName;
this.metricsRegistry = other.metricsRegistry;
this.skipAuthorizationCheck = other.skipAuthorizationCheck;
this.deletedEdgesIdsForResetHasLineage = new HashSet<>(other.deletedEdgesIdsForResetHasLineage);
this.requestUri = other.requestUri;
this.cacheEnabled = other.cacheEnabled;
this.delayTagNotifications = other.delayTagNotifications;
this.deletedClassificationAndVertices = new HashMap<>(other.deletedClassificationAndVertices);
this.addedClassificationAndVertices = new HashMap<>(other.addedClassificationAndVertices);

this.updatedEntities.putAll(other.updatedEntities);
this.deletedEntities.putAll(other.deletedEntities);
this.restoreEntities.putAll(other.restoreEntities);
this.entityCache.putAll(other.entityCache);
this.entityHeaderCache.putAll(other.entityHeaderCache);
this.entityExtInfoCache.putAll(other.entityExtInfoCache);
this.diffEntityCache.putAll(other.diffEntityCache);
this.addedPropagations.putAll(other.addedPropagations);
this.removedPropagations.putAll(other.removedPropagations);
this.requestContextHeaders.putAll(other.requestContextHeaders);
this.deletedEdgesIds.addAll(other.deletedEdgesIds);
this.processGuidIds.addAll(other.processGuidIds);
this.entitiesToSkipUpdate.addAll(other.entitiesToSkipUpdate);
this.onlyCAUpdateEntities.addAll(other.onlyCAUpdateEntities);
this.onlyBAUpdateEntities.addAll(other.onlyBAUpdateEntities);
this.queuedTasks.addAll(other.queuedTasks);
this.relationAttrsForSearch.addAll(other.relationAttrsForSearch);
this.removedElementsMap.putAll(other.removedElementsMap);
this.newElementsCreatedMap.putAll(other.newElementsCreatedMap);
this.relationshipMutationMap.putAll(other.relationshipMutationMap);
}


public static RequestContext cloneCurrentContext() {
RequestContext currentContext = get();
RequestContext requestContext = new RequestContext(currentContext);
requestContext.isCloned = true;
return requestContext;
}

public static void set(RequestContext context) {
CURRENT_CONTEXT.set(context);
}
Expand Down Expand Up @@ -861,9 +797,6 @@ public Map<String, Set<AtlasRelationship>> getRelationshipMutationMap() {
return relationshipMutationMap;
}

public boolean isCloned() {
return isCloned;
}

public boolean isAlternatePath() {
return alternatePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@

import static org.apache.atlas.AtlasErrorCode.BAD_REQUEST;
import static org.apache.atlas.AtlasErrorCode.DEPRECATED_API;
import static org.apache.atlas.authorize.AtlasAuthorizationUtils.getCurrentUserName;
import static org.apache.atlas.authorize.AtlasPrivilege.*;
import static org.apache.atlas.repository.util.AccessControlUtils.ARGO_SERVICE_USER_NAME;


/**
Expand Down

0 comments on commit 89f0deb

Please sign in to comment.