atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/3] incubator-atlas git commit: ATLAS-1523: v2 implementation of get-entity by-guid/unique-attributes
Date Wed, 08 Feb 2017 04:02:08 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 48477e208 -> dd7447658


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java b/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
index 0459061..ea6d217 100755
--- a/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
+++ b/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
@@ -34,12 +34,8 @@ import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.discovery.AtlasSearchResult;
 import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult;
 import org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult;
-import org.apache.atlas.model.instance.AtlasClassification;
-import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityHeaderWithAssociations;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
-import org.apache.atlas.model.instance.EntityMutationResponse;
+import org.apache.atlas.model.instance.*;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
 import org.apache.atlas.model.lineage.AtlasLineageInfo;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
@@ -57,11 +53,7 @@ import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang.ArrayUtils;
 
 import javax.ws.rs.core.MultivaluedMap;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF;
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF;
@@ -227,7 +219,7 @@ public class QuickStartV2 {
                                   AtlasTypeUtil.createOptionalAttrDef("dataType", "string"),
                                   AtlasTypeUtil.createOptionalAttrDef("comment", "string"),
                                   AtlasTypeUtil.createOptionalAttrDefWithConstraint("table", TABLE_TYPE, CONSTRAINT_TYPE_INVERSE_REF,
-                                          new HashMap<String, Object>() {{ put(CONSTRAINT_PARAM_ATTRIBUTE, "table"); }}));
+                                          new HashMap<String, Object>() {{ put(CONSTRAINT_PARAM_ATTRIBUTE, "columns"); }}));
 
         colType.setOptions(new HashMap<String, String>() {{ put("schemaAttributes", "[\"name\", \"description\", \"owner\", \"type\", \"comment\", \"position\"]"); }});
 
@@ -353,8 +345,8 @@ public class QuickStartV2 {
         List<AtlasEntityHeader> entities = response.getEntitiesByOperation(EntityOperation.CREATE);
 
         if (CollectionUtils.isNotEmpty(entities)) {
-            List<AtlasEntityWithAssociations> getByGuidResponse = entitiesClient.getEntityByGuid(entities.get(0).getGuid()); 
-            ret = getByGuidResponse.get(0);
+            AtlasEntityWithExtInfo getByGuidResponse = entitiesClient.getEntityByGuid(entities.get(0).getGuid());
+            ret = getByGuidResponse.getEntity();
             System.out.println("Created entity of type [" + ret.getTypeName() + "], guid: " + ret.getGuid());
         }
 
@@ -367,7 +359,7 @@ public class QuickStartV2 {
 
     AtlasEntity createDatabase(String name, String description, String owner, String locationUri, String... traitNames)
             throws Exception {
-        AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(DATABASE_TYPE);
+        AtlasEntity entity = new AtlasEntity(DATABASE_TYPE);
 
         entity.setClassifications(toAtlasClassifications(traitNames));
         entity.setAttribute("name", name);
@@ -406,7 +398,7 @@ public class QuickStartV2 {
 
     AtlasEntity createColumn(String name, String dataType, String comment, String... traitNames) throws Exception {
 
-        AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(COLUMN_TYPE);
+        AtlasEntity entity = new AtlasEntity(COLUMN_TYPE);
         entity.setClassifications(toAtlasClassifications(traitNames));
         entity.setAttribute("name", name);
         entity.setAttribute("dataType", dataType);
@@ -417,7 +409,7 @@ public class QuickStartV2 {
 
     AtlasEntity createTable(String name, String description, AtlasEntity db, AtlasEntity sd, String owner, String tableType,
                             List<AtlasEntity> columns, String... traitNames) throws Exception {
-        AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(TABLE_TYPE);
+        AtlasEntity entity = new AtlasEntity(TABLE_TYPE);
 
         entity.setClassifications(toAtlasClassifications(traitNames));
         entity.setAttribute("name", name);
@@ -428,16 +420,16 @@ public class QuickStartV2 {
         entity.setAttribute("createTime", System.currentTimeMillis());
         entity.setAttribute("lastAccessTime", System.currentTimeMillis());
         entity.setAttribute("retention", System.currentTimeMillis());
-        entity.setAttribute("db", db);
-        entity.setAttribute("sd", sd);
-        entity.setAttribute("columns", columns);
+        entity.setAttribute("db", db.getAtlasObjectId());
+        entity.setAttribute("sd", sd.getAtlasObjectId());
+        entity.setAttribute("columns", getObjectIds(columns));
 
         return createInstance(entity, traitNames);
     }
 
     AtlasEntity createProcess(String name, String description, String user, List<AtlasEntity> inputs, List<AtlasEntity> outputs,
             String queryText, String queryPlan, String queryId, String queryGraph, String... traitNames) throws Exception {
-        AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(LOAD_PROCESS_TYPE);
+        AtlasEntity entity = new AtlasEntity(LOAD_PROCESS_TYPE);
 
         entity.setClassifications(toAtlasClassifications(traitNames));
         entity.setAttribute(AtlasClient.NAME, name);
@@ -457,7 +449,7 @@ public class QuickStartV2 {
     }
 
     AtlasEntity createView(String name, AtlasEntity db, List<AtlasEntity> inputTables, String... traitNames) throws Exception {
-        AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(VIEW_TYPE);
+        AtlasEntity entity = new AtlasEntity(VIEW_TYPE);
 
         entity.setClassifications(toAtlasClassifications(traitNames));
         entity.setAttribute("name", name);
@@ -531,7 +523,7 @@ public class QuickStartV2 {
             AtlasSearchResult results = discoveryClient.dslSearchWithParams(dslQuery, 10, 0);
 
             if (results != null) {
-                List<AtlasEntityHeaderWithAssociations> entitiesResult  = results.getEntities();
+                List<AtlasEntityHeader>   entitiesResult  = results.getEntities();
                 List<AtlasFullTextResult> fullTextResults = results.getFullTextResult();
                 AttributeSearchResult     attribResult    = results.getAttributes();
 
@@ -565,7 +557,24 @@ public class QuickStartV2 {
     }
 
     private String getTableId(String tableName) throws AtlasServiceException {
-        AtlasEntity tableEntity = entitiesClient.getEntityByAttribute(TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
+
+        AtlasEntity tableEntity = entitiesClient.getEntityByAttribute(TABLE_TYPE, attributes).getEntity();
         return tableEntity.getGuid();
     }
+
+    private Collection<AtlasObjectId> getObjectIds(Collection<AtlasEntity> entities) {
+        List<AtlasObjectId> ret = new ArrayList<>();
+
+        if (CollectionUtils.isNotEmpty(entities)) {
+            for (AtlasEntity entity : entities) {
+                if (entity != null) {
+                    ret.add(entity.getAtlasObjectId());
+                }
+            }
+        }
+
+        return ret;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasEntityFormatConverter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasEntityFormatConverter.java b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasEntityFormatConverter.java
index 6818899..fb02318 100644
--- a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasEntityFormatConverter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasEntityFormatConverter.java
@@ -24,7 +24,6 @@ import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntity.Status;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasType;
@@ -32,7 +31,6 @@ import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.persistence.AtlasSystemAttributes;
 import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.persistence.Id.EntityState;
 import org.apache.commons.collections.CollectionUtils;
@@ -77,8 +75,8 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
                         LOG.error("IReferenceableInstance.getValuesMap() failed", excp);
                     }
 
-                    AtlasEntityWithAssociations entity = new AtlasEntityWithAssociations(entRef.getTypeName(),
-                                                                      super.fromV1ToV2(entityType, v1Attribs, context));
+                    AtlasEntity entity = new AtlasEntity(entRef.getTypeName(),
+                                                         super.fromV1ToV2(entityType, v1Attribs, context));
                     entity.setGuid(entRef.getId()._getId());
                     entity.setStatus(convertState(entRef.getId().getState()));
                     entity.setCreatedBy(entRef.getSystemAttributes().createdBy);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasFormatConverter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasFormatConverter.java b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasFormatConverter.java
index a4799e8..a7157a3 100644
--- a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasFormatConverter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasFormatConverter.java
@@ -21,7 +21,6 @@ package org.apache.atlas.web.adapters;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.type.AtlasType;
 
 import java.util.HashMap;
@@ -36,24 +35,16 @@ public interface AtlasFormatConverter {
 
     public static class ConverterContext {
 
-        private Map<String, AtlasEntityWithAssociations> entities = null;
+        private Map<String, AtlasEntity> entities = null;
 
-        public void addEntity(AtlasEntityWithAssociations entity) {
+        public void addEntity(AtlasEntity entity) {
             if (entities == null) {
                 entities = new HashMap<>();
             }
             entities.put(entity.getGuid(), entity);
         }
 
-        public void addEntity(AtlasEntity entity) {
-            if (entity instanceof AtlasEntityWithAssociations) {
-                this.addEntity((AtlasEntityWithAssociations)entity);
-            } else {
-                this.addEntity(new AtlasEntityWithAssociations(entity));
-            }
-        }
-
-        public AtlasEntityWithAssociations getById(String guid) {
+        public AtlasEntity getById(String guid) {
             if( entities != null) {
                 return entities.get(guid);
             }
@@ -63,7 +54,7 @@ public interface AtlasFormatConverter {
 
         public boolean entityExists(String guid) { return entities != null && entities.containsKey(guid); }
 
-        public Map<String, AtlasEntityWithAssociations> getEntities() {
+        public Map<String, AtlasEntity> getEntities() {
             return entities;
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
index 6cdf9d1..b1dae56 100644
--- a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
+++ b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
@@ -17,8 +17,6 @@
  */
 package org.apache.atlas.web.adapters;
 
-import java.util.List;
-
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
@@ -28,7 +26,6 @@ import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.instance.GuidMapping;
@@ -50,7 +47,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -129,7 +125,7 @@ public class AtlasInstanceRestAdapters {
         return ret;
     }
 
-    public Map<String, AtlasEntityWithAssociations> getAtlasEntity(IReferenceableInstance referenceable) throws AtlasBaseException {
+    public Map<String, AtlasEntity> getAtlasEntity(IReferenceableInstance referenceable) throws AtlasBaseException {
 
         AtlasFormatConverter converter  = instanceFormatters.getConverter(TypeCategory.ENTITY);
         AtlasEntityType      entityType = typeRegistry.getEntityTypeByName(referenceable.getTypeName());

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
index 24c2151..5b3a4c2 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
@@ -22,11 +22,8 @@ import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.ClassificationAssociateRequest;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
@@ -54,9 +51,7 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -138,8 +133,8 @@ public class EntitiesREST {
 
         for (String guid : guids) {
             try {
-               ITypedReferenceableInstance ref = metadataService.getEntityDefinition(guid);
-               Map<String, AtlasEntityWithAssociations> entityRet = restAdapters.getAtlasEntity(ref);
+               ITypedReferenceableInstance ref       = metadataService.getEntityDefinition(guid);
+               Map<String, AtlasEntity>    entityRet = restAdapters.getAtlasEntity(ref);
 
                addToEntityList(entityList, entityRet.values());
 
@@ -152,8 +147,8 @@ public class EntitiesREST {
         return entities;
     }
 
-    private void addToEntityList(final List<AtlasEntity> entityList, final Collection<AtlasEntityWithAssociations> values) {
-        for (AtlasEntityWithAssociations val : values) {
+    private void addToEntityList(final List<AtlasEntity> entityList, final Collection<AtlasEntity> values) {
+        for (AtlasEntity val : values) {
             if ( !entityList.contains(val)) {
                 entityList.add(val);
             }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
index bca9091..1aac0f2 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
@@ -25,10 +25,12 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
+import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.services.MetadataService;
+import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -39,15 +41,19 @@ import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.web.adapters.AtlasFormatConverter;
 import org.apache.atlas.web.adapters.AtlasInstanceRestAdapters;
 import org.apache.atlas.web.util.Servlets;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
+import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -63,49 +69,54 @@ public class EntityREST {
 
     private static final Logger LOG = LoggerFactory.getLogger(EntityREST.class);
 
-    private final AtlasTypeRegistry typeRegistry;
+    public static final String PREFIX_ATTR = "attr:";
 
+    private final AtlasTypeRegistry         typeRegistry;
     private final AtlasInstanceRestAdapters restAdapters;
-
-    private final MetadataService metadataService;
+    private final MetadataService           metadataService;
+    private final AtlasEntityStore          entitiesStore;
 
     @Inject
-    public EntityREST(AtlasTypeRegistry typeRegistry, AtlasInstanceRestAdapters restAdapters, MetadataService metadataService) {
-        this.typeRegistry = typeRegistry;
-        this.restAdapters = restAdapters;
+    public EntityREST(AtlasTypeRegistry typeRegistry, AtlasInstanceRestAdapters restAdapters, MetadataService metadataService, AtlasEntityStore entitiesStore) {
+        this.typeRegistry    = typeRegistry;
+        this.restAdapters    = restAdapters;
         this.metadataService = metadataService;
+        this.entitiesStore   = entitiesStore;
     }
 
     /**
      * Fetch the complete definition of an entity given its GUID.
      *
      * @param guid GUID for the entity
+     * @return AtlasEntity
+     * @throws AtlasBaseException
      */
     @GET
     @Path("/guid/{guid}")
+    @Consumes(Servlets.JSON_MEDIA_TYPE)
     @Produces(Servlets.JSON_MEDIA_TYPE)
-    public List<AtlasEntityWithAssociations> getById(@PathParam("guid") String guid) throws AtlasBaseException {
-        try {
-            ITypedReferenceableInstance              ref      = metadataService.getEntityDefinition(guid);
-            Map<String, AtlasEntityWithAssociations> entities = restAdapters.getAtlasEntity(ref);
-
-            return getOrderedEntityList(entities, guid);
-        } catch (AtlasException e) {
-            throw toAtlasBaseException(e);
-        }
+    public AtlasEntityWithExtInfo getById(@PathParam("guid") String guid) throws AtlasBaseException {
+        return entitiesStore.getById(guid);
     }
 
     /**
-     * Fetch the complete definition of an entity given its GUID including its associations
-     * like classifications, terms etc.
-     *
-     * @param guid GUID for the entity
+     * Get entity information using entity type and unique attribute.
+     * @param typeName
+     * @return
+     * @throws AtlasBaseException
      */
     @GET
-    @Path("/guid/{guid}/associations")
+    @Path("/uniqueAttribute/type/{typeName}")
+    @Consumes(Servlets.JSON_MEDIA_TYPE)
     @Produces(Servlets.JSON_MEDIA_TYPE)
-    public List<AtlasEntityWithAssociations> getWithAssociationsByGuid(@PathParam("guid") String guid) throws AtlasBaseException {
-        return this.getById(guid);
+    public AtlasEntityWithExtInfo getByUniqueAttributes(@PathParam("typeName") String typeName,
+                                                        @Context HttpServletRequest servletRequest) throws AtlasBaseException {
+        AtlasEntityType     entityType = ensureEntityType(typeName);
+        Map<String, Object> attributes = getAttributes(servletRequest);
+
+        validateAttributes(entityType, attributes);
+
+        return entitiesStore.getByUniqueAttribute(entityType, attributes);
     }
 
     /**
@@ -143,8 +154,8 @@ public class EntityREST {
     @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/uniqueAttribute/type/{typeName}/attribute/{attrName}")
     public EntityMutationResponse partialUpdateByUniqueAttribute(@PathParam("typeName") String entityType,
-        @PathParam("attrName") String attribute,
-        @QueryParam("value") String value, AtlasEntity entity) throws Exception {
+                                                                 @PathParam("attrName") String attribute,
+                                                                 @QueryParam("value") String value, AtlasEntity entity) throws Exception {
 
         AtlasEntityType type = (AtlasEntityType) validateType(entityType, TypeCategory.ENTITY);
         validateUniqueAttribute(type, attribute);
@@ -161,14 +172,15 @@ public class EntityREST {
     @Consumes(Servlets.JSON_MEDIA_TYPE)
     @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/uniqueAttribute/type/{typeName}/attribute/{attrName}")
-    public EntityMutationResponse deleteByUniqueAttribute(@PathParam("typeName") String entityType,
+    public EntityMutationResponse deleteByUniqueAttribute(@PathParam("typeName") String typeName,
         @PathParam("attrName") String attribute,
         @QueryParam("value") String value) throws Exception {
 
-        AtlasEntityType type = (AtlasEntityType) validateType(entityType, TypeCategory.ENTITY);
-        validateUniqueAttribute(type, attribute);
+        AtlasEntityType entityType = ensureEntityType(typeName);
+
+        validateUniqueAttribute(entityType, attribute);
 
-        final AtlasClient.EntityResult result = metadataService.deleteEntityByUniqueAttribute(entityType, attribute, value);
+        final AtlasClient.EntityResult result = metadataService.deleteEntityByUniqueAttribute(typeName, attribute, value);
         return toEntityMutationResponse(result);
     }
 
@@ -181,17 +193,18 @@ public class EntityREST {
     @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
     @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/uniqueAttribute/type/{typeName}/attribute/{attrName}")
-    public List<AtlasEntityWithAssociations> getByUniqueAttribute(@PathParam("typeName") String entityType,
+    public List<AtlasEntity> getByUniqueAttribute(@PathParam("typeName") String typeName,
         @PathParam("attrName") String attribute,
         @QueryParam("value") String value) throws AtlasBaseException {
 
-        List<AtlasEntityWithAssociations> entityList = new ArrayList<>();
-        AtlasEntityType type = (AtlasEntityType) validateType(entityType, TypeCategory.ENTITY);
-        validateUniqueAttribute(type, attribute);
+        List<AtlasEntity> entityList = new ArrayList<>();
+        AtlasEntityType                   entityType = ensureEntityType(typeName);
+
+        validateUniqueAttribute(entityType, attribute);
 
         try {
-            final ITypedReferenceableInstance entityDefinitionReference = metadataService.getEntityDefinitionReference(entityType, attribute, value);
-            Map<String, AtlasEntityWithAssociations> entityRet = restAdapters.getAtlasEntity(entityDefinitionReference);
+            final ITypedReferenceableInstance entityDefinitionReference = metadataService.getEntityDefinitionReference(typeName, attribute, value);
+            Map<String, AtlasEntity> entityRet = restAdapters.getAtlasEntity(entityDefinitionReference);
             entityList.addAll(entityRet.values());
         } catch (AtlasException e) {
             throw toAtlasBaseException(e);
@@ -209,16 +222,16 @@ public class EntityREST {
     @GET
     @Path("/guid/{guid}/classification/{classificationName}")
     @Produces(Servlets.JSON_MEDIA_TYPE)
-    public AtlasClassification getClassification(@PathParam("guid") String guid, @PathParam("classificationName") String classificationName) throws AtlasBaseException {
+    public AtlasClassification getClassification(@PathParam("guid") String guid, @PathParam("classificationName") String typeName) throws AtlasBaseException {
 
         if (StringUtils.isEmpty(guid)) {
             throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
-        validateType(classificationName, TypeCategory.CLASSIFICATION);
+        ensureClassificationType(typeName);
 
         try {
-            IStruct trait = metadataService.getTraitDefinition(guid, classificationName);
+            IStruct trait = metadataService.getTraitDefinition(guid, typeName);
             return restAdapters.getClassification(trait);
 
         } catch (AtlasException e) {
@@ -313,23 +326,23 @@ public class EntityREST {
      * Deletes a given classification from an existing entity represented by a guid.
      *
      * @param guid      globally unique identifier for the entity
-     * @param classificationName name of the trait
+     * @param typeName name of the trait
      */
     @DELETE
     @Path("/guid/{guid}/classification/{classificationName}")
     @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
     @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteClassification(@PathParam("guid") String guid,
-        @PathParam("classificationName") String classificationName) throws AtlasBaseException {
+        @PathParam("classificationName") String typeName) throws AtlasBaseException {
 
         if (StringUtils.isEmpty(guid)) {
             throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
-        validateType(classificationName, TypeCategory.CLASSIFICATION);
+        ensureClassificationType(typeName);
 
         try {
-            metadataService.deleteTrait(guid, classificationName);
+            metadataService.deleteTrait(guid, typeName);
         } catch (AtlasException e) {
             throw toAtlasBaseException(e);
         }
@@ -348,7 +361,28 @@ public class EntityREST {
         return type;
     }
 
+    private AtlasEntityType ensureEntityType(String typeName) throws AtlasBaseException {
+        AtlasEntityType ret = typeRegistry.getEntityTypeByName(typeName);
+
+        if (ret == null) {
+            throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, TypeCategory.ENTITY.name(), typeName);
+        }
+
+        return ret;
+    }
+
+    private AtlasClassificationType ensureClassificationType(String typeName) throws AtlasBaseException {
+        AtlasClassificationType ret = typeRegistry.getClassificationTypeByName(typeName);
+
+        if (ret == null) {
+            throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, TypeCategory.CLASSIFICATION.name(), typeName);
+        }
+
+        return ret;
+    }
+
     /**
+     * Deprecated method - not used
      * Validate that attribute is unique attribute
      * @param entityType     the entity type
      * @param attributeName  the name of the attribute
@@ -361,10 +395,10 @@ public class EntityREST {
         }
     }
 
-    private List<AtlasEntityWithAssociations> getOrderedEntityList(Map<String, AtlasEntityWithAssociations> entities, String firstItemGuid) {
-        List<AtlasEntityWithAssociations> ret = new ArrayList<>(entities.size());
+    private List<AtlasEntity> getOrderedEntityList(Map<String, AtlasEntity> entities, String firstItemGuid) {
+        List<AtlasEntity> ret = new ArrayList<>(entities.size());
 
-        for (AtlasEntityWithAssociations entity : entities.values()) {
+        for (AtlasEntity entity : entities.values()) {
             if (StringUtils.equals(entity.getGuid(), firstItemGuid)) {
                 ret.add(0, entity);
             } else {
@@ -374,4 +408,39 @@ public class EntityREST {
 
         return ret;
     }
+
+    private void validateAttributes(AtlasEntityType entityType, Map<String, Object> attributes)
+            throws AtlasBaseException {
+
+        if (MapUtils.isEmpty(attributes)) {
+            throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), "");
+        }
+
+        for (String attrName : attributes.keySet()) {
+            AtlasAttributeDef attrDef = entityType.getAttributeDef(attrName);
+
+            if (attrDef == null || !attrDef.getIsUnique()) {
+                throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), attrName);
+            }
+        }
+    }
+
+    private Map<String, Object> getAttributes(HttpServletRequest request) {
+        Map<String, Object> attributes = new HashMap<>();
+
+        if (MapUtils.isNotEmpty(request.getParameterMap())) {
+            for (Map.Entry<String, String[]> e : request.getParameterMap().entrySet()) {
+                String key = e.getKey();
+
+                if (key != null && key.startsWith(PREFIX_ATTR)) {
+                    String[] values = e.getValue();
+                    String   value  = values != null && values.length > 0 ? values[0] : null;
+
+                    attributes.put(key.substring(PREFIX_ATTR.length()), value);
+                }
+            }
+        }
+
+        return attributes;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
index b7cc273..eb43384 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
@@ -32,6 +32,7 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -56,7 +57,9 @@ public class QuickStartV2IT extends BaseResourceIT {
     }
 
     private AtlasEntity getDB(String dbName) throws AtlasServiceException, JSONException {
-        AtlasEntity dbEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.DATABASE_TYPE, "name", dbName).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put("name", dbName);
+        AtlasEntity dbEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.DATABASE_TYPE, attributes).getEntity();
         return dbEntity;
     }
 
@@ -73,12 +76,16 @@ public class QuickStartV2IT extends BaseResourceIT {
     }
 
     private AtlasEntity getTable(String tableName) throws AtlasServiceException {
-        AtlasEntity tableEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
+        AtlasEntity tableEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.TABLE_TYPE, attributes).getEntity();
         return tableEntity;
     }
 
     private AtlasEntity getProcess(String processName) throws AtlasServiceException {
-        AtlasEntity processEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, processName).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, processName);
+        AtlasEntity processEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
         return processEntity;
     }
      
@@ -115,8 +122,9 @@ public class QuickStartV2IT extends BaseResourceIT {
 
     @Test
     public void testProcessIsAdded() throws AtlasServiceException, JSONException {
-        AtlasEntity loadProcess = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
-                QuickStartV2.LOAD_SALES_DAILY_PROCESS).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.LOAD_SALES_DAILY_PROCESS);
+        AtlasEntity loadProcess = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
 
         Map loadProcessAttribs = loadProcess.getAttributes();
         assertEquals(QuickStartV2.LOAD_SALES_DAILY_PROCESS, loadProcessAttribs.get(AtlasClient.NAME));
@@ -169,7 +177,9 @@ public class QuickStartV2IT extends BaseResourceIT {
 
     @Test
     public void testViewIsAdded() throws AtlasServiceException, JSONException {
-        AtlasEntity view = entitiesClientV2.getEntityByAttribute(QuickStartV2.VIEW_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.PRODUCT_DIM_VIEW).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.PRODUCT_DIM_VIEW);
+        AtlasEntity view = entitiesClientV2.getEntityByAttribute(QuickStartV2.VIEW_TYPE, attributes).getEntity();
         Map<String, Object> viewAttributes = view.getAttributes();
         assertEquals(QuickStartV2.PRODUCT_DIM_VIEW, viewAttributes.get(AtlasClient.NAME));
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
index 2d49c47..354722f 100644
--- a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
+++ b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
@@ -22,8 +22,8 @@ import org.apache.atlas.RequestContext;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
@@ -98,10 +98,11 @@ public class TestEntityREST {
     @Test
     public void testGetEntityById() throws Exception {
         createOrUpdateEntity();
-        final List<AtlasEntityWithAssociations> response = entityREST.getById(dbGuid);
+        AtlasEntityWithExtInfo response = entityREST.getById(dbGuid);
 
         Assert.assertNotNull(response);
-        TestEntitiesREST.verifyAttributes(response.get(0).getAttributes(), dbEntity.getAttributes());
+        Assert.assertNotNull(response.getEntity());
+        TestEntitiesREST.verifyAttributes(response.getEntity().getAttributes(), dbEntity.getAttributes());
     }
 
     @Test
@@ -130,8 +131,8 @@ public class TestEntityREST {
     @Test(dependsOnMethods = "testAddAndGetClassification")
     public void  testGetEntityWithAssociations() throws Exception {
 
-        List<AtlasEntityWithAssociations> entity = entityREST.getWithAssociationsByGuid(dbGuid);
-        final List<AtlasClassification> retrievedClassifications = entity.get(0).getClassifications();
+        AtlasEntityWithExtInfo entity = entityREST.getById(dbGuid);
+        final List<AtlasClassification> retrievedClassifications = entity.getEntity().getClassifications();
 
         Assert.assertNotNull(retrievedClassifications);
         Assert.assertEquals(new ArrayList<AtlasClassification>() {{ add(testClassification); }}, retrievedClassifications);
@@ -172,7 +173,7 @@ public class TestEntityREST {
         Assert.assertTrue(AtlasEntity.isAssigned(dbGuid));
 
         //Get By unique attribute
-        List<AtlasEntityWithAssociations> entities = entityREST.getByUniqueAttribute(TestUtilsV2.DATABASE_TYPE, TestUtilsV2.NAME, updatedDBName);
+        List<AtlasEntity> entities = entityREST.getByUniqueAttribute(TestUtilsV2.DATABASE_TYPE, TestUtilsV2.NAME, updatedDBName);
         Assert.assertNotNull(entities);
         Assert.assertNotNull(entities.get(0).getGuid());
         Assert.assertEquals(entities.get(0).getGuid(), dbGuid);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
index 6c4147c..64593b7 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
@@ -40,7 +40,6 @@ import org.apache.atlas.AtlasTypedefClientV2;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.AtlasStruct;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
@@ -561,9 +560,8 @@ public abstract class BaseResourceIT {
         return tableInstance;
     }
 
-    protected AtlasEntityWithAssociations createHiveTableInstanceV2(AtlasEntity databaseInstance, String tableName) throws Exception {
-        AtlasEntityWithAssociations tableInstance =
-                new AtlasEntityWithAssociations(HIVE_TABLE_TYPE_V2);
+    protected AtlasEntity createHiveTableInstanceV2(AtlasEntity databaseInstance, String tableName) throws Exception {
+        AtlasEntity tableInstance = new AtlasEntity(HIVE_TABLE_TYPE_V2);
         tableInstance.setClassifications(
                 Arrays.asList(new AtlasClassification("classification"),
                         new AtlasClassification("pii"),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
index 8b51d1b..c99ff57 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityDiscoveryJerseyResourceIT.java
@@ -26,7 +26,7 @@ import org.apache.atlas.model.discovery.AtlasSearchResult;
 import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult;
 import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasQueryType;
 import org.apache.atlas.model.instance.AtlasEntity.Status;
-import org.apache.atlas.model.instance.AtlasEntityHeaderWithAssociations;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.types.ClassType;
 import org.apache.atlas.typesystem.types.DataTypes;
@@ -68,11 +68,11 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
         assertEquals(searchResult.getQueryText(), dslQuery);
         assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
 
-        List<AtlasEntityHeaderWithAssociations> entities = searchResult.getEntities();
+        List<AtlasEntityHeader> entities = searchResult.getEntities();
         assertNotNull(entities);
         assertEquals(entities.size(), 1);
 
-        AtlasEntityHeaderWithAssociations dbEntity = entities.get(0);
+        AtlasEntityHeader dbEntity = entities.get(0);
         assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
         assertEquals(dbEntity.getDisplayText(), dbName);
         assertEquals(dbEntity.getStatus(), Status.ACTIVE);
@@ -130,11 +130,11 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
 
         assertEquals(searchResult.getQueryText(), query);
         assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
-        List<AtlasEntityHeaderWithAssociations> entities = searchResult.getEntities();
+        List<AtlasEntityHeader> entities = searchResult.getEntities();
         assertNotNull(entities);
         assertEquals(entities.size(), 1);
 
-        AtlasEntityHeaderWithAssociations dbEntity = entities.get(0);
+        AtlasEntityHeader dbEntity = entities.get(0);
         assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
         assertEquals(dbEntity.getDisplayText(), dbName);
         assertEquals(dbEntity.getStatus(), Status.ACTIVE);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/808eb1d1/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
index 8c629b4..9f03718 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
@@ -37,7 +37,6 @@ import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
@@ -80,7 +79,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
     private String traitName;
 
     private AtlasEntity dbEntity;
-    private AtlasEntityWithAssociations tableEntity;
+    private AtlasEntity tableEntity;
     @Inject
     private NotificationInterface notificationInterface;
     private NotificationConsumer<EntityNotification> notificationConsumer;
@@ -187,7 +186,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
 
         //Test the same across references
         final String tableName = randomString();
-        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTableInstanceV2(hiveDBInstanceV2, tableName);
+        AtlasEntity hiveTableInstanceV2 = createHiveTableInstanceV2(hiveDBInstanceV2, tableName);
         hiveTableInstanceV2.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
 
         EntityMutationResponse entity = entitiesClientV2.createEntity(hiveTableInstanceV2);
@@ -273,7 +272,9 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
         AtlasEntity hiveDB = createHiveDB();
         String qualifiedName = (String) hiveDB.getAttribute(NAME);
         //get entity by attribute
-        AtlasEntity byAttribute = entitiesClientV2.getEntityByAttribute(DATABASE_TYPE_V2, NAME, qualifiedName).get(0);
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(NAME, qualifiedName);
+        AtlasEntity byAttribute = entitiesClientV2.getEntityByAttribute(DATABASE_TYPE_V2, attributes).getEntity();
         assertEquals(byAttribute.getTypeName(), DATABASE_TYPE_V2);
         assertEquals(byAttribute.getAttribute(NAME), qualifiedName);
     }
@@ -427,13 +428,13 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
         return hiveDBInstanceV2;
     }
 
-    private TypeUtils.Pair<AtlasEntity, AtlasEntityWithAssociations> createDBAndTable() throws Exception {
+    private TypeUtils.Pair<AtlasEntity, AtlasEntity> createDBAndTable() throws Exception {
         AtlasEntity dbInstanceV2 = createHiveDB();
-        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTable();
+        AtlasEntity hiveTableInstanceV2 = createHiveTable();
         return TypeUtils.Pair.of(dbInstanceV2, hiveTableInstanceV2);
     }
 
-    private AtlasEntityWithAssociations createHiveTable() throws Exception {
+    private AtlasEntity createHiveTable() throws Exception {
         if (tableEntity == null) {
             tableEntity = createHiveTable(createHiveDB(), TABLE_NAME);
         }
@@ -441,8 +442,8 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
 
     }
 
-    private AtlasEntityWithAssociations createHiveTable(AtlasEntity dbInstanceV2, String tableName) throws Exception {
-        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTableInstanceV2(dbInstanceV2, tableName);
+    private AtlasEntity createHiveTable(AtlasEntity dbInstanceV2, String tableName) throws Exception {
+        AtlasEntity hiveTableInstanceV2 = createHiveTableInstanceV2(dbInstanceV2, tableName);
         AtlasEntityHeader createdHeader = createEntity(hiveTableInstanceV2);
         assertNotNull(createdHeader);
         assertNotNull(createdHeader.getGuid());
@@ -478,7 +479,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
         AtlasClassificationDef classificationByName = typedefClientV2.getClassificationByName(traitName);
         assertNotNull(classificationByName);
 
-        AtlasEntityWithAssociations hiveTable = createHiveTable();
+        AtlasEntity hiveTable = createHiveTable();
         assertEquals(hiveTable.getClassifications().size(), 7);
 
         AtlasClassification piiClassification = new AtlasClassification(piiTrait.getName());
@@ -509,7 +510,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
         entitiesClientV2.addClassifications(guid, ImmutableList.of(traitInstance));
 
         // verify the response
-        AtlasEntityWithAssociations withAssociationByGuid = entitiesClientV2.getEntityWithAssociationByGuid(guid).get(0);
+        AtlasEntity withAssociationByGuid = entitiesClientV2.getEntityByGuid(guid).getEntity();
         assertNotNull(withAssociationByGuid);
         assertFalse(withAssociationByGuid.getClassifications().isEmpty());
 
@@ -620,8 +621,8 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
 
         AtlasEntity ref = new AtlasEntity(BaseResourceIT.COLUMN_TYPE_V2, values);
         columns.add(ref);
-        AtlasEntityWithAssociations hiveTable = createHiveTable();
-        AtlasEntityWithAssociations tableUpdated = hiveTable;
+        AtlasEntity hiveTable = createHiveTable();
+        AtlasEntity tableUpdated = hiveTable;
 
         hiveTable.setAttribute("columns", columns);
 
@@ -656,7 +657,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
     }
 
     private AtlasEntity getEntityByGuid(String guid) throws AtlasServiceException {
-        return entitiesClientV2.getEntityByGuid(guid).get(0);
+        return entitiesClientV2.getEntityByGuid(guid).getEntity();
     }
 
     @Test(dependsOnMethods = "testSubmitEntity")
@@ -678,7 +679,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
         AtlasEntity ref2 = new AtlasEntity(BaseResourceIT.COLUMN_TYPE_V2, values2);
         columns.add(ref1);
         columns.add(ref2);
-        AtlasEntityWithAssociations hiveTable = createHiveTable();
+        AtlasEntity hiveTable = createHiveTable();
         hiveTable.setAttribute("columns", columns);
         EntityMutationResponse updateEntityResult = entitiesClientV2.updateEntity(hiveTable);
         assertNotNull(updateEntityResult);


Mime
View raw message