Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 77AEA200C23 for ; Wed, 22 Feb 2017 08:02:24 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 76193160B67; Wed, 22 Feb 2017 07:02:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2506F160B49 for ; Wed, 22 Feb 2017 08:02:22 +0100 (CET) Received: (qmail 72920 invoked by uid 500); 22 Feb 2017 07:02:22 -0000 Mailing-List: contact commits-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list commits@atlas.incubator.apache.org Received: (qmail 72910 invoked by uid 99); 22 Feb 2017 07:02:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2017 07:02:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 9366F1AA291 for ; Wed, 22 Feb 2017 07:02:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id hJSsqh1XVYVq for ; Wed, 22 Feb 2017 07:02:17 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 64E2C5F2C5 for ; Wed, 22 Feb 2017 07:02:16 +0000 (UTC) Received: (qmail 72905 invoked by uid 99); 22 Feb 2017 07:02:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2017 07:02:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7F8B8DFF09; Wed, 22 Feb 2017 07:02:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-atlas git commit: ATLAS-1586: type search improvement by avoiding unnecessary instantiation of type objects Date: Wed, 22 Feb 2017 07:02:15 +0000 (UTC) archived-at: Wed, 22 Feb 2017 07:02:24 -0000 Repository: incubator-atlas Updated Branches: refs/heads/master e7eaa9966 -> f5f9fa099 ATLAS-1586: type search improvement by avoiding unnecessary instantiation of type objects Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/f5f9fa09 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/f5f9fa09 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/f5f9fa09 Branch: refs/heads/master Commit: f5f9fa09948b2e5ade1a084b8063cd2bbe6e80a0 Parents: e7eaa99 Author: Madhan Neethiraj Authored: Tue Feb 21 22:27:04 2017 -0800 Committer: Madhan Neethiraj Committed: Tue Feb 21 22:27:04 2017 -0800 ---------------------------------------------------------------------- .../graph/AtlasClassificationDefStore.java | 2 - .../store/graph/AtlasEntityDefStore.java | 2 - .../store/graph/AtlasEnumDefStore.java | 2 - .../store/graph/AtlasStructDefStore.java | 2 - .../store/graph/AtlasTypeDefGraphStore.java | 78 ++++---------------- .../graph/v1/AtlasClassificationDefStoreV1.java | 28 ------- .../store/graph/v1/AtlasEntityDefStoreV1.java | 29 -------- .../store/graph/v1/AtlasEnumDefStoreV1.java | 29 -------- .../store/graph/v1/AtlasStructDefStoreV1.java | 29 -------- .../atlas/repository/util/FilterUtil.java | 48 ++---------- 10 files changed, 21 insertions(+), 228 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java index ff00186..92a59f3 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java @@ -51,6 +51,4 @@ public interface AtlasClassificationDefStore { Object preDeleteByGuid(String guid) throws AtlasBaseException; void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException; - - AtlasClassificationDefs search(SearchFilter filter) throws AtlasBaseException; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java index 48f8bce..08391ba 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java @@ -51,6 +51,4 @@ public interface AtlasEntityDefStore { Object preDeleteByGuid(String guid) throws AtlasBaseException; void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException; - - AtlasEntityDefs search(SearchFilter filter) throws AtlasBaseException; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java index 217a927..d0f98e2 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java @@ -45,6 +45,4 @@ public interface AtlasEnumDefStore { void deleteByName(String name) throws AtlasBaseException; void deleteByGuid(String guid) throws AtlasBaseException; - - AtlasEnumDefs search(SearchFilter filter) throws AtlasBaseException; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java index fc3ffb5..ebd2b70 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java @@ -51,6 +51,4 @@ public interface AtlasStructDefStore { Object preDeleteByGuid(String name) throws AtlasBaseException; void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException; - - AtlasStructDefs search(SearchFilter filter) throws AtlasBaseException; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java index 0f5b726..084f09e 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java @@ -552,79 +552,29 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); - try { - List enumDefs = getEnumDefStore(typeRegistry).getAll(); - CollectionUtils.filter(enumDefs, searchPredicates); - typesDef.setEnumDefs(enumDefs); - } catch (AtlasBaseException ex) { - LOG.error("Failed to retrieve the EnumDefs", ex); - } - try { - List structDefs = getStructDefStore(typeRegistry).getAll(); - Collection typeCollection = CollectionUtils.collect(structDefs, new Transformer() { - @Override - public Object transform(Object o) { - try { - return new AtlasStructType((AtlasStructDef) o, typeRegistry); - } catch (AtlasBaseException e) { - LOG.warn("Type validation failed for {}", ((AtlasStructDef) o).getName(), e); - return null; - } - } - }); - CollectionUtils.filter(typeCollection, searchPredicates); - for (Object o : typeCollection) { - if (o != null) - typesDef.getStructDefs().add(((AtlasStructType)o).getStructDef()); + for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { + if (searchPredicates.evaluate(enumType)) { + typesDef.getEnumDefs().add(enumType.getEnumDef()); } - } catch (AtlasBaseException ex) { - LOG.error("Failed to retrieve the StructDefs", ex); } - try { - List classificationDefs = getClassificationDefStore(typeRegistry).getAll(); + for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { + if (searchPredicates.evaluate(structType)) { + typesDef.getStructDefs().add(structType.getStructDef()); + } + } - Collection typeCollection = CollectionUtils.collect(classificationDefs, new Transformer() { - @Override - public Object transform(Object o) { - try { - return new AtlasClassificationType((AtlasClassificationDef) o, typeRegistry); - } catch (AtlasBaseException e) { - LOG.warn("Type validation failed for {}", ((AtlasClassificationDef) o).getName(), e); - return null; - } - } - }); - CollectionUtils.filter(typeCollection, searchPredicates); - for (Object o : typeCollection) { - if (o != null) - typesDef.getClassificationDefs().add(((AtlasClassificationType)o).getClassificationDef()); + for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { + if (searchPredicates.evaluate(classificationType)) { + typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } - } catch (AtlasBaseException ex) { - LOG.error("Failed to retrieve the ClassificationDefs", ex); } - try { - List entityDefs = getEntityDefStore(typeRegistry).getAll(); - Collection typeCollection = CollectionUtils.collect(entityDefs, new Transformer() { - @Override - public Object transform(Object o) { - try { - return new AtlasEntityType((AtlasEntityDef) o, typeRegistry); - } catch (AtlasBaseException e) { - LOG.warn("Type validation failed for {}", ((AtlasEntityDef) o).getName(), e); - return null; - } - } - }); - CollectionUtils.filter(typeCollection, searchPredicates); - for (Object o : typeCollection) { - if (o != null) - typesDef.getEntityDefs().add(((AtlasEntityType)o).getEntityDef()); + for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { + if (searchPredicates.evaluate(entityType)) { + typesDef.getEntityDefs().add(entityType.getEntityDef()); } - } catch (AtlasBaseException ex) { - LOG.error("Failed to retrieve the EntityDefs", ex); } return typesDef; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java index f9c17fd..eb6dc03 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java @@ -338,34 +338,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple } } - @Override - public AtlasClassificationDefs search(SearchFilter filter) throws AtlasBaseException { - if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasClassificationDefStoreV1.search({})", filter); - } - - List classificationDefs = new ArrayList<>(); - Iterator vertices = typeDefStore.findTypeVerticesByCategory(TypeCategory.TRAIT); - - while(vertices.hasNext()) { - AtlasVertex vertex = vertices.next(); - AtlasClassificationDef classificationDef = toClassificationDef(vertex); - - if (classificationDef != null) { - classificationDefs.add(classificationDef); - } - } - - CollectionUtils.filter(classificationDefs, FilterUtil.getPredicateFromSearchFilter(filter)); - - AtlasClassificationDefs ret = new AtlasClassificationDefs(classificationDefs); - - if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasClassificationDefStoreV1.search({}): {}", filter, ret); - } - return ret; - } - private void updateVertexPreCreate(AtlasClassificationDef classificationDef, AtlasClassificationType classificationType, AtlasVertex vertex) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java index 32a6d83..e478720 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java @@ -336,35 +336,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At } } - @Override - public AtlasEntityDefs search(SearchFilter filter) throws AtlasBaseException { - if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasEntityDefStoreV1.search({})", filter); - } - - List entityDefs = new ArrayList<>(); - Iterator vertices = typeDefStore.findTypeVerticesByCategory(TypeCategory.CLASS); - - while(vertices.hasNext()) { - AtlasVertex vertex = vertices.next(); - AtlasEntityDef entityDef = toEntityDef(vertex); - - if (entityDef != null) { - entityDefs.add(entityDef); - } - } - - CollectionUtils.filter(entityDefs, FilterUtil.getPredicateFromSearchFilter(filter)); - - AtlasEntityDefs ret = new AtlasEntityDefs(entityDefs); - - if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasEntityDefStoreV1.search({}): {}", filter, ret); - } - - return ret; - } - private void updateVertexPreCreate(AtlasEntityDef entityDef, AtlasEntityType entityType, AtlasVertex vertex) { AtlasStructDefStoreV1.updateVertexPreCreate(entityDef, entityType, vertex, typeDefStore); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java index 3cb10ff..8832507 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java @@ -250,35 +250,6 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla } } - @Override - public AtlasEnumDefs search(SearchFilter filter) throws AtlasBaseException { - if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasEnumDefStoreV1.search({})", filter); - } - - List enumDefs = new ArrayList<>(); - Iterator vertices = typeDefStore.findTypeVerticesByCategory(TypeCategory.ENUM); - - while(vertices.hasNext()) { - AtlasVertex vertex = vertices.next(); - AtlasEnumDef enumDef = toEnumDef(vertex); - - if (enumDef != null) { - enumDefs.add(enumDef); - } - } - - CollectionUtils.filter(enumDefs, FilterUtil.getPredicateFromSearchFilter(filter)); - - AtlasEnumDefs ret = new AtlasEnumDefs(enumDefs); - - if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasEnumDefStoreV1.search({}): {}", filter, ret); - } - - return ret; - } - private void toVertex(AtlasEnumDef enumDef, AtlasVertex vertex) { List values = new ArrayList<>(enumDef.getElementDefs().size()); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java index 61314a6..3f87e69 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java @@ -347,35 +347,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At } } - @Override - public AtlasStructDefs search(SearchFilter filter) throws AtlasBaseException { - if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasStructDefStoreV1.search({})", filter); - } - - List structDefs = new ArrayList<>(); - Iterator vertices = typeDefStore.findTypeVerticesByCategory(TypeCategory.STRUCT); - - while (vertices.hasNext()) { - AtlasVertex vertex = vertices.next(); - AtlasStructDef structDef = toStructDef(vertex); - - if (structDef != null) { - structDefs.add(structDef); - } - } - - CollectionUtils.filter(structDefs, FilterUtil.getPredicateFromSearchFilter(filter)); - - AtlasStructDefs ret = new AtlasStructDefs(structDefs); - - if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasStructDefStoreV1.search({}): {}", filter, ret); - } - - return ret; - } - private AtlasStructDef toStructDef(AtlasVertex vertex) throws AtlasBaseException { AtlasStructDef ret = null; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f5f9fa09/repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java b/repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java index d0085f9..54d6b40 100644 --- a/repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java +++ b/repository/src/main/java/org/apache/atlas/repository/util/FilterUtil.java @@ -37,9 +37,10 @@ import java.util.Objects; public class FilterUtil { public static Predicate getPredicateFromSearchFilter(SearchFilter searchFilter) { List predicates = new ArrayList<>(); - final String type = searchFilter.getParam(SearchFilter.PARAM_TYPE); - final String name = searchFilter.getParam(SearchFilter.PARAM_NAME); - final String supertype = searchFilter.getParam(SearchFilter.PARAM_SUPERTYPE); + + final String type = searchFilter.getParam(SearchFilter.PARAM_TYPE); + final String name = searchFilter.getParam(SearchFilter.PARAM_NAME); + final String supertype = searchFilter.getParam(SearchFilter.PARAM_SUPERTYPE); final String notSupertype = searchFilter.getParam(SearchFilter.PARAM_NOT_SUPERTYPE); // Add filter for the type/category @@ -71,33 +72,19 @@ public class FilterUtil { return o instanceof AtlasType; } - private boolean isAtlasTypeDef(Object o) { - return o instanceof AtlasBaseTypeDef; - } - @Override public boolean evaluate(Object o) { - return o != null && - (isAtlasType(o) && Objects.equals(((AtlasType) o).getTypeName(), name)) || - (isAtlasTypeDef(o) && Objects.equals(((AtlasBaseTypeDef) o).getName(), name)); + return o != null && isAtlasType(o) && Objects.equals(((AtlasType) o).getTypeName(), name); } }; } private static Predicate getSuperTypePredicate(final String supertype) { return new Predicate() { - private boolean isClassificationTypeDef(Object o) { - return o instanceof AtlasClassificationDef; - } - private boolean isClassificationType(Object o) { return o instanceof AtlasClassificationType; } - private boolean isEntityTypeDef(Object o) { - return o instanceof AtlasEntityDef; - } - private boolean isEntityType(Object o) { return o instanceof AtlasEntityType; } @@ -105,9 +92,7 @@ public class FilterUtil { @Override public boolean evaluate(Object o) { return (isClassificationType(o) && ((AtlasClassificationType) o).getAllSuperTypes().contains(supertype))|| - (isClassificationTypeDef(o) && ((AtlasClassificationDef)o).getSuperTypes().contains(supertype)) || - (isEntityType(o) && ((AtlasEntityType)o).getAllSuperTypes().contains(supertype)) || - (isEntityTypeDef(o) && ((AtlasEntityDef)o).getSuperTypes().contains(supertype)); + (isEntityType(o) && ((AtlasEntityType)o).getAllSuperTypes().contains(supertype)); } }; } @@ -134,27 +119,8 @@ public class FilterUtil { // This shouldn't have happened return false; } - } else if (o instanceof AtlasBaseTypeDef){ - AtlasBaseTypeDef typeDef = (AtlasBaseTypeDef)o; - - switch (type.toUpperCase()) { - case "CLASS": - case "ENTITY": - return typeDef.getCategory() == TypeCategory.ENTITY; - case "TRAIT": - case "CLASSIFICATION": - return typeDef.getCategory() == TypeCategory.CLASSIFICATION; - case "STRUCT": - return typeDef.getCategory() == TypeCategory.STRUCT; - case "ENUM": - return typeDef.getCategory() == TypeCategory.ENUM; - default: - // This shouldn't have happened - return false; - } - } else { - return false; } + return false; } }; }