You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2018/05/18 17:17:18 UTC

[1/2] atlas git commit: ATLAS-2700: Error message fix ATLAS-2701: Usage attribute not getting persisted for term ATLAS-2702: Term qualifiedName not persisting after anchor change

Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 d5f817d6d -> 2a8c2d3de


ATLAS-2700: Error message fix
ATLAS-2701: Usage attribute not getting persisted for term
ATLAS-2702: Term qualifiedName not persisting after anchor change

Change-Id: I23b53086b2bb2380f451e7d85b59096edc610181
(cherry picked from commit 9044e0375cea58641b0f54c1732980f1401fd845)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/49a4f964
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/49a4f964
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/49a4f964

Branch: refs/heads/branch-1.0
Commit: 49a4f9641e954fc873304b7b1cf03a1b6ec55bfd
Parents: d5f817d
Author: apoorvnaik <ap...@apache.org>
Authored: Thu May 17 14:17:43 2018 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Fri May 18 10:16:40 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/AtlasErrorCode.java   |  4 ++--
 .../apache/atlas/glossary/GlossaryService.java  | 23 +++++++++++++++-----
 .../atlas/glossary/GlossaryTermUtils.java       |  2 +-
 .../ogm/glossary/AtlasGlossaryTermDTO.java      |  2 ++
 4 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/49a4f964/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index 4397dd9..0f6ce85 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -143,11 +143,11 @@ public enum AtlasErrorCode {
     RELATIONSHIP_END_IS_NULL(400, "ATLAS-400-00-07D", "Relationship end is invalid. Expected {0} but is NULL"),
     INVALID_TERM_RELATION_TO_SELF(400, "ATLAS-400-00-07E", "Invalid Term relationship: Term can't have a relationship with self"),
     INVALID_CHILD_CATEGORY_DIFFERENT_GLOSSARY(400, "ATLAS-400-00-07F", "Invalid child category relationship: Child category (guid = {0}) belongs to different glossary"),
-    INVALID_TERM_DISSOCIATION(400, "ATLAS-400-00-080", "Given term (guid={0}) is not associated to entity(guid={1})"),
+    INVALID_TERM_DISSOCIATION(400, "ATLAS-400-00-080", "Given relationshipGuid({0}) is invalid for term (guid={1}) and entity(guid={2})"),
     ATTRIBUTE_TYPE_INVALID(400, "ATLAS-400-00-081", "{0}.{1}: invalid attribute type. Attribute cannot be of type classification"),
     MISSING_CATEGORY_DISPLAY_NAME(400, "ATLAS-400-00-082", "Category displayName is empty/null"),
     INVALID_DISPLAY_NAME(400, "ATLAS-400-00-083", "displayName cannot contain following special chars ('@', '.')"),
-    TERM_HAS_ENTITY_ASSOCIATION(400, "ATLAS-400-00-086", "Term (guid={}) can't be deleted as it has been assigned to {} entities."),
+    TERM_HAS_ENTITY_ASSOCIATION(400, "ATLAS-400-00-086", "Term (guid={0}) can't be deleted as it has been assigned to {1} entities."),
 
     UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to perform {1}"),
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/49a4f964/repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java b/repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
index bae2ea1..bd9095b 100644
--- a/repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
+++ b/repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
@@ -348,7 +348,12 @@ public class GlossaryService {
         glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE);
 
         // Re-load term after handling relations
-        storeObject = dataAccess.load(glossaryTerm);
+        if (StringUtils.equals(storeObject.getQualifiedName(), glossaryTerm.getQualifiedName())) {
+            storeObject = dataAccess.load(glossaryTerm);
+        } else {
+            glossaryTerm.setQualifiedName(storeObject.getQualifiedName());
+            storeObject = dataAccess.save(glossaryTerm);
+        }
         setInfoForRelations(storeObject);
 
         if (DEBUG_ENABLED) {
@@ -409,11 +414,17 @@ public class GlossaryService {
                 LOG.debug("Glossary term had no immediate attr updates. Exception: {}", e.getMessage());
             } finally {
                 glossaryTermUtils.processTermRelations(storeObject, atlasGlossaryTerm, GlossaryUtils.RelationshipOperation.UPDATE);
-            }
 
+                // If qualifiedName changes due to anchor change, we need to persist the term again with updated qualifiedName
+                if (StringUtils.equals(storeObject.getQualifiedName(), atlasGlossaryTerm.getQualifiedName())) {
+                    storeObject = dataAccess.load(atlasGlossaryTerm);
+                } else {
+                    atlasGlossaryTerm.setQualifiedName(storeObject.getQualifiedName());
+                    storeObject = dataAccess.save(atlasGlossaryTerm);
+                }
+            }
         }
 
-        storeObject = dataAccess.load(atlasGlossaryTerm);
         setInfoForRelations(storeObject);
 
         if (DEBUG_ENABLED) {
@@ -539,11 +550,11 @@ public class GlossaryService {
         dataAccess.save(impactedCategories.values());
 
         // Since the current category is also affected, we need to update qualifiedName and save again
-        if (!StringUtils.equals(glossaryCategory.getQualifiedName(), storeObject.getQualifiedName())) {
+        if (StringUtils.equals(glossaryCategory.getQualifiedName(), storeObject.getQualifiedName())) {
+            storeObject = dataAccess.load(glossaryCategory);
+        } else {
             glossaryCategory.setQualifiedName(storeObject.getQualifiedName());
             storeObject = dataAccess.save(glossaryCategory);
-        } else {
-            storeObject = dataAccess.load(glossaryCategory);
         }
 
         setInfoForRelations(storeObject);

http://git-wip-us.apache.org/repos/asf/atlas/blob/49a4f964/repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java b/repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java
index 2c38d31..2af4e79 100644
--- a/repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java
+++ b/repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java
@@ -121,7 +121,7 @@ public class GlossaryTermUtils extends GlossaryUtils {
                 if (CollectionUtils.isNotEmpty(assignedEntities) && isRelationshipGuidSame(existingTermRelation, relatedObjectId)) {
                     relationshipStore.deleteById(relatedObjectId.getRelationshipGuid());
                 } else {
-                    throw new AtlasBaseException(AtlasErrorCode.INVALID_TERM_DISSOCIATION, glossaryTerm.getGuid(), relatedObjectId.getGuid());
+                    throw new AtlasBaseException(AtlasErrorCode.INVALID_TERM_DISSOCIATION, relatedObjectId.getRelationshipGuid(), glossaryTerm.getGuid(), relatedObjectId.getGuid());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/atlas/blob/49a4f964/repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java b/repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
index 9fed84a..d557752 100644
--- a/repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
+++ b/repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
@@ -60,6 +60,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
         ret.setLongDescription((String) entity.getAttribute("longDescription"));
         ret.setExamples((List<String>) entity.getAttribute("examples"));
         ret.setAbbreviation((String) entity.getAttribute("abbreviation"));
+        ret.setUsage((String) entity.getAttribute("usage"));
 
         Object anchor = entity.getRelationshipAttribute("anchor");
         if (anchor instanceof AtlasRelatedObjectId) {
@@ -212,6 +213,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
         ret.setAttribute("longDescription", obj.getLongDescription());
         ret.setAttribute("examples", obj.getExamples());
         ret.setAttribute("abbreviation", obj.getAbbreviation());
+        ret.setAttribute("usage", obj.getUsage());
 
         if (CollectionUtils.isNotEmpty(obj.getClassifications())) {
             if (LOG.isDebugEnabled()) {


[2/2] atlas git commit: ATLAS-2699: updated UI to use V2 audit API

Posted by ma...@apache.org.
ATLAS-2699: updated UI to use V2 audit API

Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit 63a0be2621c3bc77ac879f8545e9bc0f3c53bb89)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/2a8c2d3d
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/2a8c2d3d
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/2a8c2d3d

Branch: refs/heads/branch-1.0
Commit: 2a8c2d3de29208321474b16aac3fdcdbe1749f15
Parents: 49a4f96
Author: kevalbhatt <kb...@apache.org>
Authored: Fri May 18 19:17:59 2018 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Fri May 18 10:16:51 2018 -0700

----------------------------------------------------------------------
 dashboardv2/public/js/utils/Enums.js                    | 12 ++++++------
 dashboardv2/public/js/utils/UrlLinks.js                 |  2 +-
 .../public/js/views/audit/CreateAuditTableLayoutView.js |  5 ++---
 3 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/2a8c2d3d/dashboardv2/public/js/utils/Enums.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/Enums.js b/dashboardv2/public/js/utils/Enums.js
index 9ad9d05..1e493e5 100644
--- a/dashboardv2/public/js/utils/Enums.js
+++ b/dashboardv2/public/js/utils/Enums.js
@@ -25,12 +25,12 @@ define(['require'], function(require) {
         ENTITY_CREATE: "Entity Created",
         ENTITY_UPDATE: "Entity Updated",
         ENTITY_DELETE: "Entity Deleted",
-        TAG_ADD: "Classification Added",
-        TAG_DELETE: "Classification Deleted",
-        TAG_UPDATE: "Classification Updated",
-        PROPAGATED_TAG_ADD: "Propagated Classification Added",
-        PROPAGATED_TAG_DELETE: "Propagated Classification Deleted",
-        PROPAGATED_TAG_UPDATE: "Propagated Classification Updated",
+        CLASSIFICATION_ADD: "Classification Added",
+        CLASSIFICATION_DELETE: "Classification Deleted",
+        CLASSIFICATION_UPDATE: "Classification Updated",
+        PROPAGATED_CLASSIFICATION_ADD: "Propagated Classification Added",
+        PROPAGATED_CLASSIFICATION_DELETE: "Propagated Classification Deleted",
+        PROPAGATED_CLASSIFICATION_UPDATE: "Propagated Classification Updated",
         ENTITY_IMPORT_CREATE: "Entity Created by import",
         ENTITY_IMPORT_UPDATE: "Entity Updated by import",
         ENTITY_IMPORT_DELETE: "Entity Deleted by import"

http://git-wip-us.apache.org/repos/asf/atlas/blob/2a8c2d3d/dashboardv2/public/js/utils/UrlLinks.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/UrlLinks.js b/dashboardv2/public/js/utils/UrlLinks.js
index 2946988..1437871 100644
--- a/dashboardv2/public/js/utils/UrlLinks.js
+++ b/dashboardv2/public/js/utils/UrlLinks.js
@@ -67,7 +67,7 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
             }
         },
         entityCollectionaudit: function(guid) {
-            return this.baseUrl + '/entities/' + guid + '/audit';
+            return this.baseUrlV2 + '/entity/' + guid + '/audit';
         },
         classicationApiUrl: function(name, guid) {
             var typeUrl = this.typedefsUrl();

http://git-wip-us.apache.org/repos/asf/atlas/blob/2a8c2d3d/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js
index cbd6b0d..5670b8c 100644
--- a/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js
+++ b/dashboardv2/public/js/views/audit/CreateAuditTableLayoutView.js
@@ -79,12 +79,11 @@ define(['require',
                             var name = _.escape(parseDetailsObject[0]);
                         }
                     }
-                    var values = parseDetailsObject.values;
                     var name = ((name ? name : this.entityName));
                     this.ui.name.text(name);
-                    if (parseDetailsObject && parseDetailsObject.values) {
+                    if (parseDetailsObject) {
                         this.ui.auditHeaderValue.html('<th>Key</th><th>New Value</th>');
-                        table = CommonViewFunction.propertyTable({ scope: this, valueObject: values, attributeDefs: this.attributeDefs, extractJSON: { extractKey: 'value' } });
+                        table = CommonViewFunction.propertyTable({ scope: this, valueObject: parseDetailsObject, attributeDefs: this.attributeDefs, extractJSON: { extractKey: 'value' } });
                         if (table.length) {
                             this.ui.noData.hide();
                             this.ui.tableAudit.show();