You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2018/12/20 13:55:36 UTC

atlas git commit: ATLAS-2995 : Added new API method to disassociate the term assignment from entity.

Repository: atlas
Updated Branches:
  refs/heads/master beb34506a -> 9300924fd


ATLAS-2995 : Added new API method to disassociate the term assignment from entity.

Change-Id: I6655626c937bf629ba5bffcbfce8f5c1fbbd0ed9


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

Branch: refs/heads/master
Commit: 9300924fd4de98e3400105e78ddb18111c065702
Parents: beb3450
Author: nixonrodrigues <ni...@apache.org>
Authored: Thu Dec 13 17:50:04 2018 +0530
Committer: nixonrodrigues <ni...@apache.org>
Committed: Thu Dec 20 19:24:06 2018 +0530

----------------------------------------------------------------------
 dashboardv2/public/js/models/VGlossary.js       |  2 +-
 .../org/apache/atlas/web/rest/GlossaryREST.java | 30 +++++++++++++++++---
 2 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/9300924f/dashboardv2/public/js/models/VGlossary.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/models/VGlossary.js b/dashboardv2/public/js/models/VGlossary.js
index f33ef0f..48c5a99 100644
--- a/dashboardv2/public/js/models/VGlossary.js
+++ b/dashboardv2/public/js/models/VGlossary.js
@@ -106,7 +106,7 @@ define(['require',
                 contentType: 'application/json',
                 dataType: 'json'
             }, options);
-            return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
+            return this.constructor.nonCrudOperation.call(this, url, 'PUT', options);
         },
         removeTermFromCategory: function() {
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/9300924f/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
index d13fbd9..151aa6b 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
@@ -857,21 +857,43 @@ public class GlossaryREST {
     @DELETE
     @Path("/terms/{termGuid}/assignedEntities")
     public void removeTermAssignmentFromEntities(@PathParam("termGuid") String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException {
-        Servlets.validateQueryParamLength("termGuid", termGuid);
+        removeTermFromGlossary(termGuid, relatedObjectIds);
+    }
+
+
+    /**
+     * Remove the term assignment for the given list of entity headers
+     * @param termGuid Glossary term GUID
+     * @param relatedObjectIds List of related entity IDs from which the term has to be dissociated
+     * @throws AtlasBaseException
+     * @HTTP 204 If glossary term dissociation was successful
+     * @HTTP 400 If ANY of the entity header is invalid
+     * @HTTP 404 If glossary term guid in invalid
+     */
+    @PUT
+    @Path("/terms/{termGuid}/assignedEntities")
+    public void disassociateTermAssignmentFromEntities(@PathParam("termGuid") String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException {
+        removeTermFromGlossary(termGuid, relatedObjectIds);
+    }
+
+
+
+    private void removeTermFromGlossary(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException{
+
+        Servlets.validateQueryParamLength("termGuid", termGuid) ;
 
         AtlasPerfTracer perf = null;
         try {
             if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
-                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "GlossaryREST.removeTermAssignmentFromEntities(" + termGuid + ")");
+                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "GlossaryREST.removeTermFromGlossary(" + termGuid + ")");
             }
 
             glossaryService.removeTermFromEntities(termGuid, relatedObjectIds);
         } finally {
             AtlasPerfTracer.log(perf);
         }
-    }
-
 
+    }
 
     /**
      * Get all related categories (parent and children)