Commit 9300924f by nixonrodrigues

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

Change-Id: I6655626c937bf629ba5bffcbfce8f5c1fbbd0ed9
parent beb34506
...@@ -106,7 +106,7 @@ define(['require', ...@@ -106,7 +106,7 @@ define(['require',
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
}, options); }, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options); return this.constructor.nonCrudOperation.call(this, url, 'PUT', options);
}, },
removeTermFromCategory: function() { removeTermFromCategory: function() {
......
...@@ -857,21 +857,43 @@ public class GlossaryREST { ...@@ -857,21 +857,43 @@ public class GlossaryREST {
@DELETE @DELETE
@Path("/terms/{termGuid}/assignedEntities") @Path("/terms/{termGuid}/assignedEntities")
public void removeTermAssignmentFromEntities(@PathParam("termGuid") String termGuid, List<AtlasRelatedObjectId> relatedObjectIds) throws AtlasBaseException { 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; AtlasPerfTracer perf = null;
try { try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { 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); glossaryService.removeTermFromEntities(termGuid, relatedObjectIds);
} finally { } finally {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
}
}
/** /**
* Get all related categories (parent and children) * Get all related categories (parent and children)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment