Repository: incubator-atlas
Updated Branches:
  refs/heads/master b6e0d60fd -> e8a148497


Revert "ATLAS-712 Support getTrait() API (svimal2106 via kevalbhatt)"

This reverts commit b6e0d60fd5f18171397bc2a9c160614149515ae5.


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

Branch: refs/heads/master
Commit: e8a148497192863d8ad019474faddb74974d4e2c
Parents: b6e0d60
Author: kevalbhatt <kbh...@apache.org>
Authored: Fri Sep 16 11:06:21 2016 +0530
Committer: kevalbhatt <kbh...@apache.org>
Committed: Fri Sep 16 11:06:21 2016 +0530

----------------------------------------------------------------------
 .../main/java/org/apache/atlas/AtlasClient.java | 31 --------
 release-log.txt                                 |  1 -
 .../atlas/web/resources/EntityResource.java     | 80 --------------------
 .../web/resources/EntityJerseyResourceIT.java   | 28 -------
 4 files changed, 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e8a14849/client/src/main/java/org/apache/atlas/AtlasClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasClient.java 
b/client/src/main/java/org/apache/atlas/AtlasClient.java
index 49e2a31..5ed79bc 100755
--- a/client/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClient.java
@@ -100,8 +100,6 @@ public class AtlasClient {
     public static final String URI_NAME_LINEAGE = "lineage/hive/table";
     public static final String URI_LINEAGE = "lineage/";
     public static final String URI_TRAITS = "traits";
-    public static final String TRAIT_DEFINITIONS = "traitDefinitions";
-
 
     public static final String QUERY = "query";
     public static final String LIMIT = "limit";
@@ -494,8 +492,6 @@ public class AtlasClient {
         ADD_TRAITS(BASE_URI + URI_ENTITY, HttpMethod.POST, 
Response.Status.CREATED),
         DELETE_TRAITS(BASE_URI + URI_ENTITY, HttpMethod.DELETE, 
Response.Status.OK),
         LIST_TRAITS(BASE_URI + URI_ENTITY, HttpMethod.GET, Response.Status.OK),
-        GET_ALL_TRAIT_DEFINITIONS(BASE_URI + URI_ENTITY, HttpMethod.GET, 
Response.Status.OK),
-        GET_TRAIT_DEFINITION(BASE_URI + URI_ENTITY, HttpMethod.GET, 
Response.Status.OK),
 
         //Search operations
         SEARCH(BASE_URI + URI_SEARCH, HttpMethod.GET, Response.Status.OK),
@@ -991,33 +987,6 @@ public class AtlasClient {
         return extractResults(jsonResponse, AtlasClient.RESULTS, new 
ExtractOperation<String, String>());
     }
 
-    /**
-     * Get all trait definitions for an entity
-     * @param guid GUID of the entity
-     * @return List<String> trait definitions of the traits associated to the 
entity
-     * @throws AtlasServiceException
-     */
-    public List<String> listTraitDefinitions(final String guid) throws 
AtlasServiceException{
-        JSONObject jsonResponse = callAPI(API.GET_ALL_TRAIT_DEFINITIONS, null, 
guid, TRAIT_DEFINITIONS);
-        return extractResults(jsonResponse, AtlasClient.RESULTS, new 
ExtractOperation<String, String>());
-    }
-
-    /**
-     * Get trait definition for a given entity and traitname
-     * @param guid GUID of the entity
-     * @param traitname
-     * @return trait definition
-     * @throws AtlasServiceException
-     */
-    public String getTraitDefinition(final String guid, final String 
traitName) throws AtlasServiceException{
-        JSONObject jsonResponse = callAPI(API.GET_TRAIT_DEFINITION, null, 
guid, TRAIT_DEFINITIONS, traitName);
-        try {
-            return jsonResponse.getString(AtlasClient.RESULTS);
-        }catch (JSONException e){
-            throw new AtlasServiceException(API.GET_TRAIT_DEFINITION, e);
-        }
-    }
-
     protected class ExtractOperation<T, U> {
         T extractElement(U element) throws JSONException {
             return (T) element;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e8a14849/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ac9a904..f043a33 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,7 +9,6 @@ ATLAS-1060 Add composite indexes for exact match performance 
improvements for al
 ATLAS-1127 Modify creation and modification timestamps to Date instead of 
Long(sumasai)
 
 ALL CHANGES:
-ATLAS-712 Support getTrait() API (svimal2106 via kevalbhatt)
 ATLAS-1173 Doc: Minor editorial bug in the example given for property 
atlas.server.ha.zookeeper.auth (yhemanth via shwethags)
 ATLAS-1133 Jetty Server start doesn't throw exception when 
user-credential.properties file is not found (nixonrodrigues,svimal2106 via 
kevalbhatt)
 ATLAS-1149 Changes to UI to sort the hive table schema based on "position" 
attribute of hive_column (Kalyanikashikar via kevalbhatt)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e8a14849/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
----------------------------------------------------------------------
diff --git 
a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java 
b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 493ed5c..82016d0 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -639,86 +639,6 @@ public class EntityResource {
     }
 
     /**
-     * Fetches the trait definitions of all the traits associated to the given 
entity
-     * @param guid globally unique identifier for the entity
-     */
-    @GET
-    @Path("{guid}/traitDefinitions")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
-    public Response getTraitDefinitionsForEntity(@PathParam("guid") String 
guid){
-        AtlasPerfTracer perf = null;
-        try {
-            if(AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
-                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, 
"EntityResource.getTraitDefinitionsForEntity(" + guid + ")");
-            }
-            LOG.debug("Fetching all trait definitions for entity={}", guid);
-            final List<String> traitNames = 
metadataService.getTraitNames(guid);
-            ArrayList<String> traitDefinitions = new ArrayList<>();
-            for(String trait:traitNames){
-                String traitDefinition = 
metadataService.getTraitDefinition(guid, trait);
-                traitDefinitions.add(traitDefinition);
-            }
-
-            JSONObject response = new JSONObject();
-            response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
-            response.put(AtlasClient.RESULTS, getJSONArray(traitDefinitions));
-            response.put(AtlasClient.COUNT, traitDefinitions.size());
-
-            return Response.ok(response).build();
-        } catch (EntityNotFoundException e){
-            LOG.error("An entity with GUID={} does not exist", guid, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.NOT_FOUND));
-        } catch (AtlasException | IllegalArgumentException e) {
-            LOG.error("Unable to get trait definitions for entity {}", guid, 
e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.BAD_REQUEST));
-        } catch (Throwable e) {
-            LOG.error("Unable to get trait definitions for entity {}", guid, 
e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.INTERNAL_SERVER_ERROR));
-        } finally {
-            AtlasPerfTracer.log(perf);
-        }
-
-    }
-
-    /**
-     * Fetches the trait definition for an entity given its guid and trait name
-     *
-     * @param guid globally unique identifier for the entity
-     * @param traitName name of the trait
-     */
-    @GET
-    @Path("{guid}/traitDefinitions/{traitName}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
-    public Response getTraitDefinitionForEntity(@PathParam("guid") String 
guid, @PathParam("traitName") String traitName){
-        AtlasPerfTracer perf = null;
-        try {
-            if(AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
-                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, 
"EntityResource.getTraitDefinitionForEntity(" + guid + ", " + traitName + ")");
-            }
-            LOG.debug("Fetching trait definition for entity {} and trait name 
{}", guid, traitName);
-            final String traitDefinition = 
metadataService.getTraitDefinition(guid, traitName);
-
-            JSONObject response = new JSONObject();
-            response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
-            response.put(AtlasClient.RESULTS, new JSONObject(traitDefinition));
-
-            return Response.ok(response).build();
-
-        } catch (EntityNotFoundException e){
-            LOG.error("An entity with GUID={} does not exist", guid, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.NOT_FOUND));
-        } catch (AtlasException | IllegalArgumentException e) {
-            LOG.error("Unable to get trait definition for entity {} and trait 
{}", guid, traitName, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.BAD_REQUEST));
-        } catch (Throwable e) {
-            LOG.error("Unable to get trait definition for entity {} and trait 
{}", guid, traitName, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, 
Response.Status.INTERNAL_SERVER_ERROR));
-        } finally {
-            AtlasPerfTracer.log(perf);
-        }
-    }
-
-    /**
      * Adds a new trait to an existing entity represented by a guid.
      *
      * @param guid globally unique identifier for the entity

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e8a14849/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git 
a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
 
b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
index 6d90b9d..a1988ef 100755
--- 
a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ 
b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
@@ -87,7 +87,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     private final String TABLE_NAME = "table" + randomString();
     private static final String ENTITIES = "api/atlas/entities";
     private static final String TRAITS = "traits";
-    private static final String TRAIT_DEFINITION = "traitDefinitions";
 
     private Referenceable tableInstance;
     private Id tableId;
@@ -527,33 +526,6 @@ public class EntityJerseyResourceIT extends BaseResourceIT 
{
         assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_ADD);
     }
 
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testgetTraitDefinitionForEntity() throws Exception{
-        traitName = "PII_Trait" + randomString();
-        HierarchicalTypeDefinition<TraitType> piiTrait =
-                TypesUtil.createTraitTypeDef(traitName, 
ImmutableSet.<String>of());
-        String traitDefinitionAsJSON = 
TypesSerialization$.MODULE$.toJson(piiTrait, true);
-        LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
-        createType(traitDefinitionAsJSON);
-
-        Struct traitInstance = new Struct(traitName);
-        String traitInstanceAsJSON = 
InstanceSerialization.toJson(traitInstance, true);
-        LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
-
-        final String guid = tableId._getId();
-        ClientResponse clientResponse =
-                
service.path(ENTITIES).path(guid).path(TRAITS).accept(Servlets.JSON_MEDIA_TYPE)
-                        .type(Servlets.JSON_MEDIA_TYPE)
-                        .method(HttpMethod.POST, ClientResponse.class, 
traitInstanceAsJSON);
-        Assert.assertEquals(clientResponse.getStatus(), 
Response.Status.CREATED.getStatusCode());
-        List<String> allTraitDefs = serviceClient.listTraitDefinitions(guid);
-        Assert.assertEquals(allTraitDefs.size(), 9);
-
-        String traitDef = serviceClient.getTraitDefinition(guid, traitName);
-        JSONObject responseAsJSON = new JSONObject(traitDef);
-        Assert.assertEquals(responseAsJSON.get("typeName"), traitName);
-    }
-
     @Test(dependsOnMethods = "testAddTrait")
     public void testAddExistingTrait() throws Exception {
         final String traitName = "PII_Trait" + randomString();

Reply via email to