This is an automated email from the ASF dual-hosted git repository.
pinal pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new aa358b727 ATLAS-4614 : Deferred Actions : Add classification name in
response
aa358b727 is described below
commit aa358b727479aeab65fdaf18ff63da4a4927a11e
Author: pareshD <[email protected]>
AuthorDate: Fri May 6 17:11:25 2022 +0530
ATLAS-4614 : Deferred Actions : Add classification name in response
Signed-off-by: Pinal Shah <[email protected]>
(cherry picked from commit eaa6d1645e0f2215d9f210336d4be283f2bed05b)
---
.../atlas/repository/store/graph/v1/DeleteHandlerV1.java | 9 ++++-----
.../atlas/repository/store/graph/v2/EntityGraphMapper.java | 11 +++++------
.../repository/store/graph/v2/tasks/ClassificationTask.java | 5 +++--
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
index 6964211e9..8d306c745 100644
---
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
+++
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
@@ -405,7 +405,7 @@ public abstract class DeleteHandlerV1 {
if (taskManagement != null && DEFERRED_ACTION_ENABLED) {
for (AtlasVertex classificationVertex : classificationVertices) {
- createAndQueueTask(CLASSIFICATION_PROPAGATION_ADD, toVertex,
classificationVertex.getIdForDisplay(), relationshipGuid);
+ createAndQueueTask(CLASSIFICATION_PROPAGATION_ADD, toVertex,
classificationVertex.getIdForDisplay(), relationshipGuid,
GraphHelper.getClassificationName(classificationVertex));
}
} else {
final List<AtlasVertex> propagatedEntityVertices =
CollectionUtils.isNotEmpty(classificationVertices) ?
entityRetriever.getIncludedImpactedVerticesV2(toVertex, relationshipGuid) :
null;
@@ -1016,7 +1016,7 @@ public abstract class DeleteHandlerV1 {
if (isClassificationEdge && removePropagations) {
if (taskManagement != null && DEFERRED_ACTION_ENABLED) {
- createAndQueueTask(CLASSIFICATION_PROPAGATION_DELETE,
instanceVertex, classificationVertex.getIdForDisplay(), null);
+ createAndQueueTask(CLASSIFICATION_PROPAGATION_DELETE,
instanceVertex, classificationVertex.getIdForDisplay(), null,
GraphHelper.getClassificationName(classificationVertex));
} else {
removeTagPropagation(classificationVertex);
}
@@ -1190,17 +1190,16 @@ public abstract class DeleteHandlerV1 {
}
}
- public void createAndQueueTask(String taskType, AtlasVertex entityVertex,
String classificationVertexId, String relationshipGuid) {
+ public void createAndQueueTask(String taskType, AtlasVertex entityVertex,
String classificationVertexId, String relationshipGuid, String
classificationName) {
String currentUser = RequestContext.getCurrentUser();
String entityGuid = GraphHelper.getGuid(entityVertex);
- Map<String, Object> taskParams =
ClassificationTask.toParameters(entityGuid, classificationVertexId,
relationshipGuid);
+ Map<String, Object> taskParams =
ClassificationTask.toParameters(entityGuid, classificationVertexId,
relationshipGuid, classificationName);
AtlasTask task = taskManagement.createTask(taskType,
currentUser, taskParams);
AtlasGraphUtilsV2.addEncodedProperty(entityVertex,
PENDING_TASKS_PROPERTY_KEY, task.getGuid());
RequestContext.get().queueTask(task);
}
-
public void createAndQueueTask(String taskType, AtlasEdge
relationshipEdge, AtlasRelationship relationship) {
String currentUser =
RequestContext.getCurrentUser();
String relationshipEdgeId =
relationshipEdge.getIdForDisplay();
diff --git
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
index 9a7f29017..68d331dfd 100644
---
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
+++
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
@@ -2011,7 +2011,7 @@ public class EntityGraphMapper {
if (propagateTags && taskManagement != null &&
DEFERRED_ACTION_ENABLED) {
propagateTags = false;
- createAndQueueTask(CLASSIFICATION_PROPAGATION_ADD,
entityVertex, classificationVertex.getIdForDisplay());
+ createAndQueueTask(CLASSIFICATION_PROPAGATION_ADD,
entityVertex, classificationVertex.getIdForDisplay(), classificationName);
}
// add the attributes for the trait instance
@@ -2193,7 +2193,7 @@ public class EntityGraphMapper {
throw new
AtlasBaseException(AtlasErrorCode.DELETE_TAG_PROPAGATION_NOT_ALLOWED,
classificationVertexId, entityGuid);
}
- createAndQueueTask(CLASSIFICATION_PROPAGATION_DELETE,
entityVertex, classificationVertexId);
+ createAndQueueTask(CLASSIFICATION_PROPAGATION_DELETE,
entityVertex, classificationVertexId, classificationName);
entityVertices = new ArrayList<>();
} else {
@@ -2428,7 +2428,7 @@ public class EntityGraphMapper {
if (updatedTagPropagation != null && taskManagement != null &&
DEFERRED_ACTION_ENABLED) {
String propagationType = updatedTagPropagation ?
CLASSIFICATION_PROPAGATION_ADD : CLASSIFICATION_PROPAGATION_DELETE;
- createAndQueueTask(propagationType, entityVertex,
classificationVertex.getIdForDisplay());
+ createAndQueueTask(propagationType, entityVertex,
classificationVertex.getIdForDisplay(), classificationName);
updatedTagPropagation = null;
}
@@ -2823,10 +2823,9 @@ public class EntityGraphMapper {
attributes.put(bmAttribute.getName(), attrValue);
}
- private void createAndQueueTask(String taskType, AtlasVertex entityVertex,
String classificationVertexId) {
- deleteDelegate.getHandler().createAndQueueTask(taskType, entityVertex,
classificationVertexId, null);
+ private void createAndQueueTask(String taskType, AtlasVertex entityVertex,
String classificationVertexId, String classificationName) {
+ deleteDelegate.getHandler().createAndQueueTask(taskType, entityVertex,
classificationVertexId, null, classificationName);
}
-
public void removePendingTaskFromEntity(String entityGuid, String
taskGuid) throws EntityNotFoundException {
if (StringUtils.isEmpty(entityGuid) || StringUtils.isEmpty(taskGuid)) {
return;
diff --git
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/tasks/ClassificationTask.java
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/tasks/ClassificationTask.java
index 0bad84e49..74bed571f 100644
---
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/tasks/ClassificationTask.java
+++
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/tasks/ClassificationTask.java
@@ -49,6 +49,7 @@ public abstract class ClassificationTask extends AbstractTask
{
public static final String PARAM_ENTITY_GUID = "entityGuid";
public static final String PARAM_CLASSIFICATION_VERTEX_ID =
"classificationVertexId";
+ public static final String PARAM_CLASSIFICATION_NAME =
"classificationName";
public static final String PARAM_RELATIONSHIP_GUID =
"relationshipGuid";
public static final String PARAM_RELATIONSHIP_OBJECT =
"relationshipObject";
public static final String PARAM_RELATIONSHIP_EDGE_ID =
"relationshipEdgeId";
@@ -108,14 +109,14 @@ public abstract class ClassificationTask extends
AbstractTask {
return getStatus();
}
- public static Map<String, Object> toParameters(String entityGuid, String
classificationVertexId, String relationshipGuid) {
+ public static Map<String, Object> toParameters(String entityGuid, String
classificationVertexId, String relationshipGuid, String classificationName) {
return new HashMap<String, Object>() {{
put(PARAM_ENTITY_GUID, entityGuid);
put(PARAM_CLASSIFICATION_VERTEX_ID, classificationVertexId);
+ put(PARAM_CLASSIFICATION_NAME, classificationName);
put(PARAM_RELATIONSHIP_GUID, relationshipGuid);
}};
}
-
public static Map<String, Object> toParameters(String relationshipEdgeId,
AtlasRelationship relationship) {
return new HashMap<String, Object>() {{
put(PARAM_RELATIONSHIP_EDGE_ID, relationshipEdgeId);